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
This commit is contained in:
parent
b3a5fc72fb
commit
c5ce405859
@ -15,6 +15,7 @@ G_DEFINE_TYPE(ShellMenu, shell_menu, BIG_TYPE_BOX);
|
|||||||
struct _ShellMenuPrivate {
|
struct _ShellMenuPrivate {
|
||||||
gboolean popped_up;
|
gboolean popped_up;
|
||||||
gboolean have_grab;
|
gboolean have_grab;
|
||||||
|
guint activating_button;
|
||||||
|
|
||||||
gboolean released_on_source;
|
gboolean released_on_source;
|
||||||
ClutterActor *source_actor;
|
ClutterActor *source_actor;
|
||||||
@ -117,9 +118,15 @@ shell_menu_button_release_event (ClutterActor *actor,
|
|||||||
{
|
{
|
||||||
ShellMenu *box = SHELL_MENU (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;
|
return FALSE;
|
||||||
|
|
||||||
|
box->priv->activating_button = 0;
|
||||||
|
|
||||||
if (box->priv->source_actor && !box->priv->released_on_source)
|
if (box->priv->source_actor && !box->priv->released_on_source)
|
||||||
{
|
{
|
||||||
if (box->priv->source_actor == event->source ||
|
if (box->priv->source_actor == event->source ||
|
||||||
@ -134,13 +141,8 @@ shell_menu_button_release_event (ClutterActor *actor,
|
|||||||
|
|
||||||
shell_menu_popdown_nosignal (box);
|
shell_menu_popdown_nosignal (box);
|
||||||
|
|
||||||
if (!container_contains (CLUTTER_CONTAINER (box), event->source))
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (box->priv->selected == NULL)
|
|
||||||
{
|
{
|
||||||
g_signal_emit (G_OBJECT (box), shell_menu_signals[CANCELLED], 0);
|
g_signal_emit (G_OBJECT (box), shell_menu_signals[CANCELLED], 0);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -158,6 +160,7 @@ shell_menu_popup (ShellMenu *box,
|
|||||||
{
|
{
|
||||||
if (box->priv->popped_up)
|
if (box->priv->popped_up)
|
||||||
return;
|
return;
|
||||||
|
box->priv->activating_button = button;
|
||||||
box->priv->popped_up = TRUE;
|
box->priv->popped_up = TRUE;
|
||||||
box->priv->have_grab = TRUE;
|
box->priv->have_grab = TRUE;
|
||||||
box->priv->released_on_source = FALSE;
|
box->priv->released_on_source = FALSE;
|
||||||
|
Loading…
Reference in New Issue
Block a user