mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2024-12-25 13:58:15 -05:00
gnu: kmscon: Fix layout setup.
Kmscon may discover multiple inputs, corresponding to multiple devices. This means that the uxkb_dev_keymap_update function may be called multiple times, and the FIFO is registered on each input poll loop. When a new layout is written on the FIFO by the installer, the first input picking up the message, will apply the new layout. However, that input may not be the input that the user is currently using. To fix it, register the FIFO on the first input poll loop, but apply the new layout on all the inputs in the uxkb_keymap_update_handler function. * gnu/packages/patches/kmscon-runtime-keymap-switch.patch (uxkb_keymap_update_handler): Apply the new layout to all the inputs. (input_new_dev): Register the FIFO fd only on the first input poll loop.
This commit is contained in:
parent
c254af8c73
commit
68110f7288
1 changed files with 22 additions and 9 deletions
|
@ -79,10 +79,12 @@ diff --git a/src/uterm_input.c b/src/uterm_input.c
|
||||||
index 6fcbc4b..990a09d 100644
|
index 6fcbc4b..990a09d 100644
|
||||||
--- a/src/uterm_input.c
|
--- a/src/uterm_input.c
|
||||||
+++ b/src/uterm_input.c
|
+++ b/src/uterm_input.c
|
||||||
@@ -178,6 +178,8 @@ static void input_new_dev(struct uterm_input *input,
|
@@ -178,6 +178,10 @@ static void input_new_dev(struct uterm_input *input,
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_rcodepoints;
|
goto err_rcodepoints;
|
||||||
|
|
||||||
|
+ /* Add the FIFO fd only to the first input poll loop. */
|
||||||
|
+ if (shl_dlist_empty(&input->devices))
|
||||||
+ uxkb_dev_keymap_update(dev);
|
+ uxkb_dev_keymap_update(dev);
|
||||||
+
|
+
|
||||||
if (input->awake > 0) {
|
if (input->awake > 0) {
|
||||||
|
@ -132,7 +134,7 @@ index 925c755..8fe08f8 100644
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
#include "shl_hook.h"
|
#include "shl_hook.h"
|
||||||
#include "shl_llog.h"
|
#include "shl_llog.h"
|
||||||
@@ -178,6 +181,95 @@ static void timer_event(struct ev_timer *timer, uint64_t num, void *data)
|
@@ -178,6 +181,106 @@ static void timer_event(struct ev_timer *timer, uint64_t num, void *data)
|
||||||
shl_hook_call(dev->input->hook, dev->input, &dev->repeat_event);
|
shl_hook_call(dev->input->hook, dev->input, &dev->repeat_event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,7 +173,23 @@ index 925c755..8fe08f8 100644
|
||||||
+
|
+
|
||||||
+ llog_info(dev->input, "HANDLER CALLED %s|%s|%s\n",
|
+ llog_info(dev->input, "HANDLER CALLED %s|%s|%s\n",
|
||||||
+ model, layout, variant);
|
+ model, layout, variant);
|
||||||
|
+
|
||||||
|
+ struct uterm_input *input = dev->input;
|
||||||
|
+ struct shl_dlist *iter;
|
||||||
|
+
|
||||||
|
+ /* Apply the new layout to all the inputs. */
|
||||||
|
+ shl_dlist_for_each(iter, &input->devices) {
|
||||||
|
+ struct uterm_input_dev *dev;
|
||||||
|
+ dev = shl_dlist_entry(iter,
|
||||||
|
+ struct uterm_input_dev,
|
||||||
|
+ list);
|
||||||
+ uxkb_desc_init(dev->input, model, layout, variant, options, NULL);
|
+ uxkb_desc_init(dev->input, model, layout, variant, options, NULL);
|
||||||
|
+ dev->state = xkb_state_new(dev->input->keymap);
|
||||||
|
+ if (!dev->state) {
|
||||||
|
+ llog_error(dev->input, "cannot create XKB state");
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
+
|
+
|
||||||
+ /* The client will now close the FIFO. Close it too, and re-create a
|
+ /* The client will now close the FIFO. Close it too, and re-create a
|
||||||
+ * FIFO so other clients can eventually connect. */
|
+ * FIFO so other clients can eventually connect. */
|
||||||
|
@ -180,11 +198,6 @@ index 925c755..8fe08f8 100644
|
||||||
+ dev->rupdate_fd = -1;
|
+ dev->rupdate_fd = -1;
|
||||||
+ uxkb_dev_keymap_update(dev);
|
+ uxkb_dev_keymap_update(dev);
|
||||||
+
|
+
|
||||||
+ dev->state = xkb_state_new(dev->input->keymap);
|
|
||||||
+ if (!dev->state) {
|
|
||||||
+ llog_error(dev->input, "cannot create XKB state");
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+int uxkb_dev_keymap_update(struct uterm_input_dev *dev)
|
+int uxkb_dev_keymap_update(struct uterm_input_dev *dev)
|
||||||
|
|
Loading…
Reference in a new issue