diff options
author | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2018-03-19 19:55:58 +0100 |
---|---|---|
committer | Jörg Frings-Fürst <debian@jff-webhosting.net> | 2018-03-19 19:55:58 +0100 |
commit | d1a8285f818eb7e5c3d6a05709ea21a808490b8c (patch) | |
tree | 326578f0505cbed07cfe60de530022822dc237ac /app/wlib/gtklib/menu.c | |
parent | 16e9630b79f0a7a90c6cedb6781175bb8b337dc1 (diff) |
New upstream version 5.1.0upstream/5.1.0
Diffstat (limited to 'app/wlib/gtklib/menu.c')
-rw-r--r-- | app/wlib/gtklib/menu.c | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/app/wlib/gtklib/menu.c b/app/wlib/gtklib/menu.c index fb115a3..d19805a 100644 --- a/app/wlib/gtklib/menu.c +++ b/app/wlib/gtklib/menu.c @@ -32,6 +32,7 @@ #include <gtk/gtk.h> #include <gdk/gdk.h> +#include <gdk/gdkkeysyms.h> #include "gtkint.h" #include "i18n.h" @@ -237,7 +238,14 @@ static wMenuItem_p createMenuItem( return mi; } - +/** + * Add a accelerator key to a widget + * + * @param w IN unused(?) + * @param menu IN unused(?) + * @param menu_item IN owning widget + * @param acclKey IN the accelerator key + */ static void setAcclKey( wWin_p w, GtkWidget * menu, GtkWidget * menu_item, int acclKey ) { int mask; @@ -262,19 +270,12 @@ static void setAcclKey( wWin_p w, GtkWidget * menu, GtkWidget * menu_item, int a mask = 0; if (acclKey) { - int len; - char acclStr[40]; - len = 0; if (acclKey&WALT) { mask |= GDK_MOD1_MASK; - strcpy( acclStr+len, "Meta+" ); - len += 5; } if (acclKey&WSHIFT) { mask |= GDK_SHIFT_MASK; - strcpy( acclStr+len, "Shift+" ); - len += 6; switch ( (acclKey&0xFF) ) { case '0': acclKey += ')'-'0'; break; case '1': acclKey += '!'-'1'; break; @@ -302,11 +303,7 @@ static void setAcclKey( wWin_p w, GtkWidget * menu, GtkWidget * menu_item, int a } if (acclKey&WCTL) { mask |= GDK_CONTROL_MASK; - strcpy( acclStr+len, "Ctrl+" ); - len += 5; } - acclStr[len++] = (acclKey & 0xFF); - acclStr[len++] = '\0'; gtk_widget_add_accelerator( menu_item, "activate", (isalpha(acclKey&0xFF)?accel_alpha_group:accel_nonalpha_group), toupper(acclKey&0xFF), mask, GTK_ACCEL_VISIBLE|GTK_ACCEL_LOCKED ); |