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:
There is no point in using quint32 and casting back and forth in numerous places.
Fix a bunch of compiler warnings that we implicitly cast between signed and unsigned.
This makes things consistent with what we get from libinput.
Reviewers: #kwin, romangg
Reviewed By: #kwin, romangg
Subscribers: zzag, romangg, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D23086
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:
This fixes the bug where KWin-on-Wayland doesn't respect keyboard repeat settings
BUG: 408943
FIXED-IN: 5.16.4
Test Plan:
1. Start Wayland session
2. Open Wayland KCM and note the keyboard repeat/rate/delay
3. Go to keyboard preferences KCM and adjust the keyboard repeat/rate/delay
4. Open the Wayland KCM again and verify the keyboard repeat/rate/delay adjustments (it may be necessary to restart the Wayland session before this step)
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D22388
Summary:
XWayland clients have a surface associated with them asynchronously. In this
case we don't directly want to set focus on this Toplevel, but wait until the
surface is set.
This patch aims in conjunction with an unrelated fix to SDL at improving Steam
Big Picture Mode in our Wayland session.
Test Plan: Steam BPM regains focus on game close.
Reviewers: #kwin, zzag
Reviewed By: #kwin, zzag
Subscribers: anthonyfieroni, davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D19262
Summary:
So far KWin didn't send axis_source, axis_discrete, and axis_stop. Even
though most of those events are optional, clients need them to work as
expected. For example, one needs axis_source and axis_stop to implement
kinetic scrolling; Xwayland needs axis_discrete to prevent multiple
scroll events when the compositor sends axis deltas greater than 10, etc.
BUG: 404152
FIXED-IN: 5.17.0
Test Plan:
* Content of a webpage in Firefox is moved by one line per each mouse
wheel "click";
* Scrolled gedit using 2 fingers on GNOME Shell, sway, and KDE Plasma;
in all three cases wayland debug looked the same (except diagonal scroll
motions).
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D19000
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:
Building upon the generic X Selection support this patch establishes another
selection class representing the XDND selection and provides interfaces
to communicate drags originating from Xwayland windows to the Wayland
server KWin and drags originating from Wayland native drags to Xwayland.
For Wayland native drags KWin will claim the XDND selection as owner and
will simply translate all relevant events to the XDND protocol and receive
alike messages by X clients.
When an X client claims the XDND selection KWin is notified via the X protocol
and it decides if it allows the X drag to transcend into the Wayland protocol.
If this is the case the mouse position is tracked and on entering a Wayland
native window a proxy X Window is mapped to the top of the window stack. This
proxy window acts as a drag destination for the drag origin window and again
X messages will be translated into respective Wayland protocol calls. If the
cursor leaves the Wayland window geometry before a drop is registered, the
proxy window is unmapped, what triggers a subsequent drag leave event.
In both directions the necessary core integration is minimal. There is a single
call to be done in the drag and drop event filter through the Xwayland
interface class.
From my tests this patch facilitates drags between any Qt/KDE apps. What needs
extra care are the browsers, which use target formats, that are not directly
compatible with the Wayland protocol's MIME representation. For Chromium an
additional integration step must be done in order to provide it with a net
window stack containing the proxy window.
Test Plan: Manually. Auto tests planned.
Reviewers: #kwin
Subscribers: zzag, kwin, alexde
Tags: #kwin
Maniphest Tasks: T4611
Differential Revision: https://phabricator.kde.org/D15627
Summary: This is needed for remote desktop support. It also depends on D18114.
Reviewers: davidedmundson
Reviewed By: davidedmundson
Subscribers: graesslin, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D18115
This reverts commit 16e904592a.
The commit has logical errors, corrupting DND on Wayland. Also the solution
with static_cast to solve the compiler warnings is not a sensible one, it just
hides the root problem.
And next time such a change has to go through review!
Summary:
This command line option is useful for KWin in embedded use case. That
is when KWin is just used as a compositor for one application instead of
a complete desktop environment. In such a setup global shortcuts are not
wanted and interfere with the application. E.g. one does not want Alt+F4
to close the window, that would render the system unusable.
This change introduces a command line option and disables the following
event filters and spies:
* global shortcuts
* modifier only shortcuts
* terminate session
* virtual terminal switching
* screen edges
KGlobalAccel still gets inited, otherwise the (non-functional) binary
would be launched when KWin registers it's global shortcuts.
Test Plan:
New test added based on existing tests for the global
shortcuts, ctest passes
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17304
Summary:
On touch events the mouse cursor gets hidden, on next mouse event the
mouse cursor is shown again. This IMHO significantly improves the system
interaction if touch is the primary user interface.
Test Plan: Test case added and ctest passes
Reviewers: #kwin
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17280
Summary:
Certain input devices like touch screens can be in a state of having no input
target at all. In case of touch screens when there are no current touch points.
In this case unset and block at-surface targets until a touch point is
available again.
Test Plan: Auto test window-selection passes again.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: graesslin, davidedmundson, zzag, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D17537
Summary:
Use the new functionality in KWayland to support drag and drop via touch
screens.
Either a drag and drop session with pointer or touch is possible, but not
both at the same time. Pointer/touch gets deactivated if a touch/pointer
drag and drop session is active.
Test Plan: Manually.
Reviewers: #kwin, davidedmundson
Subscribers: davidedmundson, alexde, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D15466
Summary:
This patch aims at improving the Toplevel, internal window and decoration
focus tracking.
In detail the goals are:
* Clean tracking of beneath and focus Toplevel as well as decoration and
internal windows. Splitting this up in well defined sub routines.
* Minimal find Toplevel operations on window stack.
* Reduce code duplication in pointer and touch child classes.
* Reuse tracking in drag operations.
* Allow direct usage of Wayland input interfaces for decoration and internal
windows in the future.
* Update touch focus on external events like VD switches correctly.
Test Plan: Manually and existing autotests.
Reviewers: #kwin
Subscribers: kwin, zzag
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D15595
Summary:
Some members were declared protected. Better style is to have them private
with public or protected getters and setters.
This also removes the unnecessary m_input variable.
Test Plan: Builds and runs.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D15519
Summary:
We lost information when using QMouseEvent::globalPos, since
it is integer. Use instead InputRedirection::globalPointer,
which is updated before the filters are processed and is
float.
Test Plan: Manually.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: anthonyfieroni, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D15502
Summary:
Same is done on X11 (see Client::updateMouseGrab), so we should have this
on Wayland as well.
Also adding the pointer confinement restriction for modifier + wheel.
Test Plan: Run new and adjusted testcases with and without the change
Reviewers: #kwin, #plasma
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D16025
Summary:
If the pointer is constrained all mouse events should go to the window.
Also our Alt+click. To use Alt+click nevertheless one can just unconfine
the window.
CCBUG: 399375
Test Plan: Run the adjusted autotest before and after change
Reviewers: #kwin, #plasma
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D15982
Summary:
With 2694839099, 0bd5eff862 and f0ba436c72 it is now possible to
unconstrain a pointer by killing the client or deactivating the window, for
example by switching the window via the TabBox.
A user should always be able to do it therefore without needing to explicitly
break the pointer constrain as in the past with the Esc key.
Therefore remove the functionality and also remove the OSD announcing it,
which was often shown at the wrong time.
Test Plan: Manually and auto test adapted.
Reviewers: #kwin, #vdg, hein
Reviewed By: hein
Subscribers: ngraham, hein, kwin
Tags: #kwin
Maniphest Tasks: T8923
Differential Revision: https://phabricator.kde.org/D15234
Summary:
We currently only raise a client when a drag enters it and not activate it.
This is confusing since afterwards the raised window has not keyboard focus
although visually being in front of the window the drag originated from.
Therefore activate entered windows instead of only raising them.
Test Plan: Manually and autotests still pass.
Reviewers: #kwin, hein
Reviewed By: hein
Subscribers: anthonyfieroni, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D15225
Summary:
Pointer constraints should become disabled when the TabBox is invoked. Since
the current client stays activated while TabBox is enabled and currently can
not be deactivated with the risk of regression as discussed in D13758, disable
all pointer constraining explicitly and enable it again when the TabBox is
closed.
Test Plan: Manually in Wayland session.
Reviewers: #kwin, graesslin
Reviewed By: #kwin, graesslin
Subscribers: kwin
Tags: #kwin
Maniphest Tasks: T8923
Differential Revision: https://phabricator.kde.org/D14142
Summary:
A client might delete its pointer lock/confinement object. This is supposed to
directly remove the pointer lock/confinement in KWin, but did not explicitly
until now.
BUG: 388885
Test Plan:
Tested manually with Neverball, Nexuiz and the new pointer constraints test
application. The pointer constraints autotest is also appended.
Reviewers: #kwin, davidedmundson
Reviewed By: #kwin, davidedmundson
Subscribers: davidedmundson, graesslin, kwin
Tags: #kwin
Maniphest Tasks: T8923
Differential Revision: https://phabricator.kde.org/D13466
Summary:
BUG: 393253
FIXED-IN: 5.13.0
Test Plan: manual testing and new unit test
Reviewers: #kwin, #plasma
Subscribers: kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D12633
Summary:
This fixes the problem that alt+lmb did not start unrestricted move
resize for the Debug Console.
BUG: 374880
FIXED-IN: 5.12.3
Test Plan: New test case and manual testing whether alt+lmb/rmb works
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D10440
Summary:
On touch down a first hover motion is sent to the decoration. Thus e.g. a
button enters the hovered state. On touch release so far the decoration
did not get a leave event resulting in the button still being hovered.
This change ensures the leave event is sent or if the pointer is also on
the decoration a motion to the pointer position is sent.
BUG: 386231
FIXED-IN: 5.12.3
Test Plan:
New test case and manual testing to verify that the maximize
button is no longer hovered after touch down/up on it
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D10308
Summary:
When a window was being moved the touch handling performed the wrong
interaction. Due to that it was possible to move the window, but KWin
did not enter the correct code paths, thus quick tiling was for example
not functional.
BUG: 390113
FIXED-IN: 5.12.3
Test Plan: New test case added and manual test in nested KWin
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D10431
Summary:
The main reason for not having it as a mandatory dependency was that BSD
doesn't support it. But as I learned recently it is available on our CI
system. So BSDs have support now.
Even more it showed that the code doesn't compile if the dependency is
missing. And there's one thing I hate: broken build configuration
options.
So let's make UDEV and libinput a required dependency and get rid of the
problems.
Test Plan: Compiles
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D10057
Summary:
expose in the libinput wrapper a property that tells whether
a tablet mode switch input device is present on the machine,
expose it trough dbus
Test Plan:
still not complete, I need a way to either access the connection
from TabletModeManager or setting to TabletModeManager from input.cpp
Reviewers: #kwin, #plasma, graesslin
Reviewed By: #kwin, #plasma, graesslin
Subscribers: graesslin, ngraham, davidedmundson, plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D9944
Summary:
This ensures that using KDE Connect to control input properly inhibits
idle timeouts.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D9555
Summary:
This change introduces a new SwitchEvent and passes it through the
InputEventSpy and InputEventFilter. The DebugConsoleFilter implements it
so that the events can be monitored in the debug console.
Test Plan: Untested as my only device with such switches has too old libinput
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D9521
Summary:
The idea is to be output only, so also ignore for pointer and touch.
This is similar to the previous commit for keyboard events.
BUG: 386954
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D9647
Summary:
PlasmaCore.Dialog has a property outputOnly. This is for example used in
KWin's OnScreenNotification. If that property is set KWin should not send
any key events to it, just like for windows with _q_showWithoutActivating.
BUG: 388112
Test Plan: Not yet
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #plasma
Differential Revision: https://phabricator.kde.org/D9618
Summary:
This change finds the screen for a touch screen device based on:
* number available screens
* output name defined on the touch screen device
* internal screen
* and physical size
The id of the screen is stored in the Device allowing to adjust the
touch points accordingly. This means instead of transferring to the
combined display size the touch points are transferred into the output
space and the position of the output is added. Thus in a multi screen
system the touch points are properly mapped to the output.
Furthermore the screen orientation is passed to the Device and a
calibration matrix is set accordingly. Thus a transformed screen has the
touch screen transformed accordingly.
Please note that this only affects libinput on Wayland and not on X11!
The x11 standalone platform needs to gain similar code.
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8748
Summary:
In some cases, it's possible that libinput wrote device added events to
the file descriptor before the connection to handle those events was
in-place. This resulted in a compositor without any input devices.
Test Plan:
Ran a wayland session. In about 60% of all cases, no input was
possible. kwin_libinput showed the enumeration of all devices correctly,
but KWin::LibInput::Context did not have any m_devices.
After this change, this did not appear anymore.
Reviewers: #plasma, graesslin, davidedmundson
Reviewed By: #plasma, graesslin, davidedmundson
Subscribers: anthonyfieroni, ngraham, kwin, #kwin, plasma-devel
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8888
Summary:
On X11 modifier+mouse button on the window decoration triggers the
"special" handling thus as unrestricted move instead of passing the click
to the decoration. Of course on Wayland we want to have the same
functionality.
BUG: 386708
FIXED-IN: 5.11.4
Test Plan: New test case added. PointerInputTest still passes.
Reviewers: #kwin, #plasma, broulik
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8758
Summary:
The SCHED_RESET_ON_FORK results in threads (not only processes) to have
the scheduling policy reset to default. This means that the libinput
thread is not real time, but this was actually intended.
To solve this problem KWin does start without the RESET_ON_FORK flag
during startup. Once createInput has been called the scheduling is
adjusted again and RESET_ON_FORK is added again. This results in the
libinput thread and all threads Qt starts in between (e.g. dbus) to gain
real time policy. But it is still not leaked to other processes or to
threads in KWin which don't need it.
Other options considered: just don't use RESET_ON_FORK and instead
manually reset on fork. This would mean all threads in KWin gain real
time, but we don't need this. It's only interesting for the main
(rendering, Wayland thread) and the input thread. Also the danger to
leak into another process is too high.
Keeping the capability till the libinput thread is created and adjust
the thread itself. This option was discarded as I don't want KWin to
have any capabilities when the QApplication is started.
Test Plan: ps -eL -o class,rtprio,cmd,comm | grep kwin_wayland
Reviewers: #kwin, #plasma
Subscribers: plasma-devel, kwin
Tags: #kwin
Differential Revision: https://phabricator.kde.org/D8065
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