libxfce4panel could position panel plugin menus
Jasper Huijsmans
jasper at xfce.org
Fri Sep 28 17:07:30 CEST 2007
2007/9/28, Nick Schermer <nickschermer at gmail.com>:
> 2007/9/28, Diego Ongaro <ongardie at gmail.com>:
> > On 9/28/07, Nick Schermer <nickschermer at gmail.com> wrote:
> > >
> > > I don't see why there it is not just another GtkMenuPositionFunc.
> > > Because that's what you want, popup a menu... Or am I stupid or
> > > something?
> >
> > These patches solved more problems than a GtkMenuPositionFunc would
> > have. Specifically, in no particular order:
> > 1) Arrow directions
> > 2) Positioning arbitrary widgets (see Alexandre's email)
> > 3) Registering the menu ONLY when it's not already visible (see Harold's email)
> > 4) Benefit from #3 even when the plugin wants its menu on the cursor
>
> 2) can still be fixed with the same function, since you calculate with
> the widgets allocated size, so what won't differ.
> 3) also possible with the GtkMenuPositionFunc function.
> 4) not really something we should care about.
>
> > I won't agree that you're stupid, but I like to think that a
> > GtkMenuPositionFunc would have been insufficient and awkward to
> > include in the API. Also, it would have been more productive for you
> > to bring up a suggestion like this for discussion after my *first*
> > email.
>
> Maybe, but I didn't expect the patches were committed so quickly. I'd
> preferer to take a look at the patches, not the discussion.
>
> > > If you want to calculate the arrow direction, fine, but don't do this
> > > in the same function.
> >
> > I don't see why that's such a bad thing. After all, the logic to know
> > where the popup will be placed and the logic to know in which
> > direction it will be placed are identical. I'll admit it's strange to
> > have those functions return GtkArrowType to represent directions, but
> > it was the most convenient type to use.
>
> So that also means you can call the arrow position function inside the
> popup position function? Right? That way would make more sense to me.
>
> Nick
I don't disagree with you. I committed it, because it is a development
branch and it is easy to change. I find it easier to discuss starting
from an existing implementation ;-)
I agree that having the arrow direction and menu popup in the same
feels a bit wrong, but it does use the menu positioning calculation,
so if we still want that it is more efficient to do the calculation
once.
I think adding the xfce_panel_plugin_register_menu() call is a good
idea, since people tend to forget that.
Maybe we should reopen the bug report and discuss API changes there?
--
Jasper
More information about the Xfce4-dev
mailing list