After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 354416 - Panel applet doesn't resize on panel resizing
Panel applet doesn't resize on panel resizing
Status: RESOLVED FIXED
Product: tomboy
Classification: Applications
Component: General
unspecified
Other Linux
: Normal blocker
: ---
Assigned To: Tomboy Maintainers
Tomboy Maintainers
Depends on:
Blocks: 352432
 
 
Reported: 2006-09-05 11:07 UTC by Sebastian Dröge (slomo)
Modified: 2008-02-26 20:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
icon size (1.42 KB, patch)
2006-09-06 01:58 UTC, Yanko Kaneti
none Details | Review
tomboy-panel-resize.patch (2.78 KB, patch)
2006-11-21 06:15 UTC, Boyd Timothy
none Details | Review
tomboy-panel-resize.patch: Much cleaner solution (4.26 KB, patch)
2006-11-21 21:54 UTC, Boyd Timothy
none Details | Review
Cleaner patch that takes into account the orientation of the panel (3.40 KB, patch)
2007-01-30 22:13 UTC, Boyd Timothy
committed Details | Review

Description Sebastian Dröge (slomo) 2006-09-05 11:07:57 UTC
Hi,
with 0.4.0 the icon of the panel applet is 200x200 pixels large. This is caused by the commit that added OnSizeAllocated() to Tray.cs.

+		protected override void OnSizeAllocated (Gdk.Rectangle rect)
+		{
+			base.OnSizeAllocated (rect);
+
+			int icon_size = Math.Min (rect.Height, rect.Width);
+			if (icon_size_last != icon_size) {
+				icon_size_last = icon_size;
+				image.Pixbuf = GuiUtils.GetIcon (GetIconName (), icon_size);
+			}
+		}

In the above block rect.Height and rect.Width are both 200 although the panel is only 24 pixels heigh. It works fine in the notification area too.

Bye
Comment 1 Alex Graveley 2006-09-05 16:41:58 UTC
As far as I'm concerned, this is a bug in the panel.  Abitrarily allocating 200x200 to applets is broken.  How do other applets work around this?
Comment 2 Sebastian Dröge (slomo) 2006-09-05 17:41:56 UTC
Mixer applet uses change_size from PanelAppletClass... so probably PanelApplet.ChangeSize event or PanelApplet.OnChangeSize.
Comment 3 Yanko Kaneti 2006-09-06 01:58:14 UTC
Created attachment 72283 [details] [review]
icon size

This patch against the gnome-2-16 branch works for me here.
Comment 4 Sebastian Dröge (slomo) 2006-09-06 09:44:58 UTC
Yes this looks fine except that you should remove ReloadIcon() and icon_size_last too probably
Comment 5 Yanko Kaneti 2006-09-06 10:06:51 UTC
I would but there are still some "Tintin" bits in cvs that use ReloadIcon. 
I am unsure of their purpose so I'd leave that to the maintainer.
Comment 6 Alex Graveley 2006-09-06 18:52:39 UTC
This is fixed in CVS (both HEAD and gnome-2-16 branch) with a slightly different patch: it sets PanelAppletFlags.ExpandMinor to get more detailed sizing allocations, and in OnChangeSize sets the icon's size request.

Please give this a try and reopen if you're still seeing problems.  Thanks!
Comment 7 Sebastian Dröge (slomo) 2006-09-06 22:34:29 UTC
Well, one gets a small icon now but it doesn't change the size when resizing the panel which it normally should and which I would assume Yanko's patch does.
Comment 8 Sebastian Dröge (slomo) 2006-09-06 22:44:47 UTC
Yep, his patch gets the scaling right when the panel is resized :(
Comment 9 Boyd Timothy 2006-11-21 06:15:39 UTC
Created attachment 76962 [details] [review]
tomboy-panel-resize.patch

Worked through a few issues and this patch appears to work against the latest CVS.  Does anyone else have success with it?  If so, I will go ahead and check it in.
Comment 10 Alex Graveley 2006-11-21 10:51:47 UTC
So I don't understand this bug.  Tomboy run as a panel applet resizes perfectly for me, fetching the closest sized theme icon at all sizes I try.  Are you guys sure you're running tomboy after a make install, so all the image files are present?
Comment 11 Sebastian Dröge (slomo) 2006-11-21 12:50:32 UTC
Yes, all icons and everything is installed for me.

Boyd's patch works fine for me btw... The bug I told him about earlier today with that patch is not reproducible, probably a mistake on my side.
Comment 12 Boyd Timothy 2006-11-21 14:52:06 UTC
(In reply to comment #10)
> So I don't understand this bug.  Tomboy run as a panel applet resizes perfectly
> for me, fetching the closest sized theme icon at all sizes I try.

Yes.  Running as a panel applet worked fine.  The problem is when you run Tomboy from the command-line and the TrayIcon appears in the Notification Area.  If you resize your panel, it doesn't resize correctly.  Try increasing your panel to 120px and then back down to 24px.  With the patch above (there's likely an easier way to make this work), it now resizes correctly for either way you choose to run Tomboy.
Comment 13 Boyd Timothy 2006-11-21 15:23:39 UTC
The real problem is (in the Notification Area by running command-line) the code:

    int icon_size = Math.Min (rect.Width, rect.Height);

For whatever reason, after you have Tomboy running and then adjust the panel size to be bigger (say up to 120px), rect.Width stays the same while rect.Height gets larger (probably a bug in .  So, if you have Tomboy showing up in the bottom/top panel and make the panel larger, it doesn't adjust correctly.  It stays small.

This is the reason for having to pay attention to both the width and the height.  If either one of them changes, the icon should be resized.  However, resizing the icon appears to cause OnSizeAllocated () to be called again.  This is why it's still important to keep track of the actual size of the icon in the "icon_size_last" variable so we don't actually cause a resize twice for a one pixel adjustment.

Make any sense?  If someone can think of an easier way to pull this off correctly, please say, or point me down the right direction and I can rework the patch if necessary.
Comment 14 Boyd Timothy 2006-11-21 21:54:53 UTC
Created attachment 76996 [details] [review]
tomboy-panel-resize.patch: Much cleaner solution

Thanks to Alex's brilliance, this patch is much cleaner and works well.
Comment 15 Boyd Timothy 2006-11-21 21:59:21 UTC
Checked-in latest patch to CVS Head.
Comment 16 Michael Monreal 2006-11-26 16:25:58 UTC
With recent CVS when I start tomboy in notification area mode (by launching 'tomboy') it will display the scalable icon. Could this be caused by this patch?
Comment 17 Boyd Timothy 2007-01-30 22:13:37 UTC
Created attachment 81552 [details] [review]
Cleaner patch that takes into account the orientation of the panel

I've been getting some complaints that the icon is too close to the edge of the panel.  This patch addresses the issue by using an icon 4 pixels less than the allocated area we're given.  I also reworked the code so it's a bit cleaner and pays attention to whether the panel tomboy's attached is horizontally or vertically oriented.