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
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
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
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
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
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
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
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
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
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
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
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
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
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
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.
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
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
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
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
Summary:
They were only delegating into switchWindow(Direction), so let's do the
same through std::bind in kwinbindings and delegate to it directly in
scripting's WorkspaceWrapper.
Test Plan: Not yet, want to add test case for Workspace::switchWindow
Reviewers: #kwin, #plasma
Subscribers: plasma-devel
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D6791
Summary:
Thanks to std::bind we don't need that many different slots to setup the
global shortcut connections. Instead we can have one shared
implementation which takes the argument and passes it to the window.
To support std::bind arguments in kwinbindings the initShortcut method
and dependencies are adjusted as well as a new macro is added.
As I don't want to include abstract_client.h in workspace.h a new enum
is created for the quick tiling flags used in Workspace. This caused a
larger refactoring as the change to an enum class also caused quite some
changes.
Test Plan: Affected test cases still pass
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D6783
Summary:
Moves most of the implementation from Client to AbstractClient, so that
it can be used for both Client and ShellClient. Only the X11 specific
code is kept in Client.
Not yet implemented is updating the window caption.
Unfortunately the testing of this feature showed that setting a window
shortcut is not working on Wayland at all (the Qt widget doesn't properly
catch the shortcut). So this feature is currently only of erm theoretical
use.
Test Plan: Added new test case. No testing in real world as explained.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D6818
Introduce a method Workspace::markXStackingOrderAsDirty
Summary:
This method replaces the calls x_stacking_dirty = true in the code base
allowing for further refactoring of that functionality.
Remove roundtrip to XServer from Workspace::xStackingOrder
The method xStackingOrder is only used during a Compositor paint pass.
If the stacking order had changed, the method updated the stacking order
from X by performing a sync XQueryTree. With other words we had a round
trip to the X server directly in the paint pass.
This change rearchitectures this area by making better use of xcb. When
we notice that the stacking order changed and an XQueryTree is needed,
we directly send out the request. When xStackingOrder is finally called,
which normally happens a few milliseconds later, the reply is retreived.
In the worst case it still blocks, but in most cases the roundtrip is
gone.
If the stacking order changed again before accessing xStackingOrder the
running request is cancelled and a new request is issued. So whenever we
get into xStackingOrder it will have the current state.
The updating of the xStackingOrder is moved into a dedicated method and
xStackingOrder invokes it through a const_cast instead of operating on
mutable variables.
Test Plan: Normal system usage, no issues
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D6323
This brings back global menu support in KWin.
The DBusMenu infrastructure is different that we just read the DBus service name and
menu object path from the windows rather than passing around window IDs on DBus which
won't work on Wayland.
Differential Revision: https://phabricator.kde.org/D3089
Summary:
When switching virtual desktops using shortcuts, the behavior is to
switch to a virtual desktop in the opposite direction if the current
one is on the edges of the layout. For example, in a one row layout with
4 virtual desktops, "Switch One Desktop to the Left" while in virtual
desktop # 1 will send the user to virtual desktop # 4. Likewise, in a 3
rows layout with 9 virtual desktops, "Switch One Desktop Down" while in
virtual desktop # 8 will lead the user to desktop # 2.
This patch uses the same behavior whilst changing windows using
"Switch to Window Above|Below|to the Right|to the Left".
For example, in a 3 display set-up (my set-up), the user would go from an
application in the rightmost position to an application in the leftmost
position using just one key combination: "Switch to Window to the Right".
Currently, the shortcuts are no-op in these cases (ie, trying "Switch to
Window to the Left" from the leftmost window has no outcome, which is
mostly accurate with the shortcut semantics but totally useless in behavior).
Reviewers: #vdg, #kwin, graesslin
Reviewed By: #kwin, graesslin
Subscribers: luebking, subdiff, colomar, graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D3602
This allows finding the Toplevel for a QWindow which is on Wayland a
ShellClient and on X11 an Unmanaged. This can be used to simplify
code when a Toplevel is needed for an internal QWindow without having
to do platform specific checks.
Summary:
Have one dedicated method which performs the connection for both
Client and ShellClient. This fixes the desktopPresenceChanged signal
not being passed to the effects.
Note that not all signals are merged. Most signals setup for Client
don't make sense for ShellClient as ShellClient cannot block composite
or unredirect.
Test Plan:
Test case added for ShellClient to ensure that the signal
is correctly invoked on the ShellClient, Workspace and EffectsHandler.
Reviewers: #kwin, #plasma_on_wayland
Subscribers: plasma-devel, kwin
Tags: #plasma_on_wayland, #kwin
Differential Revision: https://phabricator.kde.org/D2059
This method is able to match a QWindow created by KWin to a Toplevel.
On X11 by matching winId against Unmanaged, on Wayland by matching
to internal window of ShellClient.
Finding the internal window is a commonly needed feature to e.g.
elevate the TabBox window.
Holds AbstractClients that is both X11 and Wayland clients. Allows
to easily change code which needs to operate on all clients to get
to them without needing special handling for Wayland clients. At the
same time we are still able to get to the windowing system specific
clients through the old clientList() and waylandServer()->clients().