Fix WindowHandles
This commit is contained in:
@@ -32,13 +32,14 @@ namespace Nz
|
||||
class NAZARA_PLATFORM_API Window
|
||||
{
|
||||
friend WindowImpl;
|
||||
friend class EventImpl;
|
||||
friend class Mouse;
|
||||
friend class Platform;
|
||||
|
||||
public:
|
||||
Window();
|
||||
inline Window(VideoMode mode, const String& title, WindowStyleFlags style = WindowStyle_Default);
|
||||
inline explicit Window(WindowHandle handle);
|
||||
inline explicit Window(void* handle);
|
||||
Window(const Window&) = delete;
|
||||
Window(Window&& window);
|
||||
virtual ~Window();
|
||||
@@ -46,7 +47,7 @@ namespace Nz
|
||||
inline void Close();
|
||||
|
||||
bool Create(VideoMode mode, const String& title, WindowStyleFlags style = WindowStyle_Default);
|
||||
bool Create(WindowHandle handle);
|
||||
bool Create(void* handle);
|
||||
|
||||
void Destroy();
|
||||
|
||||
@@ -61,10 +62,10 @@ namespace Nz
|
||||
inline const CursorRef& GetCursor() const;
|
||||
inline CursorController& GetCursorController();
|
||||
inline EventHandler& GetEventHandler();
|
||||
WindowHandle GetHandle() const;
|
||||
Vector2i GetPosition() const;
|
||||
Vector2ui GetSize() const;
|
||||
WindowStyleFlags GetStyle() const;
|
||||
WindowHandle GetSystemHandle() const;
|
||||
String GetTitle() const;
|
||||
|
||||
bool HasFocus() const;
|
||||
@@ -106,6 +107,8 @@ namespace Nz
|
||||
Window& operator=(Window&& window);
|
||||
|
||||
protected:
|
||||
void* GetHandle();
|
||||
|
||||
virtual bool OnWindowCreated();
|
||||
virtual void OnWindowDestroy();
|
||||
virtual void OnWindowResized();
|
||||
@@ -116,6 +119,9 @@ namespace Nz
|
||||
void ConnectSlots();
|
||||
void DisconnectSlots();
|
||||
|
||||
inline WindowImpl* GetImpl();
|
||||
inline const WindowImpl* GetImpl() const;
|
||||
|
||||
void IgnoreNextMouseEvent(int mouseX, int mouseY) const;
|
||||
void HandleEvent(const WindowEvent& event);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Nz
|
||||
Create(mode, title, style);
|
||||
}
|
||||
|
||||
inline Window::Window(WindowHandle handle) :
|
||||
inline Window::Window(void* handle) :
|
||||
Window()
|
||||
{
|
||||
ErrorFlags flags(ErrorFlag_ThrowException, true);
|
||||
@@ -111,6 +111,16 @@ namespace Nz
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline WindowImpl* Window::GetImpl()
|
||||
{
|
||||
return m_impl;
|
||||
}
|
||||
|
||||
inline const WindowImpl* Window::GetImpl() const
|
||||
{
|
||||
return m_impl;
|
||||
}
|
||||
}
|
||||
|
||||
#include <Nazara/Platform/DebugOff.hpp>
|
||||
|
||||
@@ -8,11 +8,44 @@
|
||||
#define NAZARA_WINDOWHANDLE_HPP
|
||||
|
||||
#include <Nazara/Prerequisites.hpp>
|
||||
#include <Nazara/Utility/Config.hpp>
|
||||
|
||||
namespace Nz
|
||||
{
|
||||
// Real type is SDL_Window
|
||||
using WindowHandle = void*;
|
||||
enum class WindowManager
|
||||
{
|
||||
None,
|
||||
|
||||
X11,
|
||||
Wayland,
|
||||
Windows
|
||||
};
|
||||
|
||||
struct WindowHandle
|
||||
{
|
||||
WindowManager type = WindowManager::None;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
void* display; //< Display*
|
||||
void* window; //< Window
|
||||
} x11;
|
||||
|
||||
struct
|
||||
{
|
||||
void* display; //< wl_display*
|
||||
void* surface; //< wl_surface*
|
||||
void* shellSurface; //< wl_shell_surface*
|
||||
} wayland;
|
||||
|
||||
struct
|
||||
{
|
||||
void* window; //< HWND
|
||||
} windows;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
#endif // NAZARA_WINDOWHANDLE_HPP
|
||||
|
||||
Reference in New Issue
Block a user