diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-11-08 03:57:03 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-11-08 03:57:03 +0800 |
commit | c9bb2e2c7f9db1ee1a6cf684e2f51c110cfa868c (patch) | |
tree | 2c8e398728ea41745cc2eab8d6adce7d893b1fb3 /src | |
parent | cee89e85bc3e32866e9717acdde758da5150b9c0 (diff) | |
download | gsoc2013-epiphany-c9bb2e2c7f9db1ee1a6cf684e2f51c110cfa868c.tar gsoc2013-epiphany-c9bb2e2c7f9db1ee1a6cf684e2f51c110cfa868c.tar.gz gsoc2013-epiphany-c9bb2e2c7f9db1ee1a6cf684e2f51c110cfa868c.tar.bz2 gsoc2013-epiphany-c9bb2e2c7f9db1ee1a6cf684e2f51c110cfa868c.tar.lz gsoc2013-epiphany-c9bb2e2c7f9db1ee1a6cf684e2f51c110cfa868c.tar.xz gsoc2013-epiphany-c9bb2e2c7f9db1ee1a6cf684e2f51c110cfa868c.tar.zst gsoc2013-epiphany-c9bb2e2c7f9db1ee1a6cf684e2f51c110cfa868c.zip |
When popping up the context menu with keyboard, select the first menu
2004-11-07 Christian Persch <chpe@cvs.gnome.org>
* lib/ephy-gui.c: (sanitize_popup_position),
(ephy_gui_menu_position_tree_selection),
(ephy_gui_menu_position_under_widget):
* lib/ephy-gui.h:
* lib/widgets/ephy-node-view.c: (ephy_node_view_add_toggle),
(ephy_node_view_popup):
* lib/widgets/ephy-node-view.h:
* src/bookmarks/ephy-bookmark-action.c: (show_context_menu),
(popup_menu_cb), (button_press_cb):
* src/bookmarks/ephy-bookmarks-editor.c:
(ephy_bookmarks_editor_show_popup_cb),
(keyword_node_show_popup_cb):
* src/bookmarks/ephy-topic-action.c: (button_toggled_cb),
(show_context_menu), (popup_menu_cb), (button_press_cb):
* src/ephy-history-window.c: (ephy_history_window_show_popup_cb):
* src/ephy-window.c: (show_embed_popup):
When popping up the context menu with keyboard, select the first
menu item. Fixes bug #154907 (ported from HEAD).
Diffstat (limited to 'src')
-rw-r--r-- | src/bookmarks/ephy-bookmark-action.c | 21 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks-editor.c | 6 | ||||
-rw-r--r-- | src/bookmarks/ephy-topic-action.c | 53 | ||||
-rw-r--r-- | src/ephy-history-window.c | 3 | ||||
-rw-r--r-- | src/ephy-window.c | 3 |
5 files changed, 66 insertions, 20 deletions
diff --git a/src/bookmarks/ephy-bookmark-action.c b/src/bookmarks/ephy-bookmark-action.c index b97e82e82..8ef0c1163 100644 --- a/src/bookmarks/ephy-bookmark-action.c +++ b/src/bookmarks/ephy-bookmark-action.c @@ -512,7 +512,9 @@ properties_activate_cb (GtkWidget *menu, EphyBookmarkAction *action) } static void -show_context_menu (EphyBookmarkAction *action, GtkWidget *proxy, +show_context_menu (EphyBookmarkAction *action, + GtkWidget *proxy, + GdkEventButton *event, GtkMenuPositionFunc func) { GtkWidget *menu, *item; @@ -572,8 +574,17 @@ show_context_menu (EphyBookmarkAction *action, GtkWidget *proxy, g_signal_connect (item, "activate", G_CALLBACK (move_right_activate_cb), proxy); - gtk_menu_popup (GTK_MENU (menu), NULL, NULL, func, proxy, 3, - gtk_get_current_event_time ()); + if (event != NULL) + { + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, func, proxy, + event->button, event->time); + } + else + { + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, func, proxy, 0, + gtk_get_current_event_time ()); + gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE); + } } static gboolean @@ -581,7 +592,7 @@ popup_menu_cb (GtkWidget *widget, EphyBookmarkAction *action) { if (gtk_widget_get_ancestor (widget, EPHY_TYPE_BOOKMARKSBAR)) { - show_context_menu (action, widget, + show_context_menu (action, widget, NULL, ephy_gui_menu_position_under_widget); return TRUE; } @@ -597,7 +608,7 @@ button_press_cb (GtkWidget *widget, if (event->button == 3 && gtk_widget_get_ancestor (widget, EPHY_TYPE_BOOKMARKSBAR)) { - show_context_menu (action, widget, NULL); + show_context_menu (action, widget, event, NULL); return TRUE; } else if (event->button == 2) diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c index 45843ca82..cf2d7e648 100644 --- a/src/bookmarks/ephy-bookmarks-editor.c +++ b/src/bookmarks/ephy-bookmarks-editor.c @@ -1113,8 +1113,7 @@ ephy_bookmarks_editor_show_popup_cb (GtkWidget *view, widget = gtk_ui_manager_get_widget (editor->priv->ui_merge, "/EphyBookmarkEditorPopup"); - gtk_menu_popup (GTK_MENU (widget), NULL, NULL, NULL, NULL, 2, - gtk_get_current_event_time ()); + ephy_node_view_popup (EPHY_NODE_VIEW (view), widget); return TRUE; } @@ -1206,8 +1205,7 @@ keyword_node_show_popup_cb (GtkWidget *view, EphyBookmarksEditor *editor) widget = gtk_ui_manager_get_widget (editor->priv->ui_merge, "/EphyBookmarkKeywordPopup"); - gtk_menu_popup (GTK_MENU (widget), NULL, NULL, NULL, NULL, 2, - gtk_get_current_event_time ()); + ephy_node_view_popup (EPHY_NODE_VIEW (view), widget); return TRUE; } diff --git a/src/bookmarks/ephy-topic-action.c b/src/bookmarks/ephy-topic-action.c index 39fa29c2a..ec793ee9a 100644 --- a/src/bookmarks/ephy-topic-action.c +++ b/src/bookmarks/ephy-topic-action.c @@ -686,13 +686,39 @@ button_toggled_cb (GtkWidget *button, if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button))) { GtkWidget *menu; + GdkEvent *event; + guint32 event_time = 0; + guint event_button = 0; menu = build_menu (action); g_signal_connect (menu, "deactivate", G_CALLBACK (menu_deactivate_cb), button); - gtk_menu_popup (GTK_MENU (menu), NULL, NULL, - ephy_gui_menu_position_under_widget, - button, 1, gtk_get_current_event_time ()); + + event = gtk_get_current_event (); + if (event != NULL) + { + if (event->type == GDK_BUTTON_PRESS) + { + event_button = ((GdkEventButton *) event)->button; + event_time = ((GdkEventButton *) event)->time; + } + + gdk_event_free (event); + } + + if (event_button == 0) + { + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, + ephy_gui_menu_position_under_widget, + button, 0 , gtk_get_current_event_time ()); + gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE); + } + else + { + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, + ephy_gui_menu_position_under_widget, + button, event_button, event_time); + } g_object_set_data (G_OBJECT (button), "popup", menu); } @@ -728,7 +754,9 @@ create_menu_item (GtkAction *action) } static void -show_context_menu (EphyTopicAction *action, GtkWidget *proxy, +show_context_menu (EphyTopicAction *action, + GtkWidget *proxy, + GdkEventButton *event, GtkMenuPositionFunc func) { GtkWidget *menu, *item; @@ -768,8 +796,17 @@ show_context_menu (EphyTopicAction *action, GtkWidget *proxy, g_signal_connect (item, "activate", G_CALLBACK (move_right_activate_cb), proxy); - gtk_menu_popup (GTK_MENU (menu), NULL, NULL, func, proxy, 3, - gtk_get_current_event_time ()); + if (event != NULL) + { + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, func, proxy, + event->button, event->time); + } + else + { + gtk_menu_popup (GTK_MENU (menu), NULL, NULL, func, proxy, 0, + gtk_get_current_event_time ()); + gtk_menu_shell_select_first (GTK_MENU_SHELL (menu), FALSE); + } } static gboolean @@ -777,7 +814,7 @@ popup_menu_cb (GtkWidget *widget, EphyTopicAction *action) { if (gtk_widget_get_ancestor (widget, EPHY_TYPE_BOOKMARKSBAR)) { - show_context_menu (action, widget, + show_context_menu (action, widget, NULL, ephy_gui_menu_position_under_widget); return TRUE; } @@ -837,7 +874,7 @@ button_press_cb (GtkWidget *widget, else if (event->button == 3 && gtk_widget_get_ancestor (widget, EPHY_TYPE_BOOKMARKSBAR)) { - show_context_menu (action, widget, NULL); + show_context_menu (action, widget, event, NULL); return TRUE; } diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c index c75cd55b8..0a0ed14d5 100644 --- a/src/ephy-history-window.c +++ b/src/ephy-history-window.c @@ -842,8 +842,7 @@ ephy_history_window_show_popup_cb (GtkWidget *view, widget = gtk_ui_manager_get_widget (editor->priv->ui_merge, "/EphyHistoryWindowPopup"); - gtk_menu_popup (GTK_MENU (widget), NULL, NULL, NULL, NULL, 2, - gtk_get_current_event_time ()); + ephy_node_view_popup (EPHY_NODE_VIEW (view), widget); return TRUE; } diff --git a/src/ephy-window.c b/src/ephy-window.c index 9996411ec..bfb6e0855 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -1623,8 +1623,9 @@ show_embed_popup (EphyWindow *window, EphyTab *tab, EphyEmbedEvent *event) if (type == EPHY_EMBED_EVENT_KEY) { gtk_menu_popup (GTK_MENU (widget), NULL, NULL, - popup_menu_at_coords, event, 2, + popup_menu_at_coords, event, 0, gtk_get_current_event_time ()); + gtk_menu_shell_select_first (GTK_MENU_SHELL (widget), FALSE); } else { |