! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
non-square plugins that don't handle size-changed get screwed
Status:
RESOLVED: FIXED
Product:
Xfce4-panel
Component:
General

Comments

Description Brian J. Tarricone (not reading bugmail) 2009-07-27 02:04:02 CEST
I spent about 3 hours trying to figure this out, and it's really annoying.

I was writing a simple plugin that just has a GtkMenuBar in it, and that's it.  I figured, since I don't do custom icon resizing or anything, I didn't need to handle XfcePanelPlugin::size-changed, and it would just give the plugin the size it requests.

But it doesn't.  If you don't handle size-changed at all, the panel forces a square area for the plugin equal to the panel's size (24x24 in my case), despite the fact that the GtkMenuBar in the plugin was returning 44x23 in its size-request handler.

Handling size-request and just doing a simple gtk_widget_set_size_request(widget, -1, size) (or the reverse for ORIENTATION_VERTICAL) in there fixes the problem.  Why doesn't the panel do this for us if we don't need to do anything special and decide not to handle size-changed?

At the very least, this should be documented in the libxfce4panel API docs, unless it can be changed without breaking things.

Appears to apply to both the 4.6 panel and the 4.7 git panel.
Comment 1 Nick Schermer editbugs 2009-07-27 06:21:48 CEST
Jasper and I decided we force a size if False is returned from the size-changed signal, but I can't exactly remember why we did that. IIRC it was because some plugins were too big to fit in the panel because they did not set proper sizes, but that is fixed in the new panel (and maybe in trunk too, must check) by using a fixed plugin size in the child allocation code.

So returning TRUE is enough to disable size handling of the panel and the only reason this is useful is that *most* plugins are squared buttons...
Comment 2 Brian J. Tarricone (not reading bugmail) 2009-07-27 06:37:11 CEST
Oh, so doing:

g_signal_connect(plugin, "size-changed", G_CALLBACK(gtk_true), NULL);

should be enough?

Ah yeah, that does work, cool.  Good enough for me ^_^.
Comment 3 Nick Schermer editbugs 2009-07-28 06:36:36 CEST
The question is, should I change the function to a VOID:INT since plugins that overflow are now handled in the allocation code. On the other hand, that will break the current behavior, so plugins that do not handle the size signal, are probably non-square. Guess that's not a great idea.

I'll improve the documentation of the size change signal and also mention the gtk_true trick.
Comment 4 Nick Schermer editbugs 2010-02-27 15:08:47 CET
Devel branch has been merged in master. A 4.7.0 release will follow soon. If you think this bug is not fixed? Feel free to reopen the bug.

Bug #5616

Reported by:
Brian J. Tarricone (not reading bugmail)
Reported on: 2009-07-27
Last modified on: 2010-02-27

People

Assignee:
Nick Schermer
CC List:
0 users

Version

Version:
Unspecified

Attachments

Additional information