gtk-sni-tray icon indicating copy to clipboard operation
gtk-sni-tray copied to clipboard

Fix scale.

Open kurnevsky opened this issue 4 years ago • 11 comments

Gtk requires size to be >0.

I get the following error periodically:

Jul 28 00:34:14 dell taffybar-linux-[265044]: gdk_pixbuf_scale_simple: assertion 'dest_width > 0' failed
Jul 28 00:34:14 dell taffybar[265044]: [DEBUG] StatusNotifier.Tray - targetW: 0, targetH: 1
Jul 28 00:34:14 dell taffybar[265044]: [DEBUG] StatusNotifier.Tray - Scaling pb to 1, actualW: 59, actualH: 96, scaledW: 0, scaledH: 1
Jul 28 00:34:14 dell taffybar[265044]: [DEBUG] StatusNotifier.Tray - targetW: 1, targetH: 1
Jul 28 00:34:14 dell taffybar[265044]: [DEBUG] StatusNotifier.Tray - Scaling pb to 1, actualW: 16, actualH: 16, scaledW: 1, scaledH: 1
Jul 28 00:34:14 dell taffybar[265044]: [DEBUG] StatusNotifier.Tray - targetW: 1, targetH: 1
Jul 28 00:34:14 dell taffybar[265044]: [DEBUG] StatusNotifier.Tray - Scaling pb to 1, actualW: 1, actualH: 1, scaledW: 1, scaledH: 1
Jul 28 00:34:14 dell taffybar[265044]: [DEBUG] StatusNotifier.Tray - targetW: 1, targetH: 1
Jul 28 00:34:14 dell taffybar[265044]: [DEBUG] StatusNotifier.Tray - Scaling pb to 1, actualW: 1, actualH: 1, scaledW: 1, scaledH: 1
Jul 28 00:34:14 dell taffybar[265044]: [DEBUG] StatusNotifier.Tray - targetW: 1, targetH: 1
Jul 28 00:34:14 dell taffybar[265044]: [DEBUG] StatusNotifier.Tray - Scaling pb to 1, actualW: 1, actualH: 1, scaledW: 1, scaledH: 1
Jul 28 00:34:14 dell taffybar[265044]: [DEBUG] StatusNotifier.Tray - targetW: 1, targetH: 1
Jul 28 00:34:14 dell taffybar[265044]: [DEBUG] StatusNotifier.Tray - Scaling pb to 1, actualW: 1, actualH: 1, scaledW: 1, scaledH: 1
Jul 28 00:34:14 dell taffybar[265044]: [DEBUG] StatusNotifier.Tray - targetW: 1, targetH: 1
Jul 28 00:34:14 dell taffybar[265044]: [DEBUG] StatusNotifier.Tray - Scaling pb to 1, actualW: 1, actualH: 1, scaledW: 1, scaledH: 1
Jul 28 00:34:14 dell taffybar[265044]: [DEBUG] StatusNotifier.Tray - targetW: 1, targetH: 1
Jul 28 00:34:14 dell taffybar[265044]: [DEBUG] StatusNotifier.Tray - Scaling pb to 1, actualW: 1, actualH: 1, scaledW: 1, scaledH: 1
Jul 28 00:34:14 dell taffybar[265044]: [DEBUG] StatusNotifier.Tray - targetW: 1, targetH: 1
Jul 28 00:34:14 dell taffybar[265044]: [DEBUG] StatusNotifier.Tray - Scaling pb to 1, actualW: 1, actualH: 1, scaledW: 1, scaledH: 1
Jul 28 00:34:14 dell taffybar[265044]: [WARNING] System.Taffybar.Widget.Generic.AutoSizeImage - Allocating image: size 1, width 1,  height 1, aw: 1, ah: 1, pbw: 59 pbh: 96
Jul 28 00:34:14 dell taffybar[265044]: [WARNING] StatusNotifier.Tray - Unable to scale pixbuf
Jul 28 00:34:14 dell taffybar-linux-[265044]: gdk_pixbuf_scale_simple: assertion 'dest_width > 0' failed
Jul 28 00:34:14 dell taffybar[265044]: [DEBUG] StatusNotifier.Tray - targetW: 0, targetH: 1
Jul 28 00:34:14 dell taffybar[265044]: [DEBUG] StatusNotifier.Tray - Scaling pb to 1, actualW: 59, actualH: 96, scaledW: 0, scaledH: 1
Jul 28 00:34:14 dell taffybar[265044]: [DEBUG] StatusNotifier.Tray - targetW: 1, targetH: 1
Jul 28 00:34:14 dell taffybar[265044]: [DEBUG] StatusNotifier.Tray - Scaling pb to 1, actualW: 1, actualH: 1, scaledW: 1, scaledH: 1
Jul 28 00:34:14 dell taffybar[265044]: [WARNING] System.Taffybar.Widget.Generic.AutoSizeImage - Allocating image: size 1, width 1,  height 1, aw: 1, ah: 1, pbw: 59 pbh: 96
Jul 28 00:34:14 dell taffybar[265044]: [WARNING] StatusNotifier.Tray - Unable to scale pixbuf
Jul 28 00:34:14 dell taffybar-linux-[265044]: gdk_pixbuf_scale_simple: assertion 'dest_width > 0' failed
Jul 28 00:34:14 dell taffybar[265044]: [DEBUG] StatusNotifier.Tray - targetW: 0, targetH: 1

kurnevsky avatar Jul 28 '21 07:07 kurnevsky

This is probably from a non existent icon. I think a better solution would be to find the root cause of this issue.

colonelpanic8 avatar Jul 28 '21 15:07 colonelpanic8

But I didn't notice any missing icons - all tray icons work as expected. The problem is that when this happens I have huge icons and taffybar with much bigger height. So looks like they can't be scaled.

kurnevsky avatar Jul 28 '21 16:07 kurnevsky

It's weird that the target Height and Width are both 1. I don't think that should be happening. Why would it be trying to scale things to a single pixel?

colonelpanic8 avatar Jul 28 '21 17:07 colonelpanic8

No idea, but after this patch it doesn't scale things to 1 pixel. Last time this happened after taffybar restart, but before restart it worked fine. Could it be that right after start taffybar has got wrong height?

kurnevsky avatar Jul 28 '21 17:07 kurnevsky

It's pidgin icon that causes it. Not right after start, but after some time. Probably after receiving a message... When message is received its icon blinks. So probably when it disappears taffybar can't get it as it's supposed to be empty. And after this fix it's shown as it should.

kurnevsky avatar Jul 28 '21 17:07 kurnevsky

Here is the icon it sets: https://github.com/philipl/pidgin-indicator/blob/master/icons/hicolor/22x22/status/pidgin-indicator-nothing.png Looks like it's 22x22 pixels, so not sure if it really causes this.

kurnevsky avatar Jul 28 '21 18:07 kurnevsky

It would not be about the icons size. What is being logged is the target size, so the size we are attempting to scale it to. Seems weird that we are trying to scale something to be 1 pixel or 0 pixels. Sounds like maybe the widget is hidden or something when this attempt is made.

colonelpanic8 avatar Jul 28 '21 21:07 colonelpanic8

. The problem is that when this happens I have huge icons and

The reason you have huge icons is that the attempt to scale the icon is failing, and we are falling back to just returning the unscaled pixbuf. The attempt to scale the icon is failing because we are requesting a non-sensical size. We should figure out why we are requesting this non-sensiscal size.

colonelpanic8 avatar Jul 28 '21 21:07 colonelpanic8

It would not be about the icons size. What is being logged is the target size, so the size we are attempting to scale it to.

Then I don't get it why after this fix I see taffybar with its usual height and correctly scaled icons, bigger than 1 pixel.

btw, I can't reproduce it - it only happened 2 times, but after it happened taffybar had this problem even after restart. Only after I closed pidgin and restarted taffybar it returned to its normal size.

kurnevsky avatar Jul 28 '21 21:07 kurnevsky

Then I don't get it why after this fix I see taffybar with its usual height and correctly scaled icons, bigger than 1 pixel.

Probably because after the 1 pixel resize, the bar immediately resizes and that triggers another automatic resize and then you get the correct size.

My suspicion is that there is some type of degenerate condition at startup.

colonelpanic8 avatar Jul 28 '21 22:07 colonelpanic8

Just reproduced it - it happens after you receive a message in pidgin and then restart taffybar. @IvanMalison any ideas how to debug this?

kurnevsky avatar Jul 29 '21 16:07 kurnevsky