[gnome-shell] Ignore releases of buttons other than the activating button
- From: Colin Walters <walters src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-shell] Ignore releases of buttons other than the activating button
- Date: Fri, 2 Oct 2009 23:28:35 +0000 (UTC)
commit c5ce40585931af121ae8e759e80e0094c0594ef9
Author: Colin Walters <walters verbum org>
Date: Fri Sep 25 16:44:28 2009 -0400
Ignore releases of buttons other than the activating button
Before we hardcoded popdowns to only button 1 before. But we need
to actually pop down on the release of the activating button.
(Once the button is released, if the we don't pop-down the menu,
then subsequently we let the user use any button.)
https://bugzilla.gnome.org/show_bug.cgi?id=596371
src/shell-menu.c | 19 +++++++++++--------
1 files changed, 11 insertions(+), 8 deletions(-)
---
diff --git a/src/shell-menu.c b/src/shell-menu.c
index 0eace37..4fce08c 100644
--- a/src/shell-menu.c
+++ b/src/shell-menu.c
@@ -15,6 +15,7 @@ G_DEFINE_TYPE(ShellMenu, shell_menu, BIG_TYPE_BOX);
struct _ShellMenuPrivate {
gboolean popped_up;
gboolean have_grab;
+ guint activating_button;
gboolean released_on_source;
ClutterActor *source_actor;
@@ -117,9 +118,15 @@ shell_menu_button_release_event (ClutterActor *actor,
{
ShellMenu *box = SHELL_MENU (actor);
- if (event->button != 1)
+ /* Until the user releases the button that brought up the menu, we just
+ * ignore other button press/releass.
+ * See https://bugzilla.gnome.org/show_bug.cgi?id=596371
+ */
+ if (box->priv->activating_button > 0 && box->priv->activating_button != event->button)
return FALSE;
+ box->priv->activating_button = 0;
+
if (box->priv->source_actor && !box->priv->released_on_source)
{
if (box->priv->source_actor == event->source ||
@@ -134,13 +141,8 @@ shell_menu_button_release_event (ClutterActor *actor,
shell_menu_popdown_nosignal (box);
- if (!container_contains (CLUTTER_CONTAINER (box), event->source))
- {
- g_signal_emit (G_OBJECT (box), shell_menu_signals[CANCELLED], 0);
- return FALSE;
- }
-
- if (box->priv->selected == NULL)
+ if (!container_contains (CLUTTER_CONTAINER (box), event->source) ||
+ box->priv->selected == NULL)
{
g_signal_emit (G_OBJECT (box), shell_menu_signals[CANCELLED], 0);
return FALSE;
@@ -158,6 +160,7 @@ shell_menu_popup (ShellMenu *box,
{
if (box->priv->popped_up)
return;
+ box->priv->activating_button = button;
box->priv->popped_up = TRUE;
box->priv->have_grab = TRUE;
box->priv->released_on_source = FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]