scene: Use standard wl_surface item for Xwayland surfaces

Besides unifying the code, it fixes some visual glitches caused by the
opaque region getting out of sync.

Xwayland MR: https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1698
wilder/Plasma/6.3
Vlad Zahorodnii 1 year ago
parent 63932229d7
commit edf4e2e050
  1. 21
      src/scene/surfaceitem_wayland.cpp
  2. 19
      src/scene/surfaceitem_wayland.h
  3. 2
      src/scene/windowitem.cpp

@ -12,11 +12,6 @@
#include "wayland/linuxdmabufv1clientbuffer.h"
#include "wayland/subcompositor.h"
#include "wayland/surface.h"
#include "window.h"
#if KWIN_BUILD_X11
#include "x11window.h"
#endif
namespace KWin
{
@ -247,22 +242,6 @@ bool SurfacePixmapWayland::isValid() const
return m_bufferRef;
}
#if KWIN_BUILD_X11
SurfaceItemXwayland::SurfaceItemXwayland(X11Window *window, Item *parent)
: SurfaceItemWayland(window->surface(), parent)
, m_window(window)
{
}
QRegion SurfaceItemXwayland::opaque() const
{
if (!m_window->hasAlpha()) {
return rect().toRect();
} else {
return m_window->opaqueRegion() & rect().toRect();
}
}
#endif
} // namespace KWin
#include "moc_surfaceitem_wayland.cpp"

@ -16,7 +16,6 @@ namespace KWin
class GraphicsBuffer;
class SubSurfaceInterface;
class SurfaceInterface;
class X11Window;
/**
* The SurfaceItemWayland class represents a Wayland surface in the scene.
@ -83,22 +82,4 @@ private:
SurfaceItemWayland *m_item;
};
#if KWIN_BUILD_X11
/**
* The SurfaceItemXwayland class represents an Xwayland surface in the scene.
*/
class KWIN_EXPORT SurfaceItemXwayland : public SurfaceItemWayland
{
Q_OBJECT
public:
explicit SurfaceItemXwayland(X11Window *window, Item *parent = nullptr);
QRegion opaque() const override;
private:
X11Window *m_window;
};
#endif
} // namespace KWin

@ -323,7 +323,7 @@ void WindowItemX11::initialize()
if (!window()->surface()) {
updateSurfaceItem(nullptr);
} else {
updateSurfaceItem(std::make_unique<SurfaceItemXwayland>(static_cast<X11Window *>(window()), this));
updateSurfaceItem(std::make_unique<SurfaceItemWayland>(window()->surface(), this));
}
break;
case Application::OperationModeWaylandOnly:

Loading…
Cancel
Save