Skip to content
Commit 6404dde4 authored by Thomas Lübking's avatar Thomas Lübking
Browse files

Support multiple X servers in the NETWM classes

Original patch by M. Graesslin
--------
So far on first creation of a NETRootInfo or NETWinInfo a static
initialization of atoms was performed. This meant that the NET classes
are only able to interact with the X server the first NET class is
connected to.

Normally applications don't need to interact with multiple X servers.
An exception is kwin_wayland which needs a connection to its Xwayland
server and on the x11 backend to the X server it renders to. So far
KWin could not use the NET classes for it, causing the rendering window
to e.g. not have a window title.

This change removes the implicit constraint on one X server by
creating a hash of connection and atoms. For each created NET class
we check whether we have already resolved the atoms, if yes we reuse
otherwise we create them.

For the normal use case of one X11 connection the change should be
rather minimal. Instead of performing the check whether the static
atoms have been created, it now is a check whether the atoms for the
connection have been created. The atoms are kept in a
QSharedDataPointer ensuring that we don't needless copy the atoms into
each class.

---

As we cannot avoid touching each and every atom referencing code line
we use the opportunity to clean up the code by getting rid of atom
variables (with ambigious names) and an array to link their references to
strings and an integer to define the length of the array by an atom array
(instead of the variables), enums to reference and count them
(by the actual atom tokens) and a string array - with some preproc magic, to
keep atoms, strings and counter in sync automagically.

CHANGELOG: Allow interacting with multiple X servers in the NETWM classes.
REVIEW: 125309
parent 4b9317af
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment