summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-04-05 01:04:20 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-04-06 01:40:49 -0400
commit234a21905c04327b8d976beeb54701ec60d6e07b (patch)
tree259b15167a8797e0d2bb764b6d19244f65fd8b56
parent13213c710f8b881ad2c095764c3486b1309cf6c8 (diff)
downloadgtk+-234a21905c04327b8d976beeb54701ec60d6e07b.tar.gz
gtk: Stop using keymap apis
Stop using most keymap apis in GTK. Only a few calls related to virtual modifiers are left.
-rw-r--r--gtk/gtkaccelgroup.c4
-rw-r--r--gtk/gtkflowbox.c8
-rw-r--r--gtk/gtkimcontextsimple.c11
-rw-r--r--gtk/gtkimmulticontext.c4
-rw-r--r--gtk/gtklabel.c10
-rw-r--r--gtk/gtklistbox.c8
-rw-r--r--gtk/gtkpasswordentry.c29
-rw-r--r--gtk/gtkprivate.c4
-rw-r--r--gtk/gtkstylecontext.c16
-rw-r--r--gtk/gtktext.c54
-rw-r--r--gtk/gtktextview.c27
-rw-r--r--gtk/gtkwidget.c9
12 files changed, 102 insertions, 82 deletions
diff --git a/gtk/gtkaccelgroup.c b/gtk/gtkaccelgroup.c
index 97cdc22791..68a664648f 100644
--- a/gtk/gtkaccelgroup.c
+++ b/gtk/gtkaccelgroup.c
@@ -1139,8 +1139,8 @@ gtk_accelerator_get_default_mod_mask (void)
return GDK_CONTROL_MASK | GDK_SHIFT_MASK | GDK_MOD1_MASK;
default_accel_mod_mask =
- gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
- GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK);
+ gdk_display_get_modifier_mask (display,
+ GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK);
}
return default_accel_mod_mask;
diff --git a/gtk/gtkflowbox.c b/gtk/gtkflowbox.c
index 832dc87907..ded20adb33 100644
--- a/gtk/gtkflowbox.c
+++ b/gtk/gtkflowbox.c
@@ -2999,10 +2999,10 @@ gtk_flow_box_add_move_binding (GtkWidgetClass *widget_class,
display = gdk_display_get_default ();
if (display != NULL)
{
- extend_mod_mask = gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
- GDK_MODIFIER_INTENT_EXTEND_SELECTION);
- modify_mod_mask = gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
- GDK_MODIFIER_INTENT_MODIFY_SELECTION);
+ extend_mod_mask = gdk_display_get_modifier_mask (display,
+ GDK_MODIFIER_INTENT_EXTEND_SELECTION);
+ modify_mod_mask = gdk_display_get_modifier_mask (display,
+ GDK_MODIFIER_INTENT_MODIFY_SELECTION);
}
gtk_widget_class_add_binding_signal (widget_class,
diff --git a/gtk/gtkimcontextsimple.c b/gtk/gtkimcontextsimple.c
index 6c9c965f7d..4f6e2ce441 100644
--- a/gtk/gtkimcontextsimple.c
+++ b/gtk/gtkimcontextsimple.c
@@ -1034,7 +1034,6 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
GtkIMContextSimplePrivate *priv = context_simple->priv;
GdkSurface *surface = gdk_event_get_surface ((GdkEvent *) event);
GdkDisplay *display = gdk_surface_get_display (surface);
- GdkKeymap *keymap = gdk_display_get_keymap (display);
GSList *tmp_list;
int n_compose = 0;
GdkModifierType hex_mod_mask;
@@ -1053,10 +1052,10 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
while (priv->compose_buffer[n_compose] != 0)
n_compose++;
- keyval = gdk_key_event_get_keyval ((GdkEvent *)event);
- state = gdk_event_get_modifier_state ((GdkEvent *)event);
+ keyval = gdk_key_event_get_keyval (event);
+ state = gdk_event_get_modifier_state (event);
- if (gdk_event_get_event_type ((GdkEvent *) event) == GDK_KEY_RELEASE)
+ if (gdk_event_get_event_type (event) == GDK_KEY_RELEASE)
{
if (priv->in_hex_sequence &&
(keyval == GDK_KEY_Control_L || keyval == GDK_KEY_Control_R ||
@@ -1100,7 +1099,7 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
if (keyval == gtk_compose_ignore[i])
return FALSE;
- hex_mod_mask = gdk_keymap_get_modifier_mask (keymap, GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR);
+ hex_mod_mask = gdk_display_get_modifier_mask (display, GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR);
hex_mod_mask |= GDK_SHIFT_MASK;
if (priv->in_hex_sequence && priv->modifiers_dropped)
@@ -1132,7 +1131,7 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
{
GdkModifierType no_text_input_mask;
- no_text_input_mask = gdk_keymap_get_modifier_mask (keymap, GDK_MODIFIER_INTENT_NO_TEXT_INPUT);
+ no_text_input_mask = gdk_display_get_modifier_mask (display, GDK_MODIFIER_INTENT_NO_TEXT_INPUT);
if (state & no_text_input_mask ||
(priv->in_hex_sequence && priv->modifiers_dropped &&
diff --git a/gtk/gtkimmulticontext.c b/gtk/gtkimmulticontext.c
index b7a40a1f4b..0c85cd0a07 100644
--- a/gtk/gtkimmulticontext.c
+++ b/gtk/gtkimmulticontext.c
@@ -369,8 +369,8 @@ gtk_im_multicontext_filter_keypress (GtkIMContext *context,
display = gdk_event_get_display (event);
no_text_input_mask =
- gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
- GDK_MODIFIER_INTENT_NO_TEXT_INPUT);
+ gdk_display_get_modifier_mask (display,
+ GDK_MODIFIER_INTENT_NO_TEXT_INPUT);
if (gdk_event_get_event_type (event) == GDK_KEY_PRESS &&
(state & no_text_input_mask) == 0)
diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c
index 0b7b884685..9bcdec32e9 100644
--- a/gtk/gtklabel.c
+++ b/gtk/gtklabel.c
@@ -5540,8 +5540,9 @@ get_better_cursor (GtkLabel *label,
gint *y)
{
GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
- GdkKeymap *keymap = gdk_display_get_keymap (gtk_widget_get_display (GTK_WIDGET (label)));
- PangoDirection keymap_direction = gdk_keymap_get_direction (keymap);
+ GdkSeat *seat = gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET (label)));
+ GdkDevice *device = gdk_seat_get_keyboard (seat);
+ PangoDirection keymap_direction = gdk_device_get_direction (device);
PangoDirection cursor_direction = get_cursor_direction (label);
gboolean split_cursor;
PangoRectangle strong_pos, weak_pos;
@@ -5644,8 +5645,9 @@ gtk_label_move_visually (GtkLabel *label,
strong = TRUE;
else
{
- GdkKeymap *keymap = gdk_display_get_keymap (gtk_widget_get_display (GTK_WIDGET (label)));
- PangoDirection keymap_direction = gdk_keymap_get_direction (keymap);
+ GdkSeat *seat = gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET (label)));
+ GdkDevice *device = gdk_seat_get_keyboard (seat);
+ PangoDirection keymap_direction = gdk_device_get_direction (device);
strong = keymap_direction == get_cursor_direction (label);
}
diff --git a/gtk/gtklistbox.c b/gtk/gtklistbox.c
index def3c27e05..81669abbc8 100644
--- a/gtk/gtklistbox.c
+++ b/gtk/gtklistbox.c
@@ -1432,10 +1432,10 @@ gtk_list_box_add_move_binding (GtkWidgetClass *widget_class,
display = gdk_display_get_default ();
if (display)
{
- extend_mod_mask = gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
- GDK_MODIFIER_INTENT_EXTEND_SELECTION);
- modify_mod_mask = gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
- GDK_MODIFIER_INTENT_MODIFY_SELECTION);
+ extend_mod_mask = gdk_display_get_modifier_mask (display,
+ GDK_MODIFIER_INTENT_EXTEND_SELECTION);
+ modify_mod_mask = gdk_display_get_modifier_mask (display,
+ GDK_MODIFIER_INTENT_MODIFY_SELECTION);
}
gtk_widget_class_add_binding_signal (widget_class,
diff --git a/gtk/gtkpasswordentry.c b/gtk/gtkpasswordentry.c
index f2dd58e128..b6f202f247 100644
--- a/gtk/gtkpasswordentry.c
+++ b/gtk/gtkpasswordentry.c
@@ -55,7 +55,7 @@ typedef struct {
GtkWidget *entry;
GtkWidget *icon;
GtkWidget *peek_icon;
- GdkKeymap *keymap;
+ GdkDevice *keyboard;
GMenuModel *extra_menu;
} GtkPasswordEntryPrivate;
@@ -81,8 +81,9 @@ G_DEFINE_TYPE_WITH_CODE (GtkPasswordEntry, gtk_password_entry, GTK_TYPE_WIDGET,
G_IMPLEMENT_INTERFACE (GTK_TYPE_EDITABLE, gtk_password_entry_editable_init))
static void
-keymap_state_changed (GdkKeymap *keymap,
- GtkWidget *widget)
+caps_lock_state_changed (GdkDevice *device,
+ GParamSpec *pspec,
+ GtkWidget *widget)
{
GtkPasswordEntry *entry = GTK_PASSWORD_ENTRY (widget);
GtkPasswordEntryPrivate *priv = gtk_password_entry_get_instance_private (entry);
@@ -90,7 +91,7 @@ keymap_state_changed (GdkKeymap *keymap,
if (gtk_editable_get_editable (GTK_EDITABLE (entry)) &&
gtk_widget_has_focus (priv->entry) &&
!gtk_text_get_visibility (GTK_TEXT (priv->entry)) &&
- gdk_keymap_get_caps_lock_state (priv->keymap))
+ gdk_device_get_caps_lock_state (device))
gtk_widget_show (priv->icon);
else
gtk_widget_hide (priv->icon);
@@ -102,8 +103,8 @@ focus_changed (GtkWidget *widget)
GtkPasswordEntry *entry = GTK_PASSWORD_ENTRY (widget);
GtkPasswordEntryPrivate *priv = gtk_password_entry_get_instance_private (entry);
- if (priv->keymap)
- keymap_state_changed (priv->keymap, widget);
+ if (priv->keyboard)
+ caps_lock_state_changed (priv->keyboard, NULL, widget);
}
static void
@@ -134,8 +135,8 @@ visibility_toggled (GObject *object,
gtk_widget_set_tooltip_text (priv->peek_icon, _("Show text"));
}
- if (priv->keymap)
- keymap_state_changed (priv->keymap, GTK_WIDGET (entry));
+ if (priv->keyboard)
+ caps_lock_state_changed (priv->keyboard, NULL, GTK_WIDGET (entry));
}
static void
@@ -168,9 +169,9 @@ gtk_password_entry_realize (GtkWidget *widget)
GTK_WIDGET_CLASS (gtk_password_entry_parent_class)->realize (widget);
- priv->keymap = gdk_display_get_keymap (gtk_widget_get_display (widget));
- g_signal_connect (priv->keymap, "state-changed", G_CALLBACK (keymap_state_changed), entry);
- keymap_state_changed (priv->keymap, widget);
+ priv->keyboard = gdk_seat_get_keyboard (gdk_display_get_default_seat (gtk_widget_get_display (widget)));
+ g_signal_connect (priv->keyboard, "notify::caps-lock-state", G_CALLBACK (caps_lock_state_changed), entry);
+ caps_lock_state_changed (priv->keyboard, NULL, widget);
}
static void
@@ -179,8 +180,8 @@ gtk_password_entry_dispose (GObject *object)
GtkPasswordEntry *entry = GTK_PASSWORD_ENTRY (object);
GtkPasswordEntryPrivate *priv = gtk_password_entry_get_instance_private (entry);
- if (priv->keymap)
- g_signal_handlers_disconnect_by_func (priv->keymap, keymap_state_changed, entry);
+ if (priv->keyboard)
+ g_signal_handlers_disconnect_by_func (priv->keyboard, caps_lock_state_changed, entry);
if (priv->entry)
gtk_editable_finish_delegate (GTK_EDITABLE (entry));
@@ -502,7 +503,7 @@ gtk_password_entry_set_show_peek_icon (GtkPasswordEntry *entry,
entry);
}
- keymap_state_changed (priv->keymap, GTK_WIDGET (entry));
+ caps_lock_state_changed (priv->keyboard, NULL, GTK_WIDGET (entry));
g_object_notify_by_pspec (G_OBJECT (entry), props[PROP_SHOW_PEEK_ICON]);
}
diff --git a/gtk/gtkprivate.c b/gtk/gtkprivate.c
index 5d00978de6..b61333d71c 100644
--- a/gtk/gtkprivate.c
+++ b/gtk/gtkprivate.c
@@ -196,8 +196,8 @@ _gtk_get_primary_accel_mod (void)
{
GdkDisplay *display = gdk_display_get_default ();
- primary = gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
- GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR);
+ primary = gdk_display_get_modifier_mask (display,
+ GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR);
primary = _gtk_replace_virtual_modifiers (gdk_display_get_keymap (display),
primary);
}
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index c885841799..ab087433e1 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -1253,7 +1253,8 @@ gtk_render_insertion_cursor (GtkStyleContext *context,
gboolean split_cursor;
PangoRectangle strong_pos, weak_pos;
PangoRectangle *cursor1, *cursor2;
- PangoDirection keymap_direction;
+ GdkDevice *keyboard;
+ PangoDirection keyboard_direction;
PangoDirection direction2;
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
@@ -1265,7 +1266,8 @@ gtk_render_insertion_cursor (GtkStyleContext *context,
"gtk-split-cursor", &split_cursor,
NULL);
- keymap_direction = gdk_keymap_get_direction (gdk_display_get_keymap (priv->display));
+ keyboard = gdk_seat_get_keyboard (gdk_display_get_default_seat (priv->display));
+ keyboard_direction = gdk_device_get_direction (keyboard);
pango_layout_get_cursor_pos (layout, index, &strong_pos, &weak_pos);
@@ -1283,7 +1285,7 @@ gtk_render_insertion_cursor (GtkStyleContext *context,
}
else
{
- if (keymap_direction == direction)
+ if (keyboard_direction == direction)
cursor1 = &strong_pos;
else
cursor1 = &weak_pos;
@@ -1339,7 +1341,8 @@ gtk_snapshot_render_insertion_cursor (GtkSnapshot *snapshot,
float aspect_ratio;
PangoRectangle strong_pos, weak_pos;
PangoRectangle *cursor1, *cursor2;
- PangoDirection keymap_direction;
+ GdkDevice *keyboard;
+ PangoDirection keyboard_direction;
PangoDirection direction2;
g_return_if_fail (snapshot != NULL);
@@ -1352,7 +1355,8 @@ gtk_snapshot_render_insertion_cursor (GtkSnapshot *snapshot,
"gtk-cursor-aspect-ratio", &aspect_ratio,
NULL);
- keymap_direction = gdk_keymap_get_direction (gdk_display_get_keymap (priv->display));
+ keyboard = gdk_seat_get_keyboard (gdk_display_get_default_seat (priv->display));
+ keyboard_direction = gdk_device_get_direction (keyboard);
pango_layout_get_cursor_pos (layout, index, &strong_pos, &weak_pos);
@@ -1370,7 +1374,7 @@ gtk_snapshot_render_insertion_cursor (GtkSnapshot *snapshot,
}
else
{
- if (keymap_direction == direction)
+ if (keyboard_direction == direction)
cursor1 = &strong_pos;
else
cursor1 = &weak_pos;
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index 6825c7e88a..b1300d2c05 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -410,7 +410,8 @@ static void gtk_text_insert_emoji (GtkText *self);
static void gtk_text_select_all (GtkText *self);
static void gtk_text_real_activate (GtkText *self);
-static void keymap_direction_changed (GdkKeymap *keymap,
+static void direction_changed (GdkDevice *keyboard,
+ GParamSpec *pspec,
GtkText *self);
/* IM Context Callbacks
@@ -1880,7 +1881,8 @@ gtk_text_dispose (GObject *object)
{
GtkText *self = GTK_TEXT (object);
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
- GdkKeymap *keymap;
+ GdkSeat *seat;
+ GdkDevice *keyboard;
GtkWidget *chooser;
priv->current_pos = 0;
@@ -1897,8 +1899,9 @@ gtk_text_dispose (GObject *object)
if (chooser)
gtk_widget_unparent (chooser);
- keymap = gdk_display_get_keymap (gtk_widget_get_display (GTK_WIDGET (object)));
- g_signal_handlers_disconnect_by_func (keymap, keymap_direction_changed, self);
+ seat = gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET (object)));
+ keyboard = gdk_seat_get_keyboard (seat);
+ g_signal_handlers_disconnect_by_func (keyboard, direction_changed, self);
g_clear_pointer (&priv->selection_bubble, gtk_widget_unparent);
g_clear_pointer (&priv->popup_menu, gtk_widget_unparent);
@@ -3081,11 +3084,13 @@ gtk_text_focus_in (GtkWidget *widget)
{
GtkText *self = GTK_TEXT (widget);
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
- GdkKeymap *keymap;
+ GdkSeat *seat;
+ GdkDevice *keyboard;
gtk_widget_queue_draw (widget);
- keymap = gdk_display_get_keymap (gtk_widget_get_display (widget));
+ seat = gdk_display_get_default_seat (gtk_widget_get_display (widget));
+ keyboard = gdk_seat_get_keyboard (seat);
if (priv->editable)
{
@@ -3093,8 +3098,8 @@ gtk_text_focus_in (GtkWidget *widget)
gtk_im_context_focus_in (priv->im_context);
}
- g_signal_connect (keymap, "direction-changed",
- G_CALLBACK (keymap_direction_changed), self);
+ g_signal_connect (keyboard, "notify::direction",
+ G_CALLBACK (direction_changed), self);
gtk_text_reset_blink_time (self);
gtk_text_check_cursor_blink (self);
@@ -3105,7 +3110,8 @@ gtk_text_focus_out (GtkWidget *widget)
{
GtkText *self = GTK_TEXT (widget);
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
- GdkKeymap *keymap;
+ GdkSeat *seat;
+ GdkDevice *keyboard;
gtk_text_selection_bubble_popup_unset (self);
@@ -3114,7 +3120,8 @@ gtk_text_focus_out (GtkWidget *widget)
gtk_widget_queue_draw (widget);
- keymap = gdk_display_get_keymap (gtk_widget_get_display (widget));
+ seat = gdk_display_get_default_seat (gtk_widget_get_display (widget));
+ keyboard = gdk_seat_get_keyboard (seat);
if (priv->editable)
{
@@ -3124,7 +3131,7 @@ gtk_text_focus_out (GtkWidget *widget)
gtk_text_check_cursor_blink (self);
- g_signal_handlers_disconnect_by_func (keymap, keymap_direction_changed, self);
+ g_signal_handlers_disconnect_by_func (keyboard, direction_changed, self);
}
static gboolean
@@ -3604,8 +3611,9 @@ get_better_cursor_x (GtkText *self,
int offset)
{
GtkTextPrivate *priv = gtk_text_get_instance_private (self);
- GdkKeymap *keymap = gdk_display_get_keymap (gtk_widget_get_display (GTK_WIDGET (self)));
- PangoDirection keymap_direction = gdk_keymap_get_direction (keymap);
+ GdkSeat *seat = gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET (self)));
+ GdkDevice *keyboard = gdk_seat_get_keyboard (seat);
+ PangoDirection direction = gdk_device_get_direction (keyboard);
gboolean split_cursor;
PangoLayout *layout = gtk_text_ensure_layout (self, TRUE);
const char *text = pango_layout_get_text (layout);
@@ -3621,7 +3629,7 @@ get_better_cursor_x (GtkText *self,
if (split_cursor)
return strong_pos.x / PANGO_SCALE;
else
- return (keymap_direction == priv->resolved_dir) ? strong_pos.x / PANGO_SCALE : weak_pos.x / PANGO_SCALE;
+ return (direction == priv->resolved_dir) ? strong_pos.x / PANGO_SCALE : weak_pos.x / PANGO_SCALE;
}
static void
@@ -4060,8 +4068,9 @@ gtk_text_real_activate (GtkText *self)
}
static void
-keymap_direction_changed (GdkKeymap *keymap,
- GtkText *self)
+direction_changed (GdkDevice *device,
+ GParamSpec *pspec,
+ GtkText *self)
{
gtk_text_recompute (self);
}
@@ -4326,9 +4335,10 @@ gtk_text_create_layout (GtkText *self,
if (gtk_widget_has_focus (widget))
{
GdkDisplay *display = gtk_widget_get_display (widget);
- GdkKeymap *keymap = gdk_display_get_keymap (display);
+ GdkSeat *seat = gdk_display_get_default_seat (display);
+ GdkDevice *keyboard = gdk_seat_get_keyboard (seat);
- if (gdk_keymap_get_direction (keymap) == PANGO_DIRECTION_RTL)
+ if (gdk_device_get_direction (keyboard) == PANGO_DIRECTION_RTL)
pango_dir = PANGO_DIRECTION_RTL;
else
pango_dir = PANGO_DIRECTION_LTR;
@@ -4888,10 +4898,12 @@ gtk_text_move_visually (GtkText *self,
strong = TRUE;
else
{
- GdkKeymap *keymap = gdk_display_get_keymap (gtk_widget_get_display (GTK_WIDGET (self)));
- PangoDirection keymap_direction = gdk_keymap_get_direction (keymap);
+ GdkDisplay *display = gtk_widget_get_display (GTK_WIDGET (self));
+ GdkSeat *seat = gdk_display_get_default_seat (display);
+ GdkDevice *keyboard = gdk_seat_get_keyboard (seat);
+ PangoDirection direction = gdk_device_get_direction (keyboard);
- strong = keymap_direction == priv->resolved_dir;
+ strong = direction == priv->resolved_dir;
}
if (count > 0)
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index 7b4ec0a3d4..8b91a7aaf3 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -5456,8 +5456,9 @@ gtk_text_view_click_gesture_pressed (GtkGestureClick *gesture,
}
static void
-keymap_direction_changed (GdkKeymap *keymap,
- GtkTextView *text_view)
+direction_changed (GdkDevice *device,
+ GParamSpec *pspec,
+ GtkTextView *text_view)
{
gtk_text_view_check_keymap_direction (text_view);
}
@@ -5467,6 +5468,8 @@ gtk_text_view_focus_in (GtkWidget *widget)
{
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
GtkTextViewPrivate *priv = text_view->priv;
+ GdkSeat *seat;
+ GdkDevice *keyboard;
gtk_widget_queue_draw (widget);
@@ -5480,9 +5483,10 @@ gtk_text_view_focus_in (GtkWidget *widget)
gtk_text_view_check_cursor_blink (text_view);
}
- g_signal_connect (gdk_display_get_keymap (gtk_widget_get_display (widget)),
- "direction-changed",
- G_CALLBACK (keymap_direction_changed), text_view);
+ seat = gdk_display_get_default_seat (gtk_widget_get_display (widget));
+ keyboard = gdk_seat_get_keyboard (seat);
+ g_signal_connect (keyboard, "notify::direction",
+ G_CALLBACK (direction_changed), text_view);
gtk_text_view_check_keymap_direction (text_view);
if (priv->editable)
@@ -5497,6 +5501,8 @@ gtk_text_view_focus_out (GtkWidget *widget)
{
GtkTextView *text_view = GTK_TEXT_VIEW (widget);
GtkTextViewPrivate *priv = text_view->priv;
+ GdkSeat *seat;
+ GdkDevice *keyboard;
gtk_text_view_end_selection_drag (text_view);
@@ -5510,9 +5516,9 @@ gtk_text_view_focus_out (GtkWidget *widget)
gtk_text_layout_set_cursor_visible (priv->layout, FALSE);
}
- g_signal_handlers_disconnect_by_func (gdk_display_get_keymap (gtk_widget_get_display (widget)),
- keymap_direction_changed,
- text_view);
+ seat = gdk_display_get_default_seat (gtk_widget_get_display (widget));
+ keyboard = gdk_seat_get_keyboard (seat);
+ g_signal_handlers_disconnect_by_func (keyboard, direction_changed, text_view);
gtk_text_view_selection_bubble_popup_unset (text_view);
text_view->priv->text_handles_enabled = FALSE;
@@ -7534,7 +7540,8 @@ gtk_text_view_check_keymap_direction (GtkTextView *text_view)
if (priv->layout)
{
GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (text_view));
- GdkKeymap *keymap = gdk_display_get_keymap (gtk_widget_get_display (GTK_WIDGET (text_view)));
+ GdkSeat *seat = gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET (text_view)));
+ GdkDevice *keyboard = gdk_seat_get_keyboard (seat);
GtkTextDirection new_cursor_dir;
GtkTextDirection new_keyboard_dir;
gboolean split_cursor;
@@ -7543,7 +7550,7 @@ gtk_text_view_check_keymap_direction (GtkTextView *text_view)
"gtk-split-cursor", &split_cursor,
NULL);
- if (gdk_keymap_get_direction (keymap) == PANGO_DIRECTION_RTL)
+ if (gdk_device_get_direction (keyboard) == PANGO_DIRECTION_RTL)
new_keyboard_dir = GTK_TEXT_DIR_RTL;
else
new_keyboard_dir = GTK_TEXT_DIR_LTR;
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index a276b3369b..42c47dba58 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -10670,7 +10670,7 @@ gtk_widget_get_style_context (GtkWidget *widget)
* Returns the modifier mask the @widget’s windowing system backend
* uses for a particular purpose.
*
- * See gdk_keymap_get_modifier_mask().
+ * See gdk_display_get_modifier_mask().
*
* Returns: the modifier mask used for @intent.
**/
@@ -10678,14 +10678,9 @@ GdkModifierType
gtk_widget_get_modifier_mask (GtkWidget *widget,
GdkModifierIntent intent)
{
- GdkDisplay *display;
-
g_return_val_if_fail (GTK_IS_WIDGET (widget), 0);
- display = _gtk_widget_get_display (widget);
-
- return gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
- intent);
+ return gdk_display_get_modifier_mask (_gtk_widget_get_display (widget), intent);
}
static GtkActionMuxer *