Re: [Gtk-osx-users] menu synchronisation



On Apr 4, 2010, at 2:09 PM, Olivier Sessink wrote:

> 2010/4/4 John Ralls <jralls ceridwen fremont ca us>:
>> Debug a bit deeper into get_menu_label_text and find_menu_label and make sure that the widget that's getting passed to them does in fact have a label attached to it.
> 
> I changed get_menu_label_text to:
> 
> static const gchar *
> get_menu_label_text (GtkWidget  *menu_item, GtkWidget **label) {
>    GtkWidget *my_label;
>    const gchar *text=NULL;
>    my_label = find_menu_label (menu_item);
>    if (label)
> 	*label = my_label;
>    if (my_label)
> 	text = gtk_label_get_text (GTK_LABEL (my_label));
>    g_print("found label %p for '%s'
> ('%s')\n",my_label,text,gtk_menu_item_get_label(GTK_MENU_ITEM(menu_item)));
>    return text;
> }
> 
> it seems that most of the missing labels are correctly found, but not
> all. Especially the labels with multibyte characters seem to be empty:
> 
> found label 0x18bba00 for '' ('')
> found label 0x18bbaa0 for '' ('')
> found label 0x18bbbe0 for '' ('')
> found label 0x18bbd20 for '' ('')
> found label 0x18bbdc0 for '' ('')
> found label 0x18bbf00 for '' ('')
> 
> so I'm a bit puzzled..
> 
>> 
>> For multiple windows, you need to call ige_mac_menu_set_menu_bar on each window's GtkMenuBar after you create it.
> 
> I do that, but that is where I see issues right now.
> 
>> Ige_mac_menu will set up the signal handler so that the menu follows the focus.
> 
>> See my second message on April 2 for details about the bug with ige_mac_menu_set_app_menu_item, which will cause the app_menu "quit" item to stop working. Also, if you use the stock menu items (or actions, if you're using GtkUIBuilder), they'll magically change from (e.g.) ctrl-F to cmd-F, which is what Mac users expect.
> 
> I typed <ctrl><f>, but that was my fault, I meant <cmd><f>, I already
> use that and it works like a charm :)

Are you using UTF16 or UTF32? The leading zeroes in the wchars will make g_print and the NSString import routines think that you've submitted a zero-length string, because they expect single-byte characters. You can test it by transcoding the result of gtk_menu_item_get_label in your g_print statement.

Sounds like something is interfering with the window focus signal switching the menus. You might want to set DEBUG = TRUE at the top of ige_mac_menu.c and see if you get the "Menu Switched" message on stderr when you move from window to window.

Regards,
John Ralls



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