denemo-devel
[Top][All Lists]
Advanced

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

Re: [Denemo-devel] GTK3 version


From: Richard Shann
Subject: Re: [Denemo-devel] GTK3 version
Date: Mon, 01 Oct 2012 12:10:14 +0100

On Sun, 2012-09-30 at 16:42 -0600, Josue Abarca wrote:
> Hello Richard,
> 
> On Sat, Sep 29, 2012 at 12:41:11PM +0100, Richard Shann wrote:
> > On Sat, 2012-09-29 at 11:55 +0200, Andreas Schneider wrote:
> > > For me, if I press return, the selected menu item gets the return
> > > shortcut assigned to. I also can't navigate through menus with
> arrow
> > > keys, as they produce a message box whether I want to loose the
> shortcut
> > > for something else.
> 
> For me, is the same case, I press return, the selected menu item
> (e.g. file -> Close score) gets the return shortcut assigned to.
> 
> In Debian Sid, using Denemo 0.9.6
> 
> Gtk 3:
> $ ldd /usr/bin/denemo  | grep gtk
>   libgtksourceview-3.0.so.0 =>
>   /usr/lib/x86_64-linux-gnu/libgtksourceview-3.0.so.0
> (0x00007f46d7c42000)
>   libgtk-3.so.0 => /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
> (0x00007f46d6d2f000) 

This is curious indeed, while looking at the question of Esc and arrows
(see other email) I came across the relevant bit of code

#if GTK_MAJOR_VERSION == 3
  action = 
gtk_activatable_get_related_action(gtk_menu_get_active(GTK_MENU(menu)));
#else
  action = gtk_widget_get_action(GTK_MENU_SHELL(menu)->active_menu_item);//note 
this is not gtk_menu_get_active(menu) except after a selection has been made, 
we want the menu item that the pointer has moved to before it is selected.
#endif

The second definition of the action is the one I wrote (for GTK2) and I
obviously had a struggle to get at the highlighted item, hence my note
and my access to the structure itself. Jeremiah would have created the
alternative for GTK3, and for GTK2 this yields the first menu item every
time, because the highlighted item is not selected until you release the
mouse button (when it is too late to take action).
That it actual works on some versions of GTK3 and not others is strange.
If someone compiling with GTK3 could test the following replacement for
the above:

action = gtk_activatable_get_related_action(gtk_menu_shell_get_selected_item( 
GTK_MENU_SHELL(menu)));

that would be interesting. This (gtk_menu_shell_get_selected_item) is a
new accessor in GTK3, and may be the right thing to use. The name of
this function is less promising than the one currently in use, however.
As usual the documentation is vague.

Richard





reply via email to

[Prev in Thread] Current Thread [Next in Thread]