Re: Fwd: Fwd: Gtk3 MacOS (OSX) context menu issues



On 15-03-15 10:56 AM, Konstantin Dmitriev wrote:
Sorry, forgot to forward my previous message into mailing list. ^__^


---------- Forwarded message ----------
From: Konstantin Dmitriev <ksee zelgadis gmail com>
Date: 2015-03-15 22:32 GMT+06:00
Subject: Re: Fwd: Gtk3 MacOS (OSX) context menu issues
To: Jim Charlton <charltn gmail com>


Hello, Jim!

2015-03-15 21:25 GMT+06:00 Jim Charlton <charltn gmail com>:
With the default MacPorts installation of gtk3, one can set XDG_CONFIG_HOME
to /opt/local/share/themes/Default and then include the gtk.css file with
.window-frame,
.window-frame:backdrop {
   box-shadow: none;
   margin: 0;}

in it, in /opt/local/share/themes/Default/gtk-3.0/gtk.css

and the margins will disappear on the popup menu boxes avoiding the
selection problem.  No need to install an alternate theme.
Please excuse the errors in the previous posting.
Thank you very much for providing the workaround! This solves the
problem for my situation, because I can provide modified theme with
the distributive of our software.

Just a wild guess:
It would be interesting to create a custom theme with the following css options:
.window-frame,
.window-frame:backdrop {
   box-shadow: 0 0 10px rgba(0,0,0,0.5)
   margin: 15;
}
...and test it in some other OS (Linux and Windows). Maybe the problem
of "insensitive menu" will appear there as well!

Best Regards,
K.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
I have further investigated the problem with insensitivity in context menus. This involved some debugging of the gtkmenu.c code in the gtk3 libraries. Here are my findings thus far. If anyone has a suggestion where to go next, please let me know. I don't mind working on this but I am sort of at a dead end.

At line 3569 in gtkmenu.c

  menu_item = gtk_get_event_widget ((GdkEvent*) event);
  parent = gtk_widget_get_parent (menu_item);
  if (!GTK_IS_MENU_ITEM (menu_item) ||
      !GTK_IS_MENU (parent))
    return FALSE;

Replace with
  menu_item = gtk_get_event_widget ((GdkEvent*) event);
  printf("The name of the widget is %s\n", gtk_widget_get_name(menu_item);
  parent = gtk_widget_get_parent (menu_item);
  if (!GTK_IS_MENU_ITEM (menu_item) ||
      !GTK_IS_MENU (parent))
    return FALSE;

make and make install the gtk3 libs.

Run gtk3-demo. Right click in the lower right panel to bring up the context menu. Carefully move the mouse cursor into the menu. Note that the name of the widget under the cursor that is being returned by the motion event is a GtkMenu, not a GtkMenuItem. Now move the mouse out of the popup window. The name of the widget under the cursor is now GtkTextView. Move the cursor back into the popup menu and the widget under the cursor is now reported as GtkMenuItem and one can select the "Select All" item by passing over it. Now move the cursor very carefully into the 6 pixel margin and then back into the menu popup. One can now see that the widget under the cursor is again reported (incorrectly??) to be GtkMenu instead of GtkMenuItem and the GTK_IS_MENU_ITEM test fails and one cannot select the "Select All" item.

As I pointed out earlier, the problem of insensitive menu items in context menus can be avoided by removing the margin from the popup. But this is just a workaround. The real question remains. Why does the motion event report the wrong widget type under the cursor in certain circumstances?

jim...  Jim Charlton


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