Skip to content

refactor: precache the IsWindowStateEvent() XAtom #23260

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

Merged
merged 1 commit into from
Apr 23, 2020

Conversation

ckerr
Copy link
Member

@ckerr ckerr commented Apr 23, 2020

Description of Change

Backport of #22706. See that page for more PR discussion.

Don't look up the _NET_WM_STATE XAtom every time we get an XEvent. Instead, get it when the WindowStateWatcher is constructed and keep it in a private const field. XEvents are high volume -- for example, moving a mouse across the screen can trigger dozens of XMouseEvents per second -- so looking it up in each event handler call is expensive over time.

Checklist

Release Notes

Notes: Improved window events handler efficiency on Linux.

Sorry, something went wrong.

* refactor: precache the IsWindowStateEvent() atom

XAtoms never change after creation so we can perload the atoms we need.
This is useful in WindowStateWatcher's XEvent handler, which is called
on every XEvent, e.g. mouse movement...

* empty commit for ci
@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Apr 23, 2020
@trop trop bot added 9-x-y backport This is a backport PR labels Apr 23, 2020
@codebytere codebytere merged commit 3d8b2af into 9-x-y Apr 23, 2020
@release-clerk
Copy link

release-clerk bot commented Apr 23, 2020

Release Notes Persisted

Improved window events handler efficiency on Linux.

@codebytere codebytere deleted the backport/9-x-y/intern-xatoms-sparingly branch April 23, 2020 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
9-x-y backport This is a backport PR new-pr 🌱 PR opened recently
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants