diff options
author | Pavel Cisler <pavel@eazel.com> | 2000-08-07 19:37:05 +0000 |
---|---|---|
committer | Pavel Cisler <pce@src.gnome.org> | 2000-08-07 19:37:05 +0000 |
commit | d2c7944a7eec56cdf5ca80f418e3efc47aa72dd9 (patch) | |
tree | 45a86b5c9092c01cad72595f25365b22e20027d8 | |
parent | 45bdc495d223661f2f89f932733089461e621b3e (diff) | |
download | nautilus-d2c7944a7eec56cdf5ca80f418e3efc47aa72dd9.tar.gz |
Fix bug 1941 -- Context menus need to be clicked twice.
2000-08-07 Pavel Cisler <pavel@eazel.com>
Fix bug 1941 -- Context menus need to be clicked twice.
* libnautilus-extensions/nautilus-gtk-extensions.c:
(nautilus_pop_up_context_menu):
* libnautilus-extensions/nautilus-gtk-extensions.h:
When invoked from anywhere but the button_press call, we need to
pass 0 for button otherwise the next click will not be handled.
Add a way to pass the button as a parameter.
* src/file-manager/fm-directory-view.c:
(fm_directory_view_pop_up_selection_context_menu),
(fm_directory_view_pop_up_background_context_menu):
Pass 0 for button
* src/nautilus-sidebar.c: (nautilus_sidebar_press_event):
* src/nautilus-window-toolbars.c:
(back_or_forward_button_clicked_callback):
Called from button_press, pass the actual button.
-rw-r--r-- | ChangeLog | 21 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-gtk-extensions.c | 18 | ||||
-rw-r--r-- | libnautilus-extensions/nautilus-gtk-extensions.h | 4 | ||||
-rw-r--r-- | libnautilus-private/nautilus-gtk-extensions.c | 18 | ||||
-rw-r--r-- | libnautilus-private/nautilus-gtk-extensions.h | 4 | ||||
-rw-r--r-- | src/file-manager/fm-directory-view.c | 6 | ||||
-rw-r--r-- | src/nautilus-information-panel.c | 3 | ||||
-rw-r--r-- | src/nautilus-sidebar.c | 3 | ||||
-rw-r--r-- | src/nautilus-window-toolbars.c | 6 |
9 files changed, 58 insertions, 25 deletions
@@ -1,3 +1,24 @@ +2000-08-07 Pavel Cisler <pavel@eazel.com> + + Fix bug 1941 -- Context menus need to be clicked twice. + + * libnautilus-extensions/nautilus-gtk-extensions.c: + (nautilus_pop_up_context_menu): + * libnautilus-extensions/nautilus-gtk-extensions.h: + When invoked from anywhere but the button_press call, we need to + pass 0 for button otherwise the next click will not be handled. + Add a way to pass the button as a parameter. + + * src/file-manager/fm-directory-view.c: + (fm_directory_view_pop_up_selection_context_menu), + (fm_directory_view_pop_up_background_context_menu): + Pass 0 for button + + * src/nautilus-sidebar.c: (nautilus_sidebar_press_event): + * src/nautilus-window-toolbars.c: + (back_or_forward_button_clicked_callback): + Called from button_press, pass the actual button. + 2000-08-07 John Sullivan <sullivan@eazel.com> Fixed bug 1422 (dropping an icon at the edge doesn't update diff --git a/libnautilus-extensions/nautilus-gtk-extensions.c b/libnautilus-extensions/nautilus-gtk-extensions.c index 790da26f7..664bca8c4 100644 --- a/libnautilus-extensions/nautilus-gtk-extensions.c +++ b/libnautilus-extensions/nautilus-gtk-extensions.c @@ -369,23 +369,27 @@ nautilus_popup_menu_position_func (GtkMenu *menu, /** * nautilus_pop_up_context_menu: * - * Pop up a context menu under the mouse. This assumes that - * a mouse down event just occurred, with the 3rd button pressed. - * (Context menus only appear with the 3rd mouse button, by UI - * convention.) The menu is sunk after use, so it will be destroyed - * unless the caller first ref'ed it. + * Pop up a context menu under the mouse. + * The menu is sunk after use, so it will be destroyed unless the + * caller first ref'ed it. * * This function is more of a helper function than a gtk extension, * so perhaps it belongs in a different file. * + * When calling from a callback other than button_press, make sure to pass + * 0 for button because otherwise the first button click after the button came + * up would not be handled properly (a subtle fragility of gtk_menu_popup). + * * @menu: The menu to pop up under the mouse. * @offset_x: Number of pixels to displace the popup menu vertically * @offset_y: Number of pixels to displace the popup menu horizontally + * @button: current button if called from button_press. **/ void nautilus_pop_up_context_menu (GtkMenu *menu, gint16 offset_x, - gint16 offset_y) + gint16 offset_y, + int button) { GdkPoint offset; @@ -403,7 +407,7 @@ nautilus_pop_up_context_menu (GtkMenu *menu, NULL, /* parent_menu_item */ nautilus_popup_menu_position_func, /* func */ &offset, /* data */ - 3, /* button */ + button, /* button */ GDK_CURRENT_TIME); /* activate_time */ gtk_object_sink (GTK_OBJECT(menu)); diff --git a/libnautilus-extensions/nautilus-gtk-extensions.h b/libnautilus-extensions/nautilus-gtk-extensions.h index acdcc448c..108414f93 100644 --- a/libnautilus-extensions/nautilus-gtk-extensions.h +++ b/libnautilus-extensions/nautilus-gtk-extensions.h @@ -96,8 +96,8 @@ void nautilus_gtk_selection_data_free_deep (GtkSelectionData /* GtkMenu */ void nautilus_pop_up_context_menu (GtkMenu *menu, gint16 offset_x, - gint16 offset_y); - + gint16 offset_y, + int button); /* GtkStyle */ void nautilus_gtk_style_set_font (GtkStyle *style, GdkFont *font); diff --git a/libnautilus-private/nautilus-gtk-extensions.c b/libnautilus-private/nautilus-gtk-extensions.c index 790da26f7..664bca8c4 100644 --- a/libnautilus-private/nautilus-gtk-extensions.c +++ b/libnautilus-private/nautilus-gtk-extensions.c @@ -369,23 +369,27 @@ nautilus_popup_menu_position_func (GtkMenu *menu, /** * nautilus_pop_up_context_menu: * - * Pop up a context menu under the mouse. This assumes that - * a mouse down event just occurred, with the 3rd button pressed. - * (Context menus only appear with the 3rd mouse button, by UI - * convention.) The menu is sunk after use, so it will be destroyed - * unless the caller first ref'ed it. + * Pop up a context menu under the mouse. + * The menu is sunk after use, so it will be destroyed unless the + * caller first ref'ed it. * * This function is more of a helper function than a gtk extension, * so perhaps it belongs in a different file. * + * When calling from a callback other than button_press, make sure to pass + * 0 for button because otherwise the first button click after the button came + * up would not be handled properly (a subtle fragility of gtk_menu_popup). + * * @menu: The menu to pop up under the mouse. * @offset_x: Number of pixels to displace the popup menu vertically * @offset_y: Number of pixels to displace the popup menu horizontally + * @button: current button if called from button_press. **/ void nautilus_pop_up_context_menu (GtkMenu *menu, gint16 offset_x, - gint16 offset_y) + gint16 offset_y, + int button) { GdkPoint offset; @@ -403,7 +407,7 @@ nautilus_pop_up_context_menu (GtkMenu *menu, NULL, /* parent_menu_item */ nautilus_popup_menu_position_func, /* func */ &offset, /* data */ - 3, /* button */ + button, /* button */ GDK_CURRENT_TIME); /* activate_time */ gtk_object_sink (GTK_OBJECT(menu)); diff --git a/libnautilus-private/nautilus-gtk-extensions.h b/libnautilus-private/nautilus-gtk-extensions.h index acdcc448c..108414f93 100644 --- a/libnautilus-private/nautilus-gtk-extensions.h +++ b/libnautilus-private/nautilus-gtk-extensions.h @@ -96,8 +96,8 @@ void nautilus_gtk_selection_data_free_deep (GtkSelectionData /* GtkMenu */ void nautilus_pop_up_context_menu (GtkMenu *menu, gint16 offset_x, - gint16 offset_y); - + gint16 offset_y, + int button); /* GtkStyle */ void nautilus_gtk_style_set_font (GtkStyle *style, GdkFont *font); diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index 2de6eb7ad..eeb7a6e38 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -2982,7 +2982,8 @@ fm_directory_view_pop_up_selection_context_menu (FMDirectoryView *view) nautilus_pop_up_context_menu (create_selection_context_menu (view), NAUTILUS_DEFAULT_POPUP_MENU_DISPLACEMENT, - NAUTILUS_DEFAULT_POPUP_MENU_DISPLACEMENT); + NAUTILUS_DEFAULT_POPUP_MENU_DISPLACEMENT, + 0); } /** @@ -3001,7 +3002,8 @@ fm_directory_view_pop_up_background_context_menu (FMDirectoryView *view) nautilus_pop_up_context_menu (create_background_context_menu (view), NAUTILUS_DEFAULT_POPUP_MENU_DISPLACEMENT, - NAUTILUS_DEFAULT_POPUP_MENU_DISPLACEMENT); + NAUTILUS_DEFAULT_POPUP_MENU_DISPLACEMENT, + 0); } /** diff --git a/src/nautilus-information-panel.c b/src/nautilus-information-panel.c index 8d6b20ce2..deb467a14 100644 --- a/src/nautilus-information-panel.c +++ b/src/nautilus-information-panel.c @@ -928,7 +928,8 @@ nautilus_sidebar_press_event (GtkWidget *widget, GdkEventButton *event) menu = nautilus_sidebar_create_context_menu (sidebar); nautilus_pop_up_context_menu (GTK_MENU(menu), NAUTILUS_DEFAULT_POPUP_MENU_DISPLACEMENT, - NAUTILUS_DEFAULT_POPUP_MENU_DISPLACEMENT); + NAUTILUS_DEFAULT_POPUP_MENU_DISPLACEMENT, + event->button); return TRUE; } diff --git a/src/nautilus-sidebar.c b/src/nautilus-sidebar.c index 8d6b20ce2..deb467a14 100644 --- a/src/nautilus-sidebar.c +++ b/src/nautilus-sidebar.c @@ -928,7 +928,8 @@ nautilus_sidebar_press_event (GtkWidget *widget, GdkEventButton *event) menu = nautilus_sidebar_create_context_menu (sidebar); nautilus_pop_up_context_menu (GTK_MENU(menu), NAUTILUS_DEFAULT_POPUP_MENU_DISPLACEMENT, - NAUTILUS_DEFAULT_POPUP_MENU_DISPLACEMENT); + NAUTILUS_DEFAULT_POPUP_MENU_DISPLACEMENT, + event->button); return TRUE; } diff --git a/src/nautilus-window-toolbars.c b/src/nautilus-window-toolbars.c index 79889ae18..03d5a13ba 100644 --- a/src/nautilus-window-toolbars.c +++ b/src/nautilus-window-toolbars.c @@ -237,13 +237,13 @@ back_or_forward_button_clicked_callback (GtkWidget *widget, back = NAUTILUS_WINDOW (user_data)->back_button == widget; g_assert (back || NAUTILUS_WINDOW (user_data)->forward_button == widget); - if (event->button == 3) - { + if (event->button == 3) { nautilus_pop_up_context_menu ( create_back_or_forward_menu (NAUTILUS_WINDOW (user_data), back), NAUTILUS_DEFAULT_POPUP_MENU_DISPLACEMENT, - NAUTILUS_DEFAULT_POPUP_MENU_DISPLACEMENT); + NAUTILUS_DEFAULT_POPUP_MENU_DISPLACEMENT, + event->button); return TRUE; } |