1
0
Fork 0

Platform/PlatformWindow: pass owner in constructor instead of setting the variable directly on the object. it is cleaner.

This commit is contained in:
Henrik Hautakoski 2023-08-22 17:18:39 +02:00
parent 5a7a5e3f7c
commit 1288ef88b8
6 changed files with 14 additions and 10 deletions

View file

@ -16,12 +16,11 @@ namespace sp {
PlatformWindow* PlatformWindow::make(Window* owner)
{
WindowType* disp = new WindowType();
disp->m_owner = owner;
return disp;
return new WindowType(owner);
}
PlatformWindow::PlatformWindow()
PlatformWindow::PlatformWindow(Window* owner) :
m_owner (owner)
{
}

View file

@ -60,7 +60,7 @@ public :
protected :
PlatformWindow();
PlatformWindow(Window* owner);
void onReshape(int width, int height);

View file

@ -28,8 +28,8 @@ X11Window* X11Window::getFocused()
return _priv::focused_window;
}
X11Window::
X11Window() :
X11Window::X11Window(Window *owner) :
PlatformWindow (owner),
m_screen (0),
m_size (200,200),
m_cur_last (0),

View file

@ -11,13 +11,15 @@
namespace sp {
class Window;
class X11Window : public PlatformWindow
{
public :
static X11Window* getFocused();
X11Window();
X11Window(Window *owner);
virtual bool create(WindowDescription description);

View file

@ -18,7 +18,8 @@ namespace sp {
static bool firstTime = true;
Win32Window::Win32Window() :
Win32Window::Win32Window(Window* owner) :
PlatformWindow (owner),
m_handle (NULL),
m_icon (0),
m_cursor (0),

View file

@ -9,10 +9,12 @@
namespace sp {
class Window;
class Win32Window : public PlatformWindow
{
public :
Win32Window();
Win32Window(Window* owner);
virtual ~Win32Window();
virtual bool create(WindowDescription description);