void FdoGraphicsWidget::handleClientError(QX11EmbedContainer::Error error) { Q_UNUSED(error); //qDebug() << "client error (" << d->winId << ")"; emit clientClosed(); }
void FdoGraphicsWidget::setupXEmbedDelegate() { if (d->widget) { return; } #if QT_VERSION < 0x040401 const Qt::ApplicationAttribute attr = (Qt::ApplicationAttribute)4; #else const Qt::ApplicationAttribute attr = Qt::AA_DontCreateNativeWidgetSiblings; #endif if (!QApplication::testAttribute(attr)) { QApplication::setAttribute(attr); } X11EmbedDelegate *widget = new X11EmbedDelegate(); widget->setMinimumSize(22, 22); widget->setMaximumSize(22, 22); widget->resize(22, 22); connect(widget->container(), SIGNAL(clientIsEmbedded()), this, SLOT(handleClientEmbedded())); connect(widget->container(), SIGNAL(clientClosed()), this, SLOT(handleClientClosed())); connect(widget->container(), SIGNAL(error(QX11EmbedContainer::Error)), this, SLOT(handleClientError(QX11EmbedContainer::Error))); widget->container()->embedSystemTrayClient(d->winId); d->widget = widget; }
void RKCaughtX11Window::doEmbed () { RK_TRACE (MISC); if (embedded) { #ifdef Q_WS_WIN capture = new QWinHost (xembed_container); capture->setWindow (embedded); capture->setFocusPolicy (Qt::ClickFocus); capture->setAutoDestruct (true); connect (capture, SIGNAL (clientDestroyed()), this, SLOT (deleteLater()), Qt::QueuedConnection); connect (capture, SIGNAL (clientTitleChanged(QString)), this, SLOT (setCaption(QString)), Qt::QueuedConnection); setCaption (capture->getClientTitle ()); #elif defined Q_WS_X11 capture = new QX11EmbedContainer (xembed_container); capture->embedClient (embedded); connect (capture, SIGNAL (clientClosed()), this, SLOT (deleteLater())); RKWardApplication::getApp ()->registerNameWatcher (embedded, this); #endif } if (!isAttached ()) { // make xembed_container resizable, again, now that it actually has a content dynamic_size_action->setChecked (true); fixedSizeToggled (); } // try to be helpful when the window is too large to fit on screen QRect dims = window ()->frameGeometry (); QRect avail = QApplication::desktop ()->availableGeometry (window ()); if ((dims.width () > avail.width ()) || (dims.height () > avail.height ())) { KMessageBox::information (this, i18n ("The current window appears too large to fit on the screen. If this happens regularly, you may want to adjust the default graphics window size in Settings->Configure RKWard->Onscreen Graphics."), i18n ("Large window"), "dont_ask_again_large_x11_window"); } }
void ClientThread::disconnected() { emit clientClosed(socketId); client->deleteLater(); quit = true; }
TrayIcon::TrayIcon(QWidget *parent) : QX11EmbedContainer(parent){ //this->setStyleSheet("background: grey;"); this->setBackgroundRole(QPalette::NoRole); //this->setPalette(QPalette( AID = 0; //nothing attached yet connect(this, SIGNAL(clientClosed()), this, SLOT(detachApp()) ); connect(this, SIGNAL(error(QX11EmbedContainer::Error)), this, SLOT(detachApp()) ); connect(this, SIGNAL(clientIsEmbedded()), this, SLOT(updateIcon()) ); connect(this, SIGNAL(clientIsEmbedded()), this, SIGNAL(AppAttached()) ); }
bool SysTray::x11Event( XEvent* event ) { #define SYSTEM_TRAY_REQUEST_DOCK 0 #define SYSTEM_TRAY_BEGIN_MESSAGE 1 #define SYSTEM_TRAY_CANCEL_MESSAGE 2 if (event->type == ClientMessage) { if ( event->xclient.message_type == m_opcodeAtom ) { switch ( event->xclient.data.l[1] ) { case SYSTEM_TRAY_REQUEST_DOCK: { const WId systemTrayClientId = (WId)event->xclient.data.l[2]; if ( systemTrayClientId == 0 ) { return true; } foreach(SysTrayWidget *c, findChildren<SysTrayWidget*>()) { if (c->clientWinId() == systemTrayClientId) { return true; } } // Set up a SystemTrayContainer for the client SysTrayWidget* container = new SysTrayWidget( this ); bool ret = container->embedSystemTrayClient( systemTrayClientId ); if (ret) { connect( container, SIGNAL(clientClosed()), this, SLOT(updateSysTray()) ); SysTrayWidgetList << container; qWarning() << "dock." << systemTrayClientId << "@" << container; updateLayout(); } return true; } case SYSTEM_TRAY_BEGIN_MESSAGE: qWarning() << "tray icon message begin not implemented"; break; case SYSTEM_TRAY_CANCEL_MESSAGE: qWarning() << "tray icon message cancel not implemented"; break; } } } return QWidget::x11Event(event); }
void FdoGraphicsWidget::handleClientClosed() { emit clientClosed(); //qDebug() << "client closed (" << d->winId << ")"; }