summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libmatekbd/matekbd-keyboard-drawing.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/libmatekbd/matekbd-keyboard-drawing.c b/libmatekbd/matekbd-keyboard-drawing.c
index 83c91ea..3343362 100644
--- a/libmatekbd/matekbd-keyboard-drawing.c
+++ b/libmatekbd/matekbd-keyboard-drawing.c
@@ -1913,6 +1913,9 @@ free_cdik ( /*colors doodads indicators keys */
static void
alloc_cdik (MatekbdKeyboardDrawing * drawing)
{
+ if (!drawing->xkb)
+ return;
+
drawing->physical_indicators_size =
drawing->xkb->indicators->phys_indicators + 1;
drawing->physical_indicators =
@@ -2101,13 +2104,14 @@ matekbd_keyboard_drawing_init (MatekbdKeyboardDrawing * 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);
@@ -2115,11 +2119,6 @@ matekbd_keyboard_drawing_init (MatekbdKeyboardDrawing * drawing)
alloc_cdik (drawing);
- XkbSelectEventDetails (drawing->display, XkbUseCoreKbd,
- XkbIndicatorStateNotify,
- drawing->xkb->indicators->phys_indicators,
- drawing->xkb->indicators->phys_indicators);
-
mask =
(XkbStateNotifyMask | XkbNamesNotifyMask |
XkbControlsNotifyMask | XkbIndicatorMapNotifyMask |
@@ -2328,8 +2327,12 @@ matekbd_keyboard_drawing_set_keyboard (MatekbdKeyboardDrawing * 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);