More cleaning

This commit is contained in:
James Grogan 2022-11-11 11:48:42 +00:00
parent 02ebb9a54b
commit 6adc441e6f
37 changed files with 213 additions and 181 deletions

View file

@ -5,9 +5,18 @@ namespace mt
class Window;
}
class DesktopManager;
class AbstractUIInterface
{
public:
AbstractUIInterface(DesktopManager* desktopManager, bool useHardware = false)
: mDesktopManager(desktopManager),
mUseHardwareRendering(useHardware)
{
}
virtual ~AbstractUIInterface() = default;
virtual void initialize() = 0;
@ -26,5 +35,6 @@ public:
}
protected:
DesktopManager* mDesktopManager{nullptr};
bool mUseHardwareRendering{false};
};

View file

@ -10,13 +10,15 @@
std::unique_ptr<AbstractUIInterface> UiInterfaceFactory::create(DesktopManager* desktopManager, Backend backend)
{
#ifdef __linux__
if (backend == Backend::UNSET || backend == Backend::X11)
if (backend == Backend::UNSET || backend == Backend::X11 || backend == Backend::X11_RASTER)
{
return std::make_unique<XcbInterface>(desktopManager);
const bool use_hardware = (backend != Backend::X11_RASTER);
return std::make_unique<XcbInterface>(desktopManager, use_hardware);
}
else
{
return std::make_unique<WaylandInterface>(desktopManager);
const bool use_hardware = (backend != Backend::WAYLAND_RASTER);
return std::make_unique<WaylandInterface>(desktopManager, use_hardware);
}
#else
return std::make_unique<Win32UiInterface>();

View file

@ -12,7 +12,9 @@ public:
enum class Backend
{
UNSET,
X11_RASTER,
X11,
WAYLAND_RASTER,
WAYLAND
};

View file

@ -41,9 +41,8 @@ void WaylandInterface::registryHandleGlobalRemoveEvent(void *data, struct wl_reg
}
WaylandInterface::WaylandInterface(DesktopManager* desktopManager)
: mDesktopManager(desktopManager),
WaylandInterface::WaylandInterface(DesktopManager* desktopManager, bool useHardware)
: AbstractUIInterface(desktopManager, useHardware),
mBuffer(std::make_shared<WaylandBuffer>())
{
mRegistryListener.global = registryHandleGlobalEvent;

View file

@ -14,13 +14,12 @@ class WaylandSurface;
class WaylandBuffer;
class WaylandSeatInterface;
class WaylandEglInterface;
class DesktopManager;
class WaylandInterface : public AbstractUIInterface
{
public:
WaylandInterface(DesktopManager* desktopManager);
WaylandInterface(DesktopManager* desktopManager, bool useHardware = true);
~WaylandInterface();
@ -48,8 +47,6 @@ private:
void setXdgBase(xdg_wm_base* xdg_base);
DesktopManager* mDesktopManager{nullptr};
wl_display* mDisplay{nullptr};
wl_compositor* mCompositor{nullptr};
wl_registry_listener mRegistryListener;

View file

@ -20,8 +20,8 @@
#include "FileLogger.h"
XcbInterface::XcbInterface(DesktopManager* desktopManager)
: mDesktopManager(desktopManager),
XcbInterface::XcbInterface(DesktopManager* desktopManager, bool useHardware)
: AbstractUIInterface(desktopManager, useHardware),
mConnection(nullptr),
mX11Display(),
mGlxInterface(),

View file

@ -4,7 +4,6 @@
#include <memory>
class DesktopManager;
class GlxInterface;
using GlxInterfacePtr = std::unique_ptr<GlxInterface>;
@ -26,7 +25,7 @@ namespace mt
class XcbInterface : public AbstractUIInterface
{
public:
XcbInterface(DesktopManager* desktopManager);
XcbInterface(DesktopManager* desktopManager, bool useHardware = true);
~XcbInterface();
@ -57,7 +56,6 @@ private:
uint32_t getEventMask();
private:
DesktopManager* mDesktopManager{nullptr};
xcb_connection_t* mConnection;
_XDisplay* mX11Display;
GlxInterfacePtr mGlxInterface;