Replace gdk_keymap_get_for_display by gdk_display_get_keymap

Replace all uses of the old function by the new one.
No functional change.
This commit is contained in:
Matthias Clasen 2017-12-15 07:44:58 -05:00
parent 1012bbeecf
commit e92c0e85ec
24 changed files with 46 additions and 46 deletions

View File

@ -1710,7 +1710,7 @@ gdk_event_triggers_context_menu (const GdkEvent *event)
display = gdk_window_get_display (bevent->any.window);
modifier = gdk_keymap_get_modifier_mask (gdk_keymap_get_for_display (display),
modifier = gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
GDK_MODIFIER_INTENT_CONTEXT_MENU);
if (modifier != 0 &&

View File

@ -60,7 +60,7 @@
* # Groups # {#key-group-explanation}
*
* One #GdkKeymap object exists for each user display. To obtain keymaps for
* a display, use gdk_keymap_get_for_display(). A keymap is a mapping from
* a display, use gdk_display_get_keymap(). A keymap is a mapping from
* #GdkKeymapKey to key values. You can think of a #GdkKeymapKey as a
* representation of a symbol printed on a physical keyboard key. That is, it
* contains three pieces of information. First, it contains the hardware keycode;

View File

@ -907,7 +907,7 @@ gdk_keyval_to_unicode (guint keyval)
if (GDK_IS_WIN32_DISPLAY (gdk_display_get_default ()) &&
keyval == 0xffae)
{
GdkWin32Keymap *keymap = GDK_WIN32_KEYMAP (gdk_keymap_get_for_display (gdk_display_get_default ()));
GdkWin32Keymap *keymap = GDK_WIN32_KEYMAP (gdk_display_get_keymap (gdk_display_get_default ()));
return (guint32) _gdk_win32_keymap_get_decimal_mark (keymap);
}

View File

@ -301,7 +301,7 @@ handle_key_event (GdkWindow *window, const MirInputEvent *event)
_gdk_mir_window_impl_get_cursor_state (impl, NULL, NULL, NULL, &button_state);
modifier_state = get_modifier_state (mir_keyboard_event_modifiers (keyboard_event), button_state);
keymap = gdk_keymap_get_for_display (gdk_window_get_display (window));
keymap = gdk_display_get_keymap (gdk_window_get_display (window));
generate_key_event (window,
mir_keyboard_event_action (keyboard_event) == mir_keyboard_action_up ? GDK_KEY_RELEASE : GDK_KEY_PRESS,

View File

@ -1136,7 +1136,7 @@ fill_key_event (GdkWindow *window,
gdk_event_set_device (event, device_manager->core_keyboard);
gdk_event_set_seat (event, gdk_device_get_seat (device_manager->core_keyboard));
gdk_keymap_translate_keyboard_state (gdk_keymap_get_for_display (_gdk_display),
gdk_keymap_translate_keyboard_state (gdk_display_get_keymap (_gdk_display),
event->key.hardware_keycode,
event->key.state,
event->key.group,
@ -1190,7 +1190,7 @@ fill_key_event (GdkWindow *window,
* mapped to. Since we only have one virtual modifier in the quartz
* backend, calling the standard function will do.
*/
gdk_keymap_add_virtual_modifiers (gdk_keymap_get_for_display (_gdk_display),
gdk_keymap_add_virtual_modifiers (gdk_display_get_keymap (_gdk_display),
&event->key.state);
event->key.string = NULL;

View File

@ -193,7 +193,7 @@ translate_key_event (GdkDisplay *display,
GdkEvent *event,
const XEvent *xevent)
{
GdkKeymap *keymap = gdk_keymap_get_for_display (display);
GdkKeymap *keymap = gdk_display_get_keymap (display);
GdkModifierType consumed, state;
event->any.type = xevent->xany.type == KeyPress ? GDK_KEY_PRESS : GDK_KEY_RELEASE;

View File

@ -1406,7 +1406,7 @@ gdk_x11_device_manager_xi2_translate_event (GdkEventTranslator *translator,
case XI_KeyRelease:
{
XIDeviceEvent *xev = (XIDeviceEvent *) ev;
GdkKeymap *keymap = gdk_keymap_get_for_display (display);
GdkKeymap *keymap = gdk_display_get_keymap (display);
GdkModifierType consumed, state;
GDK_NOTE (EVENTS,

View File

@ -1416,7 +1416,7 @@ gdk_x11_keymap_get_group_for_state (GdkKeymap *keymap,
else
#endif
{
GdkX11Keymap *keymap_impl = GDK_X11_KEYMAP (gdk_keymap_get_for_display (display));
GdkX11Keymap *keymap_impl = GDK_X11_KEYMAP (gdk_display_get_keymap (display));
update_keymaps (keymap_impl);
return (state & keymap_impl->group_switch_mask) ? 1 : 0;
}

View File

@ -1361,7 +1361,7 @@ gtk_accelerator_parse_with_keycode (const gchar *accelerator,
if (keyval && accelerator_codes != NULL)
{
GdkKeymap *keymap = gdk_keymap_get_for_display (gdk_display_get_default ());
GdkKeymap *keymap = gdk_display_get_keymap (gdk_display_get_default ());
GdkKeymapKey *keys;
gint n_keys, i, j;
@ -1483,7 +1483,7 @@ gtk_accelerator_name_with_keycode (GdkDisplay *display,
if (display == NULL)
display = gdk_display_manager_get_default_display (gdk_display_manager_get ());
gdk_keymap_add_virtual_modifiers (gdk_keymap_get_for_display (display), &accelerator_mods);
gdk_keymap_add_virtual_modifiers (gdk_display_get_keymap (display), &accelerator_mods);
gtk_name = gtk_accelerator_name (accelerator_key, accelerator_mods);
if (!accelerator_key)
@ -1670,7 +1670,7 @@ gtk_accelerator_get_label_with_keycode (GdkDisplay *display,
if (display == NULL)
display = gdk_display_manager_get_default_display (gdk_display_manager_get ());
gdk_keymap_add_virtual_modifiers (gdk_keymap_get_for_display (display), &accelerator_mods);
gdk_keymap_add_virtual_modifiers (gdk_display_get_keymap (display), &accelerator_mods);
gtk_label = gtk_accelerator_get_label (accelerator_key, accelerator_mods);
if (!accelerator_key)
@ -1759,7 +1759,7 @@ 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_keymap_get_for_display (display),
gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
GDK_MODIFIER_INTENT_DEFAULT_MOD_MASK);
}

View File

@ -1554,7 +1554,7 @@ gtk_bindings_activate (GObject *object,
modifiers = modifiers & BINDING_MOD_MASK () & ~GDK_RELEASE_MASK;
display = gtk_widget_get_display (GTK_WIDGET (object));
key_hash = binding_key_hash_for_keymap (gdk_keymap_get_for_display (display));
key_hash = binding_key_hash_for_keymap (gdk_display_get_keymap (display));
entries = _gtk_key_hash_lookup_keyval (key_hash, keyval, modifiers);
@ -1593,7 +1593,7 @@ gtk_bindings_activate_event (GObject *object,
return FALSE;
display = gtk_widget_get_display (GTK_WIDGET (object));
key_hash = binding_key_hash_for_keymap (gdk_keymap_get_for_display (display));
key_hash = binding_key_hash_for_keymap (gdk_display_get_keymap (display));
gdk_event_get_keycode ((GdkEvent *)event, &keycode);
gdk_event_get_state ((GdkEvent *)event, &state);

View File

@ -589,7 +589,7 @@ gtk_cell_editable_widget_key_press_event (GtkWidget *widget,
}
else
{
_gtk_translate_keyboard_accel_state (gdk_keymap_get_for_display (display),
_gtk_translate_keyboard_accel_state (gdk_display_get_keymap (display),
keycode,
state,
gtk_accelerator_get_default_mod_mask (),

View File

@ -2768,7 +2768,7 @@ gtk_entry_dispose (GObject *object)
priv->buffer = NULL;
}
keymap = gdk_keymap_get_for_display (gtk_widget_get_display (GTK_WIDGET (object)));
keymap = gdk_display_get_keymap (gtk_widget_get_display (GTK_WIDGET (object)));
g_signal_handlers_disconnect_by_func (keymap, keymap_state_changed, entry);
g_signal_handlers_disconnect_by_func (keymap, keymap_direction_changed, entry);
G_OBJECT_CLASS (gtk_entry_parent_class)->dispose (object);
@ -4250,7 +4250,7 @@ gtk_entry_focus_in (GtkWidget *widget,
gtk_widget_queue_draw (widget);
keymap = gdk_keymap_get_for_display (gtk_widget_get_display (widget));
keymap = gdk_display_get_keymap (gtk_widget_get_display (widget));
if (priv->editable)
{
@ -4295,7 +4295,7 @@ gtk_entry_focus_out (GtkWidget *widget,
gtk_widget_queue_draw (widget);
keymap = gdk_keymap_get_for_display (gtk_widget_get_display (widget));
keymap = gdk_display_get_keymap (gtk_widget_get_display (widget));
if (priv->editable)
{
@ -4846,7 +4846,7 @@ get_better_cursor_x (GtkEntry *entry,
gint offset)
{
GtkEntryPrivate *priv = entry->priv;
GdkKeymap *keymap = gdk_keymap_get_for_display (gtk_widget_get_display (GTK_WIDGET (entry)));
GdkKeymap *keymap = gdk_display_get_keymap (gtk_widget_get_display (GTK_WIDGET (entry)));
PangoDirection keymap_direction = gdk_keymap_get_direction (keymap);
gboolean split_cursor;
@ -5701,7 +5701,7 @@ gtk_entry_create_layout (GtkEntry *entry,
if (gtk_widget_has_focus (widget))
{
GdkDisplay *display = gtk_widget_get_display (widget);
GdkKeymap *keymap = gdk_keymap_get_for_display (display);
GdkKeymap *keymap = gdk_display_get_keymap (display);
if (gdk_keymap_get_direction (keymap) == PANGO_DIRECTION_RTL)
pango_dir = PANGO_DIRECTION_RTL;
else
@ -6372,7 +6372,7 @@ gtk_entry_move_visually (GtkEntry *entry,
strong = TRUE;
else
{
GdkKeymap *keymap = gdk_keymap_get_for_display (gtk_widget_get_display (GTK_WIDGET (entry)));
GdkKeymap *keymap = gdk_display_get_keymap (gtk_widget_get_display (GTK_WIDGET (entry)));
PangoDirection keymap_direction = gdk_keymap_get_direction (keymap);
strong = keymap_direction == priv->resolved_dir;

View File

@ -3007,9 +3007,9 @@ gtk_flow_box_add_move_binding (GtkBindingSet *binding_set,
display = gdk_display_get_default ();
if (display)
{
extend_mod_mask = gdk_keymap_get_modifier_mask (gdk_keymap_get_for_display (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_keymap_get_for_display (display),
modify_mod_mask = gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
GDK_MODIFIER_INTENT_MODIFY_SELECTION);
}

View File

@ -1096,7 +1096,7 @@ static guint
canonical_hex_keyval (GdkEventKey *event)
{
GdkWindow *window = gdk_event_get_window ((GdkEvent *) event);
GdkKeymap *keymap = gdk_keymap_get_for_display (gdk_window_get_display (window));
GdkKeymap *keymap = gdk_display_get_keymap (gdk_window_get_display (window));
guint keyval, event_keyval;
guint *keyvals = NULL;
gint n_vals = 0;
@ -1157,7 +1157,7 @@ gtk_im_context_simple_filter_keypress (GtkIMContext *context,
GtkIMContextSimplePrivate *priv = context_simple->priv;
GdkWindow *window = gdk_event_get_window ((GdkEvent *) event);
GdkDisplay *display = gdk_window_get_display (window);
GdkKeymap *keymap = gdk_keymap_get_for_display (display);
GdkKeymap *keymap = gdk_display_get_keymap (display);
GSList *tmp_list;
int n_compose = 0;
GdkModifierType hex_mod_mask;

View File

@ -366,7 +366,7 @@ gtk_im_multicontext_filter_keypress (GtkIMContext *context,
display = gdk_window_get_display (gdk_event_get_window ((GdkEvent *) event));
no_text_input_mask =
gdk_keymap_get_modifier_mask (gdk_keymap_get_for_display (display),
gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
GDK_MODIFIER_INTENT_NO_TEXT_INPUT);
if (gdk_event_get_event_type ((GdkEvent *) event) == GDK_KEY_PRESS &&

View File

@ -5647,7 +5647,7 @@ get_better_cursor (GtkLabel *label,
gint *y)
{
GtkLabelPrivate *priv = gtk_label_get_instance_private (label);
GdkKeymap *keymap = gdk_keymap_get_for_display (gtk_widget_get_display (GTK_WIDGET (label)));
GdkKeymap *keymap = gdk_display_get_keymap (gtk_widget_get_display (GTK_WIDGET (label)));
PangoDirection keymap_direction = gdk_keymap_get_direction (keymap);
PangoDirection cursor_direction = get_cursor_direction (label);
gboolean split_cursor;
@ -5753,7 +5753,7 @@ gtk_label_move_visually (GtkLabel *label,
strong = TRUE;
else
{
GdkKeymap *keymap = gdk_keymap_get_for_display (gtk_widget_get_display (GTK_WIDGET (label)));
GdkKeymap *keymap = gdk_display_get_keymap (gtk_widget_get_display (GTK_WIDGET (label)));
PangoDirection keymap_direction = gdk_keymap_get_direction (keymap);
strong = keymap_direction == get_cursor_direction (label);

View File

@ -1415,9 +1415,9 @@ gtk_list_box_add_move_binding (GtkBindingSet *binding_set,
display = gdk_display_get_default ();
if (display)
{
extend_mod_mask = gdk_keymap_get_modifier_mask (gdk_keymap_get_for_display (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_keymap_get_for_display (display),
modify_mod_mask = gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
GDK_MODIFIER_INTENT_MODIFY_SELECTION);
}

View File

@ -1528,7 +1528,7 @@ gtk_menu_shell_get_key_hash (GtkMenuShell *menu_shell,
if (!priv->key_hash && create)
{
GtkMnemonicHash *mnemonic_hash = gtk_menu_shell_get_mnemonic_hash (menu_shell, FALSE);
GdkKeymap *keymap = gdk_keymap_get_for_display (gtk_widget_get_display (widget));
GdkKeymap *keymap = gdk_display_get_keymap (gtk_widget_get_display (widget));
if (!mnemonic_hash)
return NULL;

View File

@ -196,9 +196,9 @@ _gtk_get_primary_accel_mod (void)
{
GdkDisplay *display = gdk_display_get_default ();
primary = gdk_keymap_get_modifier_mask (gdk_keymap_get_for_display (display),
primary = gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR);
primary = _gtk_replace_virtual_modifiers (gdk_keymap_get_for_display (display),
primary = _gtk_replace_virtual_modifiers (gdk_display_get_keymap (display),
primary);
}

View File

@ -1907,7 +1907,7 @@ gtk_render_insertion_cursor (GtkStyleContext *context,
"gtk-split-cursor", &split_cursor,
NULL);
keymap_direction = gdk_keymap_get_direction (gdk_keymap_get_for_display (priv->display));
keymap_direction = gdk_keymap_get_direction (gdk_display_get_keymap (priv->display));
pango_layout_get_cursor_pos (layout, index, &strong_pos, &weak_pos);
@ -1992,7 +1992,7 @@ gtk_snapshot_render_insertion_cursor (GtkSnapshot *snapshot,
"gtk-split-cursor", &split_cursor,
NULL);
keymap_direction = gdk_keymap_get_direction (gdk_keymap_get_for_display (priv->display));
keymap_direction = gdk_keymap_get_direction (gdk_display_get_keymap (priv->display));
pango_layout_get_cursor_pos (layout, index, &strong_pos, &weak_pos);

View File

@ -5402,7 +5402,7 @@ gtk_text_view_focus_in_event (GtkWidget *widget, GdkEventFocus *event)
gtk_text_view_check_cursor_blink (text_view);
}
g_signal_connect (gdk_keymap_get_for_display (gtk_widget_get_display (widget)),
g_signal_connect (gdk_display_get_keymap (gtk_widget_get_display (widget)),
"direction-changed",
G_CALLBACK (keymap_direction_changed), text_view);
gtk_text_view_check_keymap_direction (text_view);
@ -5437,7 +5437,7 @@ gtk_text_view_focus_out_event (GtkWidget *widget, GdkEventFocus *event)
gtk_text_layout_set_cursor_visible (priv->layout, FALSE);
}
g_signal_handlers_disconnect_by_func (gdk_keymap_get_for_display (gtk_widget_get_display (widget)),
g_signal_handlers_disconnect_by_func (gdk_display_get_keymap (gtk_widget_get_display (widget)),
keymap_direction_changed,
text_view);
gtk_text_view_selection_bubble_popup_unset (text_view);
@ -7532,7 +7532,7 @@ 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_keymap_get_for_display (gtk_widget_get_display (GTK_WIDGET (text_view)));
GdkKeymap *keymap = gdk_display_get_keymap (gtk_widget_get_display (GTK_WIDGET (text_view)));
GtkTextDirection new_cursor_dir;
GtkTextDirection new_keyboard_dir;
gboolean split_cursor;

View File

@ -13696,7 +13696,7 @@ gtk_widget_get_modifier_mask (GtkWidget *widget,
display = gtk_widget_get_display (widget);
return gdk_keymap_get_modifier_mask (gdk_keymap_get_for_display (display),
return gdk_keymap_get_modifier_mask (gdk_display_get_keymap (display),
intent);
}

View File

@ -10313,7 +10313,7 @@ gtk_window_get_key_hash (GtkWindow *window)
if (key_hash)
return key_hash;
key_hash = _gtk_key_hash_new (gdk_keymap_get_for_display (window->priv->display),
key_hash = _gtk_key_hash_new (gdk_display_get_keymap (window->priv->display),
(GDestroyNotify)window_key_entry_destroy);
_gtk_window_keys_foreach (window, add_to_key_hash, key_hash);
g_object_set_qdata (G_OBJECT (window), quark_gtk_window_key_hash, key_hash);

View File

@ -36,7 +36,7 @@ test_basic (void)
GtkKeyHash *hash;
GSList *keys;
keymap = gdk_keymap_get_for_display (gdk_display_get_default ());
keymap = gdk_display_get_keymap (gdk_display_get_default ());
count = 0;
hash = _gtk_key_hash_new (keymap, counting_destroy);
@ -78,7 +78,7 @@ test_lookup (GtkKeyHash *hash,
GdkKeymapKey *keys;
gint n_keys;
keymap = gdk_keymap_get_for_display (gdk_display_get_default ());
keymap = gdk_display_get_keymap (gdk_display_get_default ());
gdk_keymap_get_entries_for_keyval (keymap, keyval, &keys, &n_keys);
if (n_keys == 0)
@ -130,7 +130,7 @@ test_match (void)
{ 0, 0 }
};
keymap = gdk_keymap_get_for_display (gdk_display_get_default ());
keymap = gdk_display_get_keymap (gdk_display_get_default ());
hash = _gtk_key_hash_new (keymap, NULL);
add_entries (hash, entries);
@ -150,7 +150,7 @@ hyper_equals_super (void)
GdkKeymap *keymap;
GdkModifierType mods1, mods2;
keymap = gdk_keymap_get_for_display (gdk_display_get_default ());
keymap = gdk_display_get_keymap (gdk_display_get_default ());
mods1 = GDK_HYPER_MASK;
gdk_keymap_map_virtual_modifiers (keymap, &mods1);
@ -175,7 +175,7 @@ test_virtual (void)
{ 0, 0 }
};
keymap = gdk_keymap_get_for_display (gdk_display_get_default ());
keymap = gdk_display_get_keymap (gdk_display_get_default ());
hash = _gtk_key_hash_new (keymap, NULL);
add_entries (hash, entries);