KWindowSystem is a mix of two things:
Very thorough low level X11 bindings for billions of things.
High level abstraction with multiple backends round a few things.
We present this as though it's a high level abstraction round billions of things, and then they subsequently don't work.
The API doesn't fit, so for Wayland we end up writing two sets of code for anything substantial anyway.
Wayland is also done in a complex way to accommodate the problem of using kwayland. Currently we have an in-tree plugin in kwindowsystem which in turn redirects to an out of tree plugin kwayland-integration which is released with plasma. That's a mess.
Some of the things we're using it for exist in Qt. Like
KWindowSystem::activatewindow is literally the same as
QWindow::activate(), unminimize is the same as setWindowState() etc.
It needs some revisiting, probably quite early as pushing some things
to Qt would help fix things
- split KWindowSystem into KX11Stuff Net*, KSelection*, KStartup*, KXMessages, KWindowInfo, KWindowSystem.
- KAwesomeHighLevelWindowStuff which has the KWindowEffects with the current backends. Code will call into KX11/KWayland/Whatever respectively.
KKeyServer I don't know? It's XKB relevant, and we still use that on wayland.
I've tried to analyse the current usages of everything except Plasma.
kcookieserver -> setMainWindow (==setTransientPArent)
kcookiewin -> setMainWindow
kpasswrdserver -> watch windowRemoved (won't work on wayland - also why?)
krun -> currentDesktop
krun -> startupinfo
- window added / window removed (won't work on wayland!!!)
Current Usage of KWindowSystem (excluding Plasma)
dolphin - activate window
dolphin -> isplatform wayland
(why?? - lack of raise request)
kate -> activate window
kate -> set on all desktops? (no idea why?)
current desktop -> for activating the "right" one
kdialog -> set main window
konq -> startup ID (legit case)
konq -> unminize
konsole -> compositingActive
konsole -> getCurrentDesktop
yakuake -> isX11
yakuake -> detect work area changed (== QScreen::availableGeom)
kwordquiz -> unminimize
various kipi-plugins-> unminize
KRuler -> set window type
-> set keep above
okular -> get current dekstop again for DBus activation - should
probably be shared
spectacle -> isX11
-> updating the title!!!!! !???!! -> compositing active
dragonplayer -> forceActivate
juk -> forceActivate
kget -> forceActivate
krdc -> isX11
ktp -> forceActivate
kgpg -> setOnDesktop
print-manager -> forceActivate