Add a debugging console to KWin
ClosedPublic

Authored by graesslin on Mar 15 2016, 12:39 PM.

Details

Summary

The idea behind the debugging console is to have a feature comparable
to xprop and xwininfo just for Wayland. We cannot have command line
utils as that violates the security restrictions, thus it needs to be
exposed directly in KWin.

The debugging console is invoked through DBus:
qdbus org.kde.KWin /KWin showDebugConsole

This opens a window with a tree view. The DebugConsoleModel which is
used by the tree view groups all windows into four categories:

  • x11 clients (that is Workspace::clientList() and Workspace::desktopList())
  • x11 unmanaged (Workspace::unmanagedList())
  • wayland shell clients (WaylandServer::clients())
  • wayland internal clients (KWin's own QWindows - WaylandServer::internalClients())

Each window is a child to one of the four categories. Each window itself
has all it's QProperties exposed as children.

This allows to properly inspect KWin's internal knowledge for windows and
should make it easier to investigate problems. E.g. what's a window's
geometry, what's it's window type and so on.

The debugging console is intended as a developer tool and not expected to
be used by users. That's why it's invokation is rather hidden. Due to
the fact that it's internal to KWin it results in:

  • no window decoration
  • stealing keyboard focus
  • no way to resize, close, move from KWin side
  • rendered above all other windows

There is a dedicated close button to get rid of it again. While the
console is shown it's hardly possible to interact with the system in
a normal way anymore. This is something which might be improved in
future.

At the moment the model is able to update when windows are added/removed,
but not yet when a property changes. Due to the lack of interaction with
the existing system, that's not a high priority at the moment, but can
be added in future.

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
graesslin updated this revision to Diff 2779.Mar 15 2016, 12:39 PM
graesslin retitled this revision from to Add a debugging console to KWin.
graesslin updated this object.
graesslin edited the test plan for this revision. (Show Details)
graesslin added a reviewer: Plasma.

The debug console showing two wayland clients and the debug console as internal client itself expanded.

graesslin added a subscriber: Plasma.
sebas accepted this revision.Mar 15 2016, 1:08 PM
sebas added a reviewer: sebas.
sebas added a subscriber: sebas.

few minor coding style issues, otherwise looks clean and nice.

autotests/wayland/debug_console_test.cpp
133

Can we take an app that is more likely to be installed? Could be one installed by the frameworks, perhaps?

debug_console.cpp
247

spaces around +

251

spaces around +

331

spaces around +

337

spaces around +

(did you copypaste? ;))

342

spaces around +

344

spaces around +

348

spaces around +

This revision is now accepted and ready to land.Mar 15 2016, 1:08 PM
mart added a subscriber: mart.Mar 15 2016, 1:10 PM
mart added inline comments.
autotests/wayland/debug_console_test.cpp
83

some comment explaining what's going on here?

graesslin marked an inline comment as done.Mar 15 2016, 1:43 PM
graesslin added inline comments.
autotests/wayland/debug_console_test.cpp
83

added:

// this tests various combinations of row/column on the top level whether they are valid
// valid are rows 0-4 with column 0, everything else is invalid
graesslin marked an inline comment as done.Mar 16 2016, 6:42 AM
graesslin added inline comments.
autotests/wayland/debug_console_test.cpp
133

There is a reason for this: we already have another test which verifies that KWin doesn't crash if you close a glxgears window (which was a true problem). As we have that test anyway, I took the same application.

graesslin marked 7 inline comments as done.Mar 16 2016, 6:50 AM
This revision was automatically updated to reflect the committed changes.