File r902298.diff of Package kdepim4
Subject: kalarm: ensure alarms shown above full-screen windows
From: wstephenson@suse.de
Bug:
Patch-upstream: 902298
--- kalarm/Changelog (revision 902297)
+++ kalarm/Changelog (revision 902298)
@@ -1,7 +1,8 @@
KAlarm Change Log
-=== Version 2.0.7 --- 16 December 2008 ===
+=== Version 2.0.7 --- 27 December 2008 ===
- Distinguish disabled from enabled alarm colour when highlighted in alarm list.
+- Ensure alarm windows show on top of full-screen windows.
- Fix crash if KAlarm is activated again while restoring from previous session.
- Fix kalarmautostart crash on logout while kalarmautostart is still running.
- Fix failure to update alarms in KOrganizer when Kontact is running.
--- kalarm/messagewin.cpp (revision 902297)
+++ kalarm/messagewin.cpp (revision 902298)
@@ -95,6 +95,8 @@ static const char* KMAIL_DBUS_PATH
static const int proximityButtonDelay = 1000; // (milliseconds)
static const int proximityMultiple = 10; // multiple of button height distance from cursor for proximity
+static bool wantModal();
+
// A text label widget which can be scrolled and copied with the mouse
class MessageText : public KTextEdit
{
@@ -154,7 +156,7 @@ QMap<QString, unsigned> MessageWin::mErr
* displayed.
*/
MessageWin::MessageWin(const KAEvent* event, const KAAlarm& alarm, int flags)
- : MainWindowBase(0, static_cast<Qt::WFlags>(WFLAGS | WFLAGS2 | (Preferences::modalMessages() ? 0 : Qt::X11BypassWindowManagerHint))),
+ : MainWindowBase(0, static_cast<Qt::WFlags>(WFLAGS | WFLAGS2 | (wantModal() ? 0 : Qt::X11BypassWindowManagerHint))),
mMessage(event->cleanText()),
mFont(event->font()),
mBgColour(event->bgColour()),
@@ -715,8 +717,9 @@ void MessageWin::initView()
topLayout->activate();
setMinimumSize(QSize(grid->sizeHint().width() + 2*KDialog::marginHint(), sizeHint().height()));
+ bool modal = !(windowFlags() & Qt::X11BypassWindowManagerHint);
+ unsigned long wstate = (modal ? NET::Modal : 0) | NET::Sticky | NET::StaysOnTop;
WId winid = winId();
- unsigned long wstate = (Preferences::modalMessages() ? NET::Modal : 0) | NET::Sticky | NET::StaysOnTop;
KWindowSystem::setState(winid, wstate);
KWindowSystem::setOnAllDesktops(winid, true);
}
@@ -1714,3 +1717,22 @@ void MessageWin::clearErrorMessage(unsig
mErrorMessages[mEventID] &= ~msg;
}
}
+
+
+/******************************************************************************
+* Check whether the message window should be modal, i.e. with title bar etc.
+* Normally this follows the Preferences setting, but if there is a full screen
+* window displayed, on X11 the message window has to bypass the window manager
+* in order to display on top of it (which has the side effect that it will have
+* no window decoration).
+*/
+bool wantModal()
+{
+ bool modal = Preferences::modalMessages();
+ if (modal)
+ {
+ KWindowInfo wi = KWindowSystem::windowInfo(KWindowSystem::activeWindow(), NET::WMState);
+ modal = !(wi.valid() && wi.hasState(NET::FullScreen));
+ }
+ return modal;
+}
Index: kalarm/Changelog
===================================================================
Index: kalarm/messagewin.cpp
===================================================================