The Shortcut That Almost Fixed Twenty Files at Once, and Why It Couldn't

Twenty files in one KDE package needed the same fix: remove an unconditional include of a header that doesn't exist on this system. Patching all twenty by hand looked avoidable. One upstream flag, flipped the other way, looked like it would satisfy the missing header everywhere at once. It didn't — and the reason it couldn't is more specific than "it didn't work."

The problem the shortcut was aimed at

plasma-workspace has roughly twenty files that unconditionally #include <KX11Extras>, KWindowInfo, KStartupInfo, or KUserTimestamp — all real KDE Frameworks headers, all genuinely dead code once you follow what actually calls them: every use sits behind KWindowSystem::isPlatformX11(), which is always false on this Wayland-only system. The code itself is provably unreachable. The problem isn't the logic. It's that those headers don't exist at all when kwindowsystem — the framework that defines them — gets built with X11 support turned off, which it was, for the same reason described elsewhere in this build: no Xorg installed, no reason to carry X11 support forward. Dead code that can't even compile isn't dead code anymore; it's a build failure.

The shortcut that looked free

By the time kwindowsystem gets built, this system already has a working libX11/libxcb stack on disk — pulled in for an unrelated reason, kscreenlocker's own runtime dependency, documented separately. That made one option look tempting: flip kwindowsystem's own real X11 flag, KWINDOWSYSTEM_X11, back on. The libraries it needs already exist. If the headers exist again, twenty unconditional includes across a different package stop failing to compile, without touching a single one of those twenty files.

Why it couldn't actually work

Turning the flag on doesn't just restore the headers — it restores kwindowsystem's actual X11 implementation: kwindowsystem.cpp, kx11extras.cpp, kkeyserver.cpp, and the platform-specific XCB backend files. That implementation unconditionally includes <private/qtx11extras_p.h> — Qt5's QtX11Extras private header. Qt6 never carried that module forward at all. Not deprecated, not renamed, not available behind a different include path — it doesn't exist, because Qt6 dropped the whole QtX11Extras module design when it redid platform integration. This isn't a dead-code call site that a runtime check protects; it's the live implementation itself, and fixing it for real would mean building Qt6 with actual X11 platform-plugin support from scratch — an entirely different, much larger undertaking than getting twenty files in a different package to compile.

What the shortcut actually cost

Nothing shipped, no working state was lost — the attempt was reverted back to KWINDOWSYSTEM_WAYLAND, the package's own default, before doing anything downstream of it. The cost was entirely in finding out the shortcut didn't work: building far enough to hit the QtX11Extras compile failure, tracing it back to a missing Qt6 module rather than a missing KDE one, and confirming that fixing it properly was out of scope before going back to the twenty-files plan. That's a real, specific way a shortcut can fail — not by being wrong about the problem, but by being right about a symptom while resting on an assumption (that flipping this particular flag would only affect the visible, missing-header issue) that turned out to reach two layers deeper than expected.

The twenty files, patched anyway

The actual fix ended up being the one the shortcut was meant to avoid: each of plasma-workspace's files got its own dead #include and dead call site removed or guarded individually, the same approach already used across the other fifteen-plus packages hit by this system's broader X11-detection gap. Slower, but it only required removing code already proven unreachable — not rebuilding a graphics toolkit component that was never designed to be rebuilt as part of fixing a KDE package.

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.
Please share this article on your favorite website or platform.