Index: src_plugins/hid_gtk/ghid-main-menu.c =================================================================== --- src_plugins/hid_gtk/ghid-main-menu.c (revision 1492) +++ src_plugins/hid_gtk/ghid-main-menu.c (revision 1493) @@ -43,7 +43,6 @@ gint n_route_styles; GCallback action_cb; - void (*special_key_cb) (hid_cfg_mod_t mods, const char *accel, GtkAction * action, const lht_node_t * node); }; struct _GHidMainMenuClass { @@ -244,7 +243,6 @@ item = gtk_action_create_menu_item(action); gtk_menu_shell_append(shell, item); menu->actions = g_list_append(menu->actions, action); -// menu->special_key_cb(mods, accel, action, n_action); } /* keep npath for the hash so do not free(npath); */ @@ -351,7 +349,7 @@ * * \return a freshly-allocated GHidMainMenu */ -GtkWidget *ghid_main_menu_new(GCallback action_cb, void (*special_key_cb) (hid_cfg_mod_t mods, const char *accel, GtkAction * action, const lht_node_t * node)) +GtkWidget *ghid_main_menu_new(GCallback action_cb) { GHidMainMenu *mm = g_object_new(GHID_MAIN_MENU_TYPE, NULL); @@ -368,7 +366,6 @@ mm->layer_pick_shell = NULL; mm->route_style_shell = NULL; - mm->special_key_cb = special_key_cb; mm->action_cb = action_cb; mm->actions = NULL; mm->popup_table = g_hash_table_new(g_str_hash, g_str_equal); Index: src_plugins/hid_gtk/ghid-main-menu.h =================================================================== --- src_plugins/hid_gtk/ghid-main-menu.h (revision 1492) +++ src_plugins/hid_gtk/ghid-main-menu.h (revision 1493) @@ -20,8 +20,7 @@ typedef struct _GHidMainMenuClass GHidMainMenuClass; GType ghid_main_menu_get_type(void); -GtkWidget *ghid_main_menu_new(GCallback action_cb, - void (*special_key_cb) (hid_cfg_mod_t mods, const char *accel, GtkAction * action, const lht_node_t * node)); +GtkWidget *ghid_main_menu_new(GCallback action_cb); void ghid_main_menu_add_resource(GHidMainMenu * menu, const lht_node_t * res); GtkAccelGroup *ghid_main_menu_get_accel_group(GHidMainMenu * menu); void ghid_main_menu_update_toggle_state(GHidMainMenu * menu, Index: src_plugins/hid_gtk/gui-output-events.c =================================================================== --- src_plugins/hid_gtk/gui-output-events.c (revision 1492) +++ src_plugins/hid_gtk/gui-output-events.c (revision 1493) @@ -176,7 +176,6 @@ int slen, mods = 0; static hid_cfg_keyseq_t *seq[32]; static int seq_len = 0; - extern void ghid_hotkey_cb(int); unsigned short int kv = kev->keyval; ghid_note_event_location(NULL); Index: src_plugins/hid_gtk/gui-top-window.c =================================================================== --- src_plugins/hid_gtk/gui-top-window.c (revision 1492) +++ src_plugins/hid_gtk/gui-top-window.c (revision 1493) @@ -121,14 +121,6 @@ static gchar *bg_image_file; -static struct { - GtkAction *action; - const lht_node_t *node; -} ghid_hotkey_actions[256]; -#define N_HOTKEY_ACTIONS \ - (sizeof (ghid_hotkey_actions) / sizeof (ghid_hotkey_actions[0])) - - /*! \brief callback for ghid_main_menu_update_toggle_state () */ void menu_toggle_update_cb(GtkAction * act, const char *tflag, const char *aflag) { @@ -294,15 +286,11 @@ /*! \brief Menu action callback function * \par Function Description * This is the main menu callback function. The callback receives - * the original Resource pointer containing the HID actions to be + * the original lohata action node pointer HID actions to be * executed. * - * All hotkeys go through the menus which means they go through here. - * Some, such as tab, are caught by Gtk instead of passed here, so - * pcb calls this function directly through ghid_hotkey_cb() for them. - * * \param [in] The action that was activated - * \param [in] The related menu resource's action node + * \param [in] The related menu lht action node */ static void ghid_menu_cb(GtkAction * action, const lht_node_t * node) @@ -325,13 +313,6 @@ ghid_set_status_line_label(); } -/* \brief Accelerator callback for accelerators gtk tries to hide from us */ -void ghid_hotkey_cb(int which) -{ - if (ghid_hotkey_actions[which].action != NULL) - ghid_menu_cb(ghid_hotkey_actions[which].action, (gpointer) ghid_hotkey_actions[which].node); -} - static void update_board_mtime_from_disk(void) { GFile *file; @@ -1696,72 +1677,11 @@ REGISTER_ACTIONS(gtk_topwindow_action_list, ghid_cookie) -/* - * This function is used to check if a specified hotkey in the menu - * resource file is "special". In this case "special" means that gtk - * assigns a particular meaning to it and the normal menu setup will - * never see these key presses. We capture those and feed them back - * into the menu callbacks. This function is called as new - * accelerators are added when the menus are being built - */ -static void ghid_check_special_key(hid_cfg_mod_t mods, const char *accel, GtkAction * action, const lht_node_t * node) -{ - size_t len; - unsigned int ind; - - if (action == NULL || accel == NULL || *accel == '\0') - return; - -#ifdef DEBUG_MENUS - printf("%s(\"%s\", \"%s\")\n", __FUNCTION__, accel, name); -#endif - - len = strlen(accel); - -#define CHECK_KEY(a) ((len >= strlen (a)) && (strcmp (accel + len - strlen (a), (a)) == 0)) - - ind = 0; - if (CHECK_KEY("Tab")) { - ind = mods | GHID_KEY_TAB; - } - else if (CHECK_KEY("Up")) { - ind = mods | GHID_KEY_UP; - } - else if (CHECK_KEY("Down")) { - ind = mods | GHID_KEY_DOWN; - } - else if (CHECK_KEY("Left")) { - ind = mods | GHID_KEY_LEFT; - } - else if (CHECK_KEY("Right")) { - ind = mods | GHID_KEY_RIGHT; - } - - if (ind > 0) { - if (ind >= N_HOTKEY_ACTIONS) { - fprintf(stderr, "ERROR: overflow of the ghid_hotkey_actions array. Index = %d\n" "Please report this.\n", ind); - exit(1); - } - - ghid_hotkey_actions[ind].action = action; - ghid_hotkey_actions[ind].node = node; -#ifdef DEBUG_MENUS - printf("Adding \"special\" hotkey to ghid_hotkey_actions[%u] :" " %s (%s)\n", ind, accel, name); -#endif - } -} - static GtkWidget *ghid_load_menus(void) { const lht_node_t *mr; GtkWidget *menu_bar = NULL; int i; - - for (i = 0; i < N_HOTKEY_ACTIONS; i++) { - ghid_hotkey_actions[i].action = NULL; - ghid_hotkey_actions[i].node = NULL; - } - extern const char *hid_gtk_menu_default; ghid_cfg = hid_cfg_load("gtk", 0, hid_gtk_menu_default); @@ -1772,7 +1692,7 @@ mr = hid_cfg_get_menu(ghid_cfg, "/main_menu"); if (mr != NULL) { - menu_bar = ghid_main_menu_new(G_CALLBACK(ghid_menu_cb), ghid_check_special_key); + menu_bar = ghid_main_menu_new(G_CALLBACK(ghid_menu_cb)); ghid_main_menu_add_resource(GHID_MAIN_MENU(menu_bar), mr); }