Commit graph

22 commits

Author SHA1 Message Date
Martin Flöser
8015e4e84e Add virtual method to Scene to get the EGL/GLX extensions
Summary:
We had a few places (e.g. DebugConsole, Platform) where the Scene was
cased into a SceneOpenGL to access the backend and get the extensions.

This change simplifies that by adding a virtual method to Scene directly
which is implemented in SceneOpenGL and returns the backend's
extensions.

Thus the casts to SceneOpenGL are no longer required.

Test Plan:
Opened debug console to verify extensions are listed,
triggered Outline to verify the sharing QPA context gets created.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7734
2017-09-12 17:36:03 +02:00
Martina Flöser
9cc7d12158 Replaced InputEventFilter by InputEventSpy in DebugConsole
Summary:
As explained in 84e3308149
the DebugConsole should use an InputEventSpy instead of an InputEventFilter.

Reviewers: kwin, graesslin

Reviewed By: graesslin

Subscribers: graesslin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3879
2017-01-01 19:06:46 +01:00
Hrvoje Senjan
6195ab2608 Compile++
With older gcc at least there is a forward declaration error w/o explicit include.

BUG: 372821
Revewed-by: Martin Gräßlin
2016-11-23 09:35:52 +01:00
Martin Gräßlin
56d9f90546 Clean up egl/glx extensions in debug console
Summary:
As there is no difference between egl and glx extensions anymore inside
KWin (both are provided through the OpenGLBackend) there is no need to
have to group boxes and do a manual hide/show based on which platform is
used.

Instead there is now just one group box and it's called "Platform
Extensions".

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3400
2016-11-17 13:44:06 +01:00
Martin Gräßlin
d1de6899fd Move querying the egl extensions into the AbstractEglBackend
Summary:
Instead of having the egl extensions in the global kwinglutils lib it
becomes private to the AbstractEglBackend. Just like on glx the
glxextensions are moved into the platform.

The extensions are queried from initEglAPI, that is as early as possible
after initializing the EGLDisplay. This ensures that any implementing
subclass can access the extensions early enough.

As a note: the EglOnXBackend had a potentially wrong sequence for
initializing the buffer age extension. It is now moved to the correct
place where the result is needed for the first time.

From the global API eglExtensions are removed from hasGLExtension and
the eglExtensions function is dropped. As by that initEGL did not do
anything it is also dropped.

Test Plan:
Tested nested kwin on Wayland, still works, extensions shown
in debug console

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D3396
2016-11-17 13:00:29 +01:00
Martin Gräßlin
327ccffcf4 Add a keyboard tab to the debug console
Summary:
A little bit debug information about the current keyboard state is
useful. Thus a new tab is added to show information about xkbcommon.

It shows:
* layouts in the keymap
* currently active layout
* supported modifiers in key map
* currently active modifiers in state
* supported leds in key map
* currently active leds in state

Whenever a key is pressed/released the complete ui is updated to reflect
the latest state. That is pressing/releasing a modifier is directly
reflected in the ui.

This UI can extended as needed for further debug information about the
keymap state.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3379
2016-11-16 18:02:40 +01:00
Martin Gräßlin
9e4a858285 Fix DebugConsole::initGLTab
The initGLTab used GLPlatform::instance to determine whether OpenGL is
used. It assumed a nullptr would mean no GL. But GLPlatform is a
singleton which does not follow KWin's internal semantics. If there is
no instance it will be created. Thus it's never null.

This caused a heap-buffer-overflow as recorded by build.kde.org in case
one just casts the scene pointer to SceneOpenGL.

With this change this is fixed and inited correctly by verifying through
the EffectsHandler whether opengl is used.
2016-11-16 08:36:51 +01:00
Martin Gräßlin
730fd05f58 Move querying glx extensions into the platform plugin
Summary:
Glx extensions are only interesting to the glxbackend. Given that
querying can be moved there.

In order to simplify the extensions can be stored in the OpenGLBackend
which also provides the convenience check as before.

The egl platforms should also be adjusted to query in that way and
remove it from the kwinglutils.

There is still a usage of the glxextensions inside kwinglutils to
resolve one function. That should also be moved into the platform.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D3332
2016-11-16 07:47:36 +01:00
Martin Gräßlin
cc2f4e3240 Support for relative pointer motion events
Summary:
If KWin interacts with Libinput the RelativePointerManager interface
gets created on the Wayland server. The ForwardInputEventFilter does
forward the relative motion events in addition to the normal motion
events.

In order to properly support the relative motion events as they are
expected by the Wayland protocol the handling of pointer motion events
got slightly adjusted:
* Libinput Pointer event extended by the additional data points
* Libinput Pointer event carries the delta as a QSizeF instead of
QPointF
* PointerInputRedirection adjusted to take a pointer motion event with
more arguments
* Custom QMouseEvent subclass adjusted to carry the additional members

The DebugConsole is adjusted to show the relative motion events in
addition to the global position.

Test Plan:
Verified the manager object is created and verified the
events in DebugConsole. Unfortunately not aware of any test application.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2979
2016-10-12 11:26:46 +02:00
Martin Gräßlin
fd6e4bb023 Destroy DebugConsole on hide of QWindow
Summary:
The quit button in the DebugConsole is connected to deleteLater on the
DebugConsole. This is to clean up resources like the input event filter
which is rather expensive to have running.

When closed through the window decoration the DebugConsole window only
got hidden but not destroyed. Resulting in the input filter to continue
processing.

This change ensures that the DebugConsole gets properly destroyed once
the window gets hidden.

BUG: 369858
FIXED-IN: 5.8.1

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2931
2016-10-05 07:48:15 +02:00
Martin Gräßlin
3a3d1b6b0d DebugConsole window does not take keyboard input
Summary:
In order to add more tabs which can further help monitoring how KWin
handles some aspects the DebugConsole is changed to not take keyboard
input. This means it can only be navigated using pointer device or touch
screen.

This is needed for adding a new tab to monitor clipboard changes. On
Wayland sometimes windows don't get the clipboard, so it would be
helpful to have a debug monitor to see when the clipboard changes. But
for that debug console window may not take keyboard events.

To support this DebugConsole sets the WA_ShowWithoutActivating attribute
which gets honored by the InternalWindowEventFilter and does not forward
key events to such windows.

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2620
2016-09-12 13:24:33 +02:00
Martin Gräßlin
dad7004dbb Add an OpenGL information tab to Debug Console
Summary:
The new tab shows the information from GLPlatform similar to how it is
shown in the supportInformation. In addition it also lists all available
openGL and EGL/GLX extensions. For that kwinglutils is extended by
functions to return the lists of extensions.

Reviewers: #kwin, #plasma, bshah

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D2385
2016-08-10 08:27:36 +02:00
Martin Gräßlin
8a83a6fef5 [libinput] Add support for gesture events
Summary:
Gesture events are swipe or pinch events on a touch pad.

This change implements basic support by:
 * wrapping them in LibInput::Event
 * processing them in LibInput::Connection and emitting
   dedicated signals
 * Forwarding them in InputRedirection to PointerInputRedirection
 * Support them in the internal input event filter
 * Printing debug information in DebugConsole

Further handling is not yet done. In future the following should be
implemented:
 * activating e.g. zoom and present windows on pinch/swipe gesture
 * forwarding non global gestures to KWayland

Note that forwarding to KWayland is not yet useful as QtWayland does
not yet have support for the unstable protocol. No Qt application could
make use of it yet. So for the moment just global gestures is the best
we can get.

Test Plan: Looked at output of DebugConsole when triggering gestures

Reviewers: #kwin, #plasma_on_wayland

Subscribers: plasma-devel, kwin

Tags: #plasma_on_wayland, #kwin

Differential Revision: https://phabricator.kde.org/D2359
2016-08-08 09:15:06 +02:00
Martin Gräßlin
ad3101c4cf Trimm the buttonsToString in debug console 2016-05-30 15:32:05 +02:00
Martin Gräßlin
5f2245adaf Add the Device to the input event summary
Summary:
Now that we have access to the actual LibInput Device from the event
handler, let's also print out which device received an event.

Test Plan: Manual testing whether the correct device is shown

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D1668
2016-05-30 15:27:55 +02:00
Martin Gräßlin
a3ca25ecd4 Don't reset InputDevicesModel when devices change
Summary:
Instead of reset a proper beginInsertRows, beginRemoveRows is used.
In addition changes in the device are also listened on and emit the
proper dateChanged signal.

Test Plan:
Opened debug console, selected the touchpad device,
toggled shortcut and verified that this updated the data column.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1547
2016-05-13 10:04:40 +02:00
Martin Gräßlin
4d7134f6c7 [libinput] Add a wrapper class Device for a libinput_device
Summary:
The Device class wraps all the information we can get from libinput
about the device, like whether it's a keyboard, pointer, touch, etc.

In addition some more information is queried to figure out how "useful"
a device is. For a keyboard all alphanumeric keys are checked whether
they exist, for a pointer all (normal) buttons are queried.

All the information is exposed as Q_PROPERTY and used by the
DebugConsole. The DebugConsole gained a new tab "Input Devices" which
renders all devices and their properties in a tree view. When plugging
in/out a device, the model gets reset, so it's always up to date.

The new Device class can be used in future to configure the device,
e.g. disable touch pad, set mouse acceleration, etc.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1538
2016-05-06 08:21:49 +02:00
Martin Gräßlin
87e5369aed Add nullptr checks to SurfaceTreeModel
We called into waylandServer() without checking and on Neon the connects
with a null surface crashed.
2016-05-03 09:48:57 +02:00
Martin Gräßlin
90b9b08d7a Use a QTabWidget for the different modes in DebugConsole
Summary: Replaces the custom logic to switch between the three modes by tabs.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1271
2016-03-31 09:21:18 +02:00
Martin Gräßlin
3edf5a7b0a Input events mode in debug console
Summary: Inspired by xev a new tool which prints out all input events.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1264
2016-03-30 16:24:55 +02:00
Martin Gräßlin
e62dad48a6 Add a surface tree to DebugConsole
Summary:
While developing support for sub-surfaces it became obvious that there
is a need for visualizing the tree of sub-surfaces.

The surface-tree is a new mode added in the debug console. There are now
two buttons to switch between the default window tree and the surface
tree.

The surface tree is a little bit more basic than the windows tree. The
type of window (whether x11, wayland or internal) is ignored. All windows
build up the top level with the sub surfaces as children.

Each surface is represented by some basic information about it:
* Client (binary path and pid)
* internal surface id

If the surface has a shared memory buffer mapped a scaled down version
is used as the window decoration role.

The model gets reset whenever the tree changes in some way as it's
rather complex to track correctly and well, it's just a debug console.

Currently the tree is not really functional yet as KWin doesn't announce
support for sub-compositor protocol, which is also the reason for lack of
autotests for the model. Will be added once sub-compositor works
properly.

Reviewers: #plasma

Subscribers: plasma-devel

Projects: #plasma

Differential Revision: https://phabricator.kde.org/D1205
2016-03-23 15:07:12 +01:00
Martin Gräßlin
6a19f50cac Add a debugging console to KWin
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.

Reviewers: #plasma

Differential Revision: https://phabricator.kde.org/D1146
2016-03-16 14:30:19 +01:00