[Sugar-devel] Idea about palettes with gtk3

Benjamin Berg benzea at sugarlabs.org
Sat Oct 29 04:54:47 EDT 2011


Hello,

On Fri, 2011-10-28 at 19:13 +0100, Marco Pesenti Gritti wrote:
> we was discussing at the hackfest today how to fixup palettes to work
> in gtk3. I looked more into the GtkMenuShell code on the train and I
> had an idea. It seems like GtkMenuShell basically gets access to all
> the enter/leave events while it's active (because of the grab and some
> local forwarding through gtk_widget_event). And we can get the actual
> widget that was entered/left using Gtk.get_event_widget. You can see
> this by running the attached code snippet.
> 
> So the palette could be a standard GtkMenu. The icon would popup() on
> enter. The palette would listen to those events and popdown/popup
> things depending if we are on the icon, the palette, another icon for
> the palette in the same group, a submenu of the palette.

This looks perfect. By simply overriding the events on the Palette/Menu,
we can implement any behaviour that we want.

I am thinking of doing the override inside the palette group, as we
could easily check whether the user is hovering on top of another
palette/menu invoker, and switch right away.

It does not work with current pygobject introspection because of some
broken performance work that was done, where chaining up to the original
event handler does not work properly. Tomeu has got a simple fix for
this already though, it will require more work to not regress with
regard to the performance.

Benjamin



More information about the Sugar-devel mailing list