11#ifndef __NBL_I_WINDOW_XCB_H_INCLUDED__
22#define __NBL_I_WINDOW_XCB_H_INCLUDED__
33
4+ #include " nbl/ui/XCBHandle.h"
45#ifdef _NBL_PLATFORM_LINUX_
56
67#include " nbl/core/util/bitflag.h"
78
89#include " nbl/ui/IWindow.h"
9- #include " nbl/ui/XCBConnection.h"
1010
1111#include < xcb/xproto.h>
1212
@@ -24,68 +24,18 @@ class NBL_API2 IWindowXCB : public IWindow
2424
2525 struct native_handle_t {
2626 xcb_window_t m_window;
27- xcb_connection_t * m_connection;
27+ core::smart_refctd_ptr<xcb::XCBHandle> m_connection;
2828 };
2929
3030 virtual const native_handle_t * getNativeHandle () const = 0;
31-
32- virtual bool setWindowSize_impl (uint32_t width, uint32_t height) = 0;
33- virtual bool setWindowPosition_impl (int32_t x, int32_t y) = 0;
34- virtual bool setWindowRotation_impl (bool landscape) = 0;
35- virtual bool setWindowVisible_impl (bool visible) = 0;
36- virtual bool setWindowMaximized_impl (bool maximized) = 0;
37-
38- static XCBConnection::MotifWmHints fetchMotifMWHints (IWindow::E_CREATE_FLAGS flags) {
39- core::bitflag<XCBConnection::MotifFlags> motifFlags (XCBConnection::MWM_HINTS_NONE);
40- core::bitflag<XCBConnection::MotifFunctions> motifFunctions (XCBConnection::MWM_FUNC_NONE);
41- core::bitflag<XCBConnection::MotifDecorations> motifDecorations (XCBConnection::MWM_DECOR_NONE);
42- motifFlags |= XCBConnection::MWM_HINTS_DECORATIONS;
43-
44- if (flags & IWindow::ECF_BORDERLESS) {
45- motifDecorations |= XCBConnection::MWM_DECOR_ALL;
46- } else {
47- motifDecorations |= XCBConnection::MWM_DECOR_BORDER;
48- motifDecorations |= XCBConnection::MWM_DECOR_RESIZEH;
49- motifDecorations |= XCBConnection::MWM_DECOR_TITLE;
50-
51- // minimize button
52- if (flags & IWindow::ECF_MINIMIZED) {
53- motifDecorations |= XCBConnection::MWM_DECOR_MINIMIZE;
54- motifFunctions |= XCBConnection::MWM_FUNC_MINIMIZE;
55- }
56-
57- // maximize button
58- if (flags & IWindow::ECF_MAXIMIZED) {
59- motifDecorations |= XCBConnection::MWM_DECOR_MAXIMIZE;
60- motifFunctions |= XCBConnection::MWM_FUNC_MAXIMIZE;
61- }
62-
63- // close button
64- motifFunctions |= XCBConnection::MWM_FUNC_CLOSE;
65- }
66-
67- if (motifFunctions.value != XCBConnection::MWM_FUNC_NONE) {
68- motifFlags |= XCBConnection::MWM_HINTS_FUNCTIONS;
69- motifFunctions |= XCBConnection::MWM_FUNC_RESIZE;
70- motifFunctions |= XCBConnection::MWM_FUNC_MOVE;
71- } else {
72- motifFunctions = XCBConnection::MWM_FUNC_ALL;
73- }
74-
75- XCBConnection::MotifWmHints hints;
76- hints.flags = motifFlags.value ;
77- hints.functions = motifFunctions.value ;
78- hints.decorations = motifDecorations.value ;
79- hints.input_mode = 0 ;
80- hints.status = 0 ;
81- return hints;
82-
83- }
84-
31+ virtual bool setWindowSize (uint32_t width, uint32_t height) = 0;
32+ virtual bool setWindowPosition (int32_t x, int32_t y) = 0;
33+ virtual bool setWindowRotation (bool landscape) = 0;
34+ virtual bool setWindowVisible (bool visible) = 0;
35+ virtual bool setWindowMaximized (bool maximized) = 0;
8536};
8637
8738}
8839
8940#endif
90-
9141#endif
0 commit comments