scene: Port WindowItemX11 to X11Window
This commit is contained in:
parent
551e4a8233
commit
87bfdcf1d6
6 changed files with 20 additions and 13 deletions
|
@ -11,6 +11,7 @@
|
|||
#include "wayland/subcompositor_interface.h"
|
||||
#include "wayland/surface_interface.h"
|
||||
#include "window.h"
|
||||
#include "x11window.h"
|
||||
|
||||
namespace KWin
|
||||
{
|
||||
|
@ -202,7 +203,7 @@ void SurfacePixmapWayland::setBuffer(KWaylandServer::ClientBuffer *buffer)
|
|||
}
|
||||
}
|
||||
|
||||
SurfaceItemXwayland::SurfaceItemXwayland(Window *window, Scene *scene, Item *parent)
|
||||
SurfaceItemXwayland::SurfaceItemXwayland(X11Window *window, Scene *scene, Item *parent)
|
||||
: SurfaceItemWayland(window->surface(), scene, parent)
|
||||
, m_window(window)
|
||||
{
|
||||
|
|
|
@ -18,6 +18,8 @@ class SurfaceInterface;
|
|||
namespace KWin
|
||||
{
|
||||
|
||||
class X11Window;
|
||||
|
||||
/**
|
||||
* The SurfaceItemWayland class represents a Wayland surface in the scene.
|
||||
*/
|
||||
|
@ -85,12 +87,12 @@ class KWIN_EXPORT SurfaceItemXwayland : public SurfaceItemWayland
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SurfaceItemXwayland(Window *window, Scene *scene, Item *parent = nullptr);
|
||||
explicit SurfaceItemXwayland(X11Window *window, Scene *scene, Item *parent = nullptr);
|
||||
|
||||
QVector<QRectF> shape() const override;
|
||||
|
||||
private:
|
||||
Window *m_window;
|
||||
X11Window *m_window;
|
||||
};
|
||||
|
||||
} // namespace KWin
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
namespace KWin
|
||||
{
|
||||
|
||||
SurfaceItemX11::SurfaceItemX11(Window *window, Scene *scene, Item *parent)
|
||||
SurfaceItemX11::SurfaceItemX11(X11Window *window, Scene *scene, Item *parent)
|
||||
: SurfaceItem(scene, parent)
|
||||
, m_window(window)
|
||||
{
|
||||
|
@ -42,7 +42,7 @@ SurfaceItemX11::~SurfaceItemX11()
|
|||
destroyDamage();
|
||||
}
|
||||
|
||||
Window *SurfaceItemX11::window() const
|
||||
X11Window *SurfaceItemX11::window() const
|
||||
{
|
||||
return m_window;
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ xcb_visualid_t SurfacePixmapX11::visual() const
|
|||
|
||||
void SurfacePixmapX11::create()
|
||||
{
|
||||
const Window *window = m_item->window();
|
||||
const X11Window *window = m_item->window();
|
||||
if (window->isDeleted()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
namespace KWin
|
||||
{
|
||||
|
||||
class X11Window;
|
||||
|
||||
/**
|
||||
* The SurfaceItemX11 class represents an X11 surface in the scene.
|
||||
*/
|
||||
|
@ -22,10 +24,10 @@ class KWIN_EXPORT SurfaceItemX11 : public SurfaceItem
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit SurfaceItemX11(Window *window, Scene *scene, Item *parent = nullptr);
|
||||
explicit SurfaceItemX11(X11Window *window, Scene *scene, Item *parent = nullptr);
|
||||
~SurfaceItemX11() override;
|
||||
|
||||
Window *window() const;
|
||||
X11Window *window() const;
|
||||
|
||||
void preprocess() override;
|
||||
|
||||
|
@ -46,7 +48,7 @@ protected:
|
|||
std::unique_ptr<SurfacePixmap> createPixmap() override;
|
||||
|
||||
private:
|
||||
Window *m_window;
|
||||
X11Window *m_window;
|
||||
xcb_damage_damage_t m_damageHandle = XCB_NONE;
|
||||
xcb_xfixes_fetch_region_cookie_t m_damageCookie;
|
||||
bool m_isDamaged = false;
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "wayland_server.h"
|
||||
#include "window.h"
|
||||
#include "workspace.h"
|
||||
#include "x11window.h"
|
||||
|
||||
#include <KDecoration2/Decoration>
|
||||
|
||||
|
@ -285,7 +286,7 @@ void WindowItem::markDamaged()
|
|||
Q_EMIT m_window->damaged(m_window);
|
||||
}
|
||||
|
||||
WindowItemX11::WindowItemX11(Window *window, Scene *scene, Item *parent)
|
||||
WindowItemX11::WindowItemX11(X11Window *window, Scene *scene, Item *parent)
|
||||
: WindowItem(window, scene, parent)
|
||||
{
|
||||
initialize();
|
||||
|
@ -298,13 +299,13 @@ void WindowItemX11::initialize()
|
|||
{
|
||||
switch (kwinApp()->operationMode()) {
|
||||
case Application::OperationModeX11:
|
||||
updateSurfaceItem(new SurfaceItemX11(window(), scene(), this));
|
||||
updateSurfaceItem(new SurfaceItemX11(static_cast<X11Window *>(window()), scene(), this));
|
||||
break;
|
||||
case Application::OperationModeXwayland:
|
||||
if (!window()->surface()) {
|
||||
updateSurfaceItem(nullptr);
|
||||
} else {
|
||||
updateSurfaceItem(new SurfaceItemXwayland(window(), scene(), this));
|
||||
updateSurfaceItem(new SurfaceItemXwayland(static_cast<X11Window *>(window()), scene(), this));
|
||||
}
|
||||
break;
|
||||
case Application::OperationModeWaylandOnly:
|
||||
|
|
|
@ -21,6 +21,7 @@ class InternalWindow;
|
|||
class Shadow;
|
||||
class ShadowItem;
|
||||
class SurfaceItem;
|
||||
class X11Window;
|
||||
|
||||
/**
|
||||
* The WindowItem class represents a window in the scene.
|
||||
|
@ -96,7 +97,7 @@ class KWIN_EXPORT WindowItemX11 : public WindowItem
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WindowItemX11(Window *window, Scene *scene, Item *parent = nullptr);
|
||||
explicit WindowItemX11(X11Window *window, Scene *scene, Item *parent = nullptr);
|
||||
|
||||
private Q_SLOTS:
|
||||
void initialize();
|
||||
|
|
Loading…
Reference in a new issue