1. 05 Aug, 2021 1 commit
    • Vlad Zahorodnii's avatar
      Copy shape region to Deleted · e94fbcd8
      Vlad Zahorodnii authored
      Currently, the shape region is not copied to the Deleted. If either
      SurfaceItemX11 or SurfaceItemXwayland needs to build quads for a shaped
      window, it won't be able to do so properly because the corresponding
      x11 window is long time gone.
      
      If the shape region changes before the window is unmapped, you may still
      see visual artifacts. Unfortunately, the only way to fix that bug is to
      switch to wayland.
      
      BUG: 440001
      BUG: 438458
      BUG: 435378
      e94fbcd8
  2. 05 Jul, 2021 2 commits
    • Vlad Zahorodnii's avatar
      Remove unused geometry setters in Item · 1e1ad82f
      Vlad Zahorodnii authored
      Originally, only x, y, width, and height property setters were used. A
      bit later "position" and "size" helper setters were added to simplify
      code in SurfaceItem sub-classes. It seems like setX(), setY(), setWidth(),
      and setHeight() are unused now, so remove them.
      1e1ad82f
    • Vlad Zahorodnii's avatar
      x11: Fix BadDamage warning · 29ff0d30
      Vlad Zahorodnii authored
      The XDamageDestroy has a weird requirement saying that it can be called
      as long as the X11 window is still valid. On the other hand, one could
      argue that it is more intuitive if the damage handle becomes inert if the
      associated window is destroyed. Unfortunately, that's not the case and
      as git history shows, it's an easy way to shoot yourself in the foot, we
      had the exact warning many years ago.
      
      The problem with the XDamageDestroy API is that it is simply unreliable
      given the asynchronous nature of communication between kwin and xorg.
      
      Anyway, with X11 sunsetting, let's destroy the damage handle only when
      the X11 window is unmapped and not bother too much about it.
      29ff0d30
  3. 22 Jun, 2021 2 commits
    • Vlad Zahorodnii's avatar
      Remove Toplevel::compositing() and Workspace::compositing() · c61085dc
      Vlad Zahorodnii authored
      It is error-prone to have multiple sources for the same data. If the
      base implementation (Compositor::compositing()) changes, other helpers
      can get out of sync.
      c61085dc
    • Vlad Zahorodnii's avatar
      x11: Properly detect compositing status · d74e81bd
      Vlad Zahorodnii authored
      When finishing compositing, Workspace::compositing() will return true,
      but it will be preferred if it returns false instead so kwin can properly
      update x11 window visibility status, etc.
      
      Instead of checking whether the compositor has a scene, check the status
      of the compositor. It will not be "On" during teardown.
      d74e81bd
  4. 08 Jun, 2021 1 commit
  5. 19 May, 2021 3 commits
    • Vlad Zahorodnii's avatar
      e4ec955d
    • Vlad Zahorodnii's avatar
      Remove Scene::Window::{discard,update}Pixmap · 6f39d79d
      Vlad Zahorodnii authored
      They are used only by X11Client, so make X11Client call relevants
      methods on the surface item directly instead. In hindsight, it will be a
      really good idea to make SurfaceItemX11 and SurfaceItemXwayland(?)
      automatically manage the window pixmap. However, it can be done once
      an item freezing api is added and we fix the cross-fade animation.
      6f39d79d
    • Vlad Zahorodnii's avatar
      Move repaint scheduling logic to Item · 506214a6
      Vlad Zahorodnii authored
      Currently, items depend on scene windows for creating pixmaps, repaint
      scheduling, and caching quads.
      
      This change moves repaint scheduling from scene windows to items to
      make the scene items depend less on scene windows.
      
      In hindsight, we may clean up the repaint scheduling machinery further
      by introducing view objects.
      506214a6
  6. 17 May, 2021 1 commit
    • Vlad Zahorodnii's avatar
      Replace Toplevel::clientContentPos() with a better solution · 5ece6d55
      Vlad Zahorodnii authored
      The Toplevel::clientContentPos() function is needed to map the surface
      local coordinates to the global coordinates. But its name is highly
      confusing as there's already a function with a similar name. This change
      introduces a helper with a better name to fix the readability issue.
      5ece6d55
  7. 16 May, 2021 1 commit
  8. 31 Mar, 2021 3 commits
    • Vlad Zahorodnii's avatar
      libkwineffects: Drop windowPaddingChanged signal · 98b0b13f
      Vlad Zahorodnii authored
      It makes no sense on Wayland.
      98b0b13f
    • Vlad Zahorodnii's avatar
      scene: Introduce window items · 47113e09
      Vlad Zahorodnii authored
      Currently, dealing with sub-surfaces is very difficult due to the scene
      design being heavily influenced by X11 requirements.
      
      The goal of this change is to re-work scene abstractions to make improving
      the wayland support easier.
      
      The Item class is based on the QQuickItem class. My hope is that one day
      we will be able to transition to QtQuick for painting scene, but in
      meanwhile it makes more sense to have a minimalistic internal item class.
      
      The WindowItem class represents a window. The SurfaceItem class represents
      the contents of either an X11, or a Wayland, or an internal surface. The
      DecorationItem and the ShadowItem class represent the server-side deco and
      drop-shadow, respectively.
      
      At the moment, the SurfaceItem is bound to the scene window, but the long
      term plan is to break that connection so we could re-use the SurfaceItem
      for things such as software cursors and drag-and-drop additional icons.
      
      One of the responsibilities of the Item is to schedule repaints as needed.
      Ideally, there shouldn't be any addRepaint() calls in the core code. The
      Item class schedules repaints on geometry updates. In the future, it also
      has to request an update if its opacity or visibility changes.
      47113e09
    • Vlad Zahorodnii's avatar
      libkwineffects: Introduce windowExpandedGeometryChanged() · b61c800c
      Vlad Zahorodnii authored
      This signal can be useful if you want to know when the visible geometry
      has changed to update cached repaint region during an animation.
      b61c800c
  9. 16 Feb, 2021 2 commits
  10. 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
  11. 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
  12. 05 Feb, 2021 1 commit
  13. 04 Feb, 2021 1 commit
  14. 03 Feb, 2021 1 commit
  15. 21 Jan, 2021 1 commit
  16. 06 Jan, 2021 2 commits
    • Vlad Zahorodnii's avatar
      Replace window repaints with layer repaints · 8f9fcd7e
      Vlad Zahorodnii authored
      Windows have two kinds of repaints - window repaints and layer repaints.
      The main difference between the two is that the former is specified in
      the window-local coordinates while the latter is specified in the global
      screen coordinates.
      
      Window repaints are useful in case the position of the window doesn't
      matter, for example for repainting damaged regions, etc.
      
      But its biggest issue is that with per screen rendering, it's not
      possible to determine what screens exactly have to be repainted. The
      final area affected by the window repaint will be known only at
      compositing time. If a window gets damaged, we have to schedule a
      repaint on ALL outputs. Understandably, this costs a little bit in terms
      of performance.
      
      This change replaces the window repaints with the layer repaints. By
      doing so, we can avoid scheduling repaints on outputs that don't
      intersect with the dirty region and improve performance.
      8f9fcd7e
    • Vlad Zahorodnii's avatar
      Perform compositing even if there is nothing to repaint · 992e88de
      Vlad Zahorodnii authored
      In rare cases, the Compositor has to perform a compositing if there is
      nothing to repaint. For example, if a client has committed a frame
      callback to get notified about the next vblank event without damaging
      the surface.
      992e88de
  17. 02 Dec, 2020 1 commit
  18. 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
  19. 03 Nov, 2020 1 commit
  20. 30 Oct, 2020 1 commit
    • Vlad Zahorodnii's avatar
      Store repaint regions per individual screen · 74391e25
      Vlad Zahorodnii authored
      AnimationEffect schedules repaints in postPaintWindow() and performs
      cleanup in preScreenPaint(). With the X11-style rendering, this doesn't
      have any issues, scheduled repaints will be reset during the next
      compositing cycle.
      
      But with per screen rendering, we might hit the following case
      
          - Paint screen 0
          - Reset scheduled repaints
          - AnimationEffect::prePaintScreen(): update the timeline
          - AnimationEffect::postPaintScreen(): schedule a repaint
      
          - Paint screen 1
          - Reset scheduled repaints
          - AnimationEffect::prePaintScreen(): destroy the animation
          - AnimationEffect::postPaintScreen(): no repaint is scheduled
      
          - Return to the event loop
      
      In this scenario, the repaint region scheduled by AnimationEffect will
      be lost when compositing is performed on screen 1.
      
      There is no any other way to fix this issue but maintain repaint regions
      per each individual screen if per screen rendering is enabled.
      
      BUG: 428439
      74391e25
  21. 29 Oct, 2020 1 commit
    • Vlad Zahorodnii's avatar
      Transform a pending repaint into a workspace repaint before destroying Deleted · 2715cbc8
      Vlad Zahorodnii authored
      The sliding popups effect schedules a repaint and then unreferences the
      deleted window. The problem with doing so is that the scheduled repaint
      will be effectively discarded because the Deleted will be destroyed once
      we are back in the event loop.
      
      This issue is most noticeable on Wayland. Not sure why. If you close
      Kickoff, you may see its flickering ghost in background.
      
      If it happens that a Deleted has a pending repaint, transform it into a
      workspace repaint to avoid discarding any scheduled repaints.
      2715cbc8
  22. 23 Oct, 2020 1 commit
  23. 17 Oct, 2020 2 commits
    • Vlad Zahorodnii's avatar
      Adapt to input region changes in kwayland-server · 41d431de
      Vlad Zahorodnii authored
      SurfaceInterface::inputIsInfinite() has been dropped. If the surface has
      no any input region specified, SurfaceInterface::input() will return a
      region that corresponds to the rect of the surface (0, 0, width, height).
      
      While the new design is more robust, for example it's no longer possible
      to forget to check SurfaceInterface::inputIsInfinite(), it has shown some
      issues in the input stack of kwin.
      
      Currently, acceptsInput() will return false if you attempt to click the
      server-side decoration for a surface whose input region is not empty.
      
      Therefore, it's possible for an application to set an input region with
      a width and a height of 1. If user doesn't know about KSysGuard or the
      possibility of closing apps via the task manager, they won't be able to
      close such an application.
      
      Another issue is that if an application has specified an empty input
      region on purpose, user will be still able click it. With the new
      behavior of SurfaceInterface::input(), this is no longer an issue and it
      is handled properly by kwin.
      41d431de
    • Vlad Zahorodnii's avatar
      Introduce geometry conversion helpers · ba4f6b35
      Vlad Zahorodnii authored
      The new helpers are designed for the purpose of mapping points from the
      global screen coordinates to the frame-local and the surface-local coords
      ba4f6b35
  24. 29 Sep, 2020 1 commit
  25. 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
  26. 22 Sep, 2020 1 commit
  27. 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
  28. 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
  29. 17 Jul, 2020 1 commit
    • Vlad Zahorodnii's avatar
      Update input transformation matrix when buffer geometry changes · cf271288
      Vlad Zahorodnii authored and Vlad Zahorodnii's avatar Vlad Zahorodnii committed
      Currently, we update the input transformation matrix for the focused
      pointer surface only when the frameGeometryChanged() signal is emitted.
      However, since the input transformation matrix is computed based on the
      current position of the upper left corner of the main surface, it is
      wrong to do so because the frame geometry is a logical geometry that
      doesn't have any direct relationship with the buffer geometry, i.e. the
      rect on the screen occupied by the main surface.
      
      If the input transformation matrix gets out of sync, user may notice
      that pointer events are "shifted."
      
      This change introduces a new signal that's emitted when the input
      transformation matrix has been changed. Input related components in kwin
      can connect to it to keep a copy of the input transformation matrix in
      SeatInterface in sync. Under the hood, the new signal is just an alias
      for the bufferGeometryChanged() signal.
      cf271288
  30. 24 Jun, 2020 1 commit