diff options
author | Sergey Udaltsov <svu@gnome.org> | 2009-09-30 09:49:56 +0000 |
---|---|---|
committer | Sergey Udaltsov <svu@gnome.org> | 2009-09-30 09:49:56 +0000 |
commit | 9ea4cbefa5cfeac7f8b77a17380d682bf8741d16 (patch) | |
tree | 18f390e971716eedccb1758d716e297b9250497a | |
parent | ee336cef1303206c34a6176f43bad1c09eb9f2b5 (diff) | |
download | libxklavier-9ea4cbefa5cfeac7f8b77a17380d682bf8741d16.tar.gz |
engine-specific error handling
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | libxklavier/xklavier_evt.c | 16 | ||||
-rw-r--r-- | libxklavier/xklavier_evt_xkb.c | 15 | ||||
-rw-r--r-- | libxklavier/xklavier_private.h | 7 | ||||
-rw-r--r-- | libxklavier/xklavier_private_xkb.h | 4 | ||||
-rw-r--r-- | libxklavier/xklavier_xkb.c | 1 | ||||
-rwxr-xr-x | libxklavier/xklavier_xmm.c | 1 |
7 files changed, 47 insertions, 1 deletions
@@ -4,6 +4,10 @@ https://bugs.edge.launchpad.net/ubuntu/+source/libxklavier/+bug/404924 * libxklavier/xklavier_private_xkb.h, libxklavier/xklavier_xkb.c: save xinput error code and event type + * libxklavier/xklavier_evt.c, libxklavier/xklavier_evt_xkb.c, + libxklavier/xklavier_private.h, libxklavier/xklavier_private_xkb.h, + libxklavier/xklavier_xkb.c, libxklavier/xklavier_xmm.c: introduced + engine-specific error handling (for ignoring xinput errors) 2009-08-29 svu diff --git a/libxklavier/xklavier_evt.c b/libxklavier/xklavier_evt.c index dca452b..85949a0 100644 --- a/libxklavier/xklavier_evt.c +++ b/libxklavier/xklavier_evt.c @@ -522,6 +522,22 @@ xkl_process_error(Display * dpy, XErrorEvent * evt) break; } default: + if (engine != NULL + && xkl_engine_priv(engine, process_x_error)) { + if (xkl_engine_priv(engine, process_x_error) + (engine, evt)) { + xkl_debug(200, + "X ERROR processed by the engine: %p, " + WINID_FORMAT ", %d [%s], " + "X11 request: %d, minor code: %d\n", + dpy, + (unsigned long) evt->resourceid, + (int) evt->error_code, buf, + (int) evt->request_code, + (int) evt->minor_code); + break; + } + } xkl_debug(200, "Unexpected by libxklavier X ERROR: %p, " WINID_FORMAT ", %d [%s], " diff --git a/libxklavier/xklavier_evt_xkb.c b/libxklavier/xklavier_evt_xkb.c index 046e138..b910b84 100644 --- a/libxklavier/xklavier_evt_xkb.c +++ b/libxklavier/xklavier_evt_xkb.c @@ -162,6 +162,21 @@ xkl_xkb_process_x_event(XklEngine * engine, XEvent * xev) #endif } +/* + * XKB error handler + */ +gint +xkl_xkb_process_x_error(XklEngine * engine, XErrorEvent * xerev) +{ +#ifdef HAVE_XINPUT + /* Ignore XInput errors */ + if (xerev->error_code == xkl_engine_backend(engine, XklXkb, xi_error_code)) + return 1; +#endif + + return 0; +} + void xkl_xkb_set_indicators(XklEngine * engine, const XklState * window_state) { diff --git a/libxklavier/xklavier_private.h b/libxklavier/xklavier_private.h index 4298a9a..4c120a1 100644 --- a/libxklavier/xklavier_private.h +++ b/libxklavier/xklavier_private.h @@ -157,6 +157,13 @@ struct _XklEnginePrivate { gint(*process_x_event) (XklEngine * engine, XEvent * xev); /* + * Handles X errors. + * return 0 if further processing is needed + * 1 if error was handled + */ + gint(*process_x_error) (XklEngine * engine, XErrorEvent * xerev); + + /* * Flushes the cached server config info. * xkb: frees XkbDesc * xmodmap: frees internal XklConfigRec diff --git a/libxklavier/xklavier_private_xkb.h b/libxklavier/xklavier_private_xkb.h index 894b1fb..ef18672 100644 --- a/libxklavier/xklavier_private_xkb.h +++ b/libxklavier/xklavier_private_xkb.h @@ -88,7 +88,9 @@ extern gboolean xkl_xkb_write_config_rec_to_file(XklEngine * engine, const XklConfigRec * data, const gboolean binary); -extern gint xkl_xkb_process_x_event(XklEngine * engine, XEvent * kev); +extern gint xkl_xkb_process_x_event(XklEngine * engine, XEvent * xev); + +extern gint xkl_xkb_process_x_error(XklEngine * engine, XErrorEvent * xerev); extern void xkl_xkb_free_all_info(XklEngine * engine); diff --git a/libxklavier/xklavier_xkb.c b/libxklavier/xklavier_xkb.c index 9a0a7f9..7cb8e59 100644 --- a/libxklavier/xklavier_xkb.c +++ b/libxklavier/xklavier_xkb.c @@ -564,6 +564,7 @@ xkl_xkb_init(XklEngine * engine) xkl_engine_priv(engine, get_num_groups) = xkl_xkb_get_num_groups; xkl_engine_priv(engine, lock_group) = xkl_xkb_lock_group; xkl_engine_priv(engine, process_x_event) = xkl_xkb_process_x_event; + xkl_engine_priv(engine, process_x_error) = xkl_xkb_process_x_error; xkl_engine_priv(engine, free_all_info) = xkl_xkb_free_all_info; xkl_engine_priv(engine, if_cached_info_equals_actual) = xkl_xkb_if_cached_info_equals_actual; diff --git a/libxklavier/xklavier_xmm.c b/libxklavier/xklavier_xmm.c index a44a9bd..3353961 100755 --- a/libxklavier/xklavier_xmm.c +++ b/libxklavier/xklavier_xmm.c @@ -327,6 +327,7 @@ xkl_xmm_init(XklEngine * engine) xkl_engine_priv(engine, lock_group) = xkl_xmm_lock_group; xkl_engine_priv(engine, process_x_event) = xkl_xmm_process_x_event; + xkl_engine_priv(engine, process_x_error) = NULL; xkl_engine_priv(engine, free_all_info) = xkl_xmm_free_all_info; xkl_engine_priv(engine, if_cached_info_equals_actual) = xkl_xmm_if_cached_info_equals_actual; |