-
Notifications
You must be signed in to change notification settings - Fork 770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Respect win_gravity sizehint for floating windows #1335
Comments
I can see where you are coming from. However, note that this is the first time in 5 years that someone actually makes use of the gravity feature, and i3 does not care about gravity at all in its entire code. Personally, I’d say the gravity feature is old and crufty, and rarely-used. Would it be possible for you to change your code to not rely on that? I think that’d make it compatible with a wide range of niche window managers. |
[Original comment by lolilolicon@…] Replying to comment 1 @…:
Yes, it seems possible to change my code to accommodate. But I have to change a simple By default mpv (which also sets the win_gravity to Obviously, I won't always be able to find equivalent command line options, or to modify the source code, to make this work. That's why I really hope i3 will implement this support. |
[Original comment by lolilolicon@…] Replying to comment 2 by lolilolicon@…:
Now as it turns out, for my code to work in both i3 and Gnome, I have to consider _NET_FRAME_EXTENTS too. Although the code seems to work, it's getting quite ugly, and I'm not quite sure why I need to plus/minus offsets differently depending on win_gravity in Gnome, all to cancel some offsetting done by Gnome's window manager... |
Replying to comment 2 by lolilolicon@…:
Also, wouldn’t you already know the current geometry? You get ConfigureNotify events for every size/position change, so you could keep track of that.
|
[Original comment by lolilolicon@…] Replying to comment 4 @…:
To get the value win_gravity hint. This is a custom command (that can be bound to a keybinding) for sxiv that resizes the window to the size of the displayed image.
Yes, sxiv stores the window geometry on
I've always floated media players since I started using tiling window managers, dwm, xmonad, awesome, etc. A tiled window forces a size different than the actual video size, and leaves black bars around the video; I really dislike that. Floating window for small videos, fullscreen for HD content, that's what I usually do. What is particularly sticky is what I mentioned in comment 3. To have to offset for _NET_FRAME_EXTENTS really turns my code into something out of a window manager. I wonder what else could break this code now. Now, I have some more test results on mpv and its First, I have With With Now consider that |
[Original comment by lolilolicon@…] Replying to comment 5 by lolilolicon@…:
Actually, nope. I was writing this in Gnome, didn't really test it in i3. In i3, press What |
Replying to comment 5 by lolilolicon@…:
I still maintain that it should be doable in your application to implement resizing/moving in a relatively straight-forward fashion without jumping through too many hoops. Take your time to do some tests and figure it out, maybe sleep a night over it. If you, after implementing the most straight-forward way to avoid the center gravity, still think it’d be better to have this code in the window manager, post your code and I’ll reconsider. |
[Original comment by lolilolicon@…] Replying to comment 7 @…:
There is a crucial difference between Gnome/mutter and i3 in handling For example, say If I call This behavior of Gnome forces me to get the frame extents via One more example, if the
And this turned out to work in Gnome/mutter.
Unless there is either a straight-forward way to get the correct coordinates to pass to
If the above turns out to be not clear or convincing enough, I will prepare a patch for sxiv so you can test it out. Note that my code used to be a simple |
[Original comment by lolilolicon@…] sxiv patch v1 http://ix.io/dOu To test, see the note at the header of the files. |
[Original comment by lolilolicon@…] I added some logic in my code to check _NET_SUPPORTED for _NET_FRAME_EXTENTS support so it works more reliably. Speaking of which, shouldn't i3 support
In any case, I wonder, is the application supposed to check and adapt in order to place its window where it wants? Now, if I want my application to work in as many window managers as possible, I probably have to do such things. But should i3 be one of those broken window managers that require such work on the application's part? I will again quote the EWMH spec,
Would it require too much effort to implement this? |
I think the basic problem is #1341, i.e. the “does-the-frame-count” question that seems to be handled differently in i3 than in other window managers. Once that is fixed, I don’t think we need to bother with geometries. That said, not sure when/if I’ll get around to looking into these (tedious) issues. Patches appreciated at http://cr.i3wm.org/ |
[Original comment by lolilolicon@…] Well, I took a look at #1341 is related, but not that much. I think gravity handling can be fixed by itself, without considering the frame irregularity. |
[Original comment by lolilolicon@…] Replying to comment 8 by lolilolicon@…:
For reference, adding this quote from the EWMH spec,
|
[Originally reported by lolilolicon@…]
(When a floating window with win_gravity sizehint set to CenterGravity and
XResizeWindow is called on it, i3 should keep the center of the window at
the here it is. Currently, i3 always keeps the NorthWest corner instead.
The documentation[1] talks about resizing a parent window, which makes
not sure if what I'm asking is a required behavior. BUT, I can confirm
that in Gnome, it works as I like it.
[1] http://www.x.org/releases/X11R7.7/doc/libX11/libX11/libX11.html#Gravity_Attributes
The window I'm talking about is set up with something like this:
and later on change its size with
Does this make sense to you? I'd like this because I added a that
CenterGravity bit to sxiv and a key binding to resize the window to fit
image size, and I don't want the perfectly centered window to change
positions after I press that key. Please consider this, thank you!
The text was updated successfully, but these errors were encountered: