You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Repository navigation
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Image / video preview extends beyond confines of monitor #59
I have a dual screen setup with a 900x1440 monitor that has Cawbird running normally.
I've noticed that some pictures and videos will open wider than the length of the monitor and spill over onto my other display.
It's not a huge issue, but I was wondering if there was a way to restrict the preview windows to rescale automatically down to the size of the monitor it's being displayed on?
Odd. I've never seen it as an issue for vertical overflow on a single monitor.
I'll have to investigate, but in theory we've already got code that limits it to 95% of your screen size. Maybe that sees the dual screen setup as one extra-wide monitor?
Apparently X merges screens and treats them as one big one. This will need a bit of a work-around, possibly involving swapping to GdkDisplay and GdkMonitor instead of GdkScreen (which seems to be partially deprecated, especially when it comes to monitors)
This may also fix some build warnings such as: ../src/CbMediaVideoWidget.c:359:3: warning: ‘gdk_screen_get_height’ is deprecated [-Wdeprecated-declarations]
That change should fix the problem to the greatest extent that Cawbird can manage (AFAIK).
The image should now be no more than 95% of 900px wide, so as long as Cawbird is in the middle of your monitor or further away from your second monitor then it should now all stay on one screen.
If Cawbird is closer to the joining edge of the two monitors then your window manager may still decide to just centralise the image over the Cawbird main window, which could still overflow. But I believe that's just the window manager's behaviour and we're stuck with it.
Can you try the fix out and tell me whether it works?
Okay, if you can build and test b1d3427 then it should have some debugging in that will help me understand what's going on. You might need to run it as G_MESSAGES_DEBUG=cawbird cawbird. The extra debugging will show when you click an image, e.g.:
(cawbird:9925): cawbird-DEBUG: 19:34:36.018: TweetUtils.vala:341: Num monitors: 1
(cawbird:9925): cawbird-DEBUG: 19:34:36.019: TweetUtils.vala:344: Monitor 0: BNQ DP-0 - 2560×1440 (work area 2560×1413)
(cawbird:9925): cawbird-DEBUG: 19:34:36.020: TweetUtils.vala:347: Current monitor: BNQ DP-0 - 2560×1440 (work area 2560×1413)
(cawbird:9925): cawbird-DEBUG: 19:34:36.020: TweetUtils.vala:350: Max dimensions: 2432×1342
I'm running Gnome Shell on X, so I doubt Wayland will make a difference.
I've tested on my dual-monitor setup at work (without a portrait display). It looks like it should be working. Notice how the max dimensions differ vertically because the Gnome main bar is only on one monitor and so it has a smaller "work area".
(cawbird:5740): cawbird-DEBUG: 09:28:58.552: TweetUtils.vala:341: Num monitors: 2
(cawbird:5740): cawbird-DEBUG: 09:28:58.553: TweetUtils.vala:344: Monitor 0: DEL DP-2 - 2560×1440 (work area 2560×1413)
(cawbird:5740): cawbird-DEBUG: 09:28:58.553: TweetUtils.vala:344: Monitor 1: DEL DP-1 - 2560×1440 (work area 2560×1440)
(cawbird:5740): cawbird-DEBUG: 09:28:58.553: TweetUtils.vala:347: Current monitor: DEL DP-1 - 2560×1440 (work area 2560×1440)
(cawbird:5740): cawbird-DEBUG: 09:28:58.553: TweetUtils.vala:350: Max dimensions: 2432×1368
(cawbird:5740): cawbird-DEBUG: 09:29:13.218: TweetUtils.vala:341: Num monitors: 2
(cawbird:5740): cawbird-DEBUG: 09:29:13.219: TweetUtils.vala:344: Monitor 0: DEL DP-2 - 2560×1440 (work area 2560×1413)
(cawbird:5740): cawbird-DEBUG: 09:29:13.219: TweetUtils.vala:344: Monitor 1: DEL DP-1 - 2560×1440 (work area 2560×1440)
(cawbird:5740): cawbird-DEBUG: 09:29:13.220: TweetUtils.vala:347: Current monitor: DEL DP-2 - 2560×1440 (work area 2560×1413)
(cawbird:5740): cawbird-DEBUG: 09:29:13.220: TweetUtils.vala:350: Max dimensions: 2432×1342
(cawbird:15297): cawbird-DEBUG: 14:06:53.653: TweetUtils.vala:341: Num monitors: 2
(cawbird:15297): cawbird-DEBUG: 14:06:53.654: TweetUtils.vala:344: Monitor 0: DEL DisplayPort-1 - 2560×1440 (work area 2560×1402)
(cawbird:15297): cawbird-DEBUG: 14:06:53.654: TweetUtils.vala:344: Monitor 1: SAM DVI-D-0 - 900×1440 (work area 900×1440)
(cawbird:15297): cawbird-DEBUG: 14:06:53.654: TweetUtils.vala:347: Current monitor: SAM DVI-D-0 - 900×1440 (work area 900×1440)
(cawbird:15297): cawbird-DEBUG: 14:06:53.654: TweetUtils.vala:350: Max dimensions: 855×1368
Results from the 1440p monitor:
(cawbird:28463): cawbird-DEBUG: 14:23:15.199: TweetUtils.vala:341: Num monitors: 2
(cawbird:28463): cawbird-DEBUG: 14:23:15.199: TweetUtils.vala:344: Monitor 0: DEL DisplayPort-1 - 2560×1440 (work area 2560×1402)
(cawbird:28463): cawbird-DEBUG: 14:23:15.199: TweetUtils.vala:344: Monitor 1: SAM DVI-D-0 - 900×1440 (work area 900×1440)
(cawbird:28463): cawbird-DEBUG: 14:23:15.199: TweetUtils.vala:347: Current monitor: DEL DisplayPort-1 - 2560×1440 (work area 2560×1402)
(cawbird:28463): cawbird-DEBUG: 14:23:15.199: TweetUtils.vala:350: Max dimensions: 2432×1332
Now this is odd because the program is reporting the max dimensions as 855×1368, but the width is definitely longer than the edge of my monitor.
Here's a screenshot of the render extending between my monitors, the white background on the right half showing the monitor border, and the image preview extending past that:
So that screenshot is the width of your monitor plus the overlap? There's nothing more to the left? (I've just measured in Gimp and it appears to be 900px wide).
That… doesn't make much sense. I'll have to double-check what is happening, because if it's showing that logging then it's doing the cropping! Unless there's some behaviour in the widget that I'm not accounting for.
Think I found the problem, I disabled the 1440p monitor so it was just the vertical one, and the widget didn't crop or resize the image at all.
Code from the debug log:
(cawbird:10537): cawbird-DEBUG: 22:11:49.619: TweetUtils.vala:341: Num monitors: 1
(cawbird:10537): cawbird-DEBUG: 22:11:49.620: TweetUtils.vala:344: Monitor 0: SAM DVI-D-0 - 900×1440 (work area 900×1402)
(cawbird:10537): cawbird-DEBUG: 22:11:49.620: TweetUtils.vala:347: Current monitor: SAM DVI-D-0 - 900×1440 (work area 900×1402)
(cawbird:10537): cawbird-DEBUG: 22:11:49.620: TweetUtils.vala:350: Max dimensions: 855×1332
Okay, so seemingly something isn't honouring the size and I just don't see it because my monitor is big enough and the logging looks okay.
Do you have the same problem with videos? Because I tested those with an arbitrary max size (since they have slightly different logic and scale to keep the proportions, rather than cropping) and they seemed okay.
Just had a quick test with some of the videos in my feed, none of them overflowed, but I might need to find a video that's a little wider to test with properly.
Turns out it was my fault it wasn't doing the right thing. An "if image size is less than max size then use the image size" statement became an "if image size is greater than max size then constrain it" statement and I didn't move the "don't scroll" call out of the block, so GTK was being helpful and saying "if you want it X by Y but you also don't want scrolling then I'll ignore the X by Y".
Activity
IBBoard commentedon Nov 18, 2019
Odd. I've never seen it as an issue for vertical overflow on a single monitor.
I'll have to investigate, but in theory we've already got code that limits it to 95% of your screen size. Maybe that sees the dual screen setup as one extra-wide monitor?
Can you give me an example tweet to test?
rodneyrod commentedon Nov 30, 2019
The picture in this one extends over the monitor edge on my display.
https://twitter.com/RussianMemesLtd/status/1200681618933010432
IBBoard commentedon Nov 30, 2019
Okay, image is 1124×1093.
When you say 900×1440, do you mean you've got your monitors in portrait?
I'm also wondering about
gdk_screen_get_defaultand whether that sees multi-desktop as a single screen. I'll have to investigate.rodneyrod commentedon Nov 30, 2019
That's right, that monitor is in portrait
IBBoard commentedon Jan 21, 2020
Apparently X merges screens and treats them as one big one. This will need a bit of a work-around, possibly involving swapping to GdkDisplay and GdkMonitor instead of GdkScreen (which seems to be partially deprecated, especially when it comes to monitors)
This may also fix some build warnings such as:
../src/CbMediaVideoWidget.c:359:3: warning: ‘gdk_screen_get_height’ is deprecated [-Wdeprecated-declarations]Re #59: Set max size based on current monitor
IBBoard commentedon Jan 25, 2020
That change should fix the problem to the greatest extent that Cawbird can manage (AFAIK).
The image should now be no more than 95% of 900px wide, so as long as Cawbird is in the middle of your monitor or further away from your second monitor then it should now all stay on one screen.
If Cawbird is closer to the joining edge of the two monitors then your window manager may still decide to just centralise the image over the Cawbird main window, which could still overflow. But I believe that's just the window manager's behaviour and we're stuck with it.
Can you try the fix out and tell me whether it works?
rodneyrod commentedon Jan 27, 2020
Tried the latest build, no change when I've dragged on either monitor and on both edges of the 900px screen.
Tested with this image:
https://twitter.com/RussianMemesLtd/status/1221451980251353088
Would have thought this would work on Gnome Shell at least.
Do you think running it in Wayland might yield different results?
Add some debugging for #59
IBBoard commentedon Jan 28, 2020
Okay, if you can build and test b1d3427 then it should have some debugging in that will help me understand what's going on. You might need to run it as
G_MESSAGES_DEBUG=cawbird cawbird. The extra debugging will show when you click an image, e.g.:I'm running Gnome Shell on X, so I doubt Wayland will make a difference.
IBBoard commentedon Jan 30, 2020
I've tested on my dual-monitor setup at work (without a portrait display). It looks like it should be working. Notice how the max dimensions differ vertically because the Gnome main bar is only on one monitor and so it has a smaller "work area".
Can you confirm which version you've tested?
rodneyrod commentedon Feb 2, 2020
Tested with the following picture:
Results from the vertical monitor:
Results from the 1440p monitor:
Now this is odd because the program is reporting the max dimensions as 855×1368, but the width is definitely longer than the edge of my monitor.
Here's a screenshot of the render extending between my monitors, the white background on the right half showing the monitor border, and the image preview extending past that:
https://imgur.com/a/3RVaSbN
And here's a link to the tweet tested:
https://twitter.com/RussianMemesLtd/status/1222903042057461760
EDIT: I'm also using these UI extensions if they might affect rendering:
Arc Menu
Dash to Panel
Topicons Redux
Gtile
IBBoard commentedon Feb 2, 2020
So that screenshot is the width of your monitor plus the overlap? There's nothing more to the left? (I've just measured in Gimp and it appears to be 900px wide).
That… doesn't make much sense. I'll have to double-check what is happening, because if it's showing that logging then it's doing the cropping! Unless there's some behaviour in the widget that I'm not accounting for.
rodneyrod commentedon Feb 2, 2020
Think I found the problem, I disabled the 1440p monitor so it was just the vertical one, and the widget didn't crop or resize the image at all.
Code from the debug log:
IBBoard commentedon Feb 2, 2020
Okay, so seemingly something isn't honouring the size and I just don't see it because my monitor is big enough and the logging looks okay.
Do you have the same problem with videos? Because I tested those with an arbitrary max size (since they have slightly different logic and scale to keep the proportions, rather than cropping) and they seemed okay.
rodneyrod commentedon Feb 2, 2020
Just had a quick test with some of the videos in my feed, none of them overflowed, but I might need to find a video that's a little wider to test with properly.
IBBoard commentedon Feb 2, 2020
Turns out it was my fault it wasn't doing the right thing. An "if image size is less than max size then use the image size" statement became an "if image size is greater than max size then constrain it" statement and I didn't move the "don't scroll" call out of the block, so GTK was being helpful and saying "if you want it X by Y but you also don't want scrolling then I'll ignore the X by Y".
rodneyrod commentedon Feb 4, 2020
Thanks so much, works great!