1. 16 Feb, 2021 2 commits
  2. 10 Feb, 2021 1 commit
    • Vlad Zahorodnii's avatar
      Move source code to src/ directory · 93e0265e
      Vlad Zahorodnii authored
      Once in a while, we receive complaints from other fellow KDE developers
      about the file organization of kwin. This change addresses some of those
      complaints by moving all of source code in a separate directory, src/,
      thus making the project structure more traditional. Things such as tests
      are kept in their own toplevel directories.
      
      This change may wreak havoc on merge requests that add new files to kwin,
      but if a patch modifies an already existing file, git should be smart
      enough to figure out that the file has been relocated.
      
      We may potentially split the src/ directory further to make navigating
      the source code easier, but hopefully this is good enough already.
      93e0265e
  3. 06 Feb, 2021 1 commit
    • Vlad Zahorodnii's avatar
      Refactor Toplevel::opacity · 9acf04e2
      Vlad Zahorodnii authored
      The major difference between this version and the previous is that kwin
      no longer forwards the opacity to the app window if it runs as a
      window window manager and a compositing manager. As Keith Packard said [1]
      
      > The window manager support is only needed to forward the property from the
      > application window to the frame; with the Composite extension, a
      > compositing manager can then take that value into account when
      > constructing the desktop image.  Any X server can implement the Composite
      > extension; the one in the X server project at freedesktop.org is just one
      > such.  It would be trivial to implement this extension in a direct FB
      > based X server, or any other X server which places windows in off-screen
      > images.
      
      There are a couple of reasons to do so: (a) simplifies code, (b) we don't
      temper with opacities on override-redirect windows.
      
      [1] https://listman.redhat.com/archives/xdg-list/2003-December/msg00153.html
      9acf04e2
  4. 30 Nov, 2020 1 commit
    • Vlad Zahorodnii's avatar
      wayland: Plumb some X11 code · 1a4d578b
      Vlad Zahorodnii authored
      Things such as move and resize are implemented on Wayland using event
      filters that handle both X11 and Wayland clients.
      
      Having both code paths enabled results in things getting performed
      twice, e.g. window actions are executed twice, first in X11Client and
      the second time in WindowActionsEventFilter.
      
      This also fixes warnings produced by KKeyServer about an unsupported
      platform.
      1a4d578b
  5. 28 Nov, 2020 1 commit
  6. 10 Nov, 2020 1 commit
    • Vlad Zahorodnii's avatar
      Drop Toplevel::windowId() · e398a7cd
      Vlad Zahorodnii authored
      A window id generated by WaylandServer may reference an X11 window
      with the same id, which can result in undefined behavior.
      
      The main reason why we needed windowId() was because of the task
      switcher. However, since tabbox uses internal ids now, the window id
      property can be dropped.
      e398a7cd
  7. 29 Sep, 2020 1 commit
    • Vlad Zahorodnii's avatar
      x11: Make removal of X11 event filters safe · a433fb08
      Vlad Zahorodnii authored
      If an X11 event filter has been activated and it unregisters another X11
      event filter, then the window manager may crash because the foreach macro
      in Workspace::workspaceEvent() makes a copy of m_genericEventFilters or
      m_eventFilters and we can call the event() method for an already defunct
      filter.
      
      With this change, X11 event filters can be safely removed and installed
      at any particular moment.
      
      BUG: 423319
      a433fb08
  8. 24 Sep, 2020 1 commit
    • Vlad Zahorodnii's avatar
      Replace remaining usages of old connect syntax with new connect syntax · 0c266e76
      Vlad Zahorodnii authored
      This change replaces the remaining usages of the old connect syntax with
      the new connect syntax.
      
      Unfortunately, there are still places where we have to use SIGNAL() and
      SLOT() macros, for example the stuff that deals with d-bus business.
      
      Clazy was used to create this change. There were a few cases that needed
      manual intervention, the majority of those cases were about resolving
      ambiguity caused by overloaded signals.
      0c266e76
  9. 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
  10. 22 Jul, 2020 2 commits
  11. 15 Jul, 2020 1 commit
  12. 24 Jun, 2020 1 commit
    • Vlad Zahorodnii's avatar
      [x11] Hold a passive grab on buttons only when needed · ec5a0249
      Vlad Zahorodnii authored and Vlad Zahorodnii's avatar Vlad Zahorodnii committed
      Due to a bug in the XI2 protocol, clients have to reset scroll valuators
      on XI_Enter because the scroll valuators might have changed while the
      pointer was elsewhere. The XI_Enter event is usually sent when an input
      device enters the window, but it can also be generated by a passive grab.
      
      If an XI_Enter event has been generated by a passive grab, the client
      should not reset scroll valuators. Unfortunately, there is no any
      reliable way for the client to determine if an XI_Enter event has been
      sent in response to a deactivated passive grab. A correct fix for the
      scroll issues in GTK apps would involve changes in the XI2 protocol.
      
      As a work around, we can hold a passive grab only if the current mouse
      wheel action is either "Activate and scroll" or "Activate, raise, and
      scroll."
      
      BUG: 394772
      FIXED-IN: 5.19.3
      ec5a0249
  13. 18 Jun, 2020 1 commit
    • Vlad Zahorodnii's avatar
      Introduce the client geometry in Toplevel · cc3eb54b
      Vlad Zahorodnii authored and Vlad Zahorodnii's avatar Vlad Zahorodnii committed
      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
  14. 07 May, 2020 1 commit
  15. 30 Apr, 2020 1 commit
  16. 02 Apr, 2020 1 commit
    • Aleix Pol Gonzalez's avatar
      Make it possible to have a separate cursor for the tablet · 6abd23ed
      Aleix Pol Gonzalez authored
      Summary:
      As is KWin only had 1 Cursor which was a singleton. This made it impossible for
      us to properly implement the tablet (as in drawing tablets) support and show where
      we're drawing.
      This patch makes it possible to have different Cursors in KWin, it makes all the
      current code still follow the mouse but the tablet can still render a cursor.
      
      Test Plan: Tests pass, been using it and works as well as before but with beautiful tablet cursors.
      
      Reviewers: #kwin, cblack, davidedmundson
      
      Reviewed By: #kwin, cblack, davidedmundson
      
      Subscribers: davidedmundson, cblack, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D28155
      6abd23ed
  17. 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
  18. 12 Feb, 2020 1 commit
    • Vlad Zahorodnii's avatar
      Introduce Toplevel::frameGeometryChanged signal · 15af09c7
      Vlad Zahorodnii authored
      Summary:
      Currently we have two signals that are emitted when the Toplevel's geometry
      changes - geometryShapeChanged() and geometryChanged(). The former signal
      is used primarily to invalidate cached window quads and the latter is
      sort of emitted when the frame geometry changes. But it's not that easy. We
      have a bunch of connects that link those signals together...
      
      The worst part about all of this is that the window quads cache gets
      invalidated every time a geometry update occurs, for example when user
      moves a window around on the screen.
      
      This change introduces a new signal and deprecates the existing geometryChanged
      signal. frameGeometryChanged is similar to geometryChanged except that it is
      emitted when an _actual_ geometry change has occurred.
      
      We do still emit geometryShapeChanged signal. However, in long term, we
      need to get rid of this signal or come up with something that makes sense
      and doesn't require us to waste computational resources.
      
      Reviewers: #kwin, davidedmundson
      
      Reviewed By: #kwin, davidedmundson
      
      Subscribers: davidedmundson, romangg, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D26863
      15af09c7
  19. 04 Dec, 2019 1 commit
  20. 02 Dec, 2019 2 commits
    • Vlad Zahorodnii's avatar
      Revert the fix for the texture bleeding issue · 6e000314
      Vlad Zahorodnii authored
      This reverts commit 9151bb7b.
      This reverts commit ac4dce1c.
      This reverts commit 754b72d1.
      
      In order to make the fix work, we need to redirect the client window
      instead of the frame window. However, we cannot to do that because
      Xwayland expects the toplevel window(in our case, the frame window)
      to be redirected.
      
      Another solution to the texture bleeding issue must be found.
      
      CCBUG: 257566
      CCBUG: 360549
      6e000314
    • Vlad Zahorodnii's avatar
      [x11] Name client pixmap instead of frame pixmap · 754b72d1
      Vlad Zahorodnii authored
      Summary:
      Since KDE 4.2 - 4.3 times, KWin doesn't paint window decorations on real
      X11 windows, except when compositing is turned off. This leaves us with
      a problem. The actual client contents is inside a larger texture with no
      useful pixel data around it. This and decoration texture bleeding are
      the main factors that contribute to 1px gap between the server-side
      decoration and client contents with effects such as wobbly windows, and
      zoom.
      
      Another problem with naming frame pixmap instead of client pixmap is
      that it doesn't quite go along with wayland. It only makes more difficult
      to abstract window quad generation in the scene.
      
      Since we don't actually need the frame window when compositing is on,
      there is nothing that holds us from redirecting client windows instead
      of frame windows. This will help us to fix the texture bleeding issue
      and also help us with the ongoing redesign of the scene.
      
      Test Plan: X11 clients are still composited.
      
      Reviewers: #kwin, davidedmundson
      
      Reviewed By: #kwin, davidedmundson
      
      Subscribers: davidedmundson, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D25610
      754b72d1
  21. 27 Nov, 2019 1 commit
    • Vlad Zahorodnii's avatar
      [x11] Add support for _GTK_FRAME_EXTENTS · 84d75cb5
      Vlad Zahorodnii authored
      Summary:
      KDE is known for having a strong view on the client-side decorations vs
      server-side decorations issue. The main argument raised against CSD is
      that desktop will look less consistent when clients start drawing window
      decorations by themselves, which is somewhat true. It all ties to how
      well each toolkit is integrated with the desktop environment.
      
      KDE doesn't control the desktop market on Linux. Another big "player"
      is GNOME. Both KDE and GNOME have very polarized views on in which
      direction desktop should move forward. The KDE community is pushing more
      toward server-side decorations while the GNOME community is pushing
      more toward client-side decorations. Both communities have developed
      great applications and it's not rare to see a GNOME application being
      used in KDE Plasma. The only problem is that these different views are
      not left behind the curtain and our users pay the price. Resizing GTK
      clients in Plasma became practically impossible due to resize borders
      having small hit area.
      
      When a client draws its window decoration, it's more likely that it also
      draws the drop-shadow around the decoration. The compositor must know
      the extents of the shadow so things like snapping and so on work as
      expected. And here lies the problem... While the xdg-shell protocol has
      a way to specify such things, the NetWM spec doesn't have anything like
      that. There's _GTK_FRAME_EXTENTS in the wild, however the problem with
      it is that it's a proprietary atom, which is specific only to GTK apps.
      
      Due to that, _GTK_FRAME_EXTENTS wasn't implemented because implementing
      anything like that would require major changes in how we think about
      geometry.
      
      Recent xdg-shell window geometry patches adjusted geometry abstractions
      in kwin to such a degree that it's very easy to add support for client
      side decorated clients on X11. We just have to make sure that the
      X11Client class provides correct buffer geometry and frame geometry when
      the gtk frame extents are set.
      
      Even though the X11 code is feature frozen, I still think it's worth
      to have _GTK_FRAME_EXTENTS support in kwin because it will fix the resize
      issues. Also, because KWin/Wayland is unfortunately far from becoming
      default, it will help us with testing some implementation bits of the
      window geometry from xdg-shell.
      
      BUG: 390550
      FIXED-IN: 5.18.0
      
      Test Plan:
      Things like quick tiling, maximizing, tiling scripts and so on work as
      expected with GTK clients.
      
      Reviewers: #kwin, davidedmundson
      
      Reviewed By: #kwin, davidedmundson
      
      Subscribers: cblack, trmdi, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D24660
      84d75cb5
  22. 24 Oct, 2019 1 commit
  23. 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
  24. 29 Sep, 2019 1 commit
  25. 25 Sep, 2019 1 commit
    • Vlad Zahorodnii's avatar
      Rename Client to X11Client · ffcbe24e
      Vlad Zahorodnii authored
      Summary:
      Currently each managed X11 client is represented with an instance of
      Client class, however the name of that class is very generic and the
      only reason why it's called that way is because historically kwin
      was created as an x11 window manager, so "Client" was a sensible choice.
      
      With introduction of wayland support, things had changed and therefore
      Client needs to be renamed to X11Client in order to better reflect what
      that class stands for.
      
      Renaming of Client to X11Client was agreed upon during the last KWin
      sprint.
      
      Test Plan: Compiles, the test suite is still green.
      
      Reviewers: #kwin, romangg
      
      Reviewed By: #kwin, romangg
      
      Subscribers: romangg, davidedmundson, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D24184
      ffcbe24e
  26. 19 Sep, 2019 2 commits
    • Vlad Zahorodnii's avatar
      Don't initialize QFlags<T> with nullptr · b8a6fd7c
      Vlad Zahorodnii authored
      Summary: This looks very odd.
      
      Test Plan: Compiles.
      
      Reviewers: #kwin, romangg
      
      Reviewed By: #kwin, romangg
      
      Subscribers: apol, kwin
      
      Tags: #kwin
      
      Differential Revision: https://phabricator.kde.org/D24086
      b8a6fd7c
    • Vlad Zahorodnii's avatar
      Use nullptr everywhere · 62a7db70
      Vlad Zahorodnii authored
      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
      62a7db70
  27. 29 Jul, 2019 1 commit
    • Vlad Zahorodnii's avatar
      Use more traditional doxygen style · 684b4b63
      Vlad Zahorodnii authored
      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
      684b4b63
  28. 08 Jul, 2019 1 commit
    • Roman Gilg's avatar
      Correct code style of Client fullscreen control · 4f7800a5
      Roman Gilg authored
      Summary:
      As a preperational step for future changes obey the code
      styling guide in Client fullscreen functionality.
      
      No functional changes.
      
      Test Plan: Manually, autotests pass.
      
      Reviewers: #kwin, davidedmundson
      
      Reviewed By: #kwin, davidedmundson
      
      Subscribers: zzag, graesslin, kwin
      
      Tags: #kwin
      
      Maniphest Tasks: T11098
      
      Differential Revision: https://phabricator.kde.org/D18153
      4f7800a5
  29. 12 Feb, 2019 1 commit
    • Vlad Zahorodnii's avatar
      Overhaul doxygen comments · 7b20e1f6
      Vlad Zahorodnii authored
      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
      7b20e1f6
  30. 19 Oct, 2017 1 commit
    • Martin Flöser's avatar
      Create a dedicated X11Filter for Client sync events and move it to X11 platform · 2e868c50
      Martin Flöser authored
      Summary:
      On Wayland we have the sync disabled as it doesn't work properly. This
      allows us to also move the sync event handling into the X11 standalone
      platform.
      
      The code is slightly refactored: instead of passing the event to each
      Client, we search for the matching Client. For that the SyncAlaram struct
      is added to public section of Client. The method to handle the sync
      doesn't need the event any more and is moved from events.cpp to
      client.cpp.
      
      Test Plan:
      Run Xephyr+kwin_x11, resized a window and verified through
      gdb breakpoint that the sync still works
      
      Reviewers: #kwin, #plasma
      
      Subscribers: plasma-devel
      
      Tags: #plasma
      
      Differential Revision: https://phabricator.kde.org/D7942
      2e868c50
  31. 30 Sep, 2017 2 commits