Fix the stay up algorithm for combo boxes to better handle the "click"

Wed Jun  2 01:56:02 2004  Soeren Sandmann  <sandmann@daimi.au.dk>

        * gtk/gtkmenu.c: Fix the stay up algorithm for combo boxes to
        better handle the "click" case. bug  Better fix for #141169.
This commit is contained in:
Soeren Sandmann 2004-06-02 23:17:21 +00:00 committed by Søren Sandmann Pedersen
parent 02039ad7e0
commit 64bb108e2b
5 changed files with 51 additions and 18 deletions

View File

@ -1,3 +1,8 @@
Wed Jun 2 01:56:02 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkmenu.c: Fix the stay up algorithm for combo boxes to
better handle the "click" case. bug Better fix for #141169.
2004-06-02 Federico Mena Quintero <federico@ximian.com> 2004-06-02 Federico Mena Quintero <federico@ximian.com>
* gtk/gtktreeview.c (gtk_tree_view_search_init): Bail out if the * gtk/gtktreeview.c (gtk_tree_view_search_init): Bail out if the
@ -59,6 +64,8 @@ Tue Jun 1 22:19:55 2004 Matthias Clasen <maclas@gmx.de>
Wed Jun 2 00:39:58 2004 Soeren Sandmann <sandmann@daimi.au.dk> Wed Jun 2 00:39:58 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Bug #141169.
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): Make menus * gtk/gtkmenushell.c (gtk_menu_shell_button_release): Make menus
only stay up if you release within 500 milliseconds. only stay up if you release within 500 milliseconds.
(gtk_menu_shell_button_press): Set the activate_time to the event (gtk_menu_shell_button_press): Set the activate_time to the event

View File

@ -1,3 +1,8 @@
Wed Jun 2 01:56:02 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkmenu.c: Fix the stay up algorithm for combo boxes to
better handle the "click" case. bug Better fix for #141169.
2004-06-02 Federico Mena Quintero <federico@ximian.com> 2004-06-02 Federico Mena Quintero <federico@ximian.com>
* gtk/gtktreeview.c (gtk_tree_view_search_init): Bail out if the * gtk/gtktreeview.c (gtk_tree_view_search_init): Bail out if the
@ -59,6 +64,8 @@ Tue Jun 1 22:19:55 2004 Matthias Clasen <maclas@gmx.de>
Wed Jun 2 00:39:58 2004 Soeren Sandmann <sandmann@daimi.au.dk> Wed Jun 2 00:39:58 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Bug #141169.
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): Make menus * gtk/gtkmenushell.c (gtk_menu_shell_button_release): Make menus
only stay up if you release within 500 milliseconds. only stay up if you release within 500 milliseconds.
(gtk_menu_shell_button_press): Set the activate_time to the event (gtk_menu_shell_button_press): Set the activate_time to the event

View File

@ -1,3 +1,8 @@
Wed Jun 2 01:56:02 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkmenu.c: Fix the stay up algorithm for combo boxes to
better handle the "click" case. bug Better fix for #141169.
2004-06-02 Federico Mena Quintero <federico@ximian.com> 2004-06-02 Federico Mena Quintero <federico@ximian.com>
* gtk/gtktreeview.c (gtk_tree_view_search_init): Bail out if the * gtk/gtktreeview.c (gtk_tree_view_search_init): Bail out if the
@ -59,6 +64,8 @@ Tue Jun 1 22:19:55 2004 Matthias Clasen <maclas@gmx.de>
Wed Jun 2 00:39:58 2004 Soeren Sandmann <sandmann@daimi.au.dk> Wed Jun 2 00:39:58 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Bug #141169.
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): Make menus * gtk/gtkmenushell.c (gtk_menu_shell_button_release): Make menus
only stay up if you release within 500 milliseconds. only stay up if you release within 500 milliseconds.
(gtk_menu_shell_button_press): Set the activate_time to the event (gtk_menu_shell_button_press): Set the activate_time to the event

View File

@ -1,3 +1,8 @@
Wed Jun 2 01:56:02 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gtk/gtkmenu.c: Fix the stay up algorithm for combo boxes to
better handle the "click" case. bug Better fix for #141169.
2004-06-02 Federico Mena Quintero <federico@ximian.com> 2004-06-02 Federico Mena Quintero <federico@ximian.com>
* gtk/gtktreeview.c (gtk_tree_view_search_init): Bail out if the * gtk/gtktreeview.c (gtk_tree_view_search_init): Bail out if the
@ -59,6 +64,8 @@ Tue Jun 1 22:19:55 2004 Matthias Clasen <maclas@gmx.de>
Wed Jun 2 00:39:58 2004 Soeren Sandmann <sandmann@daimi.au.dk> Wed Jun 2 00:39:58 2004 Soeren Sandmann <sandmann@daimi.au.dk>
Bug #141169.
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): Make menus * gtk/gtkmenushell.c (gtk_menu_shell_button_release): Make menus
only stay up if you release within 500 milliseconds. only stay up if you release within 500 milliseconds.
(gtk_menu_shell_button_press): Set the activate_time to the event (gtk_menu_shell_button_press): Set the activate_time to the event

View File

@ -73,11 +73,16 @@ struct _GtkMenuAttachData
GtkMenuDetachFunc detacher; GtkMenuDetachFunc detacher;
}; };
typedef enum {
NONE,
SEEN_MOTION,
SEEN_MOTION_ENTER,
SEEN_MOTION_ENTER_MOTION
} SelectState;
struct _GtkMenuPrivate struct _GtkMenuPrivate
{ {
gboolean seen_motion; SelectState select_state;
gboolean seen_enter;
gboolean have_position; gboolean have_position;
gint x; gint x;
gint y; gint y;
@ -1280,8 +1285,7 @@ gtk_menu_popup (GtkMenu *menu,
menu_shell->parent_menu_shell = parent_menu_shell; menu_shell->parent_menu_shell = parent_menu_shell;
priv->seen_motion = FALSE; priv->select_state = NONE;
priv->seen_enter = FALSE;
/* Find the last viewable ancestor, and make an X grab on it /* Find the last viewable ancestor, and make an X grab on it
*/ */
@ -2728,11 +2732,18 @@ gtk_menu_motion_notify (GtkWidget *widget,
GtkMenuPrivate *priv = gtk_menu_get_private (GTK_MENU (widget)); GtkMenuPrivate *priv = gtk_menu_get_private (GTK_MENU (widget));
gtk_menu_handle_scrolling (GTK_MENU (widget), TRUE); gtk_menu_handle_scrolling (GTK_MENU (widget), TRUE);
priv->seen_motion = TRUE;
if (priv->seen_enter) if (priv->select_state == NONE)
{ {
/* After having seen both a motion event and an enter event, priv->select_state = SEEN_MOTION;
* button releases should be interpreted to mean "activate" }
else if (priv->select_state == SEEN_MOTION_ENTER)
{
priv->select_state = SEEN_MOTION_ENTER_MOTION;
/* After having seen both a motion, an enter, and a motion
* in that order, button releases should be interpreted
* as "activate".
*/ */
GTK_MENU_SHELL (widget)->activate_time = 0; GTK_MENU_SHELL (widget)->activate_time = 0;
@ -2965,6 +2976,7 @@ gtk_menu_enter_notify (GtkWidget *widget,
{ {
GtkWidget *menu_item; GtkWidget *menu_item;
menu_item = gtk_get_event_widget ((GdkEvent*) event);
if (widget && GTK_IS_MENU (widget)) if (widget && GTK_IS_MENU (widget))
{ {
GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget); GtkMenuShell *menu_shell = GTK_MENU_SHELL (widget);
@ -2973,21 +2985,14 @@ gtk_menu_enter_notify (GtkWidget *widget,
if (!menu_shell->ignore_enter) if (!menu_shell->ignore_enter)
gtk_menu_handle_scrolling (GTK_MENU (widget), TRUE); gtk_menu_handle_scrolling (GTK_MENU (widget), TRUE);
priv->seen_enter = TRUE; if (priv->select_state == SEEN_MOTION)
if (priv->seen_motion) priv->select_state = SEEN_MOTION_ENTER;
{
/* After having seen both a motion event and an enter event,
* button releases should be interpreted to mean "activate"
*/
menu_shell->activate_time = 0;
}
} }
/* If this is a faked enter (see gtk_menu_motion_notify), 'widget' /* If this is a faked enter (see gtk_menu_motion_notify), 'widget'
* will not correspond to the event widget's parent. Check to see * will not correspond to the event widget's parent. Check to see
* if we are in the parent's navigation region. * if we are in the parent's navigation region.
*/ */
menu_item = gtk_get_event_widget ((GdkEvent*) event);
if (menu_item && GTK_IS_MENU_ITEM (menu_item) && GTK_IS_MENU (menu_item->parent) && if (menu_item && GTK_IS_MENU_ITEM (menu_item) && GTK_IS_MENU (menu_item->parent) &&
gtk_menu_navigating_submenu (GTK_MENU (menu_item->parent), event->x_root, event->y_root)) gtk_menu_navigating_submenu (GTK_MENU (menu_item->parent), event->x_root, event->y_root))
return TRUE; return TRUE;