summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-04-05 00:37:51 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-04-06 01:40:49 -0400
commite1652679248f43a41c909ff444ddbb73d8055778 (patch)
treedfc5db9695171c465a9a94e5800fd00cee8282e0
parent00b25d55948c83d5ffd72ea35149bb2ce23cfa82 (diff)
downloadgtk+-e1652679248f43a41c909ff444ddbb73d8055778.tar.gz
wayland: Notify new device properties
-rw-r--r--gdk/wayland/gdkdevice-wayland.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index dcb38c2953..18824309fe 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -1856,16 +1856,38 @@ keyboard_handle_keymap (void *data,
{
GdkWaylandSeat *seat = data;
PangoDirection direction;
+ gboolean bidi;
+ gboolean caps_lock;
+ gboolean num_lock;
+ gboolean scroll_lock;
+ GdkModifierType modifiers;
direction = gdk_keymap_get_direction (seat->keymap);
+ bidi = gdk_keymap_have_bidi_layouts (seat->keymap);
+ caps_lock = gdk_keymap_get_caps_lock_state (seat->keymap);
+ num_lock = gdk_keymap_get_num_lock_state (seat->keymap);
+ scroll_lock = gdk_keymap_get_scroll_lock_state (seat->keymap);
+ modifiers = gdk_keymap_get_modifier_state (seat->keymap);
_gdk_wayland_keymap_update_from_fd (seat->keymap, format, fd, size);
g_signal_emit_by_name (seat->keymap, "keys-changed");
g_signal_emit_by_name (seat->keymap, "state-changed");
-
if (direction != gdk_keymap_get_direction (seat->keymap))
g_signal_emit_by_name (seat->keymap, "direction-changed");
+
+ if (direction != gdk_keymap_get_direction (seat->keymap))
+ g_object_notify (G_OBJECT (seat->master_keyboard), "direction");
+ if (bidi != gdk_keymap_have_bidi_layouts (seat->keymap))
+ g_object_notify (G_OBJECT (seat->master_keyboard), "has-bidi-layouts");
+ if (caps_lock != gdk_keymap_get_caps_lock_state (seat->keymap))
+ g_object_notify (G_OBJECT (seat->master_keyboard), "caps-lock-state");
+ if (num_lock != gdk_keymap_get_num_lock_state (seat->keymap))
+ g_object_notify (G_OBJECT (seat->master_keyboard), "num-lock-state");
+ if (scroll_lock != gdk_keymap_get_scroll_lock_state (seat->keymap))
+ g_object_notify (G_OBJECT (seat->master_keyboard), "scroll-lock-state");
+ if (modifiers != gdk_keymap_get_modifier_state (seat->keymap))
+ g_object_notify (G_OBJECT (seat->master_keyboard), "modifier-state");
}
static void
@@ -2155,11 +2177,23 @@ keyboard_handle_modifiers (void *data,
GdkKeymap *keymap;
struct xkb_state *xkb_state;
PangoDirection direction;
+ gboolean bidi;
+ gboolean caps_lock;
+ gboolean num_lock;
+ gboolean scroll_lock;
+ GdkModifierType modifiers;
keymap = seat->keymap;
- direction = gdk_keymap_get_direction (keymap);
xkb_state = _gdk_wayland_keymap_get_xkb_state (keymap);
+ direction = gdk_keymap_get_direction (seat->keymap);
+ bidi = gdk_keymap_have_bidi_layouts (seat->keymap);
+ caps_lock = gdk_keymap_get_caps_lock_state (seat->keymap);
+ num_lock = gdk_keymap_get_num_lock_state (seat->keymap);
+ scroll_lock = gdk_keymap_get_scroll_lock_state (seat->keymap);
+ modifiers = gdk_keymap_get_modifier_state (seat->keymap);
+
+
/* Note: the docs for xkb_state_update mask state that all parameters
* must be passed, or we may end up with an 'incoherent' state. But the
* Wayland modifiers event only includes a single group field, so we
@@ -2182,6 +2216,19 @@ keyboard_handle_modifiers (void *data,
g_signal_emit_by_name (keymap, "state-changed");
if (direction != gdk_keymap_get_direction (keymap))
g_signal_emit_by_name (keymap, "direction-changed");
+
+ if (direction != gdk_keymap_get_direction (seat->keymap))
+ g_object_notify (G_OBJECT (seat->master_keyboard), "direction");
+ if (bidi != gdk_keymap_have_bidi_layouts (seat->keymap))
+ g_object_notify (G_OBJECT (seat->master_keyboard), "has-bidi-layouts");
+ if (caps_lock != gdk_keymap_get_caps_lock_state (seat->keymap))
+ g_object_notify (G_OBJECT (seat->master_keyboard), "caps-lock-state");
+ if (num_lock != gdk_keymap_get_num_lock_state (seat->keymap))
+ g_object_notify (G_OBJECT (seat->master_keyboard), "num-lock-state");
+ if (scroll_lock != gdk_keymap_get_scroll_lock_state (seat->keymap))
+ g_object_notify (G_OBJECT (seat->master_keyboard), "scroll-lock-state");
+ if (modifiers != gdk_keymap_get_modifier_state (seat->keymap))
+ g_object_notify (G_OBJECT (seat->master_keyboard), "modifier-state");
}
static void