wok-6.x view lxpanel/stuff/Fix-failure-to-react-to-keyboard-map-changes-initiat.patch @ rev 11871
Up: poppler to 0.18.3.
author | Christopher Rogers <slaxemulator@gmail.com> |
---|---|
date | Mon Feb 27 18:15:11 2012 -0500 (2012-02-27) |
parents | |
children |
line source
1 From 438d9fdbd3e0be04de933705917d508a02b7c04b Mon Sep 17 00:00:00 2001
2 From: Marty Jack <martyj@linux.local>
3 Date: Sat, 20 Feb 2010 16:23:57 -0500
4 Subject: [PATCH 4/5] Fix failure to react to keyboard map changes initiated outside the plugin
5 - Occurred when setxkbmap was run, or when HAL configured the keyboard at X startup
6 - Caused by failure to process the NewKeyboard event
7 - Caused by dropping events due to faulty code to read them
8 - Cosmetic change, the tooltip now the Xkb Group name rather than Xkb Symbol name
10 ---
11 src/plugins/xkb/xkb-plugin.c | 92 +++++++++--------
12 src/plugins/xkb/xkb.c | 236 +++++++++++++++++++++--------------------
13 src/plugins/xkb/xkb.h | 7 +-
14 3 files changed, 173 insertions(+), 162 deletions(-)
16 diff --git a/src/plugins/xkb/xkb-plugin.c b/src/plugins/xkb/xkb-plugin.c
17 index f49a77d..80a14ba 100644
18 --- a/src/plugins/xkb/xkb-plugin.c
19 +++ b/src/plugins/xkb/xkb-plugin.c
20 @@ -1,18 +1,23 @@
21 -/*
22 -//====================================================================
23 -// xfce4-xkb-plugin - XFCE4 Xkb Layout Indicator panel plugin
24 -// -------------------------------------------------------------------
25 -// Alexander Iliev <sasoiliev@mamul.org>
26 -// 20-Feb-04
27 -// -------------------------------------------------------------------
28 -// Parts of this code belong to Michael Glickman <wmalms@yahooo.com>
29 -// and his program wmxkb.
30 -// WARNING: DO NOT BOTHER Michael Glickman WITH QUESTIONS ABOUT THIS
31 -// PROGRAM!!! SEND INSTEAD EMAILS TO <sasoiliev@mamul.org>
32 -//====================================================================
33 -*/
34 -
35 -/* Modified by Hong Jen Yee (PCMan) <pcman.tw@gmail.com> on 2008-04-06 for lxpanel */
36 +/**
37 + * Copyright (c) 2010 LxDE Developers, see the file AUTHORS for details.
38 + *
39 + * This program is free software; you can redistribute it and/or modify
40 + * it under the terms of the GNU General Public License as published by
41 + * the Free Software Foundation; either version 2 of the License, or
42 + * (at your option) any later version.
43 + *
44 + * This program is distributed in the hope that it will be useful,
45 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
46 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
47 + * GNU General Public License for more details.
48 + *
49 + * You should have received a copy of the GNU General Public License
50 + * along with this program; if not, write to the Free Software Foundation,
51 + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
52 + */
53 +
54 +/* Originally derived from xfce4-xkb-plugin, Copyright 2004 Alexander Iliev,
55 + * which credits Michael Glickman. */
57 #ifdef HAVE_CONFIG_H
58 #include <config.h>
59 @@ -49,38 +54,45 @@ void xkb_redraw(XkbPlugin * xkb)
60 if (xkb->display_type == IMAGE)
61 {
62 int size = xkb->plugin->panel->icon_size;
63 - char * group_name = (char *) xkb_get_current_group_name_lowercase(xkb);
64 - char * filename = g_strdup_printf("%s/%s.png", FLAGSDIR, group_name);
65 - GdkPixbuf * unscaled_pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
66 - g_free(filename);
67 - g_free(group_name);
68 -
69 - if (unscaled_pixbuf != NULL)
70 + char * group_name = (char *) xkb_get_current_symbol_name_lowercase(xkb);
71 + if (group_name != NULL)
72 {
73 - /* Loaded successfully. */
74 - int width = gdk_pixbuf_get_width(unscaled_pixbuf);
75 - int height = gdk_pixbuf_get_height(unscaled_pixbuf);
76 - GdkPixbuf * pixbuf = gdk_pixbuf_scale_simple(unscaled_pixbuf, size * width / height, size, GDK_INTERP_BILINEAR);
77 - if (pixbuf != NULL)
78 + char * filename = g_strdup_printf("%s/%s.png", FLAGSDIR, group_name);
79 + GdkPixbuf * unscaled_pixbuf = gdk_pixbuf_new_from_file(filename, NULL);
80 + g_free(filename);
81 + g_free(group_name);
82 +
83 + if (unscaled_pixbuf != NULL)
84 {
85 - gtk_image_set_from_pixbuf(GTK_IMAGE(xkb->image), pixbuf);
86 - g_object_unref(G_OBJECT(pixbuf));
87 - gtk_widget_hide(xkb->label);
88 - gtk_widget_show(xkb->image);
89 - gtk_widget_set_tooltip_text(xkb->btn, xkb_get_current_group_name(xkb));
90 - valid_image = TRUE;
91 + /* Loaded successfully. */
92 + int width = gdk_pixbuf_get_width(unscaled_pixbuf);
93 + int height = gdk_pixbuf_get_height(unscaled_pixbuf);
94 + GdkPixbuf * pixbuf = gdk_pixbuf_scale_simple(unscaled_pixbuf, size * width / height, size, GDK_INTERP_BILINEAR);
95 + if (pixbuf != NULL)
96 + {
97 + gtk_image_set_from_pixbuf(GTK_IMAGE(xkb->image), pixbuf);
98 + g_object_unref(G_OBJECT(pixbuf));
99 + gtk_widget_hide(xkb->label);
100 + gtk_widget_show(xkb->image);
101 + gtk_widget_set_tooltip_text(xkb->btn, xkb_get_current_group_name(xkb));
102 + valid_image = TRUE;
103 + }
104 + g_object_unref(unscaled_pixbuf);
105 }
106 - g_object_unref(unscaled_pixbuf);
107 }
108 }
110 /* Set the label. */
111 if ((xkb->display_type == TEXT) || ( ! valid_image))
112 {
113 - panel_draw_label_text(xkb->plugin->panel, xkb->label, (char *) xkb_get_current_group_name(xkb), TRUE, TRUE);
114 - gtk_widget_hide(xkb->image);
115 - gtk_widget_show(xkb->label);
116 - gtk_widget_set_tooltip_text(xkb->btn, NULL);
117 + char * group_name = (char *) xkb_get_current_symbol_name(xkb);
118 + if (group_name != NULL)
119 + {
120 + panel_draw_label_text(xkb->plugin->panel, xkb->label, (char *) group_name, TRUE, TRUE);
121 + gtk_widget_hide(xkb->image);
122 + gtk_widget_show(xkb->label);
123 + gtk_widget_set_tooltip_text(xkb->btn, xkb_get_current_group_name(xkb));
124 + }
125 }
126 }
128 @@ -196,10 +208,6 @@ static int xkb_constructor(Plugin * plugin, char ** fp)
129 /* Initialize the XKB interface. */
130 xkb_mechanism_constructor(xkb);
132 - /* Initialize a channel to listen for XKB events. */
133 - GIOChannel * channel = g_io_channel_unix_new(xkb_get_connection_number(xkb));
134 - xkb->source_id = g_io_add_watch(channel, G_IO_IN | G_IO_PRI, (GIOFunc) xkb_gio_callback, (gpointer) xkb);
135 -
136 /* Connect signals. */
137 g_signal_connect(xkb->btn, "button-press-event", G_CALLBACK(xkb_button_press_event), xkb);
138 g_signal_connect(xkb->btn, "scroll-event", G_CALLBACK(xkb_scroll_event), xkb);
139 diff --git a/src/plugins/xkb/xkb.c b/src/plugins/xkb/xkb.c
140 index 5bb0c39..898a931 100644
141 --- a/src/plugins/xkb/xkb.c
142 +++ b/src/plugins/xkb/xkb.c
143 @@ -1,18 +1,23 @@
144 -/*
145 -// ====================================================================
146 -// xfce4-xkb-plugin - XFCE4 Xkb Layout Indicator panel plugin
147 -// -------------------------------------------------------------------
148 -// Alexander Iliev <sasoiliev@mamul.org>
149 -// 20-Feb-04
150 -// -------------------------------------------------------------------
151 -// Parts of this code belong to Michael Glickman <wmalms@yahooo.com>
152 -// and his program wmxkb.
153 -// WARNING: DO NOT BOTHER Michael Glickman WITH QUESTIONS ABOUT THIS
154 -// PROGRAM!!! SEND INSTEAD EMAILS TO <sasoiliev@mamul.org>
155 -//====================================================================
156 -*/
157 -
158 -/* Modified by Hong Jen Yee (PCMan) <pcman.tw@gmail.com> on 2008-04-06 for lxpanel */
159 +/**
160 + * Copyright (c) 2010 LxDE Developers, see the file AUTHORS for details.
161 + *
162 + * This program is free software; you can redistribute it and/or modify
163 + * it under the terms of the GNU General Public License as published by
164 + * the Free Software Foundation; either version 2 of the License, or
165 + * (at your option) any later version.
166 + *
167 + * This program is distributed in the hope that it will be useful,
168 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
169 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
170 + * GNU General Public License for more details.
171 + *
172 + * You should have received a copy of the GNU General Public License
173 + * along with this program; if not, write to the Free Software Foundation,
174 + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
175 + */
176 +
177 +/* Originally derived from xfce4-xkb-plugin, Copyright 2004 Alexander Iliev,
178 + * which credits Michael Glickman. */
180 #include "xkb.h"
182 @@ -26,9 +31,13 @@
183 #include <gdk-pixbuf/gdk-pixbuf.h>
184 #include <glib.h>
186 +/* The X Keyboard Extension: Library Specification
187 + * http://www.xfree86.org/current/XKBlib.pdf */
188 +
189 static void xkb_enter_locale_by_process(XkbPlugin * xkb);
190 static void refresh_group_xkb(XkbPlugin * xkb);
191 -static int do_init_xkb(XkbPlugin * xkb);
192 +static int initialize_keyboard_description(XkbPlugin * xkb);
193 +static GdkFilterReturn xkb_event_filter(GdkXEvent * xevent, GdkEvent * event, XkbPlugin * xkb);
195 /* Insert a process and its layout into the hash table. */
196 static void xkb_enter_locale_by_process(XkbPlugin * xkb)
197 @@ -56,60 +65,65 @@ int xkb_get_group_count(XkbPlugin * xkb)
198 return xkb->group_count;
199 }
201 +/* Get the current group name. */
202 +const char * xkb_get_current_group_name(XkbPlugin * xkb)
203 +{
204 + return xkb->group_names[xkb->current_group_xkb_no];
205 +}
206 +
207 /* Convert a group number to a symbol name. */
208 const char * xkb_get_symbol_name_by_res_no(XkbPlugin * xkb, int n)
209 {
210 return xkb->symbol_names[n];
211 }
213 -/* Get the current group name. */
214 -const char * xkb_get_current_group_name(XkbPlugin * xkb)
215 +/* Get the current symbol name. */
216 +const char * xkb_get_current_symbol_name(XkbPlugin * xkb)
217 {
218 return xkb_get_symbol_name_by_res_no(xkb, xkb->current_group_xkb_no);
219 }
221 -/* Get the current group name converted to lowercase. */
222 -const char * xkb_get_current_group_name_lowercase(XkbPlugin * xkb)
223 +/* Get the current symbol name converted to lowercase. */
224 +const char * xkb_get_current_symbol_name_lowercase(XkbPlugin * xkb)
225 {
226 - const char * tmp = xkb_get_current_group_name(xkb);
227 - return g_utf8_strdown(tmp, -1);
228 + const char * tmp = xkb_get_current_symbol_name(xkb);
229 + return ((tmp != NULL) ? g_utf8_strdown(tmp, -1) : NULL);
230 }
232 /* Refresh current group number from Xkb state. */
233 static void refresh_group_xkb(XkbPlugin * xkb)
234 {
235 XkbStateRec xkb_state;
236 - XkbGetState(xkb->dsp, xkb->device_id, &xkb_state);
237 + XkbGetState(GDK_DISPLAY(), XkbUseCoreKbd, &xkb_state);
238 xkb->current_group_xkb_no = xkb_state.group;
239 }
241 -/* Initialize the Xkb structures. */
242 -static int do_init_xkb(XkbPlugin * xkb)
243 +/* Initialize the keyboard description initially or after a NewKeyboard event. */
244 +static int initialize_keyboard_description(XkbPlugin * xkb)
245 {
246 - /* Create hash table. */
247 - xkb->group_hash_table = g_hash_table_new(g_direct_hash, NULL);
248 -
249 - /* Initialize the Xkb extension. */
250 - int major, minor, opcode;
251 - Bool status = XkbQueryExtension(xkb->dsp, &opcode,
252 - &xkb->base_event_code, &xkb->base_error_code, &major, &minor);
253 -
254 - /* Use the core keyboard. */
255 - xkb->device_id = XkbUseCoreKbd;
256 + /* Free the strings. */
257 + int i;
258 + for (i = 0; i < XkbNumKbdGroups; i += 1)
259 + {
260 + g_free(xkb->group_names[i]);
261 + g_free(xkb->symbol_names[i]);
262 + xkb->group_names[i] = NULL;
263 + xkb->symbol_names[i] = NULL;
264 + }
266 /* Allocate a keyboard description structure. */
267 + int status = False;
268 XkbDescRec * kbd_desc_ptr = XkbAllocKeyboard();
269 if (kbd_desc_ptr == NULL)
270 {
271 ERR("Failed to get keyboard description\n");
272 goto HastaLaVista;
273 }
274 - kbd_desc_ptr->dpy = xkb->dsp;
276 /* Fetch information into the keyboard description. */
277 - XkbGetControls(xkb->dsp, XkbAllControlsMask, kbd_desc_ptr);
278 - XkbGetNames(xkb->dsp, XkbSymbolsNameMask, kbd_desc_ptr);
279 - XkbGetNames(xkb->dsp, XkbGroupNamesMask, kbd_desc_ptr);
280 + XkbGetControls(GDK_DISPLAY(), XkbAllControlsMask, kbd_desc_ptr);
281 + XkbGetNames(GDK_DISPLAY(), XkbSymbolsNameMask, kbd_desc_ptr);
282 + XkbGetNames(GDK_DISPLAY(), XkbGroupNamesMask, kbd_desc_ptr);
284 if (kbd_desc_ptr->names == NULL)
285 {
286 @@ -137,12 +151,11 @@ static int do_init_xkb(XkbPlugin * xkb)
288 /* Determine the group names. Trim off text beginning at a '('. */
289 const Atom * tmp_group_source = kbd_desc_ptr->names->groups;
290 - int i;
291 for (i = 0; i < xkb->group_count; i++)
292 {
293 if (tmp_group_source[i] != None)
294 {
295 - char * ptr = XGetAtomName(xkb->dsp, tmp_group_source[i]);
296 + char * ptr = XGetAtomName(GDK_DISPLAY(), tmp_group_source[i]);
297 xkb->group_names[i] = ptr;
298 if ((ptr != NULL) && ((ptr = strchr(ptr, '('))) != NULL)
299 *ptr = '\0';
300 @@ -153,7 +166,7 @@ static int do_init_xkb(XkbPlugin * xkb)
301 Atom sym_name_atom = kbd_desc_ptr->names->symbols;
302 char * sym_name;
303 if ((sym_name_atom == None)
304 - || ((sym_name = XGetAtomName(xkb->dsp, sym_name_atom)) == NULL))
305 + || ((sym_name = XGetAtomName(GDK_DISPLAY(), sym_name_atom)) == NULL))
306 goto HastaLaVista;
308 /* Parse and store symbol names. */
309 @@ -190,83 +203,106 @@ static int do_init_xkb(XkbPlugin * xkb)
310 {
311 xkb->group_count = 2;
312 xkb->symbol_names[1] = xkb->symbol_names[0];
313 - xkb->symbol_names[0] = strdup("us");
314 - xkb->group_names[0] = strdup("US/ASCII");
315 - xkb->group_names[1] = strdup("Japanese");
316 + xkb->symbol_names[0] = g_strdup("us");
317 + xkb->group_names[0] = g_strdup("US/ASCII");
318 + xkb->group_names[1] = g_strdup("Japanese");
319 }
320 else if (count < xkb->group_count)
321 {
322 /* Ensure that the names are fully initialized. */
323 int j = count, k = xkb->group_count;
324 while(--j >= 0) xkb->symbol_names[--k] = xkb->symbol_names[j];
325 - while(--k >= 0) xkb->symbol_names[k] = strdup("en_US");
326 + while(--k >= 0) xkb->symbol_names[k] = g_strdup("en_US");
327 }
329 - /* Enxure that the names are fully initialized. */
330 + /* Ensure that the names are fully initialized. */
331 for (i = 0; i < xkb->group_count; i++)
332 {
333 if (xkb->symbol_names[i] == NULL)
334 {
335 ERR("\nGroup Symbol %i is undefined, set to 'U/A' !\n", i+1);
336 - xkb->symbol_names[i] = strdup("U/A");
337 + xkb->symbol_names[i] = g_strdup("U/A");
338 }
339 }
341 + /* Create or recreate hash table.
342 + * The layout that was associated to the windows may or may not be at the same group number,
343 + * and worse, may no longer exist, which there is no meaningful way to deal with. */
344 + if (xkb->group_hash_table != NULL)
345 + g_hash_table_destroy(xkb->group_hash_table);
346 + xkb->group_hash_table = g_hash_table_new(g_direct_hash, NULL);
347 +
348 status = True;
350 HastaLaVista:
351 if (kbd_desc_ptr != NULL)
352 XkbFreeKeyboard(kbd_desc_ptr, 0, True);
353 +
354 return status;
355 }
357 +/* GDK event filter that receives events from all windows and the Xkb extension. */
358 +static GdkFilterReturn xkb_event_filter(GdkXEvent * xevent, GdkEvent * event, XkbPlugin * xkb)
359 +{
360 + XEvent * ev = (XEvent *) xevent;
361 +
362 + if (ev->xany.type == xkb->base_event_code + XkbEventCode)
363 + {
364 + /* Xkb event. */
365 + XkbEvent * xkbev = (XkbEvent *) ev;
366 + if (xkbev->any.xkb_type == XkbNewKeyboardNotify)
367 + {
368 + initialize_keyboard_description(xkb);
369 + refresh_group_xkb(xkb);
370 + xkb_redraw(xkb);
371 + xkb_enter_locale_by_process(xkb);
372 + }
373 + else if (xkbev->any.xkb_type == XkbStateNotify)
374 + {
375 + if (xkbev->state.group != xkb->current_group_xkb_no)
376 + {
377 + /* Switch to the new group and redraw the display. */
378 + xkb->current_group_xkb_no = xkbev->state.group;
379 + refresh_group_xkb(xkb);
380 + xkb_redraw(xkb);
381 + xkb_enter_locale_by_process(xkb);
382 + }
383 + }
384 + }
385 + return GDK_FILTER_CONTINUE;
386 +}
387 +
388 /* Initialize the Xkb interface. */
389 void xkb_mechanism_constructor(XkbPlugin * xkb)
390 {
391 - /* Enable the Xkb extension on all clients. */
392 - XkbIgnoreExtension(False);
393 -
394 - /* Open the display. */
395 - int major = XkbMajorVersion;
396 - int minor = XkbMinorVersion;
397 - char * display_name = "";
398 - int event_code;
399 - int error_rtrn;
400 - int reason_rtrn;
401 - xkb->dsp = XkbOpenDisplay(display_name, &event_code, &error_rtrn, &major, &minor, &reason_rtrn);
402 -
403 - switch (reason_rtrn)
404 + /* Initialize Xkb extension. */
405 + int opcode;
406 + int maj = XkbMajorVersion;
407 + int min = XkbMinorVersion;
408 + if ((XkbLibraryVersion(&maj, &min))
409 + && (XkbQueryExtension(GDK_DISPLAY(), &opcode, &xkb->base_event_code, &xkb->base_error_code, &maj, &min)))
410 {
411 - case XkbOD_BadLibraryVersion:
412 - ERR("Bad XKB library version.\n");
413 - return;
414 - case XkbOD_ConnectionRefused:
415 - ERR("Connection to X server refused.\n");
416 - return;
417 - case XkbOD_BadServerVersion:
418 - ERR("Bad X server version.\n");
419 - return;
420 - case XkbOD_NonXkbServer:
421 - ERR("XKB not present.\n");
422 - return;
423 - case XkbOD_Success:
424 - break;
425 - }
426 + /* Read the keyboard description. */
427 + initialize_keyboard_description(xkb);
429 - /* Initialize our mechanism. */
430 - if (do_init_xkb(xkb) != True)
431 - return;
432 + /* Establish GDK event filter. */
433 + gdk_window_add_filter(NULL, (GdkFilterFunc) xkb_event_filter, (gpointer) xkb);
435 - /* Specify events we will receive. */
436 - XkbSelectEventDetails(xkb->dsp, xkb->device_id, XkbStateNotify, XkbAllStateComponentsMask, XkbGroupStateMask);
437 + /* Specify events we will receive. */
438 + XkbSelectEvents(GDK_DISPLAY(), XkbUseCoreKbd, XkbNewKeyboardNotifyMask, XkbNewKeyboardNotifyMask);
439 + XkbSelectEventDetails(GDK_DISPLAY(), XkbUseCoreKbd, XkbStateNotify, XkbAllStateComponentsMask, XkbGroupStateMask);
441 - /* Get current state. */
442 - refresh_group_xkb(xkb);
443 + /* Get current state. */
444 + refresh_group_xkb(xkb);
445 + }
446 }
448 /* Deallocate resources associated with Xkb interface. */
449 void xkb_mechanism_destructor(XkbPlugin * xkb)
450 {
451 + /* Remove event filter. */
452 + gdk_window_remove_filter(NULL, (GdkFilterFunc) xkb_event_filter, xkb);
453 +
454 /* Free group and symbol name memory. */
455 int i;
456 for (i = 0; i < xkb->group_count; i++)
457 @@ -283,21 +319,11 @@ void xkb_mechanism_destructor(XkbPlugin * xkb)
458 }
459 }
461 - /* Close the display. */
462 - XCloseDisplay(xkb->dsp);
463 - xkb->dsp = NULL;
464 -
465 /* Destroy the hash table. */
466 g_hash_table_destroy(xkb->group_hash_table);
467 xkb->group_hash_table = NULL;
468 }
470 -/* Return the connection number for the display. */
471 -int xkb_get_connection_number(XkbPlugin * xkb)
472 -{
473 - return ConnectionNumber(xkb->dsp);
474 -}
475 -
476 /* Set the layout to the next layout. */
477 int xkb_change_group(XkbPlugin * xkb, int increment)
478 {
479 @@ -307,33 +333,13 @@ int xkb_change_group(XkbPlugin * xkb, int increment)
480 if (next_group >= xkb->group_count) next_group = 0;
482 /* Execute the change. */
483 - XkbLockGroup(xkb->dsp, xkb->device_id, next_group);
484 + XkbLockGroup(GDK_DISPLAY(), XkbUseCoreKbd, next_group);
485 refresh_group_xkb(xkb);
486 xkb_redraw(xkb);
487 xkb_enter_locale_by_process(xkb);
488 return 1;
489 }
491 -/* Callback when activity detected on the Xkb channel. */
492 -gboolean xkb_gio_callback(GIOChannel * source, GIOCondition condition, gpointer data)
493 -{
494 - XkbPlugin * xkb = (XkbPlugin *) data;
495 -
496 - XkbEvent evnt;
497 - XNextEvent(xkb->dsp, &evnt.core);
498 - if ((evnt.type == xkb->base_event_code)
499 - && (evnt.any.xkb_type == XkbStateNotify)
500 - && (evnt.state.group != xkb->current_group_xkb_no))
501 - {
502 - /* Switch to the new group and redraw the display. */
503 - xkb->current_group_xkb_no = evnt.state.group;
504 - refresh_group_xkb(xkb);
505 - xkb_redraw(xkb);
506 - xkb_enter_locale_by_process(xkb);
507 - }
508 - return TRUE;
509 -}
510 -
511 /* React to change of focus by switching to the application's layout or the default layout. */
512 void xkb_active_window_changed(XkbPlugin * xkb, gint pid)
513 {
514 @@ -345,7 +351,7 @@ void xkb_active_window_changed(XkbPlugin * xkb, gint pid)
516 if (new_group_xkb_no < xkb->group_count)
517 {
518 - XkbLockGroup(xkb->dsp, xkb->device_id, new_group_xkb_no);
519 + XkbLockGroup(GDK_DISPLAY(), XkbUseCoreKbd, new_group_xkb_no);
520 refresh_group_xkb(xkb);
521 }
522 }
523 diff --git a/src/plugins/xkb/xkb.h b/src/plugins/xkb/xkb.h
524 index 9265198..20c7ed3 100644
525 --- a/src/plugins/xkb/xkb.h
526 +++ b/src/plugins/xkb/xkb.h
527 @@ -49,10 +49,8 @@ typedef struct {
528 GtkWidget * per_app_default_layout_menu; /* Combo box of all available layouts */
530 /* Mechanism. */
531 - Display * dsp; /* Handle to X display */
532 int base_event_code; /* Result of initializing Xkb extension */
533 int base_error_code;
534 - int device_id; /* Keyboard device ID (always "core keyboard") */
535 int current_group_xkb_no; /* Current layout */
536 int group_count; /* Count of groups as returned by Xkb */
537 char * group_names[XkbNumKbdGroups]; /* Group names as returned by Xkb */
538 @@ -67,12 +65,11 @@ extern int xkb_get_current_group_xkb_no(XkbPlugin * xkb);
539 extern int xkb_get_group_count(XkbPlugin * xkb);
540 extern const char * xkb_get_symbol_name_by_res_no(XkbPlugin * xkb, int group_res_no);
541 extern const char * xkb_get_current_group_name(XkbPlugin * xkb);
542 -extern const char * xkb_get_current_group_name_lowercase(XkbPlugin * xkb);
543 +extern const char * xkb_get_current_symbol_name(XkbPlugin * xkb);
544 +extern const char * xkb_get_current_symbol_name_lowercase(XkbPlugin * xkb);
545 extern void xkb_mechanism_constructor(XkbPlugin * xkb);
546 extern void xkb_mechanism_destructor(XkbPlugin * xkb);
547 -extern int xkb_get_connection_number(XkbPlugin * xkb);
548 extern int xkb_change_group(XkbPlugin * xkb, int increment);
549 -extern gboolean xkb_gio_callback(GIOChannel * source, GIOCondition condition, gpointer data);
550 extern void xkb_active_window_changed(XkbPlugin * xkb, GPid pid);
552 #endif
553 --
554 1.7.0