libxfce4panel could position panel plugin menus
ongardie at gmail.com
Mon Sep 24 23:54:38 CEST 2007
I was able to fairly easily create a wrapper around gtk_menu_popup()
and get the launcher and window list plugins to use that.
However, the whole thing is more complicated than I had thought,
thanks to those little arrows. The arrows are supposed to point in the
direction that the menu will open.
Well, it's expensive to know which way the menu will open for floating
panels, because you need to know how high or how wide the menu is or
The launcher generates its menu when it needs to and keeps it around
until something changes. On the other hand, the windowlist generates
its menu each time it's opened, and the menu is destroyed once it's
Here are just a few ways we could handle this:
(1) If a plugin wants to know which way its menu will open, it has to
give libxfce4panel the menu to find out. This would be OK for the
launcher - it would just have to build its menu on initialization
instead of lazily. This would not be so good (expensive) for
(2) Let libxfce4panel *guess* which way the menu will open based on
the panel's position on the screen. It'll always get it right for
fixed position panels, and it'll get it right most of the time for
floating panels (it might miss those that float near, but not at, the
bottom or right of the screen). Then, when it opens a menu, it will
report the actual direction the menu opened, and the plugin can adjust
the arrow's direction accordingly. This "cache" could even be saved in
the rc file.
(3) Get rid of the arrow buttons. Use a dot or something else instead.
(4) Get rid of floating panels.
More information about the Xfce4-dev