Skip to content
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

Fix event propagation on Openbox #1802

Merged
merged 5 commits into from
Apr 9, 2024
Merged

Fix event propagation on Openbox #1802

merged 5 commits into from
Apr 9, 2024

Conversation

Caellian
Copy link
Collaborator

@Caellian Caellian commented Apr 6, 2024

Events now get correctly propagated to a window (or desktop if none) behind conky instead of always to desktop.

This PR addresses some of the issues raised in #1767, but it's mainly correcting event propagation/passing.

This was a necessary change to handle cases such as MATE+caja where caja is used between conky and background to show icons and desktop menu.

@github-actions github-actions bot added the sources PR modifies project sources label Apr 6, 2024
Copy link

netlify bot commented Apr 6, 2024

Deploy Preview for conkyweb canceled.

Name Link
🔨 Latest commit 2bfe8bb
🔍 Latest deploy log https://app.netlify.com/sites/conkyweb/deploys/661421ff20f90100087a9bf1

@Caellian Caellian linked an issue Apr 6, 2024 that may be closed by this pull request
Events now get correctly propagated to a window (or root if none) behind conky.
This was a necessary change to handle cases such as MATE+caja where caja
is used between conky and background to show icons and desktop menu.

Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
src/x11.cc Outdated Show resolved Hide resolved
@Caellian
Copy link
Collaborator Author

Caellian commented Apr 6, 2024

Detecting the window below conky breaks openbox because it does something weird with the window tree:

0x201369 (has no name): ()  253x102+44+44  +44+44
        24 children:
        0x2200001 "conky (torchwood)": ("Conky" "Conky")  253x102+0+0  +44+44
        0x201395 (has no name): ()  1x1+0+0  +44+44
        0x201394 (has no name): ()  1x1+0+0  +44+44
        0x201393 (has no name): ()  1x1+0+0  +44+44
        0x201392 (has no name): ()  1x1+0+0  +44+44
        0x201391 (has no name): ()  1x1+0+0  +44+44
        0x201390 (has no name): ()  1x1+0+0  +44+44
        0x20138f (has no name): ()  1x1+0+0  +44+44
        0x20138e (has no name): ()  1x1+0+0  +44+44
        0x201389 (has no name): ()  1x1+0+0  +44+44

I've seen a similar thing happen on Plasma...

Atoms should be faster than graph traversal, and also don't include
decorations (windows) inserted by WM/DEs, nor special 1x1 windows.

Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
@Caellian
Copy link
Collaborator Author

Caellian commented Apr 6, 2024

openbox [...] it does something weird with the window tree

Not sure what it is, spent an hour looking for it online but there's no mention of it anywhere. I left the previous impl as a fallback and rely on atoms instead now - so openbox works again. I think _NET_CLIENT_LIST "SHOULD" be common enough. There's ways to improve correctness (like manual ordering based on depth in window attributes if _NET_CLIENT_LIST_STACKED is not defined), but I'm burnt out for now and they seem wasteful.

MATE still doesn't work, that's next I guess.

@Caellian
Copy link
Collaborator Author

Caellian commented Apr 8, 2024

MATE uses caja, which uses gtk. No events get properly passed through, but I'm focusing on right-click which should open a context menu.

Gdk starts handling menu opening with gdk_x11_toplevel_show_window_menu, in gdk/x11/gdksurface-x11.c, which is then translated into a GdkEvent (through very complicated and long pipeline of handlers,signals,converters,...), but up to the point where high level "get events" function is, nothing seems to be checking whether the right-clicked surface is below pointer, nor whether the click event was synthetic (which was my previous hunch).

It seems Gdk only accepts Xinput pointer events, which is why it ignores the basic X11 ones.

Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
@Caellian Caellian changed the title [WIP] Fix propagation Fix event propagation on Openbox Apr 8, 2024
return PointerMotionMask;
default:
return NoEventMask;
}
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a bunch more, but we're not forwarding those events so I didn't implement all of them.

@Caellian Caellian linked an issue Apr 8, 2024 that may be closed by this pull request
Copy link
Owner

@brndnmtthws brndnmtthws left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR looks good, one minor nit.

src/x11.cc Outdated Show resolved Hide resolved
Causes input focus flickering, especially with WMs where focus follows
pointer. This looks weird (carret flashing) and effectively acheives
nothing. So I'm, leaving it up to WMs to manage focus.

Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
@Caellian Caellian marked this pull request as draft April 8, 2024 16:52
Signed-off-by: Tin Švagelj <tin.svagelj@live.com>
@Caellian Caellian marked this pull request as ready for review April 8, 2024 17:21
@Caellian Caellian mentioned this pull request Apr 8, 2024
@Caellian Caellian merged commit 9424ab8 into main Apr 9, 2024
62 checks passed
@Caellian Caellian deleted the fix/event-propagation branch April 9, 2024 12:28
@brndnmtthws brndnmtthws added the bug Bug report or bug fix PR label Apr 11, 2024
@lodgerz
Copy link

lodgerz commented May 6, 2024

thanks for fixing the bug. it happened to me too on openbox: due to conky the cpu reached 40% and the temperature over 60°, then by killing conky everything went back to normal.

If you're interested, I found a way to reproduce the bug:

  1. open lxappearance and change the theme (one at random)
  2. close and reopen chromium and save a random image (the problem starts when the chromium file manager opens, I think it uses gtk3)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report or bug fix PR sources PR modifies project sources
Projects
None yet
Development

Successfully merging this pull request may close these issues.

how to make conky consistenly pass clicks to the root window #320
3 participants