From f83aeaa6f0ef3e3f0536b60d4a1a872ebacf5ab3 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Thu, 9 Mar 2006 20:41:18 +0000 Subject: [PATCH] - trap X error reply to limit the damage of bug 183569. --- ...lavier-2.1.0.2006.02.23-trap-x-error.patch | 42 +++++++++++++++++++ libxklavier.spec | 6 +-- 2 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 libxklavier-2.1.0.2006.02.23-trap-x-error.patch diff --git a/libxklavier-2.1.0.2006.02.23-trap-x-error.patch b/libxklavier-2.1.0.2006.02.23-trap-x-error.patch new file mode 100644 index 0000000..7eaa288 --- /dev/null +++ b/libxklavier-2.1.0.2006.02.23-trap-x-error.patch @@ -0,0 +1,42 @@ +--- libxklavier-2.1.0.2006.02.23/libxklavier/xklavier_config_xkb.c.trap-x-error 2006-03-09 15:10:56.000000000 -0500 ++++ libxklavier-2.1.0.2006.02.23/libxklavier/xklavier_config_xkb.c 2006-03-09 15:35:13.000000000 -0500 +@@ -158,6 +158,20 @@ void _XklXkbConfigCleanupNative( XkbComp + free(componentNamesPtr->symbols); + free(componentNamesPtr->geometry); + } ++static int (* _XklTrapBeforeXkbWriteToServer) (Display *, XErrorEvent *); ++ ++static int _XklXkbWriteToServerTrap (Display *dpy, ++ XErrorEvent *error_event) ++{ ++ if (error_event->error_code != 0 && ++ error_event->error_code != BadValue && ++ _XklTrapBeforeXkbWriteToServer != NULL) ++ { ++ return _XklTrapBeforeXkbWriteToServer (dpy, error_event); ++ } ++ ++ return 0; ++} + + static XkbDescPtr _XklConfigGetKeyboard( XkbComponentNamesPtr componentNamesPtr, Bool activate ) + { +@@ -243,8 +257,17 @@ static XkbDescPtr _XklConfigGetKeyboard( + XklDebug( 150, "Loaded legal keymap\n" ); + if( activate ) + { ++ Bool config_was_written = False; ++ + XklDebug( 150, "Activating it...\n" ); +- if( XkbWriteToServer(&result) ) ++ ++ _XklTrapBeforeXkbWriteToServer = XSetErrorHandler (_XklXkbWriteToServerTrap); ++ ++ config_was_written = XkbWriteToServer (&result); ++ ++ XSetErrorHandler (_XklTrapBeforeXkbWriteToServer); ++ ++ if (config_was_written) + { + XklDebug( 150, "Updating the keyboard...\n" ); + xkb = result.xkb; diff --git a/libxklavier.spec b/libxklavier.spec index 416662b..0a610eb 100644 --- a/libxklavier.spec +++ b/libxklavier.spec @@ -1,7 +1,7 @@ Summary: library providing high-level API for X Keyboard Extension Name: libxklavier Version: 2.1.0.2006.02.23 -Release: 1 +Release: 2 License: LGPL Group: Development/Libraries Url: http://gswitchit.sourceforge.net/ @@ -69,10 +69,10 @@ rm -rf %{buildroot} %{_includedir}/* %changelog -* Thu Mar 9 2006 Ray Strode - 2.1-5 +* Thu Mar 9 2006 Ray Strode - 2.1.0.2006.02.23-2 - trap X error reply to limit the damage of bug 183569. -* Thu Feb 23 2006 Ray Strode - 2.1-4 +* Thu Feb 23 2006 Ray Strode - 2.1.0.2006.02.23-1 - upgrade to latest cvs to handle xml comments (bug 178163) * Fri Feb 10 2006 Jesse Keating - 2.1-3.2