This fix makes it possible to have a popup that does not steal window focus when opened or used.
Therefor you need to set Qt::X11BypassWindowManagerHint on the widget shown in the popup. This does NOT affect widgets that do not set the Flag. This fix is needed vor the virtual keyboard plasmoid "plasmaboard", which can only work if the focus is untouched when being opened svn path=/trunk/KDE/kdelibs/; revision=976221
This commit is contained in:
parent
8d646f2376
commit
784fb1229b
@ -281,9 +281,6 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints)
|
||||
//stuff out of your Dialog (extenders). Monitor WindowDeactivate events so we can
|
||||
//emulate the same kind of behavior as Qt::Popup (close when you click somewhere
|
||||
//else.
|
||||
dialog->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
|
||||
KWindowSystem::setState(dialog->winId(), NET::SkipTaskbar | NET::SkipPager);
|
||||
dialog->installEventFilter(q);
|
||||
|
||||
q->setMinimumSize(QSize(0, 0));
|
||||
if (gWidget) {
|
||||
@ -295,13 +292,23 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints)
|
||||
dialog->setGraphicsWidget(gWidget);
|
||||
gWidget->resize(gWidget->preferredSize());
|
||||
}
|
||||
dialog->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | (gWidget->windowFlags() & Qt::X11BypassWindowManagerHint));
|
||||
|
||||
} else if (qWidget) {
|
||||
QVBoxLayout *l_layout = new QVBoxLayout(dialog);
|
||||
l_layout->setSpacing(0);
|
||||
l_layout->setMargin(0);
|
||||
l_layout->addWidget(qWidget);
|
||||
dialog->adjustSize();
|
||||
dialog->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | (qWidget->windowFlags() & Qt::X11BypassWindowManagerHint));
|
||||
}
|
||||
else{
|
||||
dialog->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
|
||||
}
|
||||
dialog->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
|
||||
KWindowSystem::setState(dialog->winId(), NET::SkipTaskbar | NET::SkipPager);
|
||||
dialog->installEventFilter(q);
|
||||
|
||||
|
||||
QObject::connect(dialog, SIGNAL(dialogResized()), q, SLOT(dialogSizeChanged()));
|
||||
QObject::connect(dialog, SIGNAL(dialogVisible(bool)), q, SLOT(dialogStatusChanged(bool)));
|
||||
|
@ -44,6 +44,8 @@ class PopupAppletPrivate;
|
||||
*
|
||||
* If you use this class as a base class for your extender using applet, the extender will
|
||||
* automatically be used for the popup; reimplementing graphicsWidget() is unnecessary in this case.
|
||||
* If you need a popup that does not steal window focus when openend or used, set window flag
|
||||
* Qt::X11BypassWindowManagerHint the widget returned by widget() or graphicsWidget().
|
||||
*/
|
||||
|
||||
class PLASMA_EXPORT PopupApplet : public Plasma::Applet
|
||||
@ -89,7 +91,7 @@ public:
|
||||
|
||||
/**
|
||||
* Sets whether or not the dialog popup that gets created should be a "passive" popup
|
||||
* that does not steal focus from other windows or not.
|
||||
* that does not steal focus from other windows or not.
|
||||
*
|
||||
* @arg passive true if the dialog should be treated as a passive popup
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user