summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Udaltsov <svu@gnome.org>2009-03-10 15:04:27 +0000
committerSergey Udaltsov <svu@gnome.org>2009-03-10 15:04:27 +0000
commit17898d8e3752c05afeedb46a5dd2e72561af5539 (patch)
treeb542e596d52319270d53c3dfcb1971a278447a3e
parent57a3e285eab90261afef7a606d056d86958cadfd (diff)
downloadlibxklavier-17898d8e3752c05afeedb46a5dd2e72561af5539.tar.gz
The X11 error processing is more robust in relation to the missing engine (during the initialization) - but it just might mean the troubles may cause crashes at later stages
-rw-r--r--ChangeLog4
-rw-r--r--libxklavier/xklavier_evt.c65
2 files changed, 32 insertions, 37 deletions
diff --git a/ChangeLog b/ChangeLog
index e11573f..c4f80e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-03-10 svu
+
+ * libxklavier/xklavier_evt.c: a
+
2009-03-09 svu
* libxklavier/xklavier_config_xkb.c: no need to display loads of
diff --git a/libxklavier/xklavier_evt.c b/libxklavier/xklavier_evt.c
index 8c25a2c..fbe98c9 100644
--- a/libxklavier/xklavier_evt.c
+++ b/libxklavier/xklavier_evt.c
@@ -50,8 +50,7 @@ xkl_engine_filter_events(XklEngine * engine, XEvent * xev)
break;
case CreateNotify:
xkl_engine_process_create_window_evt(engine,
- &xev->
- xcreatewindow);
+ &xev->xcreatewindow);
break;
case DestroyNotify:
xkl_debug(150,
@@ -162,10 +161,8 @@ xkl_engine_process_focus_in_evt(XklEngine * engine,
&tmp_state))
{
xkl_engine_update_current_state(engine,
- tmp_state.
- group,
- tmp_state.
- indicators,
+ tmp_state.group,
+ tmp_state.indicators,
"Loading current (previous) state from the current (previous) window");
}
@@ -219,10 +216,8 @@ xkl_engine_process_focus_in_evt(XklEngine * engine,
"Restoring the group from %d to %d after gaining focus\n",
xkl_engine_priv
(engine,
- curr_state).
- group,
- selected_window_state.
- group);
+ curr_state).group,
+ selected_window_state.group);
/*
* For fast mouse movements - the state is probably not updated yet
* (because of the group change notification being late).
@@ -230,21 +225,17 @@ xkl_engine_process_focus_in_evt(XklEngine * engine,
*/
xkl_engine_update_current_state
(engine,
- selected_window_state.
- group,
- selected_window_state.
- indicators,
+ selected_window_state.group,
+ selected_window_state.indicators,
"Enforcing fast update of the current state");
xkl_engine_lock_group
(engine,
- selected_window_state.
- group);
+ selected_window_state.group);
} else {
xkl_debug(150,
"Both old and new focused window "
"have group %d so no point restoring it\n",
- selected_window_state.
- group);
+ selected_window_state.group);
xkl_engine_one_switch_to_secondary_group_performed
(engine);
}
@@ -258,10 +249,8 @@ xkl_engine_process_focus_in_evt(XklEngine * engine,
xkl_debug(150,
"Restoring the indicators from %X to %X after gaining focus\n",
xkl_engine_priv(engine,
- curr_state).
- indicators,
- selected_window_state.
- indicators);
+ curr_state).indicators,
+ selected_window_state.indicators);
xkl_engine_ensure_vtable_inited
(engine);
xkl_engine_vcall(engine,
@@ -272,14 +261,12 @@ xkl_engine_process_focus_in_evt(XklEngine * engine,
xkl_debug(150,
"Not restoring the indicators %X after gaining focus: indicator handling is not enabled\n",
xkl_engine_priv(engine,
- curr_state).
- indicators);
+ curr_state).indicators);
} else
xkl_debug(150,
"Not restoring the group %d after gaining focus: global layout (xor transparent window)\n",
xkl_engine_priv(engine,
- curr_state).
- group);
+ curr_state).group);
} else
xkl_debug(150,
"Same app window - just do nothing\n");
@@ -405,13 +392,11 @@ xkl_engine_process_property_evt(XklEngine * engine, XPropertyEvent * pev)
"Something (%d) happened to WM_STATE of window 0x%x\n",
pev->state, pev->window);
xkl_engine_select_input_merging(engine,
- pev->
- window,
+ pev->window,
PropertyChangeMask);
if (has_xkl_state) {
xkl_engine_delete_state(engine,
- pev->
- window);
+ pev->window);
}
}
} /* XKLL_MANAGE_WINDOW_STATES */
@@ -477,6 +462,8 @@ xkl_engine_process_create_window_evt(XklEngine * engine,
/*
* Just error handler - sometimes we get BadWindow error for already gone
* windows, so we'll just ignore
+ * This handler can be called in the middle of the engine initialization -
+ * so it is not fair to assume that the engine is available
*/
void
xkl_process_error(Display * dpy, XErrorEvent * evt)
@@ -484,13 +471,15 @@ xkl_process_error(Display * dpy, XErrorEvent * evt)
char buf[128] = "";
XklEngine *engine = xkl_get_the_engine();
- xkl_engine_priv(engine, last_error_code) = evt->error_code;
- switch (xkl_engine_priv(engine, last_error_code)) {
+ if (engine != NULL)
+ xkl_engine_priv(engine, last_error_code) = evt->error_code;
+
+ switch (evt->error_code) {
case BadWindow:
case BadAccess:
{
- XGetErrorText(xkl_engine_get_display(engine),
- evt->error_code, buf, sizeof(buf));
+ XGetErrorText(evt->display, evt->error_code, buf,
+ sizeof(buf));
/* in most cases this means we are late:) */
xkl_debug(200,
"ERROR: %p, " WINID_FORMAT ", %d [%s], "
@@ -509,9 +498,11 @@ xkl_process_error(Display * dpy, XErrorEvent * evt)
(unsigned long) evt->resourceid,
(int) evt->error_code, buf,
(int) evt->request_code, (int) evt->minor_code);
- if (!xkl_engine_priv(engine, criticalSection))
- (*xkl_engine_priv(engine, default_error_handler))
- (dpy, evt);
+ if (engine != NULL)
+ if (!xkl_engine_priv(engine, criticalSection))
+ (*xkl_engine_priv
+ (engine, default_error_handler))
+ (dpy, evt);
}
}