Prep for image support in windows.

This commit is contained in:
James Grogan 2022-11-11 15:51:37 +00:00
parent 53c98a227d
commit e7683cd94e
13 changed files with 172 additions and 135 deletions

View file

@ -15,7 +15,6 @@
#include "XcbWindow.h"
#include "XcbLayerInterface.h"
#include "XcbEventInterface.h"
#include "XcbWindowInterface.h"
#include "GlxInterface.h"
#include "FileLogger.h"
@ -25,8 +24,7 @@ XcbInterface::XcbInterface(DesktopManager* desktopManager, bool useHardware)
mConnection(nullptr),
mX11Display(),
mGlxInterface(),
mXcbEventInterface(XcbEventInterface::Create()),
mXcbWindowInterface(XcbWindowInterface::Create())
mXcbEventInterface(XcbEventInterface::Create())
{
}
@ -45,7 +43,6 @@ void XcbInterface::initialize()
{
initializeOpenGl();
}
mDesktopManager->SetKeyboard(XcbKeyboard::Create());
}
@ -117,10 +114,10 @@ void XcbInterface::createOpenGlDrawable(mt::Window* window)
return;
}
if (!mGlxInterface->SetupWindow(mX11Display, xcb_window->GetHandle()))
if (!mGlxInterface->SetupWindow(mX11Display, xcb_window->getHandle()))
{
MLOG_ERROR("Failed to set up OpenGL Drawable");
xcb_destroy_window(mConnection, xcb_window->GetHandle());
xcb_destroy_window(mConnection, xcb_window->getHandle());
}
}
@ -146,12 +143,12 @@ void XcbInterface::createGraphicsContext()
void XcbInterface::mapWindow(mt::Window* window)
{
mXcbWindowInterface->Map(window, mConnection);
window->map();
}
void XcbInterface::showWindow(mt::Window* window)
{
mXcbWindowInterface->Show(window, mConnection);
window->show();
if (mUseHardwareRendering)
{
@ -170,7 +167,7 @@ uint32_t XcbInterface::getEventMask()
void XcbInterface::addWindow(mt::Window* window)
{
auto screen = mDesktopManager->GetDefaultScreen();
mXcbWindowInterface->Add(window, mConnection, screen, getEventMask());
XcbWindow::add(window, mConnection, screen, getEventMask());
}
void XcbInterface::onPaint()
@ -179,8 +176,8 @@ void XcbInterface::onPaint()
auto mainWindow = mDesktopManager->GetWindowManager()->GetMainWindow();
auto defaultScreen = mDesktopManager->GetDefaultScreen();
auto xcb_screen = dynamic_cast<XcbScreen*>(defaultScreen->GetPlatformScreen());
mXcbWindowInterface->Paint(mainWindow, mConnection, xcb_screen->GetNativeScreen(), xcb_screen->GetGraphicsContext());
mainWindow->doPaint(defaultScreen);
}
void XcbInterface::onExposeEvent(xcb_expose_event_t* event)
@ -265,7 +262,7 @@ void XcbInterface::onEventsDispatched()
{
mDesktopManager->SetIsModified(false);
auto mainWindow = mDesktopManager->GetWindowManager()->GetMainWindow();
mXcbWindowInterface->Clear(mainWindow, mConnection);
mainWindow->clear();
}
}