1. 29 Sep, 2020 1 commit
    • Vlad Zahorodnii's avatar
      Use better window placement heuristics for internal clients · ef65a340
      Vlad Zahorodnii authored
      Currently, we do some sort of window placement only for decorated
      internal windows, which feels hacky.
      
      With this change, all internal clients will go through the window
      placement code, unless it's a popup or the BypassWindowManagerHint
      flag is set.
      
      If the BypassWindowManagerHint flag is set, the window must have
      valid position.
      
      CCBUG: 400675
      
      
      (cherry picked from commit bc347365)
      ef65a340
  2. 04 Sep, 2020 1 commit
  3. 21 Aug, 2020 1 commit
    • Vlad Zahorodnii's avatar
      Use universal helper for writing toplevels to QDebug streams · 90b53f41
      Vlad Zahorodnii authored
      Toplevel::debug() is one of annoyances that you need to deal with when
      implementing a new client type. It can be tempting to just write "this"
      to the stream, but it will result in a crash.
      
      In order to make implementing new client types easier, this change
      introduces a debug stream insertion operator overload that works for all
      kinds of the Toplevel class.
      90b53f41
  4. 20 Aug, 2020 2 commits
  5. 19 Aug, 2020 1 commit
    • Vlad Zahorodnii's avatar
      Refactor color scheme related code · 9e74199e
      Vlad Zahorodnii authored
      Currently, we have two functions that update the color scheme for a
      client - updateColorScheme(QString) and updateColorScheme(). Even though
      they both share the same name, they do different things. The first one
      sets the specified color scheme, while the other determines the color
      scheme preferred by the client and assigns it.
      
      This change refactors the color scheme initialization code so we no
      longer need those two methods. The setColorScheme() method sets the
      specified color scheme, and the preferredColorScheme() method returns
      the color scheme preferred by the client. Sub-classes of AbstractClient
      can override the preferredColorScheme() method in order to add support
      for platform-specific color scheme protocols.
      
      The end result: color scheme related code is a bit more comprehensible.
      9e74199e
  6. 07 Aug, 2020 2 commits
    • Vlad Zahorodnii's avatar
      Prettify license headers · 4ce853e8
      Vlad Zahorodnii authored
      4ce853e8
    • 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.
      1fb9f6f1
  7. 22 Jul, 2020 1 commit
    • Vlad Zahorodnii's avatar
      Check if we successfully restored input focus · 55588507
      Vlad Zahorodnii authored
      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
      55588507
  8. 18 Jun, 2020 1 commit
    • Vlad Zahorodnii's avatar
      Introduce the client geometry in Toplevel · cc3eb54b
      Vlad Zahorodnii authored
      In most cases, we don't need to react to client geometry changes, but in
      code that deals with server-side window decorations, we need to react to
      client geometry changes. The problem is that frame and client geometry
      updates are not correlated even though there is a connection between the
      frame geometry and the client geometry.
      
      This change introduces the client geometry in the Toplevel class in order
      to allow monitoring client geometry updates from DecoratedClientImpl.
      cc3eb54b
  9. 26 Mar, 2020 1 commit
    • Aleix Pol Gonzalez's avatar
      Remove overloads on virtual methods · 5eb84af4
      Aleix Pol Gonzalez authored
      Summary:
      Prefer virtual methods that take QRect and QSize rather than multi-int versions.
      Makes for clearer API and reduces the amount of code that was taking all of the
      components and turn it into a class.
      
      Reviewers: #kwin, zzag
      
      Reviewed By: #kwin, zzag
      
      Subscribers: zzag, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D28283
      5eb84af4
  10. 05 Mar, 2020 1 commit
    • Vlad Zahorodnii's avatar
      Introduce AbstractClient::createDecoration() · 4ae6c99c
      Vlad Zahorodnii authored
      Summary:
      We have duplicated code in InternalClient and XdgShellClient to create
      decorations. In order to get rid of the code duplication, this change
      introduces a method that AbstractClient subclasses can call to create
      a window decoration.
      
      Test Plan: Tests pass.
      
      Reviewers: #kwin, apol
      
      Reviewed By: apol
      
      Subscribers: apol, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D27822
      4ae6c99c
  11. 04 Mar, 2020 1 commit
    • Vlad Zahorodnii's avatar
      Introduce AbstractClient::destroyClient() · 86188389
      Vlad Zahorodnii authored
      Summary:
      The new method provides a generic way for destructing clients. Notice
      that we can't just delete clients because we may need to discard
      temporary window rules, which is usually done in destroyClient().
      
      Test Plan: Compiles.
      
      Reviewers: #kwin, davidedmundson
      
      Reviewed By: #kwin, davidedmundson
      
      Subscribers: kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D27821
      86188389
  12. 28 Feb, 2020 1 commit
  13. 22 Feb, 2020 4 commits
    • Nicolas Fella's avatar
      Revert "[kcm/effects] Clip ListView" · 7159684c
      Nicolas Fella authored
      Bad merge
      
      This reverts commit b7130442.
      7159684c
    • Nicolas Fella's avatar
      [kcm/effects] Clip ListView · b7130442
      Nicolas Fella authored
      Summary:
      Otherwise the content overflows the frame when scrolling.
      
      QQC2 scrollview docs say "ScrollView does not automatically clip its contents. If it is not used as a full-screen item, you should consider setting the clip property to true"
      
      Test Plan:
      Before:
      {F8121150}
      
      After:
      {F8121152}
      
      Reviewers: #kwin, #plasma, ngraham
      
      Reviewed By: ngraham
      
      Subscribers: ngraham, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D27558
      b7130442
    • Nicolas Fella's avatar
      Revert "[kcm/effects] Clip ListView" · cdc5ea19
      Nicolas Fella authored
      Bad merge
      
      This reverts commit 5babf52d.
      cdc5ea19
    • Nicolas Fella's avatar
      [kcm/effects] Clip ListView · 5babf52d
      Nicolas Fella authored
      Summary:
      Otherwise the content overflows the frame when scrolling.
      
      QQC2 scrollview docs say "ScrollView does not automatically clip its contents. If it is not used as a full-screen item, you should consider setting the clip property to true"
      
      Test Plan:
      Before:
      {F8121150}
      
      After:
      {F8121152}
      
      Reviewers: #kwin, #plasma, ngraham
      
      Reviewed By: ngraham
      
      Subscribers: ngraham, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D27558
      5babf52d
  14. 12 Feb, 2020 3 commits
    • Vlad Zahorodnii's avatar
      Make support for the maximized mode partially optional · 5af81c1c
      Vlad Zahorodnii authored
      Summary:
      Not all Client classes have support for the maximized mode. Therefore,
      it can be made opt-in to reduce the amount of plumbed methods.
      
      Unfortunately, there a few places, which don't have any connection with
      the maximized mode, where AbstractClient::geometryRestore() is used, so
      it cannot be made 100% optional at the moment.
      
      Reviewers: #kwin
      
      Subscribers: kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D27169
      5af81c1c
    • Vlad Zahorodnii's avatar
      Make support for the minimized state optional · 34df058e
      Vlad Zahorodnii authored
      Summary:
      In long term, we want to split XdgShellClient into several classes. One
      class for xdg-toplevel clients, and the other one for xdg-popup clients.
      
      xdg-popup clients are much simpler than xdg-toplevel clients, they can't
      be maximized or shown in full screen mode, they can't be interactively
      moved on the screen, and so on. In the end, we will have to plumb many
      pure virtual methods, which looks a bit ugly.
      
      This change makes support for the minimized state in AbstractClient
      optional so we don't have to add those no-op methods and keep code more
      or less "clean."
      
      Test Plan: Compiles.
      
      Reviewers: #kwin
      
      Subscribers: kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D27163
      34df058e
    • Vlad Zahorodnii's avatar
      Make support for full screen mode optional · 4ec24bc4
      Vlad Zahorodnii authored
      Summary:
      In long term, we want to split XdgShellClient into several classes. One
      class for xdg-toplevel clients, and the other one for xdg-popup clients.
      
      xdg-popup clients are much simpler than xdg-toplevel clients, they can't
      be maximized or shown in full screen mode, they can't be interactively
      moved on the screen, and so on. In the end, we will have to plumb many
      pure virtual methods, which looks a bit ugly.
      
      This change makes support for full screen mode in AbstractClient optional
      so we don't have to add those no-op methods and keep code more or less
      "clean."
      
      Test Plan: Compiles.
      
      Reviewers: #kwin
      
      Subscribers: kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D27162
      4ec24bc4
  15. 14 Jan, 2020 1 commit
  16. 08 Jan, 2020 1 commit
  17. 27 Nov, 2019 1 commit
    • Vlad Zahorodnii's avatar
      [wayland] Implement window geometry more properly · 9f7a856d
      Vlad Zahorodnii authored
      Summary:
      So far the window geometry from xdg-shell wasn't implemented as it should
      be. A toplevel must have two geometries assigned to it - frame and buffer.
      The frame geometry describes bounds of the client excluding server-side
      and client-side drop-shadows. The buffer geometry specifies rectangle on
      the screen occupied by the main surface.
      
      State and geometry handling in XdgShellClient is still a bit broken. This
      change doesn't intend to fix that, it must be done in another patch asap.
      
      Test Plan: New tests pass.
      
      Reviewers: #kwin, davidedmundson
      
      Reviewed By: #kwin, davidedmundson
      
      Subscribers: davidedmundson, romangg, kwin
      
      Tags: #kwin
      
      Maniphest Tasks: T10867
      
      Differential Revision: https://phabricator.kde.org/D24455
      9f7a856d
  18. 02 Oct, 2019 1 commit
    • Vlad Zahorodnii's avatar
      Rename geometry property to frameGeometry · 7d4471eb
      Vlad Zahorodnii authored
      Summary:
      In order to properly implement xdg_surface.set_window_geometry we need
      two kinds of geometry - frame and buffer. The frame geometry specifies
      visible bounds of the client on the screen, excluding client-side drop
      shadows. The buffer geometry specifies rectangle on the screen that the
      attached buffer or x11 pixmap occupies on the screen.
      
      This change renames the geometry property to frameGeometry in order to
      reflect the new meaning assigned to it as well to make it easier to
      differentiate between frame geometry and buffer geometry in the future.
      
      Reviewers: #kwin
      
      Subscribers: kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D24334
      7d4471eb
  19. 29 Sep, 2019 1 commit
  20. 23 Sep, 2019 1 commit
    • 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
  21. 09 Jul, 2019 1 commit
    • Vlad Zahorodnii's avatar
      [wayland] Apply window rules only to xdg-shell clients · 18844f59
      Vlad Zahorodnii authored
      Summary:
      There are rules that have to be applied only once, e.g. every Remember
      and Apply Initially rule, as well rules that need to configure the client,
      e.g. size, etc. In the best scenario the compositor would evaluate such
      rules when the client is about to be mapped.
      
      This change limits window rules only to xdg-shell clients because right
      now only this protocol lets compositors to intervene in the client
      initialization process. Also, it makes things a bit easier for us on the
      compositor side.
      
      xdg-shell protocol satisfies most of ours requirements to implement window
      rules, but not all of them. If the client is about to be mapped for the
      second time and its size is forced by a rule, then compositor may need
      to configure it. Currently, xdg-shell protocol doesn't have any mechanism
      that a client could use to notify the compositor about its intent to map.
      
      Reviewers: #kwin, davidedmundson
      
      Reviewed By: #kwin, davidedmundson
      
      Subscribers: fmonteiro, davidedmundson, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D19411
      18844f59
  22. 09 Apr, 2019 1 commit
  23. 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