Cleaning for opengl rendering prep.

This commit is contained in:
James Grogan 2022-11-14 11:19:51 +00:00
parent 402f381d10
commit 7c6a92f4ec
58 changed files with 570 additions and 533 deletions

View file

@ -88,11 +88,6 @@ target_include_directories(windows PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/ui_interfaces/x11"
"${CMAKE_CURRENT_SOURCE_DIR}/ui_interfaces/wayland"
"${CMAKE_CURRENT_SOURCE_DIR}/ui_interfaces/win32"
"${PROJECT_SOURCE_DIR}/src/core"
"${PROJECT_SOURCE_DIR}/src/geometry"
"${PROJECT_SOURCE_DIR}/src/graphics"
"${PROJECT_SOURCE_DIR}/src/ui_elements"
"${PROJECT_SOURCE_DIR}/src/ui_elements/widgets"
${WAYLAND_INCLUDE_DIRS}
${X11_INCLUDE_DIRS}
)

View file

@ -25,32 +25,32 @@ std::unique_ptr<DesktopManager> DesktopManager::Create(AbstractDesktopApp* appli
return std::make_unique<DesktopManager>(application);
}
void DesktopManager::ClearEvents()
void DesktopManager::clearEvents()
{
mEventManager->ClearEvents();
}
void DesktopManager::OnKeyboardEvent(const KeyboardEvent* event)
void DesktopManager::onKeyboardEvent(const KeyboardEvent* event)
{
GetWindowManager()->OnKeyboardEvent(event);
mWindowManager->onKeyboardEvent(event);
}
void DesktopManager::OnPaintEvent(const PaintEvent* event)
void DesktopManager::onPaintEvent(const PaintEvent* event)
{
GetWindowManager()->OnPaintEvent(event);
mWindowManager->onPaintEvent(event);
}
void DesktopManager::OnMouseEvent(const MouseEvent* event)
void DesktopManager::onMouseEvent(const MouseEvent* event)
{
GetWindowManager()->OnMouseEvent(event);
mWindowManager->onMouseEvent(event);
}
bool DesktopManager::IsModified() const
bool DesktopManager::isModified() const
{
return mModified;
}
void DesktopManager::OnUiEvent(UiEventUPtr eventUPtr)
void DesktopManager::onUiEvent(UiEventUPtr eventUPtr)
{
mModified = false;
const auto event = mEventManager->AddEvent(std::move(eventUPtr));
@ -58,19 +58,19 @@ void DesktopManager::OnUiEvent(UiEventUPtr eventUPtr)
{
case (UiEvent::Type::Paint):
{
OnPaintEvent(dynamic_cast<const PaintEvent*>(event));
onPaintEvent(dynamic_cast<const PaintEvent*>(event));
break;
}
case (UiEvent::Type::Keyboard):
{
OnKeyboardEvent(dynamic_cast<const KeyboardEvent*>(event));
onKeyboardEvent(dynamic_cast<const KeyboardEvent*>(event));
mModified = true;
break;
}
case (UiEvent::Type::Mouse):
{
auto mouseEvent = dynamic_cast<const MouseEvent*>(event);
OnMouseEvent(mouseEvent);
onMouseEvent(mouseEvent);
if (mouseEvent->GetAction() == MouseEvent::Action::Pressed)
{
mModified = true;
@ -86,17 +86,17 @@ void DesktopManager::OnUiEvent(UiEventUPtr eventUPtr)
}
}
void DesktopManager::SetIsModified(bool modified)
void DesktopManager::setIsModified(bool modified)
{
mModified = modified;
}
Keyboard* DesktopManager::GetKeyboard() const
Keyboard* DesktopManager::getKeyboard() const
{
return mKeyboard.get();
}
void DesktopManager::SetKeyboard(KeyboardUPtr keyboard)
void DesktopManager::setKeyboard(KeyboardUPtr keyboard)
{
mKeyboard = std::move(keyboard);
}
@ -106,12 +106,12 @@ AbstractApp* DesktopManager::getMainApp() const
return mUiApplication->getMainApplication();
}
void DesktopManager::AddScreen(ScreenPtr screen)
void DesktopManager::addScreen(ScreenPtr screen)
{
mScreens.push_back(std::move(screen));
}
mt::Screen* DesktopManager::GetDefaultScreen() const
mt::Screen* DesktopManager::getDefaultScreen() const
{
if (mScreens.size() > 0)
{
@ -120,12 +120,12 @@ mt::Screen* DesktopManager::GetDefaultScreen() const
return nullptr;
}
void DesktopManager::SetWindowManager(WindowManagerUPtr windowManager)
void DesktopManager::setWindowManager(WindowManagerUPtr windowManager)
{
mWindowManager = std::move(windowManager);
}
WindowManager* DesktopManager::GetWindowManager() const
WindowManager* DesktopManager::getWindowManager() const
{
return mWindowManager.get();
}

View file

@ -25,33 +25,33 @@ public:
static std::unique_ptr<DesktopManager> Create(AbstractDesktopApp* application);
void SetWindowManager(WindowManagerUPtr windowManager);
void setWindowManager(WindowManagerUPtr windowManager);
AbstractApp* getMainApp() const;
WindowManager* GetWindowManager() const;
WindowManager* getWindowManager() const;
Keyboard* GetKeyboard() const;
Keyboard* getKeyboard() const;
void AddScreen(ScreenPtr screen);
void addScreen(ScreenPtr screen);
mt::Screen* GetDefaultScreen() const;
mt::Screen* getDefaultScreen() const;
bool IsModified() const;
bool isModified() const;
void SetIsModified(bool modified);
void setIsModified(bool modified);
void SetKeyboard(KeyboardUPtr keyboard);
void setKeyboard(KeyboardUPtr keyboard);
void OnUiEvent(UiEventUPtr event);
void onUiEvent(UiEventUPtr event);
void OnKeyboardEvent(const KeyboardEvent* keyboardEvent);
void onKeyboardEvent(const KeyboardEvent* keyboardEvent);
void OnMouseEvent(const MouseEvent* mouseEvent);
void onMouseEvent(const MouseEvent* mouseEvent);
void OnPaintEvent(const PaintEvent* paintEvent);
void onPaintEvent(const PaintEvent* paintEvent);
void ClearEvents();
void clearEvents();
private:
std::vector<ScreenPtr> mScreens;

View file

@ -3,7 +3,7 @@
WindowManager::WindowManager()
: mWindows()
{
AddWindow(mt::Window::Create());
addWindow(mt::Window::Create());
}
WindowManager::~WindowManager()
@ -16,22 +16,22 @@ std::unique_ptr<WindowManager> WindowManager::Create()
return std::make_unique<WindowManager>();
}
void WindowManager::OnPaintEvent(const PaintEvent* event)
void WindowManager::onPaintEvent(const PaintEvent* event)
{
GetMainWindow()->OnPaint(event);
getMainWindow()->onPaint(event);
}
void WindowManager::OnMouseEvent(const MouseEvent* event)
void WindowManager::onMouseEvent(const MouseEvent* event)
{
GetMainWindow()->OnMouseEvent(event);
getMainWindow()->onMouseEvent(event);
}
void WindowManager::OnKeyboardEvent(const KeyboardEvent* event)
void WindowManager::onKeyboardEvent(const KeyboardEvent* event)
{
GetMainWindow()->OnKeyboardEvent(event);
getMainWindow()->onKeyboardEvent(event);
}
void WindowManager::AddWindow(WindowUPtr window)
void WindowManager::addWindow(WindowUPtr window)
{
mWindows.push_back(std::move(window));
}
@ -44,7 +44,7 @@ void WindowManager::clearPlatformWindows()
}
}
mt::Window* WindowManager::GetMainWindow() const
mt::Window* WindowManager::getMainWindow() const
{
if(mWindows.size()>0)
{

View file

@ -17,15 +17,15 @@ public:
static std::unique_ptr<WindowManager> Create();
void AddWindow(WindowUPtr window);
void addWindow(WindowUPtr window);
mt::Window* GetMainWindow() const;
mt::Window* getMainWindow() const;
void OnPaintEvent(const PaintEvent* event);
void onPaintEvent(const PaintEvent* event);
void OnMouseEvent(const MouseEvent* event);
void onMouseEvent(const MouseEvent* event);
void OnKeyboardEvent(const KeyboardEvent* event);
void onKeyboardEvent(const KeyboardEvent* event);
void clearPlatformWindows();

View file

@ -1,7 +1,6 @@
#include "WaylandEglWindowInterface.h"
#include "FileLogger.h"
#include "OpenGlInterface.h"
#include <wayland-egl.h>
@ -59,7 +58,7 @@ void WaylandEglWindowInterface::initialize(wl_surface* surface, int width, int h
}
}
void WaylandEglWindowInterface::draw()
void WaylandEglWindowInterface::beforePaint()
{
if (!mEglSurface)
{
@ -70,8 +69,14 @@ void WaylandEglWindowInterface::draw()
{
MLOG_ERROR("Made current failed");
}
}
OpenGlInterface::draw(nullptr);
void WaylandEglWindowInterface::afterPaint()
{
if (!mEglSurface)
{
return;
}
if (!eglSwapBuffers(mEglInterface->getDisplay(), mEglSurface))
{

View file

@ -15,7 +15,8 @@ public:
void initialize(wl_surface* surface, int width, int height);
void draw();
void beforePaint();
void afterPaint();
private:
wl_egl_window* mEglWindow{nullptr};

View file

@ -81,13 +81,13 @@ void WaylandInterface::initialize()
initializeHardwareRendering();
}
const auto num_windows = mDesktopManager->GetWindowManager()->getNumWindows();
const auto num_windows = mDesktopManager->getWindowManager()->getNumWindows();
for(std::size_t idx=0; idx< num_windows; idx++)
{
addWindow(mDesktopManager->GetWindowManager()->getWindow(idx));
addWindow(mDesktopManager->getWindowManager()->getWindow(idx));
}
mDesktopManager->GetWindowManager()->GetMainWindow()->show();
mDesktopManager->getWindowManager()->getMainWindow()->show();
}
void WaylandInterface::initializeHardwareRendering()

View file

@ -2,11 +2,14 @@
#include "WaylandEglWindowInterface.h"
#include "ImagePrimitives.h"
#include "DrawingContext.h"
void WaylandSurface::add(mt::Window* window, wl_compositor* compositor, xdg_wm_base* xdg_wm_base, std::shared_ptr<WaylandBuffer> buffer, WaylandEglInterface* eglInterface)
{
auto wayland_window = std::make_unique<WaylandSurface>(window, compositor, xdg_wm_base, buffer, eglInterface);
window->SetPlatformWindow(std::move(wayland_window));
const auto drawing_mode = eglInterface ? DrawingMode::GRAPH : DrawingMode::RASTER;
window->setPlatformWindow(std::move(wayland_window), drawing_mode);
}
WaylandSurface::WaylandSurface(mt::Window* window, wl_compositor* compositor, xdg_wm_base* xdg_wm_base, std::shared_ptr<WaylandBuffer> buffer, WaylandEglInterface* eglInterface)
@ -62,7 +65,7 @@ void WaylandSurface::initialize()
xdg_toplevel_set_title(mXdgTopLevel, "Example client");
auto region = wl_compositor_create_region(mCompositor);
wl_region_add(region, 0, 0, mWindow->GetWidth(), mWindow->GetHeight());
wl_region_add(region, 0, 0, mWindow->getWidth(), mWindow->getHeight());
wl_surface_set_opaque_region(mSurface, region);
wl_surface_commit(mSurface);
@ -71,56 +74,65 @@ void WaylandSurface::initialize()
void WaylandSurface::onConfigure(xdg_surface *xdg_surface, uint32_t serial)
{
xdg_surface_ack_configure(xdg_surface, serial);
paint(nullptr);
beforePaint(nullptr);
}
void WaylandSurface::paint(mt::Screen* screen)
void WaylandSurface::beforePaint(mt::Screen* screen)
{
if (mEglWindowInterface)
{
paintHardware();
mEglWindowInterface->initialize(mSurface, mWindow->getWidth(), mWindow->getHeight());
mEglWindowInterface->beforePaint();
}
else
{
paintSoftware();
beforePaintSoftware();
}
}
void WaylandSurface::paintHardware()
void WaylandSurface::afterPaint(mt::Screen* screen)
{
mEglWindowInterface->initialize(mSurface, mWindow->GetWidth(), mWindow->GetHeight());
mEglWindowInterface->draw();
if (mEglWindowInterface)
{
mEglWindowInterface->afterPaint();
}
else
{
afterPaintSoftware();
}
}
void WaylandSurface::paintSoftware()
unsigned WaylandSurface::getImageBufferSize() const
{
auto buffer = drawFrame();
wl_surface_attach(mSurface, buffer, 0, 0);
//wl_surface_damage(mSurface, 0, 0, UINT32_MAX, UINT32_MAX);
wl_surface_commit(mSurface);
}
const auto width = mWindow->getWidth();
const auto height = mWindow->getHeight();
const int stride = width * mWorkingBitDepth;
wl_buffer* WaylandSurface::drawFrame()
{
const auto width = mWindow->GetWidth();
const auto height = mWindow->GetHeight();
const int bitDepth = 4;
const int stride = width * bitDepth;
//const int numBuffers = 2; // i.e. front/back
const int numBuffers = 1;
const int shm_pool_size = height * stride * numBuffers;
return height * stride * mNumFrameBuffers;
}
void WaylandSurface::beforePaintSoftware()
{
const auto width = mWindow->getWidth();
const auto height = mWindow->getHeight();
const int stride = width * mWorkingBitDepth;
const int shm_pool_size = getImageBufferSize();
mBuffer->initializeSharedBuffer(shm_pool_size);
mBuffer->setUpPool(shm_pool_size, width, height, stride);
int offset = 0;
ImagePrimitives::drawCheckerboard(mBuffer->getPoolData(), width, height, offset);
mBuffer->tearDownPool(shm_pool_size);
return mBuffer->getWorkingBuffer();
//ImagePrimitives::drawCheckerboard(mBuffer->getPoolData(), width, height, offset);
}
void WaylandSurface::afterPaintSoftware()
{
const int shm_pool_size = getImageBufferSize();
mBuffer->tearDownPool(shm_pool_size);
wl_surface_attach(mSurface, mBuffer->getWorkingBuffer(), 0, 0);
//wl_surface_damage(mSurface, 0, 0, UINT32_MAX, UINT32_MAX);
wl_surface_commit(mSurface);
}

View file

@ -37,13 +37,13 @@ public:
private:
void initialize();
void paint(mt::Screen* screen) override;
void beforePaint(mt::Screen* screen) override;
void afterPaint(mt::Screen* screen) override;
void paintHardware();
void paintSoftware();
void beforePaintSoftware();
void afterPaintSoftware();
wl_buffer* drawFrame();
unsigned getImageBufferSize() const;
mt::Window* mWindow{nullptr};
@ -57,6 +57,8 @@ private:
xdg_surface_listener mXdgSurfaceListener;
xdg_toplevel* mXdgTopLevel{nullptr};
unsigned mWorkingBitDepth{4};
unsigned mNumFrameBuffers{1};
};
using WaylandSurfacePtr = std::unique_ptr<WaylandSurface>;

View file

@ -1,6 +1,5 @@
#include "XcbGlWindowInterface.h"
#include "OpenGlInterface.h"
#include "XcbGlInterface.h"
#include "FileLogger.h"
@ -22,9 +21,8 @@ XcbGlWindowInterface::~XcbGlWindowInterface()
}
}
void XcbGlWindowInterface::draw()
void XcbGlWindowInterface::afterPaint()
{
OpenGlInterface::draw(nullptr);
swapBuffers();
}

View file

@ -14,7 +14,7 @@ public:
bool initialize(xcb_window_t window);
void draw();
void afterPaint();
private:
void destroyWindow();

View file

@ -4,6 +4,7 @@
#include "Window.h"
#include "XcbWindow.h"
#include "Image.h"
class XcbImage
{
@ -11,9 +12,9 @@ public:
XcbImage(xcb_connection_t* connection, mt::Window* window, xcb_screen_t* screen)
{
mPixmap = xcb_generate_id(connection);
auto hwnd = dynamic_cast<XcbWindow*>(window->GetPlatformWindow())->getHandle();
const auto w = window->GetWidth();
const auto h = window->GetHeight();
auto hwnd = dynamic_cast<XcbWindow*>(window->getPlatformWindow())->getHandle();
const auto w = window->getWidth();
const auto h = window->getHeight();
xcb_create_pixmap(connection, screen->root_depth, mPixmap, hwnd, w, h);
}
@ -21,10 +22,10 @@ public:
{
if (!mXImage)
{
auto backing_image = window->getBackingImage();
auto backing_image = window->getImage();
const auto w = window->GetWidth();
const auto h = window->GetHeight();
const auto w = window->getWidth();
const auto h = window->getHeight();
//auto data = const_cast<unsigned char*>(backing_image->getDataPtr());
auto data = backing_image->getData();

View file

@ -40,15 +40,15 @@ void XcbInterface::initialize()
{
initializeHardwareRendering();
}
mDesktopManager->SetKeyboard(XcbKeyboard::Create());
mDesktopManager->setKeyboard(XcbKeyboard::Create());
const auto num_windows = mDesktopManager->GetWindowManager()->getNumWindows();
const auto num_windows = mDesktopManager->getWindowManager()->getNumWindows();
for(std::size_t idx=0; idx< num_windows; idx++)
{
addWindow(mDesktopManager->GetWindowManager()->getWindow(idx));
addWindow(mDesktopManager->getWindowManager()->getWindow(idx));
}
mDesktopManager->GetWindowManager()->GetMainWindow()->show();
mDesktopManager->getWindowManager()->getMainWindow()->show();
}
void XcbInterface::connect()
@ -96,7 +96,7 @@ void XcbInterface::updateScreen()
auto xcb_screen = XcbScreen::Create(screen_iter.data);
auto screen = mt::Screen::Create();
screen->SetPlatformScreen(std::move(xcb_screen));
mDesktopManager->AddScreen(std::move(screen));
mDesktopManager->addScreen(std::move(screen));
}
void XcbInterface::initializeHardwareRendering()
@ -107,11 +107,11 @@ void XcbInterface::initializeHardwareRendering()
void XcbInterface::createGraphicsContext()
{
if (!mConnection || mDesktopManager->GetDefaultScreen())
if (!mConnection || mDesktopManager->getDefaultScreen())
{
return;
}
auto xcb_screen = dynamic_cast<XcbScreen*>(mDesktopManager->GetDefaultScreen()->GetPlatformScreen());
auto xcb_screen = dynamic_cast<XcbScreen*>(mDesktopManager->getDefaultScreen()->GetPlatformScreen());
if (!xcb_screen)
{
return;
@ -145,16 +145,16 @@ uint32_t XcbInterface::getEventMask()
void XcbInterface::addWindow(mt::Window* window)
{
auto screen = mDesktopManager->GetDefaultScreen();
auto screen = mDesktopManager->getDefaultScreen();
XcbWindow::add(window, mConnection, screen, getEventMask(), mGlInterface.get());
}
void XcbInterface::onPaint()
{
mDesktopManager->OnUiEvent(PaintEvent::Create());
mDesktopManager->onUiEvent(PaintEvent::Create());
auto mainWindow = mDesktopManager->GetWindowManager()->GetMainWindow();
auto defaultScreen = mDesktopManager->GetDefaultScreen();
auto mainWindow = mDesktopManager->getWindowManager()->getMainWindow();
auto defaultScreen = mDesktopManager->getDefaultScreen();
mainWindow->doPaint(defaultScreen);
}
@ -183,26 +183,26 @@ void XcbInterface::loop()
}
case XCB_KEY_PRESS: {
auto kp = reinterpret_cast<xcb_key_press_event_t*>(event);
auto ui_event = mEventInterface->ConvertKeyPress(kp, mDesktopManager->GetKeyboard());
mDesktopManager->OnUiEvent(std::move(ui_event));
auto ui_event = mEventInterface->ConvertKeyPress(kp, mDesktopManager->getKeyboard());
mDesktopManager->onUiEvent(std::move(ui_event));
break;
}
case XCB_KEY_RELEASE: {
auto kr = reinterpret_cast<xcb_key_release_event_t*>(event);
auto ui_event = mEventInterface->ConvertKeyRelease(kr, mDesktopManager->GetKeyboard());
mDesktopManager->OnUiEvent(std::move(ui_event));
auto ui_event = mEventInterface->ConvertKeyRelease(kr, mDesktopManager->getKeyboard());
mDesktopManager->onUiEvent(std::move(ui_event));
break;
}
case XCB_BUTTON_PRESS: {
auto press = reinterpret_cast<xcb_button_press_event_t*>(event);
auto ui_event = mEventInterface->ConvertButtonPress(press);
mDesktopManager->OnUiEvent(std::move(ui_event));
mDesktopManager->onUiEvent(std::move(ui_event));
break;
}
case XCB_BUTTON_RELEASE: {
auto release = reinterpret_cast<xcb_button_release_event_t*>(event);
auto ui_event = mEventInterface->ConvertButtonRelease(release);
mDesktopManager->OnUiEvent(std::move(ui_event));
mDesktopManager->onUiEvent(std::move(ui_event));
break;
}
default:
@ -216,17 +216,17 @@ void XcbInterface::loop()
void XcbInterface::onEventsDispatched()
{
if (mDesktopManager->IsModified())
if (mDesktopManager->isModified())
{
mDesktopManager->SetIsModified(false);
auto mainWindow = mDesktopManager->GetWindowManager()->GetMainWindow();
mDesktopManager->setIsModified(false);
auto mainWindow = mDesktopManager->getWindowManager()->getMainWindow();
mainWindow->clear();
}
}
void XcbInterface::shutDown()
{
mDesktopManager->GetWindowManager()->clearPlatformWindows();
mDesktopManager->getWindowManager()->clearPlatformWindows();
if (!mConnection)
{

View file

@ -7,6 +7,7 @@
#include "Screen.h"
#include "ImagePrimitives.h"
#include "XcbGlWindowInterface.h"
#include "DrawingContext.h"
#include <xcb/xcb.h>
@ -42,14 +43,16 @@ void XcbWindow::add(mt::Window* window, xcb_connection_t* connection, mt::Screen
hwnd, /* window Id */
xcb_screen->GetNativeScreen()->root, /* parent window */
0, 0, /* x, y */
window->GetWidth(), window->GetHeight(), /* width, height */
window->getWidth(), window->getHeight(), /* width, height */
10, /* border_width */
XCB_WINDOW_CLASS_INPUT_OUTPUT, /* class */
xcb_screen->GetNativeScreen()->root_visual, /* visual */
mask, values ); /* masks */
auto xcb_window = std::make_unique<XcbWindow>(window, hwnd, connection, xcbGlInterface);
window->SetPlatformWindow(std::move(xcb_window));
const auto drawing_mode = xcbGlInterface ? DrawingMode::GRAPH : DrawingMode::RASTER;
window->setPlatformWindow(std::move(xcb_window), drawing_mode);
}
int XcbWindow::getHandle() const
@ -67,54 +70,40 @@ void XcbWindow::show()
map();
}
void XcbWindow::paint(mt::Screen* screen)
{
auto xcb_screen = dynamic_cast<XcbScreen*>(screen->GetPlatformScreen());
if (mGlInterface)
{
paintHardware(xcb_screen);
}
else
{
paintSoftware(xcb_screen);
}
}
void XcbWindow::paintHardware(XcbScreen* screen)
void XcbWindow::beforePaint(mt::Screen* screen)
{
if (mGlInterface)
{
mGlInterface->initialize(mHandle);
mGlInterface->draw();
}
else
{
auto xcb_screen = dynamic_cast<XcbScreen*>(screen->GetPlatformScreen());
if (!mBackingImage)
{
mBackingImage = std::make_unique<XcbImage>(mConnection, mWindow, xcb_screen->GetNativeScreen());
}
}
}
void XcbWindow::paintSoftware(XcbScreen* screen)
void XcbWindow::afterPaint(mt::Screen* screen)
{
if (!mBackingImage)
if (mGlInterface)
{
mBackingImage = std::make_unique<XcbImage>(mConnection, mWindow, screen->GetNativeScreen());
mGlInterface->afterPaint();
}
auto backing_image = mWindow->getBackingImage();
backing_image->initialize();
//ImagePrimitives::drawCheckerboard(const_cast<unsigned char*>(backing_image->getDataPtr()), backing_image->getWidth(), backing_image->getHeight(), 0);
mBackingImage->update(mWindow, screen->GetNativeScreen(), mConnection, screen->GetGraphicsContext());
xcb_copy_area(mConnection, mBackingImage->getPixMap(), mHandle, screen->GetGraphicsContext(), 0, 0 ,0 , 0, backing_image->getWidth(), backing_image->getHeight());
/*
for(const auto& layer : mWindow->GetLayers())
else
{
XcbLayerInterface::AddLayer(mConnection, xcb_screen->GetNativeScreen(), mHandle, xcb_screen->GetGraphicsContext(), layer);
auto xcb_screen = dynamic_cast<XcbScreen*>(screen->GetPlatformScreen());
mBackingImage->update(mWindow, xcb_screen->GetNativeScreen(), mConnection, xcb_screen->GetGraphicsContext());
xcb_copy_area(mConnection, mBackingImage->getPixMap(), mHandle, xcb_screen->GetGraphicsContext(), 0, 0 ,0 , 0, mWindow->getWidth(), mWindow->getHeight());
}
*/
}
void XcbWindow::clear()
{
xcb_clear_area(mConnection, 1, mHandle, 0, 0, mWindow->GetWidth(), mWindow->GetHeight());
xcb_clear_area(mConnection, 1, mHandle, 0, 0, mWindow->getWidth(), mWindow->getHeight());
xcb_flush(mConnection);
}

View file

@ -26,16 +26,15 @@ public:
void show() override;
void paint(mt::Screen* screen) override;
void beforePaint(mt::Screen* screen) override;
void afterPaint(mt::Screen* screen) override;
void clear() override;
void map() override;
private:
void paintHardware(XcbScreen* screen);
void paintSoftware(XcbScreen* screen);
int mHandle{-1};
unsigned mGraphicsContext {0};
xcb_connection_t* mConnection{nullptr};