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. Better fix for #141169.
This commit is contained in:
Soeren Sandmann
2004-06-02 23:15:45 +00:00
committed by Søren Sandmann Pedersen
parent 3ac2421694
commit ce4015d2ec
5 changed files with 50 additions and 17 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. Better fix for #141169.
2004-06-02 Federico Mena Quintero <federico@ximian.com>
Merged from HEAD:
@@ -63,6 +68,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>
Bug #141169.
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): Make menus
only stay up if you release within 500 milliseconds.
(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. Better fix for #141169.
2004-06-02 Federico Mena Quintero <federico@ximian.com>
Merged from HEAD:
@@ -63,6 +68,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>
Bug #141169.
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): Make menus
only stay up if you release within 500 milliseconds.
(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. Better fix for #141169.
2004-06-02 Federico Mena Quintero <federico@ximian.com>
Merged from HEAD:
@@ -63,6 +68,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>
Bug #141169.
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): Make menus
only stay up if you release within 500 milliseconds.
(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. Better fix for #141169.
2004-06-02 Federico Mena Quintero <federico@ximian.com>
Merged from HEAD:
@@ -63,6 +68,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>
Bug #141169.
* gtk/gtkmenushell.c (gtk_menu_shell_button_release): Make menus
only stay up if you release within 500 milliseconds.
(gtk_menu_shell_button_press): Set the activate_time to the event

View File

@@ -72,11 +72,16 @@ struct _GtkMenuAttachData
GtkMenuDetachFunc detacher;
};
typedef enum {
NONE,
SEEN_MOTION,
SEEN_MOTION_ENTER,
SEEN_MOTION_ENTER_MOTION
} SelectState;
struct _GtkMenuPrivate
{
gboolean seen_motion;
gboolean seen_enter;
SelectState select_state;
gboolean have_position;
gint x;
gint y;
@@ -1243,8 +1248,7 @@ gtk_menu_popup (GtkMenu *menu,
menu_shell->parent_menu_shell = parent_menu_shell;
priv->seen_motion = FALSE;
priv->seen_enter = FALSE;
priv->select_state = NONE;
/* Find the last viewable ancestor, and make an X grab on it
*/
@@ -2690,11 +2694,18 @@ gtk_menu_motion_notify (GtkWidget *widget,
GtkMenuPrivate *priv = gtk_menu_get_private (GTK_MENU (widget));
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,
* button releases should be interpreted to mean "activate"
priv->select_state = SEEN_MOTION;
}
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;
@@ -2935,14 +2946,8 @@ gtk_menu_enter_notify (GtkWidget *widget,
if (!menu_shell->ignore_enter)
gtk_menu_handle_scrolling (GTK_MENU (widget), TRUE);
priv->seen_enter = TRUE;
if (priv->seen_motion)
{
/* 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 (priv->select_state == SEEN_MOTION)
priv->select_state = SEEN_MOTION_ENTER;
}
/* If this is a faked enter (see gtk_menu_motion_notify), 'widget'