maim icon indicating copy to clipboard operation
maim copied to clipboard

Invalid coordinates when using window IDs

Open wavexx opened this issue 8 years ago • 11 comments

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.

wavexx avatar Jan 16 '17 18:01 wavexx

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.

9ary avatar Jan 17 '17 20:01 9ary

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.

wavexx avatar Jan 18 '17 18:01 wavexx

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.

9ary avatar Jan 18 '17 18:01 9ary

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.

Narthorn avatar Jan 21 '17 11:01 Narthorn

So... what can we do? Downgrade Xorg?

ntrrgc avatar Feb 12 '17 13:02 ntrrgc

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

CamilleScholtz avatar Feb 12 '17 14:02 CamilleScholtz

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!

naelstrof avatar Feb 13 '17 21:02 naelstrof

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 ;)

wavexx avatar Feb 13 '17 22:02 wavexx

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

naelstrof avatar Feb 13 '17 23:02 naelstrof

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.

wavexx avatar Feb 20 '17 11:02 wavexx

This should be fixed in the new release https://github.com/naelstrof/maim/releases/tag/v4.4.47 Let me know how it works.

naelstrof avatar Feb 23 '17 12:02 naelstrof