Example #1
0
static gboolean
shell_menu_button_release_event (ClutterActor       *actor,
                                 ClutterButtonEvent *event)
{
  ShellMenu *menu = SHELL_MENU (actor);

  /* 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 (menu->priv->activating_button > 0 &&
      menu->priv->activating_button != event->button)
    return FALSE;

  menu->priv->activating_button = 0;

  if (menu->priv->source_actor && !menu->priv->released_on_source)
    {
      if (menu->priv->source_actor == event->source ||
          (CLUTTER_IS_CONTAINER (menu->priv->source_actor) &&
           container_contains (CLUTTER_CONTAINER (menu->priv->source_actor), event->source)))
        {
          /* On the next release, we want to pop down the menu regardless */
          menu->priv->released_on_source = TRUE;
          return TRUE;
        }
    }

  shell_menu_popdown_nosignal (menu);

  if (!container_contains (CLUTTER_CONTAINER (menu), event->source) ||
      menu->priv->selected == NULL)
    {
      g_signal_emit (G_OBJECT (menu), shell_menu_signals[CANCELLED], 0);
      return FALSE;
    }

  g_signal_emit (G_OBJECT (menu), shell_menu_signals[ACTIVATE], 0,
                 menu->priv->selected); 

  return TRUE;
}
Example #2
0
static gboolean
shell_menu_enter_event (ClutterActor         *actor,
                        ClutterCrossingEvent *event)
{
  ShellMenu *menu = SHELL_MENU (actor);

  if (container_contains (CLUTTER_CONTAINER (menu), event->source) &&
      event->source != CLUTTER_ACTOR (menu))
    set_selected (menu, event->source);

  return CLUTTER_ACTOR_CLASS (shell_menu_parent_class)->enter_event (actor, event);
}
Example #3
0
 bool container_contains(const Container& c, const T& value)
 {
   return container_contains(boost::begin(c), boost::end(c), value);
 }