mirror of
https://github.com/AxioDL/boo.git
synced 2025-12-09 21:47:57 +00:00
Rename classes to match their functionality/API better
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
*/
|
||||
|
||||
#define APPLICATION_UNIX_CPP
|
||||
#include "ApplicationXCB.hpp"
|
||||
#include "ApplicationXlib.hpp"
|
||||
#include "ApplicationWayland.hpp"
|
||||
|
||||
#include <memory>
|
||||
@@ -60,9 +60,9 @@ int ApplicationRun(IApplication::EPlatformType platform,
|
||||
return 1;
|
||||
if (platform == IApplication::PLAT_WAYLAND)
|
||||
APP = new ApplicationWayland(cb, uniqueName, friendlyName, pname, args, singleInstance);
|
||||
else if (platform == IApplication::PLAT_XCB ||
|
||||
else if (platform == IApplication::PLAT_XLIB ||
|
||||
platform == IApplication::PLAT_AUTO)
|
||||
APP = new ApplicationXCB(cb, uniqueName, friendlyName, pname, args, singleInstance);
|
||||
APP = new ApplicationXlib(cb, uniqueName, friendlyName, pname, args, singleInstance);
|
||||
else
|
||||
return 1;
|
||||
return APP->run();
|
||||
|
||||
@@ -92,11 +92,11 @@ static Window GetWindowOfEvent(XEvent* event, bool& windowEvent)
|
||||
return 0;
|
||||
}
|
||||
|
||||
IWindow* _WindowXCBNew(const std::string& title,
|
||||
IWindow* _WindowXlibNew(const std::string& title,
|
||||
Display* display, int defaultScreen,
|
||||
GLXContext lastCtx);
|
||||
|
||||
class ApplicationXCB final : public IApplication
|
||||
class ApplicationXlib final : public IApplication
|
||||
{
|
||||
IApplicationCallback& m_callback;
|
||||
const std::string m_uniqueName;
|
||||
@@ -121,7 +121,7 @@ class ApplicationXCB final : public IApplication
|
||||
}
|
||||
|
||||
public:
|
||||
ApplicationXCB(IApplicationCallback& callback,
|
||||
ApplicationXlib(IApplicationCallback& callback,
|
||||
const std::string& uniqueName,
|
||||
const std::string& friendlyName,
|
||||
const std::string& pname,
|
||||
@@ -207,14 +207,14 @@ public:
|
||||
XFlush(m_xDisp);
|
||||
}
|
||||
|
||||
~ApplicationXCB()
|
||||
~ApplicationXlib()
|
||||
{
|
||||
XCloseDisplay(m_xDisp);
|
||||
}
|
||||
|
||||
EPlatformType getPlatformType() const
|
||||
{
|
||||
return PLAT_XCB;
|
||||
return PLAT_XLIB;
|
||||
}
|
||||
|
||||
int run()
|
||||
@@ -308,7 +308,7 @@ public:
|
||||
|
||||
IWindow* newWindow(const std::string& title)
|
||||
{
|
||||
IWindow* newWindow = _WindowXCBNew(title, m_xDisp, m_xDefaultScreen, m_lastGlxCtx);
|
||||
IWindow* newWindow = _WindowXlibNew(title, m_xDisp, m_xDefaultScreen, m_lastGlxCtx);
|
||||
m_windows[(Window)newWindow->getPlatformHandle()] = newWindow;
|
||||
return newWindow;
|
||||
}
|
||||
@@ -317,9 +317,9 @@ public:
|
||||
GLXContext m_lastGlxCtx = nullptr;
|
||||
};
|
||||
|
||||
void _XCBUpdateLastGlxCtx(GLXContext lastGlxCtx)
|
||||
void _XlibUpdateLastGlxCtx(GLXContext lastGlxCtx)
|
||||
{
|
||||
static_cast<ApplicationXCB*>(APP)->m_lastGlxCtx = lastGlxCtx;
|
||||
static_cast<ApplicationXlib*>(APP)->m_lastGlxCtx = lastGlxCtx;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -39,7 +39,7 @@ namespace boo
|
||||
{
|
||||
static LogVisor::LogModule Log("boo::WindowXCB");
|
||||
IGraphicsCommandQueue* _NewGLES3CommandQueue(IGraphicsContext* parent);
|
||||
void _XCBUpdateLastGlxCtx(GLXContext lastGlxCtx);
|
||||
void _XlibUpdateLastGlxCtx(GLXContext lastGlxCtx);
|
||||
void GLXExtensionCheck();
|
||||
void GLXWaitForVSync();
|
||||
void GLXEnableVSync(Display* disp, GLXWindow drawable);
|
||||
@@ -150,7 +150,7 @@ static void genFrameDefault(Screen* screen, int& xOut, int& yOut, int& wOut, int
|
||||
hOut = height;
|
||||
}
|
||||
|
||||
struct GraphicsContextXCB : IGraphicsContext
|
||||
struct GraphicsContextGLX : IGraphicsContext
|
||||
{
|
||||
EGraphicsAPI m_api;
|
||||
EPixelFormat m_pf;
|
||||
@@ -171,7 +171,7 @@ struct GraphicsContextXCB : IGraphicsContext
|
||||
public:
|
||||
IWindowCallback* m_callback;
|
||||
|
||||
GraphicsContextXCB(EGraphicsAPI api, IWindow* parentWindow,
|
||||
GraphicsContextGLX(EGraphicsAPI api, IWindow* parentWindow,
|
||||
Display* display, int defaultScreen,
|
||||
GLXContext lastCtx, uint32_t& visualIdOut)
|
||||
: m_api(api),
|
||||
@@ -239,7 +239,7 @@ public:
|
||||
visualIdOut = m_visualid;
|
||||
}
|
||||
|
||||
~GraphicsContextXCB()
|
||||
~GraphicsContextGLX()
|
||||
{
|
||||
if (m_glxCtx)
|
||||
glXDestroyContext(m_xDisp, m_glxCtx);
|
||||
@@ -283,7 +283,7 @@ public:
|
||||
m_glxWindow = glXCreateWindow(m_xDisp, m_fbconfig, m_parentWindow->getPlatformHandle(), nullptr);
|
||||
if (!m_glxWindow)
|
||||
Log.report(LogVisor::FatalError, "unable to make new GLX window");
|
||||
_XCBUpdateLastGlxCtx(m_glxCtx);
|
||||
_XlibUpdateLastGlxCtx(m_glxCtx);
|
||||
|
||||
/* Make additional shared context for vsync timing */
|
||||
m_timerCtx = glXCreateContextAttribsARB(m_xDisp, m_fbconfig, m_glxCtx, True, ContextAttribs);
|
||||
@@ -333,7 +333,7 @@ public:
|
||||
IGraphicsDataFactory* getDataFactory()
|
||||
{
|
||||
if (!m_dataFactory)
|
||||
m_dataFactory = new class GLES3DataFactory(this);
|
||||
m_dataFactory = new class GLDataFactory(this);
|
||||
return m_dataFactory;
|
||||
}
|
||||
|
||||
@@ -367,13 +367,13 @@ public:
|
||||
|
||||
};
|
||||
|
||||
struct WindowXCB : IWindow
|
||||
struct WindowXlib : IWindow
|
||||
{
|
||||
Display* m_xDisp;
|
||||
IWindowCallback* m_callback;
|
||||
Colormap m_colormapId;
|
||||
Window m_windowId;
|
||||
GraphicsContextXCB m_gfxCtx;
|
||||
GraphicsContextGLX m_gfxCtx;
|
||||
uint32_t m_visualId;
|
||||
|
||||
/* Last known input device id (0xffff if not yet set) */
|
||||
@@ -392,7 +392,7 @@ struct WindowXCB : IWindow
|
||||
|
||||
public:
|
||||
|
||||
WindowXCB(const std::string& title,
|
||||
WindowXlib(const std::string& title,
|
||||
Display* display, int defaultScreen,
|
||||
GLXContext lastCtx)
|
||||
: m_xDisp(display), m_callback(nullptr),
|
||||
@@ -476,7 +476,7 @@ public:
|
||||
m_gfxCtx.initializeContext();
|
||||
}
|
||||
|
||||
~WindowXCB()
|
||||
~WindowXlib()
|
||||
{
|
||||
XUnmapWindow(m_xDisp, m_windowId);
|
||||
XDestroyWindow(m_xDisp, m_windowId);
|
||||
@@ -1075,11 +1075,11 @@ public:
|
||||
|
||||
};
|
||||
|
||||
IWindow* _WindowXCBNew(const std::string& title,
|
||||
IWindow* _WindowXlibNew(const std::string& title,
|
||||
Display* display, int defaultScreen,
|
||||
GLXContext lastCtx)
|
||||
{
|
||||
return new WindowXCB(title, display, defaultScreen, lastCtx);
|
||||
return new WindowXlib(title, display, defaultScreen, lastCtx);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user