~ubuntu-branches/debian/experimental/gtk+2.0/experimental

« back to all changes in this revision

Viewing changes to gtk/gtkmenu.c

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-09-17 11:15:05 UTC
  • mto: (72.1.1 lenny) (1.4.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 55.
  • Revision ID: james.westby@ubuntu.com-20070917111505-giz9c5xltxkb5y54
Tags: upstream-2.12.0
ImportĀ upstreamĀ versionĀ 2.12.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1251
1251
 * a mouse button press, such as a mouse button release or a keypress,
1252
1252
 * @button should be 0.
1253
1253
 *
1254
 
 * The @activate_time parameter should be the time stamp of the event that
1255
 
 * initiated the popup. If such an event is not available, use
1256
 
 * gtk_get_current_event_time() instead.
1257
 
 *
 
1254
 * The @activate_time parameter is used to conflict-resolve initiation of
 
1255
 * concurrent requests for mouse/keyboard grab requests. To function
 
1256
 * properly, this needs to be the time stamp of the user event (such as
 
1257
 * a mouse click or key press) that caused the initiation of the popup.
 
1258
 * Only if no such event is available, gtk_get_current_event_time() can
 
1259
 * be used instead.
1258
1260
 */
1259
1261
void
1260
1262
gtk_menu_popup (GtkMenu             *menu,
2708
2710
   */
2709
2711
  if (GTK_IS_MENU_SHELL (gtk_get_event_widget ((GdkEvent *) event)) &&
2710
2712
      pointer_in_menu_window (widget, event->x_root, event->y_root))
2711
 
    return TRUE;
 
2713
    {
 
2714
      /*  Ugly: make sure menu_shell->button gets reset to 0 when we
 
2715
       *  bail out early here so it is in a consistent state for the
 
2716
       *  next button_press/button_release in GtkMenuShell.
 
2717
       *  See bug #449371.
 
2718
       */
 
2719
      if (GTK_MENU_SHELL (widget)->active)
 
2720
        GTK_MENU_SHELL (widget)->button = 0;
 
2721
 
 
2722
      return TRUE;
 
2723
    }
2712
2724
 
2713
2725
  return GTK_WIDGET_CLASS (gtk_menu_parent_class)->button_release_event (widget, event);
2714
2726
}
2786
2798
    {
2787
2799
      guint keyval = 0;
2788
2800
      GdkModifierType mods = 0;
2789
 
      gboolean handled = FALSE;
2790
2801
      
2791
2802
      gtk_accelerator_parse (accel, &keyval, &mods);
2792
2803
 
2797
2808
       * thing, to properly consider i18n etc., but that probably requires
2798
2809
       * AccelGroup changes etc.
2799
2810
       */
2800
 
      if (event->keyval == keyval &&
2801
 
          (mods & event->state) == mods)
2802
 
        gtk_menu_shell_cancel (menu_shell);
2803
 
 
2804
 
      g_free (accel);
2805
 
 
2806
 
      if (handled)
2807
 
        return TRUE;
 
2811
      if (event->keyval == keyval && (mods & event->state) == mods)
 
2812
        {
 
2813
          gtk_menu_shell_cancel (menu_shell);
 
2814
          g_free (accel);
 
2815
          return TRUE;
 
2816
        }
2808
2817
    }
 
2818
 
 
2819
  g_free (accel);
2809
2820
  
2810
2821
  switch (event->keyval)
2811
2822
    {