[Xfce4-commits] <xfce4-xkb-plugin:4.10_panel_support> Ignore xkl config change callbacks caused by our own config changes.
Igor Slepchin
noreply at xfce.org
Fri Mar 29 22:38:02 CET 2013
Updating branch refs/heads/4.10_panel_support
to 93f3b95ec40fef08f96920d1ef0924c8891c608e (commit)
from e18da18ad13220a3dc4ca94eff4178e7b0b554be (commit)
commit 93f3b95ec40fef08f96920d1ef0924c8891c608e
Author: Igor Slepchin <igor.slepchin at gmail.com>
Date: Fri Mar 29 16:50:38 2013 -0400
Ignore xkl config change callbacks caused by our own config changes.
libxklavier emits X-config-changed signal from within
xkl_config_rec_activate before it gets a chance to fully update
its internal state so that xkl_config_rec_get_from_server returns
the *old* xkl config when invoked from the callback. This, in turn,
updates xkb-plugin's internal state to the old xkl config and causes it
go out of sync with the real xkl state.
Since X-config-changed signal is synchronous, the easiest work around
is to simply ignore the xkl config change notification when we know
we're in the middle of updating xkl config.
panel-plugin/xkb-config.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/panel-plugin/xkb-config.c b/panel-plugin/xkb-config.c
index 08ba9c2..13656bd 100644
--- a/panel-plugin/xkb-config.c
+++ b/panel-plugin/xkb-config.c
@@ -23,6 +23,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "xfce4-xkb-plugin.h"
#include "xkb-config.h"
#include <stdio.h>
@@ -65,6 +66,7 @@ typedef struct
} t_xkb_config;
t_xkb_config *config;
+gboolean ignore_xkl_config_change = FALSE;
void xkb_config_state_changed (XklEngine *engine,
XklEngineStateChange *change,
@@ -394,7 +396,11 @@ xkb_config_update_settings (t_xkb_settings *settings)
}
if (activate_settings && !settings->never_modify_config)
+ {
+ ignore_xkl_config_change = TRUE;
xkl_config_rec_activate (config->config_rec, config->engine);
+ ignore_xkl_config_change = FALSE;
+ }
xkb_config_initialize_xkb_options (settings);
@@ -564,6 +570,10 @@ xkb_config_state_changed (XklEngine *engine,
void
xkb_config_xkl_config_changed (XklEngine *engine)
{
+ TRACE ("ignore_xkl_config_change: %d ", ignore_xkl_config_change);
+
+ if (ignore_xkl_config_change) return;
+
kbd_config_free (config->settings->kbd_config);
config->settings->kbd_config = NULL;
xkb_config_update_settings (config->settings);
More information about the Xfce4-commits
mailing list