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()) ); }
X11EmbedContainer::X11EmbedContainer(QWidget *parent) : QX11EmbedContainer(parent), d(new Private(this)) { connect(this, SIGNAL(clientIsEmbedded()), this, SLOT(ensureValidSize())); }
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; }
X11EmbedContainer::X11EmbedContainer(QWidget *parent) : QX11EmbedContainer(parent), d(new Private(this)) { setAttribute(Qt::WA_PaintOnScreen); setAttribute(Qt::WA_PaintUnclipped); connect(this, SIGNAL(clientIsEmbedded()), this, SLOT(ensureValidSize())); }
void VstPlugin::createUI( QWidget * parent ) { if ( m_pluginWidget ) { qWarning() << "VstPlugin::createUI called twice"; m_pluginWidget->setParent( parent ); return; } if( m_pluginWindowID == 0 ) { return; } QWidget* container = nullptr; #if QT_VERSION >= 0x050100 if (m_embedMethod == "qt" ) { QWindow* vw = QWindow::fromWinId(m_pluginWindowID); container = QWidget::createWindowContainer(vw, parent ); container->installEventFilter(this); } else #endif #ifdef LMMS_BUILD_WIN32 if (m_embedMethod == "win32" ) { QWidget * helper = new QWidget; QHBoxLayout * l = new QHBoxLayout( helper ); QWidget * target = new QWidget( helper ); l->setSpacing( 0 ); l->setMargin( 0 ); l->addWidget( target ); // we've to call that for making sure, Qt created the windows helper->winId(); HWND targetHandle = (HWND)target->winId(); HWND pluginHandle = (HWND)(intptr_t)m_pluginWindowID; DWORD style = GetWindowLong(pluginHandle, GWL_STYLE); style = style & ~(WS_POPUP); style = style | WS_CHILD; SetWindowLong(pluginHandle, GWL_STYLE, style); SetParent(pluginHandle, targetHandle); DWORD threadId = GetWindowThreadProcessId(pluginHandle, NULL); DWORD currentThreadId = GetCurrentThreadId(); AttachThreadInput(currentThreadId, threadId, true); container = helper; RemotePlugin::showUI(); } else #endif #ifdef LMMS_BUILD_LINUX if (m_embedMethod == "xembed" ) { if (parent) { parent->setAttribute(Qt::WA_NativeWindow); } QX11EmbedContainer * embedContainer = new QX11EmbedContainer( parent ); connect(embedContainer, SIGNAL(clientIsEmbedded()), this, SLOT(handleClientEmbed())); embedContainer->embedClient( m_pluginWindowID ); container = embedContainer; } else #endif { qCritical() << "Unknown embed method" << m_embedMethod; return; } container->setFixedSize( m_pluginGeometry ); container->setWindowTitle( name() ); m_pluginWidget = container; }