-
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
Input shapes with holes don't correctly allow input through #2742
Comments
Note that this is not a bug since i3 doesn't claim to support the Shape extension. In general there's also no reason to: tiling window managers don't have overlapping windows, that's the entire point. Floating windows in i3 are meant for dialogs and popups, not long-living applications. That said, I see why in this specific case a floating window makes sense even for such an application. I think implementing Shape in i3 would be quite a lot of work, and would of course introduce a new dependency. I'm not really sure yet whether we'd want this. |
+1 to support Shape in i3, even just for this peek killer-app. |
peek is indeed pretty slick and useful. Two observations:
So, pull requests which implement just enough of the shape extension so that clicks are routed correctly are welcome :). |
This requirement will go away in the next release :) Only the click through won't work with i3 then. |
Interesting. How are you going to implement transparency without a compositor? |
Sorry for raising false hopes, won't work on i3 still. Of course it uses the shape extension, which is not supported, hence this issue here :D |
@stapelberg phw/peek#147 and phw/peek@1843473 and https://developer.gnome.org/gdk3/stable/gdk3-Windows.html#gdk-window-shape-combine-region (so, as @phw says: By using the SHAPE extension) |
Please have a look, you can have peek recording stacked and it will work perfectly fine. |
Sorry to raise a year old issue, but it's still very much relevant. I'm curious what in i3 actually makes this not work, especially seeing that something as simplistic as tinywm which is a super bare bones wm with just 50 lines of C code somehow manages to behave as expected with the likes of peek and xeyes. I'm not well versed in Xlib and xcb (and the differences between them). It just seems odd that it appears to work out of the box with Xlib, while it doesn't work in i3. |
It works for tinywm because it doesn't do reparenting, I'd guess. |
I would claim that tinywm is not a WM. It doesn't do any of the things ICCCM requires from a WM. @algmyr Let's say you want your WM to add window decorations to windows (=titlebar). The way to do this is for the WM to create its own window that is slightly larger than the window that should get the decorations. Then, the WM reparents the target window into its own window. This means that the target window is now inside of the WM's window and e.g. moves with it. Now, the WM can draw stuff on its target window to e.g. add a close button. Now, if the target window has a hole in it (as in xeyes and peek), then that hole just allows you to see the WM's window. Since the WM does not expect this part to be visible, you usually end up with a black background here. In a non-reparenting WM, you do not get things like a close button. And since the WM does not add its own frame window around the window that some program creates, a hole in the window allows to see through to whatever is behind that window. |
@Airblader I guess that makes sense. Does that mean that the garbage with something like xeyes comes from the parent window (which I guess handles the window decoration) rather than the application itself? It would make sense if the garbage comes from an uninitialized pixmap where only the decoration is actually drawn. |
Yes, it is. |
Uhm. Is that "garbage screenshot" with i3? Line 855 in 64e7646
A simple call to xcb_poly_fill_rectangles(conn, con->frame_buffer.id, con->frame_buffer.gc, 1, (xcb_rectangle_t[]) { x = 0, y, = 0, width = width, height = height }); should do the job.
(Also, I will not ask why this seems to have one GC per container and I also will not ask why this pixmap even is as large as it is, instead of just having a pixmap for the area that is actually used (which seems to be enough given that @algmyr has a screenshot suggesting that the remaining area is never filled with anything)) |
I wouldn't mind, though for the record on my machine xeyes works just fine (in the sense that the background is black).
Aren't gcs per drawable? You know much more about this stuff, so I'm sure that if you say it's unnecessary, it is. :-)
You mean why it covers the entire window rather than just the titlebar? We'll need it for the borders, right? |
i3-gaps, but I suspect the behavior would be the same in plain i3. Edit: it is I can get the xeyes background to be black in some circumstances, like launching it on an empty workspace. If I launch it on a non-empty workspace the background will be some existing part of the screen. The "garbage" shows up when resizing, that particular screenshot was after toggling the window to floating (which consistently seems to give that kind of thing). I suppose the cairo surface is reallocated and never overwritten, so old data just stays there. |
From https://www.x.org/releases/X11R7.5/doc/x11proto/proto.html (look for "CreateGC"):
So, assuming i3 does not support zaphod mode and only cares about a single root window, GCs are per depth. Which, in practice, likely means that you need one GC for depth 24 and one for depth 32.
Sorry, but that sounds like a waste of memory. Memory is cheap these days, but still... A pixmap of size 800x600 and 4 byte per pixel needs about 1.8 MiB (
Actually... The code that draws the titlebars and copies the pixmap to the window does not run for floating containers: Line 419 in 64e7646
Thus, these end up being not painted (and since, I guess, i3 uses a background of None for its frame windows, this means whatever was visible here before ends up being visible). (Oh, which means that the pixmap allocated for floating containers is completely unused...? ;-) )
Hm, that's not "consistent" with the available symptoms. Cairo clears image surfaces that it allocates, unless you use (Even more off-topic: Why does Line 216 in db0add0
|
Please don't :-) I've created issues for all of the raised points: The point about x_draw_decoration filling the background first would be void if we used separate pixmaps, though, right? I've created an issue nonetheless since that change is much easier to do: |
This codebase is a bit of a maze to me right now. I think that resizing containers trigger reallocs of pixmaps/surfaces at around Line 855 in 64e7646
draw_util_surface_init , but then I suspect that it's the xcb_create_pixmap that is not cleared? Otherwise I have no clue why there would be garbage data in the pixmap.
On the other hand, wouldn't Line 889 in 64e7646
|
@algmyr First: Yupp, this |
@Airblader Here is some start of proper(?) shape support: https://github.com/psychon/i3/tree/shape_support I'm out of time for today and if anyone wants, they can pick this up and continue working on it. (For how the actual shapeing is done here: The XFixes extension introduces the concept of "regions" in version 2. A region can e.g. be created from the shape of a window and can also be used to set the shape of a window. Thus, this allows to "copy" the shape from one window to another without actually having to download the shape from the X11 server. This just needs to add the geometry of window decorations to the shape first so that these stay visible.) |
@psychon Thank you so much for this already, that's a really great starting point for someone to work on this! I appreciate it. |
I've continued the work of @psychon: https://github.com/xzfc/i3/tree/2742-shape. Anyone feel free to take my commit. Changes made:
For now peek is usable, but you should disable compositing. Some clumsy test app: https://gist.github.com/xzfc/d3b28cc800e477a89cb70b7bf081f3cd |
@xzfc Thanks. Very nice. One quick comment: Input shapes were added in shape version 1.1. My initial commit does not do any version checks because version 1.0 was "good enough" and there is no older version. For input shape handling, this should test if the server actually supports shape 1.1 and otherwise stay away from |
OK, but I think this is a minor issue now, since the X.Org supports 1.1.
Not sure if this is the right way, but I just made it in the same way as Openbox does: it handles both bounding and clip as the bounding. |
Oh, hey... https://github.com/danakj/openbox/blob/9e8813e111cbe6c1088f6abbc771a29470f05fc2/openbox/frame.c#L293
|
Yay, switching to |
Basic idea: if the window has a shape, set the parent container shape as the union of the window shape and the shape of the frame borders. Co-authored-by: Uli Schlachter <psychon@znc.in>
Basic idea: if the window has a shape, set the parent container shape as the union of the window shape and the shape of the frame borders. Co-authored-by: Uli Schlachter <psychon@znc.in>
Basic idea: if the window has a shape, set the parent container shape as the union of the window shape and the shape of the frame borders. Co-authored-by: Uli Schlachter <psychon@znc.in>
Basic idea: if the window has a shape, set the parent container shape as the union of the window shape and the shape of the frame borders. Co-authored-by: Uli Schlachter <psychon@znc.in>
Basic idea: if the window has a shape, set the parent container shape as the union of the window shape and the shape of the frame borders. Co-authored-by: Uli Schlachter <psychon@znc.in>
Basic idea: if the window has a shape, set the parent container shape as the union of the window shape and the shape of the frame borders. Co-authored-by: Uli Schlachter <psychon@znc.in>
Basic idea: if the window has a shape, set the parent container shape as the union of the window shape and the shape of the frame borders. Co-authored-by: Uli Schlachter <psychon@znc.in>
Basic idea: if the window has a shape, set the parent container shape as the union of the window shape and the shape of the frame borders. Co-authored-by: Uli Schlachter <psychon@znc.in>
Basic idea: if the window has a shape, set the parent container shape as the union of the window shape and the shape of the frame borders. Co-authored-by: Uli Schlachter <psychon@znc.in>
Basic idea: if the window has a shape, set the parent container shape as the union of the window shape and the shape of the frame borders. Co-authored-by: Uli Schlachter <psychon@znc.in>
Add input and bounding shapes support (#2742)
Output of
i3 --moreversion 2>&- || i3 --version
:URL to a logfile as per http://i3wm.org/docs/debugging.html:
http://logs.i3wm.org/logs/5744863563743232.bz2
What I did:
Started peek and clicked on its click-through-able region during recording.
What I saw:
The click was received by peek and not the program underneath.
For what its worth, I observed the same behavior with licecap running in wine.
What I expected instead:
Mouse events to be received by the program under peek.
According the the peek developer, this is likely an upstream issue.
The text was updated successfully, but these errors were encountered: