Re: Submenu navigation patch for 1.2



George <jirka 5z com> writes:

> Here's a port of Nils Barth's submenu navigation patch for 1.2.  For the two
> extra GtkMenu fields it uses get/set_data.  I think this is 1) simple enough
> 2) incredibly useful to add to the 1.2 branch.  This has probably been the
> number one usability complaint on the panel and I would bet for gtk as well.
> It would be very nice to have this patch in whatever gtk comes with GNOME
> 1.4.

This looks good. While scanning through it, I did notice one bug
in the original code:

> @@ -1123,15 +1188,302 @@ gtk_menu_motion_notify  (GtkWidget	   *w
>  	  send_event.crossing.window = event->window;
>  	  send_event.crossing.time = event->time;
>  	  send_event.crossing.send_event = TRUE;
> -	  
> -	  gtk_widget_event (widget, &send_event);
> +	  send_event.crossing.x_root = event->x_root;
> +	  send_event.crossing.y_root = event->y_root;
> +	  send_event.crossing.x = event->x;
> +	  send_event.crossing.y = event->y;
> +
> +	  /* We send the event to 'widget', the currently active menu,
> +	   * instead of 'menu', the menu that the pointer is in. This
> +	   * will ensure that the event will be ignored unless the
> +	   * menuitem is a child of the active menu or some parent
> +	   * menu of the active menu.
> +	   */
> +	  return gtk_widget_event (widget, &send_event);
>  	}
> +      
> +      menu_shell->ignore_enter = FALSE; 
>      }

The menu_shell->ignore_enter setting is supposed to always occur,
so should be moved up above the conditional with the return.

Also, as a small matter of style: 

> +  if (!quark_navigation_timeout)
> +    quark_navigation_timeout = g_quark_from_static_string ("GtkMenu-navigation-timeout");

Should probably look like

static const gchar *navigation_key = "gtk-menu-navigation_timeout";
static guint        navigation_key_id = 0;

[...]

  if (!navigation_key_id)
    navigation_key_id = g_quark_from_static_string (navigation_key);

That is, some slightly different naming, and put the string in a
static variablea to avoid possible mistyping.


If you could apply this to stable, and your fix and the fix above to
HEAD, that would be great. I think it is something that will be very
good to have in GTK+-1.2.9 and has a low possibility of breakage;
getting it in now should make sure that we get sufficient testing.

Regards,
                                        Owen




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]