2015-08-18 22:43:30 +00:00
|
|
|
#include "boo/IWindow.hpp"
|
|
|
|
#include "boo/IGraphicsContext.hpp"
|
2017-02-15 06:00:10 +00:00
|
|
|
#include "boo/audiodev/IAudioVoiceEngine.hpp"
|
2015-05-06 00:50:57 +00:00
|
|
|
|
2015-08-28 00:10:46 +00:00
|
|
|
#include <X11/Xlib.h>
|
2015-11-21 01:12:22 +00:00
|
|
|
#undef None
|
2015-08-28 00:10:46 +00:00
|
|
|
|
2018-12-08 05:17:51 +00:00
|
|
|
namespace boo {
|
2015-10-29 04:44:38 +00:00
|
|
|
|
2018-12-08 05:17:51 +00:00
|
|
|
struct GraphicsContextWayland : IGraphicsContext {
|
|
|
|
|
|
|
|
EGraphicsAPI m_api;
|
|
|
|
EPixelFormat m_pf;
|
|
|
|
IWindow* m_parentWindow;
|
2015-10-29 04:44:38 +00:00
|
|
|
|
|
|
|
public:
|
2018-12-08 05:17:51 +00:00
|
|
|
IWindowCallback* m_callback;
|
|
|
|
|
|
|
|
GraphicsContextWayland(EGraphicsAPI api, IWindow* parentWindow)
|
|
|
|
: m_api(api), m_pf(EPixelFormat::RGBA8), m_parentWindow(parentWindow) {}
|
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
~GraphicsContextWayland() override = default;
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
void _setCallback(IWindowCallback* cb) override { m_callback = cb; }
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
EGraphicsAPI getAPI() const override { return m_api; }
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
EPixelFormat getPixelFormat() const override { return m_pf; }
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
void setPixelFormat(EPixelFormat pf) override {
|
2018-12-08 05:17:51 +00:00
|
|
|
if (pf > EPixelFormat::RGBAF32_Z24)
|
|
|
|
return;
|
|
|
|
m_pf = pf;
|
|
|
|
}
|
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
bool initializeContext(void*) override { return false; }
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
void makeCurrent() override {}
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
void postInit() override {}
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
IGraphicsCommandQueue* getCommandQueue() override { return nullptr; }
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
IGraphicsDataFactory* getDataFactory() override { return nullptr; }
|
2015-10-31 04:28:21 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
IGraphicsDataFactory* getMainContextDataFactory() override { return nullptr; }
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
IGraphicsDataFactory* getLoadContextDataFactory() override { return nullptr; }
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
void present() override {}
|
2015-10-29 04:44:38 +00:00
|
|
|
};
|
2015-10-30 06:26:02 +00:00
|
|
|
|
2018-12-08 05:17:51 +00:00
|
|
|
struct WindowWayland : IWindow {
|
|
|
|
GraphicsContextWayland m_gfxCtx;
|
|
|
|
|
|
|
|
WindowWayland(std::string_view title) : m_gfxCtx(IGraphicsContext::EGraphicsAPI::OpenGL3_3, this) {}
|
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
~WindowWayland() override = default;
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
void setCallback(IWindowCallback* cb) override {}
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
void closeWindow() override {}
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
void showWindow() override {}
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
void hideWindow() override {}
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
std::string getTitle() override { return ""; }
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
void setTitle(std::string_view title) override {}
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
void setCursor(EMouseCursor cursor) override {}
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
void setWaitCursor(bool wait) override {}
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
double getWindowRefreshRate() const override { return 60.0; }
|
2019-02-12 07:18:35 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
void setWindowFrameDefault() override {}
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
void getWindowFrame(float& xOut, float& yOut, float& wOut, float& hOut) const override {}
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
void getWindowFrame(int& xOut, int& yOut, int& wOut, int& hOut) const override {}
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
void setWindowFrame(float x, float y, float w, float h) override {}
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
void setWindowFrame(int x, int y, int w, int h) override {}
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
float getVirtualPixelFactor() const override { return 0; }
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
void setStyle(EWindowStyle /*style*/) override {}
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
EWindowStyle getStyle() const override { return EWindowStyle::None; }
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
bool isFullscreen() const override { return false; }
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
void setFullscreen(bool fs) override {}
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
void claimKeyboardFocus(const int coord[2]) override {}
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
bool clipboardCopy(EClipboardType type, const uint8_t* data, size_t sz) override { return false; }
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
std::unique_ptr<uint8_t[]> clipboardPaste(EClipboardType type, size_t& sz) override { return std::unique_ptr<uint8_t[]>(); }
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
int waitForRetrace() override { return 1; }
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
uintptr_t getPlatformHandle() const override { return 0; }
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
ETouchType getTouchType() const override { return ETouchType::None; }
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
IGraphicsCommandQueue* getCommandQueue() override { return m_gfxCtx.getCommandQueue(); }
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
IGraphicsDataFactory* getDataFactory() override { return m_gfxCtx.getDataFactory(); }
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
IGraphicsDataFactory* getMainContextDataFactory() override { return m_gfxCtx.getMainContextDataFactory(); }
|
2018-12-08 05:17:51 +00:00
|
|
|
|
2019-08-13 00:52:20 +00:00
|
|
|
IGraphicsDataFactory* getLoadContextDataFactory() override { return m_gfxCtx.getLoadContextDataFactory(); }
|
2015-05-06 00:50:57 +00:00
|
|
|
};
|
|
|
|
|
2018-12-08 05:17:51 +00:00
|
|
|
std::shared_ptr<IWindow> _WindowWaylandNew(std::string_view title) { return std::make_shared<WindowWayland>(title); }
|
|
|
|
|
|
|
|
} // namespace boo
|