BurntSushi / xpybutil

An incomplete xcb-util port plus some extras
Do What The F*ck You Want To Public License
62 stars 15 forks source link

Move and resize do not seems to be applied #15

Closed AlexisBRENON closed 4 years ago

AlexisBRENON commented 4 years ago

Hi,

For my project I need to set the geometry of a window, but it does not seem to work as I expect it.

Here is a code snippet:

import xpybutil.ewmh
import xpybutil.window
import xpybutil.util
atom = xpybutil.util.get_atom

cookie = xpybutil.ewmh.get_active_window()
window = cookie.reply()[0]

expected_geometry = dict(x=1930, y=10, w=2540, h=1420)

xpybutil.ewmh.request_wm_state(
    window, 0,
    atom('_NET_WM_STATE_MAXIMIZED_HORZ'), atom('_NET_WM_STATE_MAXIMIZED_VERT'))
xpybutil.window.moveresize(
    window,
    **expected_geometry
)

actual_geometry = dict(zip(('x', 'y', 'w', 'h'), xpybutil.window.get_geometry(window)))

assert actual_geometry == expected_geometry```

Which fails with
```none
{'h': 1440, 'w': 2560, 'x': 1920, 'y': 0} != {'h': 1420, 'w': 2540, 'x': 1930, 'y': 10}

Expected :{'h': 1420, 'w': 2540, 'x': 1930, 'y': 10}
Actual   :{'h': 1440, 'w': 2560, 'x': 1920, 'y': 0}

I saw that you recommend to use the checked version of the moveresize method or call the reply() on the cookie, I don't see any checked in the window module, and it seems that this module already handle the call to reply.

Do I do something wrong?

BurntSushi commented 4 years ago

You don't seem to indicate whether the geometry changes at all. Moveresize is just a request to the WM. The WM decides how to apply it (if at all).

Also, please consider noting that this project is effectively unmaintained. That should be clear from the commit history and issue tracker.

AlexisBRENON commented 4 years ago

Yes, the geometry seems to be changed. However, the reported geometry seems to have one call delay (changing the expected geometry, will have an impact, not on the next call, but the one after it), and in either case, there is 10 px difference in width and height.

Anyway, do you know any other project which is equivalent and still maintained? Or are you looking for any maintainer? (The last commit is not so old).

BurntSushi commented 4 years ago

However, the reported geometry seems to have one call delay (changing the expected geometry, will have an impact, not on the next call, but the one after it)

This sounds like a buffer issue and is usually what happens when an unchecked request is sent. I believe there is a flush or sync call you can make to force the buffer to flush. Maybe try that?

and in either case, there is 10 px difference in width and height.

This is not something I can help debug. This is between you and your WM.

Anyway, do you know any other project which is equivalent and still maintained?

No.

Or are you looking for any maintainer?

No. I'd recommend forking the project and starting a new one.

(The last commit is not so old).

Sure, but look at the history. There have been only nominal commits for the past several years. I myself haven't used this library in over 7 years. And I haven't worked with X directly in about 5 years since my WM has been working well without issue. It's been so long that I just do not have the context to help you, sorry. You'll need to find someone else to help you or dig into this on your own. (The latter is unfortunately the most common reality when dealing with X.)