[gtk/wip/ebassi/shortcut: 255/267] accel: Add display arg to gtk_accelerator_parse_with_keycode()
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/ebassi/shortcut: 255/267] accel: Add display arg to gtk_accelerator_parse_with_keycode()
- Date: Thu, 6 Feb 2020 18:25:17 +0000 (UTC)
commit bc8f27601aaec27cb3a5f9e781cc1013a26f85a9
Author: Benjamin Otte <otte redhat com>
Date: Tue Aug 21 00:44:47 2018 +0200
accel: Add display arg to gtk_accelerator_parse_with_keycode()
It was using the default display unconditionally.
gtk/gtkaccelgroup.c | 6 ++++--
gtk/gtkaccelgroup.h | 1 +
testsuite/gtk/accel.c | 1 +
3 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkaccelgroup.c b/gtk/gtkaccelgroup.c
index 2b5e1dbe61..960fb326ae 100644
--- a/gtk/gtkaccelgroup.c
+++ b/gtk/gtkaccelgroup.c
@@ -912,6 +912,7 @@ is_keycode (const gchar *string)
/**
* gtk_accelerator_parse_with_keycode:
* @accelerator: string representing an accelerator
+ * @display: (allow-none): the #GdkDisplay to look up @accelerator_codes in
* @accelerator_key: (out) (allow-none): return location for accelerator
* keyval, or %NULL
* @accelerator_codes: (out) (array zero-terminated=1) (transfer full) (allow-none):
@@ -937,6 +938,7 @@ is_keycode (const gchar *string)
*/
gboolean
gtk_accelerator_parse_with_keycode (const gchar *accelerator,
+ GdkDisplay *display,
guint *accelerator_key,
guint **accelerator_codes,
GdkModifierType *accelerator_mods)
@@ -1100,7 +1102,7 @@ gtk_accelerator_parse_with_keycode (const gchar *accelerator,
if (keyval && accelerator_codes != NULL)
{
- GdkKeymap *keymap = gdk_display_get_keymap (gdk_display_get_default ());
+ GdkKeymap *keymap = gdk_display_get_keymap (display ? display : gdk_display_get_default ());
GdkKeymapKey *keys;
gint n_keys, i, j;
@@ -1193,7 +1195,7 @@ gtk_accelerator_parse (const gchar *accelerator,
guint *accelerator_key,
GdkModifierType *accelerator_mods)
{
- return gtk_accelerator_parse_with_keycode (accelerator, accelerator_key, NULL, accelerator_mods);
+ return gtk_accelerator_parse_with_keycode (accelerator, NULL, accelerator_key, NULL, accelerator_mods);
}
/**
diff --git a/gtk/gtkaccelgroup.h b/gtk/gtkaccelgroup.h
index cc5d64c58a..2efa868899 100644
--- a/gtk/gtkaccelgroup.h
+++ b/gtk/gtkaccelgroup.h
@@ -189,6 +189,7 @@ gboolean gtk_accelerator_parse (const gchar *accelerator,
GdkModifierType *accelerator_mods);
GDK_AVAILABLE_IN_ALL
gboolean gtk_accelerator_parse_with_keycode (const gchar *accelerator,
+ GdkDisplay *display,
guint *accelerator_key,
guint **accelerator_codes,
GdkModifierType *accelerator_mods);
diff --git a/testsuite/gtk/accel.c b/testsuite/gtk/accel.c
index 51e6fc7bee..c49a10e72f 100644
--- a/testsuite/gtk/accel.c
+++ b/testsuite/gtk/accel.c
@@ -29,6 +29,7 @@ test_one_accel (const char *accel,
accel_key = 0;
g_assert (gtk_accelerator_parse_with_keycode (accel,
+ gdk_display_get_default (),
&accel_key,
&keycodes,
&mods));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]