Cleaning window managers for consistency.

This commit is contained in:
James Grogan 2022-11-12 15:34:54 +00:00
parent 5d984aa61d
commit 392a2b7889
28 changed files with 452 additions and 325 deletions

View file

@ -1,6 +1,9 @@
#include "WaylandInterface.h"
#include "FileLogger.h"
#include "DesktopManager.h"
#include "WindowManager.h"
#include "WaylandSurface.h"
#include "WaylandBuffer.h"
#include "WaylandSeatInterface.h"
@ -13,10 +16,9 @@ void WaylandInterface::registryHandleGlobalEvent(void *data, struct wl_registry
uint32_t name, const char *interface, uint32_t version)
{
auto thisClass = static_cast<WaylandInterface*>(data);
std::stringstream sstrm;
sstrm << "interface: " << interface << " version " << version << " name " << name;
MLOG_INFO(sstrm.str());
//MLOG_INFO(sstrm.str());
if (strcmp(interface, wl_compositor_interface.name) == 0)
{
@ -51,7 +53,7 @@ WaylandInterface::WaylandInterface(DesktopManager* desktopManager, bool useHardw
WaylandInterface::~WaylandInterface()
{
shutDown();
}
void WaylandInterface::initialize()
@ -76,9 +78,21 @@ void WaylandInterface::initialize()
if (mUseHardwareRendering)
{
mEglInterface = std::make_unique<WaylandEglInterface>();
mEglInterface->initialize(mDisplay);
initializeHardwareRendering();
}
const auto num_windows = mDesktopManager->GetWindowManager()->getNumWindows();
for(std::size_t idx=0; idx< num_windows; idx++)
{
addWindow(mDesktopManager->GetWindowManager()->getWindow(idx));
}
mDesktopManager->GetWindowManager()->GetMainWindow()->show();
}
void WaylandInterface::initializeHardwareRendering()
{
mEglInterface = std::make_unique<WaylandEglInterface>(mDisplay);
}
void WaylandInterface::setSeat(wl_seat* seat)
@ -115,18 +129,12 @@ void WaylandInterface::doXdgPong(uint32_t serial)
void WaylandInterface::addWindow(mt::Window* window)
{
auto surface = std::make_unique<WaylandSurface>(window);
mSurfaces.push_back(std::move(surface));
WaylandSurface::add(window, mCompositor, mXdgBase, mBuffer, mEglInterface.get());
}
void WaylandInterface::showWindow(mt::Window* window)
{
if (mSurfaces.empty())
{
return;
}
mSurfaces[0]->initialize(mCompositor, mXdgBase, mBuffer, mEglInterface.get());
window->show();
}
void WaylandInterface::shutDown()
@ -139,6 +147,8 @@ void WaylandInterface::shutDown()
void WaylandInterface::loop()
{
initialize();
while (wl_display_dispatch(mDisplay) != -1)
{
/* This space deliberately left blank */