diff options
Diffstat (limited to 'kdesktop')
-rw-r--r-- | kdesktop/lock/lockdlg.cc | 14 | ||||
-rw-r--r-- | kdesktop/lock/lockprocess.cc | 47 | ||||
-rw-r--r-- | kdesktop/lock/lockprocess.h | 2 | ||||
-rw-r--r-- | kdesktop/lock/main.cc | 87 |
4 files changed, 143 insertions, 7 deletions
diff --git a/kdesktop/lock/lockdlg.cc b/kdesktop/lock/lockdlg.cc index 236bf8a62..005ac9913 100644 --- a/kdesktop/lock/lockdlg.cc +++ b/kdesktop/lock/lockdlg.cc @@ -573,9 +573,19 @@ void PasswordDlg::gplugActivity() void PasswordDlg::gplugMsgBox( TQMessageBox::Icon type, const TQString &text ) { - TQDialog dialog( this, 0, true, (WFlags)WX11BypassWM ); + TQDialog dialog( this, 0, true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM)) ); + if (trinity_desktop_lock_use_system_modal_dialogs) { + // Signal that we do not want any window controls to be shown at all + Atom kde_wm_system_modal_notification; + kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_KDE_WM_MODAL_SYS_NOTIFICATION", False); + XChangeProperty(tqt_xdisplay(), dialog.winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); + } + dialog.setCaption(i18n("Authentication Subsystem Notice")); TQFrame *winFrame = new TQFrame( &dialog ); - winFrame->setFrameStyle( TQFrame::WinPanel | TQFrame::Raised ); + if (trinity_desktop_lock_use_system_modal_dialogs) + winFrame->setFrameStyle( TQFrame::NoFrame ); + else + winFrame->setFrameStyle( TQFrame::WinPanel | TQFrame::Raised ); winFrame->setLineWidth( 2 ); TQVBoxLayout *vbox = new TQVBoxLayout( &dialog ); vbox->addWidget( winFrame ); diff --git a/kdesktop/lock/lockprocess.cc b/kdesktop/lock/lockprocess.cc index 2ce750756..db92c0018 100644 --- a/kdesktop/lock/lockprocess.cc +++ b/kdesktop/lock/lockprocess.cc @@ -138,6 +138,8 @@ extern bool trinity_desktop_lock_delay_screensaver_start; extern bool trinity_desktop_lock_use_sak; extern bool trinity_desktop_lock_forced; +extern TQXLibWindowList trinity_desktop_lock_hidden_window_list; + bool trinity_desktop_lock_autohide_lockdlg = TRUE; bool trinity_desktop_lock_closing_windows = FALSE; bool trinity_desktop_lock_in_sec_dlg = FALSE; @@ -960,6 +962,31 @@ void LockProcess::createSaverWindow() setGeometry(0, 0, mRootWidth, mRootHeight); + // HACK + // Hide all tooltips and notification windows + { + Window rootWindow = RootWindow(x11Display(), x11Screen()); + Window parent; + Window* children = NULL; + unsigned int noOfChildren = 0; + XWindowAttributes childAttr; + Window childTransient; + + if (XQueryTree(x11Display(), rootWindow, &rootWindow, &parent, &children, &noOfChildren) && noOfChildren>0 ) { + for (unsigned int i=0; i<noOfChildren; i++) { + if (XGetWindowAttributes(x11Display(), children[i], &childAttr) && XGetTransientForHint(x11Display(), children[i], &childTransient)) { + if ((childAttr.map_state == IsViewable) && (childAttr.override_redirect) && (childTransient)) { + if (!trinity_desktop_lock_hidden_window_list.contains(children[i])) { + trinity_desktop_lock_hidden_window_list.append(children[i]); + } + XLowerWindow(x11Display(), children[i]); + XFlush(x11Display()); + } + } + } + } + } + kdDebug(1204) << "Saver window Id: " << winId() << endl; } @@ -2162,9 +2189,19 @@ void LockProcess::unlockXF86() void LockProcess::msgBox( TQMessageBox::Icon type, const TQString &txt ) { - TQDialog box( 0, "messagebox", true, (WFlags)WX11BypassWM ); + TQDialog box( 0, "messagebox", true, (trinity_desktop_lock_use_system_modal_dialogs?((WFlags)WStyle_StaysOnTop):((WFlags)WX11BypassWM)) ); + if (trinity_desktop_lock_use_system_modal_dialogs) { + // Signal that we do not want any window controls to be shown at all + Atom kde_wm_system_modal_notification; + kde_wm_system_modal_notification = XInternAtom(tqt_xdisplay(), "_KDE_WM_MODAL_SYS_NOTIFICATION", False); + XChangeProperty(tqt_xdisplay(), box.winId(), kde_wm_system_modal_notification, XA_INTEGER, 32, PropModeReplace, (unsigned char *) "TRUE", 1L); + } + box.setCaption(i18n("Authentication Subsystem Notice")); TQFrame *winFrame = new TQFrame( &box ); - winFrame->setFrameStyle( TQFrame::WinPanel | TQFrame::Raised ); + if (trinity_desktop_lock_use_system_modal_dialogs) + winFrame->setFrameStyle( TQFrame::NoFrame ); + else + winFrame->setFrameStyle( TQFrame::WinPanel | TQFrame::Raised ); winFrame->setLineWidth( 2 ); TQLabel *label1 = new TQLabel( winFrame ); label1->setPixmap( TQMessageBox::standardIcon( type ) ); @@ -2264,8 +2301,10 @@ void LockProcess::windowAdded( WId w, bool managed ) int y = XDisplayHeight( tqt_xdisplay(), tqt_xscreen()) - attr_geom.height; if( managed ) { XSetWindowAttributes attr; - attr.override_redirect = True; - XChangeWindowAttributes( tqt_xdisplay(), w, CWOverrideRedirect, &attr ); + if (!trinity_desktop_lock_use_system_modal_dialogs) { + attr.override_redirect = True; + XChangeWindowAttributes( tqt_xdisplay(), w, CWOverrideRedirect, &attr ); + } XReparentWindow( tqt_xdisplay(), w, tqt_xrootwin(), x, y ); XMapWindow( tqt_xdisplay(), w ); } diff --git a/kdesktop/lock/lockprocess.h b/kdesktop/lock/lockprocess.h index 0dacc46b4..7fd423666 100644 --- a/kdesktop/lock/lockprocess.h +++ b/kdesktop/lock/lockprocess.h @@ -38,6 +38,8 @@ struct GreeterPluginHandle { #define FIFO_FILE_OUT "/tmp/tdesocket-global/kdesktoplockcontrol_out" #define PIPE_CHECK_INTERVAL 50 +typedef TQValueList<Window> TQXLibWindowList; + //=========================================================================== // // Screen saver handling process. Handles screensaver window, diff --git a/kdesktop/lock/main.cc b/kdesktop/lock/main.cc index 56b4b5fed..7235776fb 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; @@ -76,6 +78,76 @@ bool MyApp::x11EventFilter( XEvent *ev ) emit activity(); } } + else if (ev->type == MapNotify) { + // HACK + // 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)) { + 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); + XFlush(map_event.display); + } + } + } + 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); + XFlush(visibility_event.display); + } + } + } + } + else if (ev->type == CreateNotify) { + // HACK + // Close all tooltips and notification windows + XCreateWindowEvent create_event = ev->xcreatewindow; + XWindowAttributes childAttr; + Window childTransient; + if (XGetWindowAttributes(create_event.display, create_event.window, &childAttr) && XGetTransientForHint(create_event.display, create_event.window, &childTransient)) { + if ((childAttr.override_redirect) && (childTransient)) { + if (!trinity_desktop_lock_hidden_window_list.contains(create_event.window)) { + trinity_desktop_lock_hidden_window_list.append(create_event.window); + } + XLowerWindow(create_event.display, create_event.window); + XFlush(create_event.display); + } + } + } + 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 + XCreateWindowEvent create_event = ev->xcreatewindow; + XWindowAttributes childAttr; + Window childTransient; + if (XGetWindowAttributes(create_event.display, create_event.window, &childAttr) && XGetTransientForHint(create_event.display, create_event.window, &childTransient)) { + if ((childAttr.override_redirect) && (childTransient)) { + XDestroyWindow(create_event.display, create_event.window); + } + } + } +#endif return KApplication::x11EventFilter( ev ); } @@ -90,6 +162,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(tqt_xdisplay(), win); + } +} + static void sigusr1_handler(int) { signalled_forcelock = TRUE; @@ -332,7 +412,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" )); @@ -340,7 +423,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; |