maim
maim copied to clipboard
Invalid coordinates when using window IDs
I'm was trying to capture a single window using maim -s, but while the screenshot seem to be of the correct size, it's actually black after a certain position.
The coordinates reported by slop though seem correct. In fact, running maim -g $(slop -f%g) works perfectly.
It seems that using window IDs instead is broken in maim itself. maim -i $(slop -f%i) has the same issue as maim -s when just selecting a window.
Sounds like the same as #71, I've been experiencing this for the past few days as well.
Running i3gaps and Mesa/radeonsi, happens with 3.4.47 and master, regardless of whether compton is running or not. I've also tried disabling masking as suggested in the past, same problem.
Actually, the problem is related to X.org 1.19, downgrading to 1.18 fixes it.
Does slop use a different method to calculate coordinates from window IDs that could account for such a difference? I always had weird offsets in screenshots when using maim -s. If passing coordinates to maim works, and slop calculates correct coordinates to begin with, it would suggest a bug in maim.
I'm already pretty sure the issue is in maim itself, I've tried imagemagick import, and it worked fine. Windows that are large enough show a small portion grabbed properly on the left (at the right position), but the rest of the screenshot is entirely blank.
Most screenshotters don't use coordinates to capture a window by ID, they grab its own framebuffer directly.
The bug is likely to be in either imlib2 or xorg itself. Here's a minimal working example that calls imlib2 directly and has the same issue when trying to capture a window - no coordinate shenanigans involved.
Edit: Further testing without imlib2 seems to indicate that the problem comes from xorg's XShm extension somehow.
On my dual-monitor setup, windows captured on the leftmost screen (1680x1050) show up fine, while windows captured between screens or on the rightmost screen (1920x1200) show up partially blank or fully blank depending on window size.
So... what can we do? Downgrade Xorg?
I wrote a really minimal clone of maim in go (that makes use of slop): https://github.com/onodera-punpun/xutils/blob/master/xscrot/main.go
Minimal here meaning it only does the things I use, anyways you can use it till this issue is fixed
I'm currently working on remaking slop and maim. Slop's remake is pretty much done here: https://github.com/naelstrof/slop/tree/slop-release-candidate
I'm currently working on removing dependencies from maim, hang in there!
On Mon, Feb 13 2017, Dalton Nell wrote:
https://github.com/naelstrof/slop/tree/slop-release-candidate
Please tell us that standard X11 geometry will be the default output ;)
You've waited a good 2 years, since I'm changing the options formatting anyway I might as well...
How's this? https://github.com/naelstrof/slop/commit/f119dc80d76a8bbe503455cecf1f1ebd54e34522
Aaargh, don't edit existing messages. Github doesn't send notifications for edits. This is something I wish they wouldn't allow entirely. That is perfect.
This should be fixed in the new release https://github.com/naelstrof/maim/releases/tag/v4.4.47 Let me know how it works.