Commit Graph

680 Commits (master)

Author SHA1 Message Date
Vlad Zahorodnii a433fb08a3 x11: Make removal of X11 event filters safe
If an X11 event filter has been activated and it unregisters another X11
event filter, then the window manager may crash because the foreach macro
in Workspace::workspaceEvent() makes a copy of m_genericEventFilters or
m_eventFilters and we can call the event() method for an already defunct
filter.

With this change, X11 event filters can be safely removed and installed
at any particular moment.

BUG: 423319
2020-09-29 08:26:28 +00:00
Vlad Zahorodnii a9fd5ac19f Move struts logic to AbstractClient 2020-09-03 18:11:44 +00:00
Vlad Zahorodnii 4ce853e8e4 Prettify license headers 2020-08-07 19:57:56 +00:00
Vlad Zahorodnii 1fb9f6f13a Switch to SPDX license markers
The main advantage of SPDX license identifiers over the traditional
license headers is that it's more difficult to overlook inappropriate
licenses for kwin, for example GPL 3. We also don't have to copy a
lot of boilerplate text.

In order to create this change, I ran licensedigger -r -c from the
toplevel source directory.
2020-08-07 19:57:56 +00:00
Vlad Zahorodnii 19ad172584 Survive Xwayland crashes
If the Xwayland process crashes, it will bring down the entire session
together with itself. Obviously, we don't want that. At least, Wayland
clients should survive the crash.

This change refactors relevant X11 parts to handle Xwayland crashes in a
less fatal way.

In order to handle Xwayland crashes better, a pair of start() and stop()
methods had been introduced in the Xwayland class to allow starting and
stopping the Xwayland process at any moment.

If we detect that the Xwayland process has crashed, we will immediately
stop the Xwayland server, which in its turn will deactivate the socket
notifier and destroy all connected X11 clients. Unfortunately, a couple
of subtle changes in X11Client::releaseWindow() and Unmanaged::release()
had to be made to ensure that we are left with a valid state after the
Xwayland server has been stopped.
2020-08-05 08:48:00 +00:00
Aleix Pol 1ef90d9c90 Add API to easily find Toplevels from their internal Id 2020-07-23 13:14:22 +02:00
Vlad Zahorodnii 555885072d Check if we successfully restored input focus
In rare cases, Workspace::restoreFocus() may fail, for example when the
most recently activated client is about to be destroyed or unmapped.

If it happens that we cannot restore the focus, then mark the window in
FocusIn event as active.

CCBUG: 424223
2020-07-22 12:29:41 +00:00
Nate Graham 87578bfc15 Allow corner-tiling by quickly combining edge tiling shortcuts
Currently the only way for a uuser to invoke corner-tiling is to
manually set shortcuts for them. This patch adds another option: invoke
the existing shortcuts for edge tiling in a combined manner in quick
succession.

For example, hitting Meta+Left and then Meta+Up within a one-second
period will tile the active window into the top left corner. In practice
you hold down the Meta key and then press Left then Up (or Up and then
Left), and I think it feels very natural. Linux Mint's window manager
has this feature and I always missed it when I left Mint for the KDE
world.

Autotests for existing tiling shortcuts are adjusted to not break, and
additional tests for the new tiling options are added.
2020-06-12 13:50:24 +00:00
Vlad Zahorodnii fc3b16f892 Store normal clients and desktop clients in the same list
Summary:
On X11, Workspace stores windows in two lists. One with desktop windows
and the other one with all other windows. On Wayland, desktop windows
and normal windows are stored in the same list - m_allClients.

In order to unify scripting on X11 and Wayland, this change makes the
Workspace class store X11 desktop windows and normal X11 windows in the
same list. It's the responsibility of scripts to filter desktop windows.

Reviewers: #kwin, apol

Reviewed By: apol

Subscribers: apol, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29522
2020-05-14 16:21:47 +03:00
Vlad Zahorodnii 7b751099bf Emit Workspace::clientAdded() with AbstractClient
Summary:
Currently, if one wants to monitor for new X11 and Wayland clients, they
have to listen for two signals. Workspace::clientAdded() is emitted only
for X11 and Xwayland clients, while WaylandServer::shellClientAdded() is
emitted only for xdg-shell clients. Such design doesn't scale well.

As the first towards emitting Workspace::clientAdded() for new Wayland
clients, this change replaces the X11Client parameter in the clientAdded
signal with AbstractClient.

Test Plan: Tests still pass.

Reviewers: #kwin, cblack

Reviewed By: cblack

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29665
2020-05-12 08:38:01 +03:00
Vlad Zahorodnii 325b85f8ca Drop Workspace::sendPingToWindow()
Summary:
This change drops Workspace::sendPingToWindow() in order to better
separate X11-specific and more generic code.

Test Plan: Still able to close X11 windows.

Reviewers: #kwin, apol

Reviewed By: apol

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D29472
2020-05-06 15:05:51 +03:00
Vlad Zahorodnii a9d2bad007 [x11] Enable synchronized resizing for Xwayland clients
Given that we now query the current X11 time stamp on Wayland, we can
enable synchronized resizing for Xwayland clients.

Differential Revision: https://phabricator.kde.org/D29250
2020-04-29 16:37:23 +03:00
Kai Uwe Broulik be31101f12 Remove QSessionManager usage
Summary: Instead, have KSMServer talk to us directly on DBus.

Test Plan: Depends on D28616

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D28617
2020-04-06 11:51:47 +02:00
Vlad Zahorodnii be759b7d33 Use AbstractClient instead of XdgShellClient wherever possible
Summary:
Currently, we have only one shell client type - XdgShellClient. We use
it when we are dealing with Wayland clients. But it isn't really a good
idea because we may need to support shell surfaces other than xdg-shell
ones, for example input panel surfaces.

In order to make kwin more extensible, this change replaces all usages
of the XdgShellClient class with the AbstractClient class.

Test Plan: Existing tests pass.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D27778
2020-03-04 09:57:13 +02:00
Vlad Zahorodnii 55b4912004 Update my email address 2020-01-14 18:17:18 +02:00
Vlad Zahorodnii 0c7196769d [scenes/opengl] Discard cached Lanczos textures for all toplevels
Summary:
Currently, the Lanczos filter doesn't discard cached textures for
internal and wayland clients.

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D25616
2019-12-02 15:14:21 +02:00
Vlad Zahorodnii eb186a78a1 Delete class forward declarations in utils.h 2019-11-27 15:54:08 +02:00
Vlad Zahorodnii 9d4a32596c Drop some custom list typedefs
Summary:
Qt has its own thing where a type might also have corresponding list
alias, e.g. QObject and QObjectList, QWidget and QWidgetList. I don't
know why Qt does that, maybe for some historical reasons, but what
matters is that we copy this pattern here in KWin. While this pattern
might be useful with some long list types, for example

    QList<QWeakPointer<TabBoxClient>> TabBoxClientList

in general, it causes more harm than good. For example, we've got two
new client types, do we need corresponding list typedefs for them? If
no, why do we have ClientList and so on?

Another problem with these typedefs is that you need to include utils.h
header in order to use them. A better way to handle such things is to
just forward declare a client class (if that's possible) and use it
directly with QList or QVector. This way translation units don't get
"bloated" with utils.h stuff for no apparent reason.

So, in order to make code more consistent and easier to follow, this
change drops some of our custom typedefs. Namely ConstClientList,
ClientList, DeletedList, UnmanagedList, ToplevelList, and GroupList.

Test Plan: Compiles.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24950
2019-11-27 15:54:08 +02:00
David Edmundson ec610fd7ed Port one of session management connections state to a custom API
Summary:
Currently kwin opens a second ICE connection to ksmserver in order to
tell the state of kwin's whether we're logging out and saving clients or
not.

This requires that kwin launches after ksmserver to have the connection
which is a dependency I want to break.

Practically this code is already ksmserver specific as it relies on some
custom code that sends the first saveState request to kwin first.

Instead we can replace it with a bespoke IPC over DBus and siplify the
code both end. This will allow several other future enhancements that we
want with regards to handling the session state, as well as make an
effort platform agnostic session management, as well as cleaning up some
complex code.

Ksmserver calls into kwin, rather than having kwin watch ksmserver state
to allow us make sure it's race free.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: romangg, zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24862
2019-11-01 17:14:42 +00:00
Vlad Zahorodnii 1f301b2271 Fix coding style issues in window packing code
Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24335
2019-10-02 11:46:40 +03:00
Vlad Zahorodnii f93875535c Update my last name 2019-09-29 17:03:25 +03:00
Vlad Zahorodnii ffcbe24e2b Rename Client to X11Client
Summary:
Currently each managed X11 client is represented with an instance of
Client class, however the name of that class is very generic and the
only reason why it's called that way is because historically kwin
was created as an x11 window manager, so "Client" was a sensible choice.

With introduction of wayland support, things had changed and therefore
Client needs to be renamed to X11Client in order to better reflect what
that class stands for.

Renaming of Client to X11Client was agreed upon during the last KWin
sprint.

Test Plan: Compiles, the test suite is still green.

Reviewers: #kwin, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D24184
2019-09-25 21:11:37 +03:00
Vlad Zagorodniy 168ea98845 Rename ShellClient to XdgShellClient
Summary:
Rename ShellClient to XdgShellClient in order to reflect that it
represents only xdg-shell clients.

Test Plan: Compiles, tests still pass.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23589
2019-09-23 17:28:56 +03:00
Vlad Zagorodniy bebe81209c Port QPA away from Wayland
Summary:
So far wayland was used by internal clients to submit raster buffers
and position themselves on the screen. While we didn't have issues with
submitting raster buffers, there were some problems with positioning
task switchers. Mostly, because we had effectively two paths that may
alter geometry.

A better approach to deal with internal clients is to let our QPA use
kwin core api directly. This way we can eliminate unnecessary roundtrips
as well make geometry handling much easier and comprehensible.

The last missing piece is shadows. Both Plasma::Dialog and Breeze widget
style use platform-specific APIs to set and unset shadows. We need to
add shadows API to KWindowSystem. Even though some internal clients lack
drop-shadows at the moment, I don't consider it to be a blocker. We can
add shadows back later on.

CCBUG: 386304

Reviewers: #kwin, davidedmundson, romangg

Reviewed By: #kwin, romangg

Subscribers: romangg, kwin

Tags: #kwin

Maniphest Tasks: T9600

Differential Revision: https://phabricator.kde.org/D22810
2019-09-23 17:28:56 +03:00
Vlad Zahorodnii 62a7db7028 Use nullptr everywhere
Summary:
Because KWin is a very old project, we use three kinds of null pointer
literals: 0, NULL, and nullptr. Since C++11, it's recommended to use
nullptr keyword.

This change converts all usages of 0 and NULL literal to nullptr. Even
though it breaks git history, we need to do it in order to have consistent
code as well to ease code reviews (it's very tempting for some people to
add unrelated changes to their patches, e.g. converting NULL to nullptr).

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson, romangg

Reviewed By: #kwin, davidedmundson, romangg

Subscribers: romangg, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D23618
2019-09-19 17:48:21 +03:00
Frederik Gladhorn b64e67ce7c Remove disabled TabGroup feature
Summary:
This has been commented out since 2014, I doubt it will come back.
This is a big amount of code, maintenance will be easier without it.

Reviewers: #kwin, zzag

Reviewed By: #kwin, zzag

Subscribers: romangg, graesslin, kwin

Tags: #kwin, #documentation

Differential Revision: https://phabricator.kde.org/D23069
2019-09-14 10:58:48 +02:00
Vlad Zagorodniy 50693f4fe8 Cleanup the order of things in workspace.h file 2019-07-29 22:24:43 +03:00
Vlad Zagorodniy 684b4b635e Use more traditional doxygen style
Summary:
So far we were following a bit unique and rare doxygen comment style:

    /**
     * Contents of the comment.
     **/

Doxygen comments with this style look balanced and neat, but many people
that contribute to KWin don't follow this style. Instead, they prefer
more traditional doxygen comment style, i.e.

    /**
     * Contents of the comment.
     */

Reviewing such changes has been a bit frustrating for me (so selfish!)
and for other contributors.

This change switches doxygen comment style in KWin to a more traditional
style. The main reason for doing this is to make code review process easier
for new contributors as well us.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22812
2019-07-29 22:06:19 +03:00
Vlad Zagorodniy b3bd9e7e9b [wayland] Update tabbox when a client is added or closed
Summary: Update tabbox similar to how it's done in KWin/X11.

Reviewers: #kwin

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D21005
2019-07-29 21:24:21 +03:00
Vlad Zagorodniy 8af2fa73dc Run clang-tidy with modernize-use-override check
Summary:
Currently code base of kwin can be viewed as two pieces. One is very
ancient, and the other one is more modern, which uses new C++ features.

The main problem with the ancient code is that it was written before
C++11 era. So, no override or final keywords, lambdas, etc.

Quite recently, KDE compiler settings were changed to show a warning if
a virtual method has missing override keyword. As you might have already
guessed, this fired back at us because of that ancient code. We had
about 500 new compiler warnings.

A "solution" was proposed to that problem - disable -Wno-suggest-override
and the other similar warning for clang. It's hard to call a solution
because those warnings are disabled not only for the old code, but also
for new. This is not what we want!

The main argument for not actually fixing the problem was that git
history will be screwed as well because of human factor. While good git
history is a very important thing, we should not go crazy about it and
block every change that somehow alters git history. git blame allows to
specify starting revision for a reason.

The other argument (human factor) can be easily solved by using tools
such as clang-tidy. clang-tidy is a clang-based linter for C++. It can
be used for various things, e.g. fixing coding style(e.g. add missing
braces to if statements, readability-braces-around-statements check),
or in our case add missing override keywords.

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, apol, romangg, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D22371
2019-07-22 20:03:22 +03:00
Roman Gilg a502804337 Remove unused signal from Workspace
The signal Workspace::reinitializeCompositing is nowhere actually emitted.
2019-07-02 13:47:08 +02:00
Vlad Zagorodniy 0fb09cf413 Make session loading/saving helpers local to sm.cpp
Summary:
There is no point for keeping them in the Workspace class because they
are used only in sm.cpp.

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D20783
2019-05-03 21:24:07 +03:00
Vlad Zagorodniy abe128818c Use more accurate name for Workspace::getMovingClient method
Summary:
The name of Workspace::getMovingClient() method implies that the
returned value is a client that is currently being moved around
by the user, but this is of course incorrect.

Reviewers: #kwin, apol

Reviewed By: apol

Subscribers: apol, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D20663
2019-04-22 11:12:22 +03:00
Roman Gilg 4c18d156e2 [xwl] Support stack optimizing X drag source clients
Summary:
Some X clients acting as drag sources might try to optimize finding the current
target window by checking if a window manager, that sets the root window
_NET_CLIENT_LIST_STACKING property, is present. An example for this is Chromium
and since KWin sets the property the drag proxy windows must be added to this
list. Otherwise the origin client will not detect the proxy window and not send
an XdndEnter message.

Test Plan: Manually with Chromium.

Reviewers: #kwin

Subscribers: zzag, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D15628
2019-02-19 13:24:18 +01:00
Vlad Zagorodniy 7b20e1f66f Overhaul doxygen comments
Summary:
We have a mix of different doxygen comment styles, e.g.

    /*!
      Foo bar.
     */

    /**
     * Foo bar.
     */

    /** Foo bar.
     */

    /**
     * Foo bar.
     */

    /**
     * Foo bar.
     **/

To make the code more consistent, this change updates the style of all
doxygen comments to the last one.

Test Plan: Compiles.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D18683
2019-02-12 19:29:33 +02:00
David Edmundson 7e8facc3fd [wayland] Use the new plasma virtual desktop protocol
Summary:
implement virtual desktop support for Wayland.
use the new virtual desktop protocol from D12820
The VirtualDesktopManager class needed some big change in order
to accomodate it, which is where most changes are.
Other than that, it's mostly connections to wire up
VirtualDesktopsManager and VirtualDesktopsManagement(the wayland protocol impl)

Depends on D12820
Other notable detail, is the client visibility updated to reflect the presence
of the client in the plasmavirtualdesktop.
(and the unSetDesktop concept)

Test Plan: used a bit a plasma session together with D12820, D13748 and D13746

Reviewers: #plasma, #kwin, graesslin, davidedmundson

Reviewed By: #plasma, #kwin, davidedmundson

Subscribers: hein, zzag, davidedmundson, kwin

Tags: #kwin

Maniphest Tasks: T4457

Differential Revision: https://phabricator.kde.org/D13887
2018-11-01 16:35:29 +01:00
Vlad Zagorodniy fe4d69b653 Keep Deleted transients above old parents
Summary:
If a modal window is closed, usually, it will go behind its parent. The
reason for this is that Workspace::constrainedStackingOrder() puts only
AbstractClient transients above parents, not Deleted transients.

So, if fade/glide/scale effect animates the disappearing of a transient,
unfortunately, one can't see that animation.

BUG: 397448
FIXED-IN: 5.15.0

Test Plan:
=== Closing of a transient and parent window

Before:

https://www.youtube.com/watch?v=XiLq7EAVCp0

After:

https://www.youtube.com/watch?v=cH_Ki-sqY8M

=== Scale effect

Before:

https://www.youtube.com/watch?v=Eb2a3U7R10I

After:

https://www.youtube.com/watch?v=4AKu3fdrnYQ

=== Sheet effect

Before:

https://www.youtube.com/watch?v=xPPSnR5FUU0

After:

https://www.youtube.com/watch?v=o_hxTNT-5Hg

=== Popup menus on Wayland

Before:

https://www.youtube.com/watch?v=5DnrY8p3F5A

After:

https://www.youtube.com/watch?v=7XEo8n_CrCc

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: abetts, davidedmundson, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D14868
2018-10-16 18:58:17 +03:00
Martin Flöser 1e7b4fbc8a Merge branch 'Plasma/5.11' 2017-10-15 16:40:03 +02:00
Martin Flöser 1b01f1b300 Update pointer position whenever a window gets (un)minimized
Summary:
This fixes the following problem:
1. Have two windows maximized
2. Click minimize button on first window
3. Click minimize button on second window

What happened:
Second click was ignored as the pointer was not updated.

BUG: 378704
FIXED-IN: 5.11

Test Plan:
Nested KWin/Wayland, added two maximized windows, minimized
both without moving the mouse

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D8145
2017-10-15 16:38:45 +02:00
Martin Flöser 793eecc826 Fix compile warnings after removing ObscurringWindows 2017-10-01 09:51:09 +02:00
Martin Flöser 5cbd28f9a0 Move X11 specific Workspace initialization code into dedicated method
Summary:
This is required to start KWin/Wayland without XWayland support or
delayed XWayland support.

Test Plan: Run kwin_x11 in a nested Xephyr

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7897
2017-09-30 13:03:52 +02:00
Martin Flöser ec7fe44190 Make xstacking order dirty handling work without X11
Summary:
The xStackingOrder unlike indicated by it's name is relevant for both
X11 and Wayland and contains the stacking order of the windows used for
compositing.

So far it was determined whether it needs to be recreated based on
whether an xcb query is pending. This change introduces a boolean
variable to check whether the stacking order is dirty and guards the X11
specific code to only be run if we have an X11 connection.

This is to my current knowledge the last remaining issue where X11 was
used during the normal Wayland operation mode. Now it should be possible
to re-order the Workspace startup [1] and try to run kwin_wayland without
Wayland support.

[1] Workspace::Workspace and Workspace::init is still highly X11
specific and needs to be split into X11 only and general parts.

Test Plan: Compiles

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7856
2017-09-30 12:59:20 +02:00
Martin Flöser 0ed609590b Add a dedicated X11EventFilter for forwarding property events to the effect system
Summary:
So far both Workspace and Toplevel emitted signals for every property
notify event on the root window and the respective Toplevel windows. The
signals were only used in EffectsHandlerImpl to forward to the effect
system in case the property which changed is registered by an effect.

This change introduces a dedicated event filter for this which is only
created in EffectsHandlerImpl in case an X11 connection is available. It
supports a restart of the X11 system.

The signals used so far are removed from Workspace and Toplevel.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7853
2017-09-25 20:36:45 +02:00
Martin Flöser 42fd77b836 Drop unused method Workspace::waitForCompositingSetup
Seems to have been used in old compositing kcm, documented as DBus API.
But Workspace doesn't expose a DBus interface anymore and our new DBus
interface does not call this method -> it is dead.
2017-09-24 10:28:47 +02:00
Martin Flöser 4cef894e87 Drop delegating Workspace::slotToggleCompositing
Instead connect global shortcut directly to method in Compositor.
2017-09-24 10:15:13 +02:00
Martin Flöser 9b1827803f Drop delegating Workspace::slotInvertScreen
Instead directly connect global shortcut to the method in Platform.
2017-09-24 10:10:52 +02:00
Martin Flöser bd5f5e0915 Move X11 movingClient handling into a dedicated X11EventFilter
Summary:
Splits out the X11 specific window movement handling so that it's not
used in the Wayland case at runtime. As a nice side effect it
un-spaghetties the X11 event handler.

Test Plan:
Run nested KWin on Xephyr and nested KWin/Wayland to verify
that move/resize of X11 windows is still working

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7374
2017-09-01 16:57:43 +02:00
Martin Flöser 70bc9524d9 Send QKeyEvent with Qt::Key as expected by Qt to internal windows
Summary:
KWin passes the current keysym converted to a Qt::Key in the QKeyEvent.
The current keysym does not always change when a key gets released, so
when pressing a shortcut the release carry a Qt::Key which could be
considered as wrong.

QtWayland transforms the actual pressed/released key into a keysym and
passes that through the QKeyEvent. This change does the same for the
internal windows. A new QKeyEvent is created and adjusted in a way that
it matches what Qt expects.

Why not change everything to how Qt expects it? The key is used at
various places and in KWin internally we expect the behavior how it is
currently implemented. So it's better to use Qt's expectation only when
interacting with Qt.

Also the change carries a workaround for a bug in QKeySequenceEdit
(see QTBUG-62102) and transforms Super to Meta. As this adjustment only
makes sense for the internal windows we need to send in an adjusted
QKeyEvent anyway, so another argument for using the Qt behavior only in
this place.

Test Plan:
Can set a shortcut on Wayland and it can be used to activate
the window.

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D6828
2017-08-19 11:37:08 +02:00
Martin Flöser 36a3189863 Create a dedicated X11EventFilter for recognizing first user interaction
Summary:
Workspace monitors the X11 events to detect when the user first
interacts with the system. This is only required on X11 for activating
the same client from previous session. So far this was spread over many
parts in the long event switch statement. To make this more contained a
dedicated event filter is introduced which also gets deleted again once
the first user interaction got recognized.

Test Plan: Compiles

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D7371
2017-08-19 10:14:53 +02:00
Martin Flöser c8c15f0057 Use std::bind expression for Workspace::slotWindowtoDesktop
Summary:
This way we don't need the sender() hack to get the value set on the
QAction.

Test Plan: New autotest in master still passes

Reviewers: #kwin, #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D6811
2017-07-29 17:41:33 +02:00