1. 23 Sep, 2019 4 commits
    • Vlad Zahorodnii's avatar
      a4ec7978
    • Vlad Zahorodnii's avatar
      Rename ShellClient to XdgShellClient · 168ea988
      Vlad Zahorodnii authored
      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
      168ea988
    • Vlad Zahorodnii's avatar
      [autotests] Don't test wl-shell clients · d92d6e77
      Vlad Zahorodnii authored
      Summary:
      This change removes all traces of wl-shell in the test suite. That's a
      prerequisite for dropping wl-shell support in KWin.
      
      Given that wl-shell and xdg-shell are not interchangeable, some tests
      were removed and initialization sequence in some tests was adjusted.
      
      The most notable change is ensuring that each plasmashell window sets
      its role and initial position before committing the surface. Setting
      those properties before the first surface commit is important because
      our window placement code needs to know window type in order to
      avoid maximizing panels, popups, etc.
      
      Reviewers: #kwin, davidedmundson
      
      Reviewed By: #kwin, davidedmundson
      
      Subscribers: kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D23561
      d92d6e77
    • Vlad Zahorodnii's avatar
      Port QPA away from Wayland · bebe8120
      Vlad Zahorodnii authored
      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
      bebe8120
  2. 27 Aug, 2019 1 commit
    • Roman Gilg's avatar
      [platforms/virtual] Create output devices · cd6b69a4
      Roman Gilg authored
      Summary:
      Create output devices in virtual backend. For that the setVirtualOutputs call
      can only come after the Wayland server has been initiliazied such that the
      display exists to create the output and output device interfaces. Tests have
      been adjusted for that.
      
      Test Plan:
      ```
      98% tests passed, 3 tests failed out of 148
      
      Total Test time (real) = 362.97 sec
      
      The following tests FAILED:
               33 - kwin-testInternalWindow (Failed)
               39 - kwin-testPointerInput (Failed)
              101 - kwin-testMoveResize (Failed)
      ```
      Failing of these tests looks unrelated to the change.
      
      Reviewers: #kwin
      
      Subscribers: kwin
      
      Tags: #kwin
      
      Maniphest Tasks: T11459
      
      Differential Revision: https://phabricator.kde.org/D23477
      cd6b69a4
  3. 22 Jul, 2019 1 commit
    • Vlad Zahorodnii's avatar
      Run clang-tidy with modernize-use-override check · 8af2fa73
      Vlad Zahorodnii authored
      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
      8af2fa73
  4. 27 Jun, 2019 1 commit
    • Roman Gilg's avatar
      [autotests] In internal window test remove spy waits or guard them · 349560a7
      Roman Gilg authored
      Summary:
      The internal window test is failing on CI because the client add spy waits
      are not triggered. The signal has been emitted already at this point.
      
      Removing them fixes this (the condition is still checked by subsequent
      count verify on the spy) in all but one instance. In this case the wait
      needs to be guarded.
      
      Is there a more general approach to it? Always guarding is ugly. Also when
      was this test regression introduced? In the past we must have had some
      slack until the signal was fired to start the wait call.
      
      Test Plan: Internal window test passes with this patch again.
      
      Reviewers: #kwin, zzag
      
      Reviewed By: #kwin, zzag
      
      Subscribers: davidedmundson, zzag, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D22119
      349560a7
  5. 02 May, 2019 1 commit
  6. 21 Feb, 2019 1 commit
    • Martin Flöser's avatar
      Split out a dedicated InternalClient class · 9b922f88
      Martin Flöser authored
      Summary:
      Most of the functionality which is special to internal clients is moved
      from ShellClient to InternalClient. As KWin's qpa is still bound to the
      Wayland protocol InternalClient inherits from ShellClient. Due to that
      some aspects in ShellClient are "weird". ShellClient still detects
      whether it's an internal client and uses the variable m_internal to
      capture the state. This is required as we cannot use the isInternal
      method. Most of m_internal usage is in init which is called from
      constructor of ShellClient. Thus it's not possible to call into virtual
      methods of InternalClient.
      
      Also some of the code is duplicated and some methods are temporarily
      marked as virtual.
      
      The next step will be to remove ShmBuffer for internal windows which
      should decouple the two implementations further with the long term goal
      of having InternalClient inherit AbstractClient directly.
      
      Test Plan:
      Run nested KWin, triggered outline (OpenGL case) and debug console (shm case).
      InternalWindow unit test still passes.
      
      Reviewers: #kwin
      
      Subscribers: kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D18569
      9b922f88
  7. 27 Jan, 2019 1 commit
    • Martin Flöser's avatar
      Add windowsystem plugin for KWin's qpa · 02a05610
      Martin Flöser authored
      Summary:
      KWindowSystem provides a plugin interface to have platform specific
      implementations. So far KWin relied on the implementation in
      KWayland-integration repository.
      
      This is something I find unsuited, for the following reasons:
       * any test in KWin for functionality set through the plugin would fail
       * it's not clear what's going on where
       * in worst case some code could deadlock
       * KWin shouldn't use KWindowSystem and only a small subset is allowed
      to be used
      
      The last point needs some further explanation. KWin internally does not
      and cannot use KWindowSystem. KWindowSystem (especially KWindowInfo) is
      exposing information which KWin sets. It's more than weird if KWin asks
      KWindowSystem for the state of a window it set itself. On X11 it's just
      slow, on Wayland it can result in roundtrips to KWin itself which is
      dangerous.
      
      But due to using Plasma components we have a few areas where we use
      KWindowSystem. E.g. a Plasma::Dialog sets a window type, the slide in
      direction, blur and background contrast. This we want to support and
      need to support. Other API elements we do not want, like for examples
      the available windows. KWin internal windows either have direct access
      to KWin or a scripting interface exposed providing (limited) access -
      there is just no need to have this in KWindowSystem.
      
      To make it more clear what KWin supports as API of KWindowSystem for
      internal windows this change implements a stripped down version of the
      kwayland-integration plugin. The main difference is that it does not use
      KWayland at all, but a QWindow internal side channel.
      
      To support this EffectWindow provides an accessor for internalWindow and
      the three already mentioned effects are adjusted to read from the
      internal QWindow and it's dynamic properties.
      
      This change is a first step for a further refactoring. I plan to split
      the internal window out of ShellClient into a dedicated class. I think
      there are nowadays too many special cases. If it moves out there is the
      question whether we really want to use Wayland for the internal windows
      or whether this is just historic ballast (after all we used to use
      qwayland for that in the beginning).
      
      As the change could introduce regressions I'm targetting 5.16.
      
      Test Plan:
      new test case for window type, manual testing using Alt+Tab
      for the effects integration. Sliding popups, blur and contrast worked fine.
      
      Reviewers: #kwin
      
      Subscribers: kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D18228
      02a05610
  8. 14 Jan, 2019 1 commit
    • David Edmundson's avatar
      Add high DPI support to internal KWin windows · 2df9d22a
      David Edmundson authored
      Summary:
      So far we didn't try to do high DPI on kwin internal windows, such as
      the user context menu and tab bars and whatever.
      
      Due to wayland scaling they were the correct phyiscal size but upscaled.
      This patch fixes our QPA to enable Qt's high-dpi support.
      
      BUG: 402853
      
      Note icons are still low res. This is because the global
      QGuiApplication::devicePixelRatio which is the max of all connected
      screens is static for the duration of the app. QIcon uses this when
      determining the DPR to use. This will require a Qt change.
      
      Test Plan:
      Ran at 2x on my normal DPI screen (as that's easier to see anything)
      * User action menu is high DPI
      * Window deco tooltips are still fine
      * Tab switcher is high DPI
      * Overlay in present windows Desktop grid are still ok
      
      Reviewers: #kwin
      
      Subscribers: zzag, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D18042
      2df9d22a
  9. 05 Jan, 2019 1 commit
  10. 02 Dec, 2018 1 commit
    • Roman Gilg's avatar
      Rework InputDeviceHandler focus tracking · 2e297113
      Roman Gilg authored
      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
      2e297113
  11. 19 Mar, 2018 1 commit
    • Roman Gilg's avatar
      [platforms/virtual] Add virtual output class · 8136c272
      Roman Gilg authored
      Summary:
      This matches the DRM backend more closely and allows mid-test removal and
      addition of virtual outputs with different properties in the future.
      
      Test Plan: Before and after 93% tests passed.
      
      Reviewers: #kwin, graesslin
      
      Reviewed By: #kwin, graesslin
      
      Subscribers: graesslin, kwin, #kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D11351
      8136c272
  12. 04 Mar, 2018 1 commit
  13. 25 Feb, 2018 1 commit
    • Martin Flöser's avatar
      Init the icon in ShellClient::init · 5795fc8c
      Martin Flöser authored
      Summary:
      If the window never provides the appId, we would not get an icon for
      the window. This happens for example for KWin's internal windows which
      don't set the app id as KWin also doesn't have a desktop file. With this
      change the DebugConsole has a window icon in the decoration.
      
      Test Plan: Extended tests and manual verification of DebugConsole
      
      Reviewers: #kwin, #plasma
      
      Subscribers: plasma-devel, kwin
      
      Tags: #plasma
      
      Differential Revision: https://phabricator.kde.org/D10294
      5795fc8c
  14. 07 Sep, 2017 1 commit
    • Martin Flöser's avatar
      Delay syncing internal window geometry to end of cycle · e0f95fd9
      Martin Flöser authored
      Summary:
      The syncing of the window geometry to the internal geometry can
      unfortunately cause a freeze in very special conditions:
      1. create QML component
      2. a Plasma::Dialog gets created
      3. It creates the DialogShadows
      4. This triggers QGlobalStatic creation which locks a non-recursive
      mutex
      5. The creation of DialogShadows creates a Registry and triggers a
      roundtrip on the Wayland server
      6. KWin processes all Wayland events
      7. This triggers the creation of a ShellClient
      8. The ShellClient has a PlasmaShellSurface which requested a position
      9. The new geometry does not match the geometry of the Plasma::Dialog
      10. ShellClient syncs the geometry to the Plasma::Dialog
      11. Plasma::Dialog updates the theme because window geometry changed
      12. This accesses the DialogShadows...
      
      which is still in the non recursive mutex and we have a freeze.
      
      By delaying the sync to the end of cycle we jump out of this deadly
      sequence.
      
      BUG: 384441
      
      Test Plan:
      The freeze doesn't hit any more. It's possible that some test
      cases need adjustments.
      
      Reviewers: #kwin, #plasma
      
      Subscribers: plasma-devel, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D7712
      e0f95fd9
  15. 13 Jan, 2017 1 commit
  16. 04 Jan, 2017 1 commit
    • Martin Flöser's avatar
      Fix syncing of geometry to internal window when using ::move · 6a78bd45
      Martin Flöser authored
      Summary:
      The OnScreenNotification gets moved during its placement. This update
      of the geometry did not get synced to the QWindow's geometry as it
      should.
      
      The reason for this is the rather special implementation of
      AbstractClient::move. This just modifies the geom variable and does not
      call into setGeometry at all. Instead a virtual doMove method is invoked
      to inform the platform specific client implementation about the move of
      the window. For a "normal" ShellClient that is fine - there is nothing
      to do.
      
      This change adds an implementation of doMove in ShellClient to sync the
      geometry to the internal window. This is not yet enough to fix the
      geometry of the OnScreenNotification. It gets placed with a
      GeometryUpdatesBlocker in place causing the doMove never to be called.
      Instead setGeometry is invoked again when the geometry updates get
      unblocked. So far ShellClient did not do anything in this case. This
      change ensures that at least the doSetGeometry method is performed again.
      
      Test Plan: Added test case and manual testing of OnScreenNotification
      
      Reviewers: #kwin, #plasma_on_wayland
      
      Subscribers: plasma-devel, kwin
      
      Tags: #plasma_on_wayland, #kwin
      
      Differential Revision: https://phabricator.kde.org/D3963
      6a78bd45
  17. 03 Jan, 2017 1 commit
    • Martin Flöser's avatar
      Sync opacity from an internal QWindow to its ShellClient · 0a042dad
      Martin Flöser authored
      Summary:
      This change adds support for opacity on a KWin internal QWindow.
      Calling QWindow::setOpacity syncs the value to the ShellClient
      representation of the QWindow.
      
      This is needed for fading out the OnScreenNotification on mouse
      over.
      
      Test Plan: Added auto test and manual test
      
      Reviewers: #kwin, #plasma_on_wayland
      
      Subscribers: plasma-devel, kwin
      
      Tags: #plasma_on_wayland, #kwin
      
      Differential Revision: https://phabricator.kde.org/D3928
      0a042dad
  18. 15 Dec, 2016 1 commit
  19. 12 Sep, 2016 1 commit
    • Martin Flöser's avatar
      DebugConsole window does not take keyboard input · 3a3d1b6b
      Martin Flöser authored
      Summary:
      In order to add more tabs which can further help monitoring how KWin
      handles some aspects the DebugConsole is changed to not take keyboard
      input. This means it can only be navigated using pointer device or touch
      screen.
      
      This is needed for adding a new tab to monitor clipboard changes. On
      Wayland sometimes windows don't get the clipboard, so it would be
      helpful to have a debug monitor to see when the clipboard changes. But
      for that debug console window may not take keyboard events.
      
      To support this DebugConsole sets the WA_ShowWithoutActivating attribute
      which gets honored by the InternalWindowEventFilter and does not forward
      key events to such windows.
      
      Reviewers: #kwin, #plasma_on_wayland
      
      Subscribers: plasma-devel, kwin
      
      Tags: #plasma_on_wayland, #kwin
      
      Differential Revision: https://phabricator.kde.org/D2620
      3a3d1b6b
  20. 09 Sep, 2016 1 commit
    • Martin Flöser's avatar
      Remove non visible internal windows from the x stacking order · 8d4204ac
      Martin Flöser authored
      Summary:
      KWin always has a few internal windows around which are not visible.
      A QWindow created somewhere, but not shown. Such windows should not
      be part of the stacking order.
      
      If they are it breaks code which looks at the top most window in the
      stacking order like e.g. SlidebackEffect.
      
      This change ensures that the stacking order gets updated whenever a
      ShellClient gets hidden and that internal windows with isShown being
      false are excluded from the stacking order.
      
      BUG: 364483
      
      Reviewers: #kwin, #plasma_on_wayland
      
      Subscribers: plasma-devel, kwin
      
      Tags: #plasma_on_wayland, #kwin
      
      Differential Revision: https://phabricator.kde.org/D2636
      8d4204ac
  21. 30 Aug, 2016 1 commit
    • Martin Flöser's avatar
      Add a Workspace::findToplevel(QWindow*) method · 4c0e33a9
      Martin Flöser authored
      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.
      4c0e33a9
  22. 16 Aug, 2016 5 commits
  23. 08 Aug, 2016 1 commit
  24. 13 Jul, 2016 1 commit
    • Martin Flöser's avatar
      Handle situation of no XDG_RUNTIME_DIR gracefully · 3c04d529
      Martin Flöser authored
      Summary:
      If KWin fails to start the Wayland server due to XDG_RUNTIME_DIR not
      being set, kwin_wayland should terminate with an error condition but
      not crash.
      
      This change makes sure that KWin detects that the Wayland server does
      not work and terminates the startup early and ensures that it doesn't
      crash while going down.
      
      An error message is shown that we could not create the Wayland server.
      
      Test Plan:
      Test case added which verifies that WaylandServer fails to
      init. Manual testing that kwin_wayland exits with error 1.
      
      Reviewers: #kwin, #plasma_on_wayland
      
      Subscribers: plasma-devel, kwin
      
      Tags: #plasma_on_wayland, #kwin
      
      Differential Revision: https://phabricator.kde.org/D2078
      3c04d529
  25. 29 Jun, 2016 1 commit
  26. 23 May, 2016 1 commit
    • Martin Flöser's avatar
      Support touch events on KWin internal windows · ff88f938
      Martin Flöser authored
      Summary:
      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
      ff88f938
  27. 03 May, 2016 1 commit
  28. 07 Apr, 2016 2 commits
  29. 17 Feb, 2016 1 commit
    • Martin Flöser's avatar
      Improve keyboard handling for internal windows · 521470b0
      Martin Flöser authored
      So far the key handler in the InternalWindowEventFilter used the
      PointerInputRedirection's internal window. This had the result that
      key events were only delivered to an internal window if the window
      was under the cursor.
      
      This change tries sending the event to the latest created and visible
      window. Thus e.g. with nested context menus it goes to the current
      sub menu as expected. The return value of sendEvent is used to filter
      out the event.
      521470b0
  30. 11 Feb, 2016 1 commit
  31. 08 Feb, 2016 1 commit
  32. 05 Feb, 2016 1 commit