Do not let plasma popup appear over screensaver.

BUG: 179924


CCMAIL:aseigo@kde.org

svn path=/branches/KDE/4.2/kdelibs/; revision=956998
This commit is contained in:
Aurélien Gâteau 2009-04-21 09:20:10 +00:00
parent 76b571b6bc
commit 259e98fdfc
2 changed files with 14 additions and 17 deletions

View File

@ -275,13 +275,8 @@ void PopupAppletPrivate::popupConstraintsEvent(Plasma::Constraints constraints)
//stuff out of your Dialog (extenders). Monitor WindowDeactivate events so we can //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 //emulate the same kind of behavior as Qt::Popup (close when you click somewhere
//else. //else.
Qt::WindowFlags wflags = Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint; dialog->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
updateDialogFlags();
if (passive) {
wflags |= Qt::X11BypassWindowManagerHint;
}
dialog->setWindowFlags(wflags);
KWindowSystem::setState(dialog->winId(), NET::SkipTaskbar | NET::SkipPager); KWindowSystem::setState(dialog->winId(), NET::SkipTaskbar | NET::SkipPager);
dialog->installEventFilter(q); dialog->installEventFilter(q);
@ -339,7 +334,7 @@ void PopupApplet::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
bool PopupApplet::eventFilter(QObject *watched, QEvent *event) bool PopupApplet::eventFilter(QObject *watched, QEvent *event)
{ {
if (watched == d->dialog && (event->type() == QEvent::WindowDeactivate)) { if (!d->passive && watched == d->dialog && (event->type() == QEvent::WindowDeactivate)) {
d->popupLostFocus = true; d->popupLostFocus = true;
hidePopup(); hidePopup();
QTimer::singleShot(100, this, SLOT(clearPopupLostFocus())); QTimer::singleShot(100, this, SLOT(clearPopupLostFocus()));
@ -410,15 +405,7 @@ void PopupApplet::setPassivePopup(bool passive)
d->passive = passive; d->passive = passive;
if (d->dialog) { if (d->dialog) {
Qt::WindowFlags wflags = d->dialog->windowFlags(); d->updateDialogFlags();
if (d->passive) {
wflags |= Qt::X11BypassWindowManagerHint;
} else {
wflags &= ~Qt::X11BypassWindowManagerHint;
}
d->dialog->setWindowFlags(wflags);
} }
} }
@ -627,6 +614,15 @@ void PopupAppletPrivate::updateDialogPosition()
dialog->move(pos); dialog->move(pos);
} }
void PopupAppletPrivate::updateDialogFlags()
{
Q_ASSERT(dialog);
dialog->setAttribute(Qt::WA_X11NetWmWindowTypeNotification, passive);
}
} // Plasma namespace } // Plasma namespace
#include "popupapplet.moc" #include "popupapplet.moc"

View File

@ -35,6 +35,7 @@ public:
void dialogSizeChanged(); void dialogSizeChanged();
void dialogStatusChanged(bool status); void dialogStatusChanged(bool status);
void updateDialogPosition(); void updateDialogPosition();
void updateDialogFlags();
void popupConstraintsEvent(Plasma::Constraints constraints); void popupConstraintsEvent(Plasma::Constraints constraints);
void checkExtenderAppearance(Plasma::FormFactor f); void checkExtenderAppearance(Plasma::FormFactor f);