[maemo-commits] [maemo-commits] r11865 - in projects/haf/trunk/gtk+: . gtk
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Fri May 25 17:19:51 EEST 2007
- Previous message: [maemo-commits] r11864 - projects/haf/hafbuildbot
- Next message: [maemo-commits] r11866 - projects/haf/trunk/hildon-fm/hildon-fm
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: mitch Date: 2007-05-25 17:19:49 +0300 (Fri, 25 May 2007) New Revision: 11865 Modified: projects/haf/trunk/gtk+/ChangeLog projects/haf/trunk/gtk+/gtk/gtkmenushell.c Log: 2007-05-25 Michael Natterer <mitch at imendio.com> * gtk/gtkmenushell.c (gtk_menu_shell_class_init): add settings property gtk-menu-popup-click-time to replace the hardcoded MENU_SHELL_TIMEOUT of 500ms. (gtk_menu_shell_button_release): use the new setting instead of the 500ms. Additionally special-case a setting of 0 which always keeps the menu open on its opening click unless an item was activated. (patch filed upstream, therefore no #ifdef MAEMO_CHANGES) Modified: projects/haf/trunk/gtk+/ChangeLog =================================================================== --- projects/haf/trunk/gtk+/ChangeLog 2007-05-25 14:12:51 UTC (rev 11864) +++ projects/haf/trunk/gtk+/ChangeLog 2007-05-25 14:19:49 UTC (rev 11865) @@ -1,5 +1,16 @@ 2007-05-25 Michael Natterer <mitch at imendio.com> + * gtk/gtkmenushell.c (gtk_menu_shell_class_init): add settings + property gtk-menu-popup-click-time to replace the hardcoded + MENU_SHELL_TIMEOUT of 500ms. + + (gtk_menu_shell_button_release): use the new setting instead of + the 500ms. Additionally special-case a setting of 0 which always + keeps the menu open on its opening click unless an item was + activated. + +2007-05-25 Michael Natterer <mitch at imendio.com> + * gtk/gtkmenushell.c (gtk_menu_shell_enter_notify): really fix enter-notify on already selected menu items. Modified: projects/haf/trunk/gtk+/gtk/gtkmenushell.c =================================================================== --- projects/haf/trunk/gtk+/gtk/gtkmenushell.c 2007-05-25 14:12:51 UTC (rev 11864) +++ projects/haf/trunk/gtk+/gtk/gtkmenushell.c 2007-05-25 14:19:49 UTC (rev 11865) @@ -43,8 +43,6 @@ #include "gtkintl.h" #include "gtkalias.h" -#define MENU_SHELL_TIMEOUT 500 - #define PACK_DIRECTION(m) \ (GTK_IS_MENU_BAR (m) \ ? gtk_menu_bar_get_pack_direction (GTK_MENU_BAR (m)) \ @@ -357,6 +355,14 @@ TRUE, GTK_PARAM_READWRITE)); + gtk_settings_install_property (g_param_spec_int ("gtk-menu-popup-click-time", + P_("Popup click time"), + P_("Maximum time allowed (in milliseconds) between button press and release for them to be considered part of a popup action instead of a (menu item) select action. 0 always considers the corresponding button release part of the popup click and always keeps the menu open unless an item was activated."), + 0, + G_MAXINT, + 500, + GTK_PARAM_READWRITE)); + g_type_class_add_private (object_class, sizeof (GtkMenuShellPrivate)); } @@ -638,6 +644,7 @@ { GtkWidget *menu_item; gboolean deactivate = TRUE; + gint popup_click_time; if (menu_shell->button && (event->button != menu_shell->button)) { @@ -649,7 +656,12 @@ menu_shell->button = 0; menu_item = gtk_menu_shell_get_item (menu_shell, (GdkEvent*) event); - if ((event->time - menu_shell->activate_time) > MENU_SHELL_TIMEOUT) + g_object_get (gtk_widget_get_settings (widget), + "gtk-menu-popup-click-time", &popup_click_time, + NULL); + + if (popup_click_time == 0 || + (event->time - menu_shell->activate_time) > popup_click_time) { if (menu_item && (menu_shell->active_menu_item == menu_item) && _gtk_menu_item_is_selectable (menu_item)) @@ -730,6 +742,16 @@ { deactivate = FALSE; } + + /* popup-click-time = 0 causes the menu to always stay open on + * its opening click, unless an item was activated. + */ + if (!menu_item && popup_click_time == 0 && + menu_shell->activate_time != 0) + { + menu_shell->activate_time = 0; + deactivate = FALSE; + } } else /* a very fast press-release */ {
- Previous message: [maemo-commits] r11864 - projects/haf/hafbuildbot
- Next message: [maemo-commits] r11866 - projects/haf/trunk/hildon-fm/hildon-fm
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]