On Mon, Oct 01, 2012 at 12:10:14PM +0100, Richard Shann wrote: ... > 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
I have tested this (gtk_menu_shell_get_selected_item), and for me, Denemo keeps working fine :). You can see attached the change(patch) that I made. $ ldd /tmp/denemo/bin/denemo | grep gtk libgtksourceview-3.0.so.0 => /usr/lib/x86_64-linux-gnu/libgtksourceview-3.0.so.0 (0x00007fbe96f19000) libgtk-3.so.0 => /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 (0x00007fbe96005000) -- Josué M. Abarca S. Vos mereces Software Libre. PGP key 4096R/70D8FB2A 2009-06-17 Huella de clave = B3ED 4984 F65A 9AE0 6511 DAF4 756B EB4B 70D8 FB2A
>From b6d7994d852624dd3436893dc19f7b6c2f3bbe56 Mon Sep 17 00:00:00 2001 From: Josue Abarca <[email protected]> Date: Tue, 2 Oct 2012 01:51:46 -0600 Subject: [PATCH 3/3] Use gtk_menu_shell_get_selected_item instead of gtk_menu_get_active --- src/kbd-custom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/kbd-custom.c b/src/kbd-custom.c index 2a7efae..0bb3fe4 100644 --- a/src/kbd-custom.c +++ b/src/kbd-custom.c @@ -1445,7 +1445,7 @@ if(Denemo.prefs.menunavigation && ((event->keyval==0xFF1B)|| (event->keyval==0xF keyval = event->keyval; #if GTK_MAJOR_VERSION == 3 - action = gtk_activatable_get_related_action(gtk_menu_get_active(GTK_MENU(menu))); + action = gtk_activatable_get_related_action(gtk_menu_shell_get_selected_item( GTK_MENU_SHELL(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 -- 1.7.10.4
_______________________________________________ Denemo-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/denemo-devel
