1. 16 Dec, 2020 1 commit
  2. 08 Sep, 2020 1 commit
    • David Edmundson's avatar
      Avoid QPointer in return types of Input methods · 6acf35e4
      David Edmundson authored
      QPointer is a really useful way to store a pointer over time.
      It doesn't make have any value as a return value used by a short-lived
      There isn't a good copy constructor, it's effectively the same as
      creating a new QWeakPointer reference that has to be cleaned up.
      Testing if something is null is still the same. A new QPointer can be
      made by the caller if it actually is needed.
      Input handling is a very hot path called many times a frame, so it's
      important to keep this light. focus() and at() are called a lot which
      added up to slightly over 1% of CPU time when moving the mouse about.
  3. 07 Aug, 2020 2 commits
    • Vlad Zahorodnii's avatar
      Prettify license headers · 4ce853e8
      Vlad Zahorodnii authored
    • Vlad Zahorodnii's avatar
      Switch to SPDX license markers · 1fb9f6f1
      Vlad Zahorodnii authored
      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.
  4. 20 Mar, 2020 1 commit
  5. 14 Jan, 2020 1 commit
  6. 10 Dec, 2019 1 commit
  7. 29 Sep, 2019 1 commit
  8. 11 Aug, 2019 1 commit
  9. 29 Jul, 2019 1 commit
    • Vlad Zahorodnii's avatar
      Use more traditional doxygen style · 684b4b63
      Vlad Zahorodnii authored
      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
  10. 22 Jul, 2019 1 commit
    • Vlad Zahorodnii's avatar
      Run clang-tidy with modernize-use-override check · 8af2fa73
      Vlad Zahorodnii authored
      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 ...
  11. 06 Jun, 2019 1 commit
    • Roman Gilg's avatar
      Delayed focus updates for Toplevels without surface · 846961bf
      Roman Gilg authored
      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
  12. 17 May, 2019 1 commit
    • Vlad Zahorodnii's avatar
      Send axis_source, axis_discrete, and axis_stop · 7f593a67
      Vlad Zahorodnii authored
      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
      Reviewers: #kwin, davidedmundson
      Reviewed By: #kwin, davidedmundson
      Subscribers: davidedmundson, kwin
      Tags: #kwin
      Differential Revision: https://phabricator.kde.org/D19000
  13. 19 Feb, 2019 1 commit
    • Roman Gilg's avatar
      [xwl] Drag and drop between Xwayland and Wayland native clients · 548978bf
      Roman Gilg authored
      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 lea...
  14. 12 Feb, 2019 1 commit
    • Vlad Zahorodnii's avatar
      Overhaul doxygen comments · 7b20e1f6
      Vlad Zahorodnii authored
      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
  15. 11 Jan, 2019 1 commit
  16. 13 Dec, 2018 1 commit
    • Roman Gilg's avatar
      Unset touch targets on no current touch points · 05ca6c97
      Roman Gilg authored
      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
  17. 02 Dec, 2018 2 commits
    • Roman Gilg's avatar
      Rework InputDeviceHandler focus tracking · 2e297113
      Roman Gilg authored
      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
    • Roman Gilg's avatar
      Privatize variables in InputDeviceHandler · eab71a8a
      Roman Gilg authored
      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
  18. 12 Sep, 2018 1 commit
    • Roman Gilg's avatar
      Remove breaking pointer constraints functionality · 6072b0cd
      Roman Gilg authored
      With 26948390, 0bd5eff8 and f0ba436c 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
  19. 25 Jan, 2018 1 commit
    • Marco Martin's avatar
      Expose if the tablet mode switch is available · 87b688da
      Marco Martin authored
      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
  20. 09 Jan, 2018 1 commit
  21. 29 Jul, 2017 1 commit
    • Martin Flöser's avatar
      Replace Workspace::slotWindowQuickTileFoo by a quickTileWindow with argument · 64da6c8d
      Martin Flöser authored
      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
      Test Plan: Affected test cases still pass
      Reviewers: #kwin, #plasma
      Subscribers: plasma-devel, kwin
      Tags: #kwin
      Differential Revision: https://phabricator.kde.org/D6783
  22. 07 May, 2017 1 commit
    • David Edmundson's avatar
      Keep all touchpad QActions in the main thread · fe231be5
      David Edmundson authored
      Making QActions with the Connection as a parent is dangerous as it gets
      moved to a new thread, moving all child objects to that thread.
      KGlobalAccel and QAction aren't thread safe and we shouldn't be using it
      in two threads. This was notably seen when runnng invokeShortcut over
      DBus which then invokes it on the main thread. Something my laptop was
      doing when I closed the lid.
      This patch simply moves the code to the Input class, where we set up the
      libinput connection.
      Test Plan:
      Closed lid, kwin_wayland was still there when I resumed
      Set manual shortcut for toggling touchpad, that still worked
      Reviewers: #plasma
      Subscribers: plasma-devel, kwin, #kwin
      Tags: #kwin
      Differential Revision: https://phabricator.kde.org/D5733
  23. 24 Apr, 2017 1 commit
    • Martin Flöser's avatar
      Add a KSharedConfigPtr for kcminputrc to KWin::Application · 857d8a9c
      Martin Flöser authored
      There are a few places where KWin needs to read values from kcminputrc.
      As I need to add yet another one it makes more sense to properly
      structure it like in other cases and have only one kcminputrc hold in
      the application. This also allows to better mock the config values in
      the integration tests.
      Reviewers: #kwin, #plasma
      Subscribers: plasma-devel, kwin
      Tags: #kwin
      Differential Revision: https://phabricator.kde.org/D5540
  24. 27 Mar, 2017 1 commit
    • Martin Flöser's avatar
      Add support for global touchpad swipe gestures · 22c91df2
      Martin Flöser authored
      This change adds global touchpad swipe gestures to the
      GlobalShortcutsManager and hooks up the swipe gestures as defined at the
      Plasma Affenfels sprint:
       * swipe up: Desktop Grid
       * swipe down: Present Windows
       * swipe left: previous virtual desktop
       * swipe right: next virtual desktop
      The main work is handled by two new classes: SwipeGesture and
      GestureRecognizer. This is implemented in a way that it can be extended
      to also recognize touch screen gestures and pinch gestures.
      The SwipeGesture defines what is required for the gesture to trigger.
      Currently this includes the minimum and maximum number of fingers
      participating in the gesture and the direction. The gesture gets
      registered in the GestureRecognizer.
      The events for the gesture are fed into the GestureRecognizer. It
      evaluates which gestures could trigger and tracks them for every update
      of the gesture. In the process of the gesture tracking the
      GestureRecognizer emits signals on the Gesture:
       * started: when the Gesture gets considered for a sequence
       * cancelled: the Gesture no longer matches the sequence
       * triggered: the sequence ended and the Gesture still matches
      The remaining changes are related to hook up the existing shortcut
      framework with the new touchpad gestures. The GlobalShortcutManager
      gained support for it, InputRedirection and EffectsHandler offer methods
      to register a QAction. VirtualDesktopManager, PresentWindows and
      DesktopGrid are adjusted to support the gesture.
      Reviewers: #kwin, #plasma_on_wayland
      Subscribers: plasma-devel
      Tags: #plasma_on_wayland
      Differential Revision: https://phabricator.kde.org/D5097
  25. 17 Jan, 2017 1 commit
    • Martin Flöser's avatar
      Move X11 specific KGlobalAccel handling into the x11-standalone platform · 2904d4a0
      Martin Flöser authored
      InputRedirection has a workaround to add a connect on a QAction which
      is used for a global shortcut. This is specific to the X11 platform as
      the xtime needs to be updated.
      This change adds a new virtual method to the Platform and moves the
      implementation into the X11 standalone platform. Thus it does no longer
      gets called on Wayland.
      Reviewers: #kwin, #plasma
      Subscribers: plasma-devel
      Tags: #kwin
      Differential Revision: https://phabricator.kde.org/D4168
  26. 02 Jan, 2017 2 commits
  27. 30 Dec, 2016 1 commit
    • Martin Flöser's avatar
      Introduce an InputEventSpy for processing input events · 84e33081
      Martin Flöser authored
      So far KWin's input event processing is mostly based on
      InputEventFilters. A filter can - as the name suggest - filter out an
      input event from further processing. Our code shows that this is not
      sufficient for all input event processing.
      We have several areas inside KWin where we need to have access to all
      input events, where the processing needs to happen on all events and
      filtering is not allowed. This results in sub-optimal code which has
      classes which know too much and do too much.
       * key-repeat handling done in KeyboardInputRedirection
       * Layout change OSD in Xkb
       * modifier only shortcuts in Xkb
       * emitting signals for Cursor class in KeyboardInputRedirection
      Also there are misuses of the InputEventFilters and internal API
       * DebugConsole keyboard state (uses wrong information)
       * DebugConsole input events tab (uses Filter, should be a spy)
      This change introduces the API needed to fix these problems. It
      introduces an InputEventSpy which is modelled after the InputEventFilter
      with the difference that it has only void messages and uses the KWin
      introduced event classes.
      The spies are always processed prior to the filters, thus we know it can
      have all events.
      Reviewers: #kwin, #plasma
      Subscribers: plasma-devel, kwin
      Tags: #kwin
      Differential Revision: https://phabricator.kde.org/D3863
  28. 27 Dec, 2016 2 commits
    • Martin Flöser's avatar
      Add the modifiers relevant for global shortcuts into the input Events · 58361213
      Martin Flöser authored
      Prior to this change various event filters performed deep calls into
      Xkb class to figure out the modifiers relevant for global shortcuts (aka
      consumed modifiers). This shows that this is a general useful
      information which should be available to all input event filters
      Thus it's now added to the input events and exposed directly in
      InputRedirection so that the calls into Xkb are no longer needed.
      Reviewers: #kwin, #plasma_on_wayland
      Subscribers: plasma-devel, kwin
      Tags: #plasma_on_wayland, #kwin
      Differential Revision: https://phabricator.kde.org/D3810
    • Martin Flöser's avatar
      Reduce code duplication for processing input events · e3d79cdd
      Martin Flöser authored
      For every input event we have similar code. We go through all
      InputFilters, invoke a method with some arguments and check whether
      the filter returns true.
      Instead of duplicating that logic everywhere, there is now one method
      in InputRedirection which takes a std::function to call on the input
      filters. The std::function is supposed to be generated with a std::bind
      on the InputFilter::method with all the required arguments.
      Reviewers: #kwin, #plasma
      Subscribers: plasma-devel, kwin
      Tags: #kwin
      Differential Revision: https://phabricator.kde.org/D3806
  29. 08 Dec, 2016 1 commit
    • Martin Flöser's avatar
      Implement support for pointer constraints · 0c5ca405
      Martin Flöser authored
      There are two types of constraints supported:
      1. Pointer confinement
      2. Pointer locking
      In the case of confinement the pointer is confined to a given region of
      the surface. This is comparable to general operation where the pointer
      is confined to the screen region.
      In the second case the pointer gets locked. That means it cannot move at
      all. No further position updates are provided, only relative motion
      events can go to the application. There is a hint about cursor position
      update on unlock which is not yet implemented in KWayland::Server, thus
      also not in this change.
      The implementation in KWin grants the requests for pointer constraints
      when the pointer enters the constrained region, either by pointer
      movement or by e.g. stacking order changes. There is no confirmation
      from user required to enter that mode. But we want to show an OSD when
      the pointer gets constrained, this is not yet implemented, though.
      Breaking an active constraint is relatively easy. E.g. changing the
      stacking order will break the constraint if another surface is under the
      cursor. Also (in case of confinement) moving the pointer to an
      overlapping window breaks the confinement. But as soon as one moves the
      pointer back to the window a constraint might get honoured again.
      To properly break there is a dedicated event filter. It listens for a
      long press of the Escape key. If hold for 3sec the pointer constraint is
      broken and not activated again till the pointer got moved out of the
      window. Afterward when moving in the pointer might activate again.
      The escape filter ensures that the key press is forwarded to the
      application if it's a short press or if another key gets pressed during
      the three seconds. If the three seconds way fires, the later escape
      release is not sent to the application.
      This basic interaction is also ensured through an added auto test.
      This change implements T4605.
      Test Plan: Added auto test and nested KWin Wayland with D3488
      Reviewers: #kwin, #plasma_on_wayland
      Subscribers: plasma-devel, kwin
      Tags: #plasma_on_wayland, #kwin
      Differential Revision: https://phabricator.kde.org/D3506
  30. 25 Nov, 2016 1 commit
    • Martin Flöser's avatar
      Add interactive position selection to screenshot screen under cursor · f9f7b84c
      Martin Flöser authored
      A second interactive selection mode gets added to select a position on
      the screen. This is handled by the same input event filter as for the
      window selection. Just that instead of returning a window, it returns a
      This allows to pick a point on the screen which we need to screenshot
      the screen under the mouse cursor and in future for color picking.
      The screenshot effect provides two new dbus methods to (interactively)
      select a screen or fullscreen. This allows spectacle to screenshot the
      (full) screen with still having the user in control.
      Reviewers: #kwin, #plasma_on_wayland, bgupta
      Subscribers: plasma-devel, kwin
      Tags: #plasma_on_wayland, #kwin
      Differential Revision: https://phabricator.kde.org/D3475
  31. 17 Nov, 2016 1 commit
    • Martin Flöser's avatar
      Implement interactive window selection for Wayland platforms · fd83366e
      Martin Flöser authored
      The interactive window selection is implemented in InputRedirection
      through a dedicated InputEventFilter. The InputEventFilter so far takes
      care of pointer input and keyboard input. In addition it ensures that
      keyboard and pointer focus is reset on start and on end.
      With this change KillWindow now also works on Wayland, but only for X11
      windows, as the Wayland variant is not yet implemented.
      Test Plan: Tested in nested setup, auto-tests still needed
      Reviewers: #kwin, #plasma_on_wayland
      Subscribers: plasma-devel, kwin
      Tags: #plasma_on_wayland, #kwin
      Differential Revision: https://phabricator.kde.org/D3365
  32. 15 Sep, 2016 1 commit
    • Martin Flöser's avatar
      Better handling for forwarding key events to Wayland Server · 8fdcc24b
      Martin Flöser authored
      A new protected method is added to InputEventFilter to forward a
      QKeyEvent to the Wayland server. Several input filters need to forward
      the event to have a proper state of the events. E.g. the TabBox filter,
      but also the internal window filter and effects filter. It's important
      to update all events even if the events are not forwarded to a surface.
      This new method takes care of the general handling like ignoring key
      repeats, etc.
      Reviewed-By: bshah
  33. 08 Aug, 2016 1 commit
    • Martin Flöser's avatar
      [libinput] Add support for gesture events · 8a83a6fe
      Martin Flöser authored
      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
       * 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
  34. 03 Aug, 2016 1 commit
    • Martin Flöser's avatar
      [wayland] Always have a keyboard on the Seat · 4c6c4e67
      Martin Flöser authored
      This is a workaround for QTBUG-54371 resulting in QtWayland never
      requesting the input methods panel without having keyboard focus.
      Thus also the virtual keyboard is not working.
      With this change we go back to always announcing a keyboard and
      binding the virtual keyboard to whether we don't have an alpha-numeric
      keyboard instead of whether there is a keyboard on the seat.
      Reviewers: #kwin, #plasma_on_wayland, bshah
      Subscribers: plasma-devel, kwin
      Tags: #plasma_on_wayland, #kwin
      Differential Revision: https://phabricator.kde.org/D2343
  35. 23 May, 2016 1 commit
    • Martin Flöser's avatar
      Support touch events on KWin internal windows · ff88f938
      Martin Flöser authored
      Qt's touch event API is rather difficult and complex to implement.
      As none of KWin's internal windows supports multi-touch gestures yet,
      this is going the easy route and just simulates a left mouse button
      press. If in future need arises for touch gesture support on KWin's
      internal windows, this can be added.
      Test Plan: Tested on exopc with DebugConsole and auto test
      Reviewers: #plasma
      Subscribers: plasma-devel
      Tags: #plasma
      Differential Revision: https://phabricator.kde.org/D1661
  36. 17 May, 2016 1 commit
    • Martin Flöser's avatar
      Support touch events in DecorationEventFilter · 73fae5e6
      Martin Flöser authored
      Touch events are emulating mouse events, in particular left mouse
      With this change one can move windows through the decoration, use
      the decoration buttons and also support the double click action.
      As finding the decoration is pretty much exactly the same as for
      pointer events, a new base class is introduces which provides the
      functionality of updating the decoration and the shared common
      Reviewers: #plasma
      Subscribers: plasma-devel
      Projects: #plasma
      Differential Revision: https://phabricator.kde.org/D1604