summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libgnomekbd/gkbd-keyboard-drawing.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/libgnomekbd/gkbd-keyboard-drawing.c b/libgnomekbd/gkbd-keyboard-drawing.c
index 6894f47..64e62ea 100644
--- a/libgnomekbd/gkbd-keyboard-drawing.c
+++ b/libgnomekbd/gkbd-keyboard-drawing.c
@@ -1895,6 +1895,9 @@ free_cdik ( /*colors doodads indicators keys */
static void
alloc_cdik (GkbdKeyboardDrawing * drawing)
{
+ if (!drawing->xkb)
+ return;
+
drawing->physical_indicators_size =
drawing->xkb->indicators->phys_indicators + 1;
drawing->physical_indicators =
@@ -2047,13 +2050,14 @@ gkbd_keyboard_drawing_init (GkbdKeyboardDrawing * drawing)
XkbGBN_SymbolsMask |
XkbGBN_IndicatorMapMask,
XkbUseCoreKbd);
- if (drawing->xkb == NULL) {
- g_critical
- ("XkbGetKeyboard failed to get keyboard from the server!");
- return;
+ if (drawing->xkb) {
+ XkbGetNames (drawing->display, XkbAllNamesMask, drawing->xkb);
+ XkbSelectEventDetails (drawing->display, XkbUseCoreKbd,
+ XkbIndicatorStateNotify,
+ drawing->xkb->indicators->phys_indicators,
+ drawing->xkb->indicators->phys_indicators);
}
- XkbGetNames (drawing->display, XkbAllNamesMask, drawing->xkb);
drawing->l3mod = XkbKeysymToModifiers (drawing->display,
GDK_KEY_ISO_Level3_Shift);
@@ -2061,11 +2065,6 @@ gkbd_keyboard_drawing_init (GkbdKeyboardDrawing * drawing)
alloc_cdik (drawing);
- XkbSelectEventDetails (drawing->display, XkbUseCoreKbd,
- XkbIndicatorStateNotify,
- drawing->xkb->indicators->phys_indicators,
- drawing->xkb->indicators->phys_indicators);
-
mask =
(XkbStateNotifyMask | XkbNamesNotifyMask |
XkbControlsNotifyMask | XkbIndicatorMapNotifyMask |
@@ -2312,8 +2311,12 @@ gkbd_keyboard_drawing_set_keyboard (GkbdKeyboardDrawing * drawing,
drawing->xkbOnDisplay = TRUE;
}
- if (drawing->xkb == NULL)
- return FALSE;
+ if (drawing->xkb) {
+ XkbSelectEventDetails (drawing->display, XkbUseCoreKbd,
+ XkbIndicatorStateNotify,
+ drawing->xkb->indicators->phys_indicators,
+ drawing->xkb->indicators->phys_indicators);
+ }
alloc_cdik (drawing);