[gtk/shortcuts-rebased-again: 91/145] gdk: Make gdk_keyval_name() return a const char
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/shortcuts-rebased-again: 91/145] gdk: Make gdk_keyval_name() return a const char
- Date: Sun, 23 Jun 2019 04:15:49 +0000 (UTC)
commit 4ae8daf0f58052886a6674d663fd9badfaa4da0b
Author: Benjamin Otte <otte redhat com>
Date: Mon Aug 20 06:20:05 2018 +0200
gdk: Make gdk_keyval_name() return a const char
The string is const, so return it like that.
gdk/gdkkeys.c | 2 +-
gdk/gdkkeys.h | 2 +-
gtk/a11y/gtkaccessibilityutil.c | 2 +-
gtk/gtkaccelgroup.c | 8 ++++----
gtk/gtkshortcutlabel.c | 2 +-
5 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/gdk/gdkkeys.c b/gdk/gdkkeys.c
index 50d50d2138..400c67661e 100644
--- a/gdk/gdkkeys.c
+++ b/gdk/gdkkeys.c
@@ -738,7 +738,7 @@ gdk_keymap_get_modifier_mask (GdkKeymap *keymap,
* of the key, or %NULL if @keyval is not a valid key. The string
* should not be modified.
*/
-gchar *
+const gchar *
gdk_keyval_name (guint keyval)
{
return _gdk_keyval_name (keyval);
diff --git a/gdk/gdkkeys.h b/gdk/gdkkeys.h
index d6a0f0cb19..a34dcc4b32 100644
--- a/gdk/gdkkeys.h
+++ b/gdk/gdkkeys.h
@@ -133,7 +133,7 @@ GdkModifierType gdk_keymap_get_modifier_mask (GdkKeymap *keymap,
/* Key values
*/
GDK_AVAILABLE_IN_ALL
-gchar* gdk_keyval_name (guint keyval) G_GNUC_CONST;
+const gchar*gdk_keyval_name (guint keyval) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
guint gdk_keyval_from_name (const gchar *keyval_name);
diff --git a/gtk/a11y/gtkaccessibilityutil.c b/gtk/a11y/gtkaccessibilityutil.c
index 1b840f80e1..beaae3a50e 100644
--- a/gtk/a11y/gtkaccessibilityutil.c
+++ b/gtk/a11y/gtkaccessibilityutil.c
@@ -131,7 +131,7 @@ atk_key_event_from_gdk_event_key (GdkEventKey *key,
event->state = state;
event->keyval = keyval;
- event->string = gdk_keyval_name (keyval);
+ event->string = (char *) gdk_keyval_name (keyval);
event->length = strlen (event->string);
event->keycode = keycode;
event->timestamp = gdk_event_get_time ((GdkEvent *)key);
diff --git a/gtk/gtkaccelgroup.c b/gtk/gtkaccelgroup.c
index e21647e4bb..097c872986 100644
--- a/gtk/gtkaccelgroup.c
+++ b/gtk/gtkaccelgroup.c
@@ -1418,10 +1418,10 @@ gtk_accelerator_get_label_with_keycode (GdkDisplay *display,
* so no need to be UTF-8 safe.
*/
static void
-append_without_underscores (GString *s,
- gchar *str)
+append_without_underscores (GString *s,
+ const gchar *str)
{
- gchar *p;
+ const gchar *p;
if (g_str_has_prefix (str, "XF86"))
p = str + 4;
@@ -1722,7 +1722,7 @@ gtk_accelerator_print_label (GString *gstring,
}
else if (!append_keyval_symbol (accelerator_key, gstring))
{
- gchar *tmp;
+ const gchar *tmp;
tmp = gdk_keyval_name (gdk_keyval_to_lower (accelerator_key));
if (tmp != NULL)
diff --git a/gtk/gtkshortcutlabel.c b/gtk/gtkshortcutlabel.c
index 6f0b2e39e8..c61362e7b4 100644
--- a/gtk/gtkshortcutlabel.c
+++ b/gtk/gtkshortcutlabel.c
@@ -129,7 +129,7 @@ get_labels (guint key, GdkModifierType modifier, guint *n_mods)
const gchar *labels[16];
GList *freeme = NULL;
gchar key_label[6];
- gchar *tmp;
+ const gchar *tmp;
gunichar ch;
gint i = 0;
gchar **retval;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]