From 1c506c5e9a244d785ff995cee1b5cd465f0bdc53 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Tue, 20 Apr 2021 10:10:50 -0400 Subject: [PATCH] Fix infinite loop --- ...signal-for-reporting-X-server-events.patch | 2 +- ...nager-Fix-overzealous-rename-mistake.patch | 2 +- ...nager-Add-function-to-load-input-sou.patch | 2 +- 0004-wip-Better-support-libxklavier.patch | 46 ++++++++++++++++--- gnome-kiosk.spec | 5 +- 5 files changed, 46 insertions(+), 11 deletions(-) diff --git a/0001-compositor-Add-signal-for-reporting-X-server-events.patch b/0001-compositor-Add-signal-for-reporting-X-server-events.patch index a3e4594..9233f6a 100644 --- a/0001-compositor-Add-signal-for-reporting-X-server-events.patch +++ b/0001-compositor-Add-signal-for-reporting-X-server-events.patch @@ -1,4 +1,4 @@ -From 6b1fa184af2a847d8b3d74a09bb65af6803d4e6d Mon Sep 17 00:00:00 2001 +From db59d653751018f9b79c2a38a996fc7f0692d6b5 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Thu, 15 Apr 2021 13:28:00 -0400 Subject: [PATCH 1/4] compositor: Add signal for reporting X server events diff --git a/0002-input-sources-manager-Fix-overzealous-rename-mistake.patch b/0002-input-sources-manager-Fix-overzealous-rename-mistake.patch index d4c1624..fb0dc80 100644 --- a/0002-input-sources-manager-Fix-overzealous-rename-mistake.patch +++ b/0002-input-sources-manager-Fix-overzealous-rename-mistake.patch @@ -1,4 +1,4 @@ -From 840bac654aef7aa0e241be8ac0052f5a5c67e4d5 Mon Sep 17 00:00:00 2001 +From 83e38979f48829d4498b2df6ea62aafa34c1975b Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Thu, 15 Apr 2021 14:39:55 -0400 Subject: [PATCH 2/4] input-sources-manager: Fix overzealous rename mistake diff --git a/0003-input-sources-manager-Add-function-to-load-input-sou.patch b/0003-input-sources-manager-Add-function-to-load-input-sou.patch index 0927851..8c79451 100644 --- a/0003-input-sources-manager-Add-function-to-load-input-sou.patch +++ b/0003-input-sources-manager-Add-function-to-load-input-sou.patch @@ -1,4 +1,4 @@ -From b321b57e2908fddcde9da31e0d71af54c3e2cd98 Mon Sep 17 00:00:00 2001 +From 60e52b132e9957452004c85a0999b37a2e46ff55 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Thu, 15 Apr 2021 14:41:41 -0400 Subject: [PATCH 3/4] input-sources-manager: Add function to load input sources diff --git a/0004-wip-Better-support-libxklavier.patch b/0004-wip-Better-support-libxklavier.patch index 70f4492..8725ae9 100644 --- a/0004-wip-Better-support-libxklavier.patch +++ b/0004-wip-Better-support-libxklavier.patch @@ -1,4 +1,4 @@ -From 69d0eb2a62114d72a08cb580ba86d52ef698336a Mon Sep 17 00:00:00 2001 +From 75e759aa88e75d55b956bd531509306f50e6fcc2 Mon Sep 17 00:00:00 2001 From: Ray Strode Date: Thu, 15 Apr 2021 14:43:17 -0400 Subject: [PATCH 4/4] wip! Better support libxklavier @@ -12,10 +12,10 @@ stays in sync with X server state. compositor/kiosk-input-source-group.c | 17 + compositor/kiosk-input-source-group.h | 5 +- compositor/kiosk-input-sources-manager.c | 142 ++++++ - compositor/kiosk-x-keyboard-manager.c | 546 +++++++++++++++++++++++ + compositor/kiosk-x-keyboard-manager.c | 578 +++++++++++++++++++++++ compositor/kiosk-x-keyboard-manager.h | 22 + meson.build | 1 + - 6 files changed, 732 insertions(+), 1 deletion(-) + 6 files changed, 764 insertions(+), 1 deletion(-) create mode 100644 compositor/kiosk-x-keyboard-manager.c create mode 100644 compositor/kiosk-x-keyboard-manager.h @@ -566,10 +566,10 @@ index 4b4ef62..c6c8c91 100644 } diff --git a/compositor/kiosk-x-keyboard-manager.c b/compositor/kiosk-x-keyboard-manager.c new file mode 100644 -index 0000000..94b8f0b +index 0000000..23c3de3 --- /dev/null +++ b/compositor/kiosk-x-keyboard-manager.c -@@ -0,0 +1,546 @@ +@@ -0,0 +1,578 @@ +#include "config.h" +#include "kiosk-x-keyboard-manager.h" + @@ -615,6 +615,7 @@ index 0000000..94b8f0b + + /* flags */ + guint32 watching_x_server_root_window : 1; ++ guint32 disallow_layout_selection: 1; +}; + +enum @@ -774,6 +775,18 @@ index 0000000..94b8f0b +} + +static void ++kiosk_x_keyboard_manager_disallow_layout_selection (KioskXKeyboardManager *self) ++{ ++ self->disallow_layout_selection = FALSE; ++} ++ ++static void ++kiosk_x_keyboard_manager_allow_layout_selection (KioskXKeyboardManager *self) ++{ ++ self->disallow_layout_selection = TRUE; ++} ++ ++static void +kiosk_x_keyboard_manager_set_layout_index (KioskXKeyboardManager *self, + size_t layout_index) +{ @@ -807,8 +820,10 @@ index 0000000..94b8f0b + meta_x11_error_trap_pop (self->x11_display); + + if (status != Success) { ++ g_debug ("KioskXKeyboardManager: Could not read current layout index"); + return; + } ++ g_debug ("KioskXKeyboardManager: Current layout index: %u", xkb_state.locked_group); + + kiosk_x_keyboard_manager_set_layout_index (self, xkb_state.locked_group); +} @@ -888,11 +903,14 @@ index 0000000..94b8f0b + break; + case LAYOUTS: + layouts_string = g_steal_pointer (&value); ++ g_debug ("KioskXKeyboardManager: Read layouts '%s'", layouts_string); + break; + case VARIANTS: + variants_string = g_steal_pointer (&value); ++ g_debug ("KioskXKeyboardManager: Read variants '%s'", variants_string); + break; + case OPTIONS: ++ g_debug ("KioskXKeyboardManager: Read options '%s'", options); + options = g_steal_pointer (&value); + break; + } @@ -907,12 +925,14 @@ index 0000000..94b8f0b + qualified_layouts = qualify_layouts_with_variants (self, (const char * const *)layouts, (const char * const *)variants); + + if (qualified_layouts == NULL) { ++ g_debug ("KioskXKeyboardManager: Unable to qualify layouts with variants"); + return FALSE; + } + + number_of_layouts = g_strv_length (qualified_layouts); + + if (number_of_layouts == 0) { ++ g_debug ("KioskXKeyboardManager: No layouts found"); + return FALSE; + } + @@ -925,6 +945,8 @@ index 0000000..94b8f0b + kiosk_x_keyboard_manager_read_current_layout_index (self); + g_object_thaw_notify (G_OBJECT (self)); + ++ kiosk_x_keyboard_manager_allow_layout_selection (self); ++ + return TRUE; +} + @@ -969,7 +991,12 @@ index 0000000..94b8f0b + return; + } + -+ g_debug ("KioskXKeyboardManager: XKB rules_names data changed in X server"); ++ g_debug ("KioskXKeyboardManager: XKB rules names data changed in X server"); ++ ++ /* We block layout index changes until we have a chance to figure out what the new layouts are ++ */ ++ kiosk_x_keyboard_manager_diallow_layout_selection (self); ++ + kiosk_gobject_utils_queue_defer_callback (G_OBJECT (self), + "[kiosk-input-sources-manager] on_x_server_xkb_rules_names_data_changed", + self->cancellable, @@ -981,12 +1008,17 @@ index 0000000..94b8f0b +kiosk_x_keyboard_manager_handle_xkb_event (KioskXKeyboardManager *self, + XkbEvent *x_server_event) +{ -+ g_debug ("KioskXKeyboardManager: Got XKB event"); + size_t layout_index; + + layout_index = XkbStateGroup (&x_server_event->state); + switch (x_server_event->any.xkb_type) { + case XkbStateNotify: ++ if (!(x_server_event->state.changed & XkbGroupStateMask)) { ++ return; ++ } ++ if (self->disallow_layout_selection) { ++ return; ++ } + g_debug ("KioskXKeyboardManager: Approving keyboard group change to group %lu", layout_index); + meta_backend_lock_layout_group (self->backend, layout_index); + kiosk_x_keyboard_manager_set_layout_index (self, layout_index); diff --git a/gnome-kiosk.spec b/gnome-kiosk.spec index d539f29..4101f5b 100644 --- a/gnome-kiosk.spec +++ b/gnome-kiosk.spec @@ -12,7 +12,7 @@ Name: gnome-kiosk Version: 40~alpha -Release: 3%{?dist} +Release: 4%{?dist} Summary: Window management and application launching for GNOME License: GPLv2+ @@ -88,6 +88,9 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/org.gnome.Kiosk.Searc %{_datadir}/wayland-sessions/org.gnome.Kiosk.SearchApp.Session.desktop %changelog +* Tue Apr 20 2021 Ray Strode - 40~alpha-4 +- Fix infinite loop + * Mon Apr 19 2021 Ray Strode - 40~alpha-3 - Fix crash