diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2013-03-22 00:18:32 -0500 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2013-05-05 05:09:53 +0200 |
commit | 52b8af3d7975010b98ebf728ab1b6b47f6031580 (patch) | |
tree | 8705126448ad992259ba2734819c1062761f36ff /kdesktop/lock/main.cc | |
parent | 64ed2efaa1b28e938e531b045c6ff1f5bd76f09f (diff) | |
download | tdebase-52b8af3d7975010b98ebf728ab1b6b47f6031580.tar.gz tdebase-52b8af3d7975010b98ebf728ab1b6b47f6031580.zip |
Clean up spurious kdesktop_lock X11 error messages
Introduce disabled framework for future ARGB visual support
(cherry picked from commit bf0b8eb3b27ea20173bee2690a8daef410a00b59)
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 e1cf0cb41..66d4ec313 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 "/kdm/kdmdistrc" , &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(KApplication::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(); KGlobal::locale()->insertCatalogue("libdmctl"); |