diff options
author | Timothy Pearson <[email protected]> | 2013-03-22 00:18:32 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2013-03-22 00:18:32 -0500 |
commit | bf0b8eb3b27ea20173bee2690a8daef410a00b59 (patch) | |
tree | de0b191086dc9641059ac41606346abf6f91bc9b /kdesktop/lock/main.cc | |
parent | 2e6d8f1b552cb9a4870291fcd7c8c1d52c101608 (diff) | |
download | tdebase-bf0b8eb3b27ea20173bee2690a8daef410a00b59.tar.gz tdebase-bf0b8eb3b27ea20173bee2690a8daef410a00b59.zip |
Clean up spurious kdesktop_lock X11 error messages
Introduce disabled framework for future ARGB visual support
Diffstat (limited to 'kdesktop/lock/main.cc')
-rw-r--r-- | kdesktop/lock/main.cc | 93 |
1 files changed, 61 insertions, 32 deletions
diff --git a/kdesktop/lock/main.cc b/kdesktop/lock/main.cc index 377080d23..017250a35 100644 --- a/kdesktop/lock/main.cc +++ b/kdesktop/lock/main.cc @@ -19,6 +19,8 @@ Boston, MA 02110-1301, USA. */ +#include <config.h> + #include "lockprocess.h" #include "main.h" #include "kdesktopsettings.h" @@ -35,8 +37,19 @@ #include <stdlib.h> -#include <X11/Xlib.h> -#include <fixx11h.h> +#if defined(Q_WS_X11) && defined(HAVE_XRENDER) && TQT_VERSION >= 0x030300 +#define COMPOSITE +#endif + +#ifdef COMPOSITE +# include <X11/Xlib.h> +# include <X11/extensions/Xrender.h> +# include <fixx11h.h> +# include <dlfcn.h> +#else +# include <X11/Xlib.h> +# include <fixx11h.h> +#endif #define OPEN_TDMCONFIG_AND_SET_GROUP \ if( stat( KDE_CONFDIR "/tdm/tdmdistrc" , &st ) == 0) { \ @@ -64,6 +77,38 @@ bool signalled_blank; bool signalled_run; bool in_internal_mode = FALSE; +bool argb_visual = FALSE; + +static void sigusr1_handler(int) +{ + signalled_forcelock = TRUE; +} + +static void sigusr2_handler(int) +{ + signalled_dontlock = TRUE; +} + +static void sigusr3_handler(int) +{ + signalled_securedialog = TRUE; +} + +static void sigusr4_handler(int) +{ + signalled_blank = TRUE; +} + +static void sigusr5_handler(int) +{ + signalled_run = TRUE; +} + +static int trapXErrors(Display *, XErrorEvent *) +{ + return 0; +} + bool MyApp::x11EventFilter( XEvent *ev ) { if (ev->type == ButtonPress || ev->type == ButtonRelease || ev->type == MotionNotify) { @@ -119,6 +164,10 @@ bool MyApp::x11EventFilter( XEvent *ev ) XCreateWindowEvent create_event = ev->xcreatewindow; XWindowAttributes childAttr; Window childTransient; + + // XGetWindowAttributes may generate BadWindow errors, so make sure they are silently ignored + int (*oldHandler)(Display *, XErrorEvent *); + oldHandler = XSetErrorHandler(trapXErrors); 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)) { @@ -128,6 +177,7 @@ bool MyApp::x11EventFilter( XEvent *ev ) XFlush(create_event.display); } } + XSetErrorHandler(oldHandler); } else if (ev->type == DestroyNotify) { XDestroyWindowEvent destroy_event = ev->xdestroywindow; @@ -171,36 +221,6 @@ void restore_hidden_override_redirect_windows() { } } -static void sigusr1_handler(int) -{ - signalled_forcelock = TRUE; -} - -static void sigusr2_handler(int) -{ - signalled_dontlock = TRUE; -} - -static void sigusr3_handler(int) -{ - signalled_securedialog = TRUE; -} - -static void sigusr4_handler(int) -{ - signalled_blank = TRUE; -} - -static void sigusr5_handler(int) -{ - signalled_run = TRUE; -} - -static int trapXErrors(Display *, XErrorEvent *) -{ - return 0; -} - // ----------------------------------------------------------------------------- int main( int argc, char **argv ) @@ -287,7 +307,16 @@ int main( int argc, char **argv ) } } +// FIXME +// Composite should be enabled where possible, however using ARGB visuals seems to cause problems +// with XScreenSaver hacks (they do not display). +// #ifdef COMPOSITE +// MyApp app(TDEApplication::openX11RGBADisplay()); +// argb_visual = app.isX11CompositionAvailable(); +// #else MyApp app; +// #endif + kdDebug() << "app " << kdesktop_screen_number << " " << starting_screen << " " << child << " " << child_sockets.count() << " " << parent_connection << endl; app.disableSessionManagement(); TDEGlobal::locale()->insertCatalogue("libdmctl"); |