gdk: Make gdk_keyval_name() return a const char

The string is const, so return it like that.
This commit is contained in:
Benjamin Otte 2018-08-20 06:20:05 +02:00 committed by Matthias Clasen
parent 998384aa08
commit fce37b137d
5 changed files with 8 additions and 8 deletions

View File

@ -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 * of the key, or %NULL if @keyval is not a valid key. The string
* should not be modified. * should not be modified.
*/ */
gchar * const gchar *
gdk_keyval_name (guint keyval) gdk_keyval_name (guint keyval)
{ {
return _gdk_keyval_name (keyval); return _gdk_keyval_name (keyval);

View File

@ -133,7 +133,7 @@ GdkModifierType gdk_keymap_get_modifier_mask (GdkKeymap *keymap,
/* Key values /* Key values
*/ */
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
gchar* gdk_keyval_name (guint keyval) G_GNUC_CONST; const char *gdk_keyval_name (guint keyval) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
guint gdk_keyval_from_name (const gchar *keyval_name); guint gdk_keyval_from_name (const gchar *keyval_name);

View File

@ -131,7 +131,7 @@ atk_key_event_from_gdk_event_key (GdkEventKey *key,
event->state = state; event->state = state;
event->keyval = keyval; event->keyval = keyval;
event->string = gdk_keyval_name (keyval); event->string = (char *) gdk_keyval_name (keyval);
event->length = strlen (event->string); event->length = strlen (event->string);
event->keycode = keycode; event->keycode = keycode;
event->timestamp = gdk_event_get_time ((GdkEvent *)key); event->timestamp = gdk_event_get_time ((GdkEvent *)key);

View File

@ -574,10 +574,10 @@ find_accel (GtkAccelKey *key,
* so no need to be UTF-8 safe. * so no need to be UTF-8 safe.
*/ */
static void static void
append_without_underscores (GString *s, append_without_underscores (GString *s,
gchar *str) const char *str)
{ {
gchar *p; const char *p;
if (g_str_has_prefix (str, "XF86")) if (g_str_has_prefix (str, "XF86"))
p = str + 4; p = str + 4;
@ -816,7 +816,7 @@ _gtk_accel_label_class_get_accelerator_label (GtkAccelLabelClass *klass,
} }
else if (!append_keyval_symbol (accelerator_key, gstring)) else if (!append_keyval_symbol (accelerator_key, gstring))
{ {
gchar *tmp; const char *tmp;
tmp = gdk_keyval_name (gdk_keyval_to_lower (accelerator_key)); tmp = gdk_keyval_name (gdk_keyval_to_lower (accelerator_key));
if (tmp != NULL) if (tmp != NULL)

View File

@ -130,7 +130,7 @@ get_labels (guint key, GdkModifierType modifier, guint *n_mods)
const gchar *labels[16]; const gchar *labels[16];
GList *freeme = NULL; GList *freeme = NULL;
gchar key_label[6]; gchar key_label[6];
gchar *tmp; const gchar *tmp;
gunichar ch; gunichar ch;
gint i = 0; gint i = 0;
gchar **retval; gchar **retval;