summaryrefslogtreecommitdiffstats
path: root/kdesktop/lock/main.cc
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2012-09-22 18:06:15 -0500
committerSlávek Banko <slavek.banko@axis.cz>2012-09-24 19:16:39 +0200
commit22e8f5bec8d677c7a55848976e411069038bd708 (patch)
treeb4376a6a5c079a62d669cd2e68df3fddad267dbd /kdesktop/lock/main.cc
parentb3ab725915e6c9f69dd131502c095f2037b07383 (diff)
downloadtdebase-22e8f5bec8d677c7a55848976e411069038bd708.tar.gz
tdebase-22e8f5bec8d677c7a55848976e411069038bd708.zip
Lower override redirect windows instead of unmapping them on lock start
Restore lowered windows on lock exit This provides a better solution to Bug 1079 (cherry picked from commit 57f5c0698d49f0a0a7a55c75404f5b9ded910002)
Diffstat (limited to 'kdesktop/lock/main.cc')
-rw-r--r--kdesktop/lock/main.cc49
1 files changed, 46 insertions, 3 deletions
diff --git a/kdesktop/lock/main.cc b/kdesktop/lock/main.cc
index 343ab9778..5449fa050 100644
--- a/kdesktop/lock/main.cc
+++ b/kdesktop/lock/main.cc
@@ -47,6 +47,8 @@ else { \
} \
tdmconfig->setGroup("X-*-Greeter");
+TQXLibWindowList trinity_desktop_lock_hidden_window_list;
+
// [FIXME] Add GUI configuration checkboxes for these three settings (see kdesktoprc [ScreenSaver] UseUnmanagedLockWindows, DelaySaverStart, and UseTDESAK)
bool trinity_desktop_lock_use_system_modal_dialogs = FALSE;
bool trinity_desktop_lock_delay_screensaver_start = FALSE;
@@ -78,16 +80,43 @@ bool MyApp::x11EventFilter( XEvent *ev )
}
else if (ev->type == MapNotify) {
// HACK
- // Close all tooltips and notification windows
+ // Hide all tooltips and notification windows
XMapEvent map_event = ev->xmap;
XWindowAttributes childAttr;
Window childTransient;
if (XGetWindowAttributes(map_event.display, map_event.window, &childAttr) && XGetTransientForHint(map_event.display, map_event.window, &childTransient)) {
if((childAttr.map_state == IsViewable) && (childAttr.override_redirect) && (childTransient)) {
- XUnmapWindow(map_event.display, map_event.window);
+ if (!trinity_desktop_lock_hidden_window_list.contains(map_event.window)) {
+ trinity_desktop_lock_hidden_window_list.append(map_event.window);
+ }
+ XLowerWindow(map_event.display, map_event.window);
}
}
}
+ else if (ev->type == VisibilityNotify) {
+ // HACK
+ // Hide all tooltips and notification windows
+ XVisibilityEvent visibility_event = ev->xvisibility;
+ XWindowAttributes childAttr;
+ Window childTransient;
+ if ((visibility_event.state == VisibilityUnobscured) || (visibility_event.state == VisibilityPartiallyObscured)) {
+ if (XGetWindowAttributes(visibility_event.display, visibility_event.window, &childAttr) && XGetTransientForHint(visibility_event.display, visibility_event.window, &childTransient)) {
+ if((childAttr.map_state == IsViewable) && (childAttr.override_redirect) && (childTransient)) {
+ if (!trinity_desktop_lock_hidden_window_list.contains(visibility_event.window)) {
+ trinity_desktop_lock_hidden_window_list.append(visibility_event.window);
+ }
+ XLowerWindow(visibility_event.display, visibility_event.window);
+ }
+ }
+ }
+ }
+ else if (ev->type == DestroyNotify) {
+ XDestroyWindowEvent destroy_event = ev->xdestroywindow;
+ if (trinity_desktop_lock_hidden_window_list.contains(destroy_event.window)) {
+ trinity_desktop_lock_hidden_window_list.remove(destroy_event.window);
+ }
+ }
+#if 0
else if (ev->type == CreateNotify) {
// HACK
// Close all tooltips and notification windows
@@ -100,6 +129,7 @@ bool MyApp::x11EventFilter( XEvent *ev )
}
}
}
+#endif
return KApplication::x11EventFilter( ev );
}
@@ -114,6 +144,14 @@ static KCmdLineOptions options[] =
KCmdLineLastOption
};
+void restore_hidden_override_redirect_windows() {
+ TQXLibWindowList::iterator it;
+ for (it = trinity_desktop_lock_hidden_window_list.begin(); it != trinity_desktop_lock_hidden_window_list.end(); ++it) {
+ Window win = *it;
+ XRaiseWindow(qt_xdisplay(), win);
+ }
+}
+
static void sigusr1_handler(int)
{
signalled_forcelock = TRUE;
@@ -356,7 +394,10 @@ int main( int argc, char **argv )
}
if (in_internal_mode == FALSE) {
- return app.exec();
+ trinity_desktop_lock_hidden_window_list.clear();
+ int ret = app.exec();
+ restore_hidden_override_redirect_windows();
+ return ret;
}
else {
pid_t kdesktop_pid = atoi(args->getOption( "internal" ));
@@ -364,7 +405,9 @@ int main( int argc, char **argv )
// The controlling kdesktop process probably died. Commit suicide...
return 12;
}
+ trinity_desktop_lock_hidden_window_list.clear();
app.exec();
+ restore_hidden_override_redirect_windows();
if (kill(kdesktop_pid, SIGUSR1) < 0) {
// The controlling kdesktop process probably died. Commit suicide...
return 12;