From 3d2d6fb29c87e60a4e6762be1774d10f338d3b04 Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 18 Jan 2014 16:21:06 -0800 Subject: [PATCH] Small hack in pugl headers to expose size vars in MacOS --- dgl/Window.hpp | 2 -- dgl/src/Window.cpp | 15 ++++----------- dgl/src/pugl/pugl_internal.h | 5 +++-- examples/Makefile | 2 +- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/dgl/Window.hpp b/dgl/Window.hpp index 2a3282ae..3c2b7a1a 100644 --- a/dgl/Window.hpp +++ b/dgl/Window.hpp @@ -54,11 +54,9 @@ public: bool isResizable() const noexcept; void setResizable(bool yesNo); -#ifndef DGL_OS_MAC int getWidth() const noexcept; int getHeight() const noexcept; Size getSize() const noexcept; -#endif void setSize(unsigned int width, unsigned int height); void setTitle(const char* title); diff --git a/dgl/src/Window.cpp b/dgl/src/Window.cpp index ea866e59..0d82caa9 100644 --- a/dgl/src/Window.cpp +++ b/dgl/src/Window.cpp @@ -29,7 +29,10 @@ #elif DGL_OS_MAC extern "C" { # include "pugl/pugl_osx_extended.h" -} +struct PuglViewImpl { + int width; + int height; +};} #elif DGL_OS_LINUX extern "C" { # include "pugl/pugl_x11.c" @@ -275,10 +278,8 @@ public: fVisible = yesNo; -#ifndef DGL_OS_MAC if (yesNo && fFirstInit) setSize(fView->width, fView->height, true); -#endif #if DGL_OS_WINDOWS if (yesNo) @@ -336,14 +337,11 @@ public: fResizable = yesNo; -#ifndef DGL_OS_MAC setSize(fView->width, fView->height, true); -#endif } // ------------------------------------------------------------------- -#ifndef DGL_OS_MAC int getWidth() const noexcept { return fView->width; @@ -358,7 +356,6 @@ public: { return Size(fView->width, fView->height); } -#endif void setSize(unsigned int width, unsigned int height, const bool forced = false) { @@ -367,7 +364,6 @@ public: if (height == 0) height = 1; -#ifndef DGL_OS_MAC if (fView->width == (int)width && fView->height == (int)height && ! forced) { DBG("Window setSize ignored!\n"); @@ -376,7 +372,6 @@ public: fView->width = width; fView->height = height; -#endif DBG("Window setSize called\n"); @@ -811,7 +806,6 @@ void Window::setResizable(bool yesNo) pData->setResizable(yesNo); } -#ifndef DGL_OS_MAC int Window::getWidth() const noexcept { return pData->getWidth(); @@ -826,7 +820,6 @@ Size Window::getSize() const noexcept { return pData->getSize(); } -#endif void Window::setSize(unsigned int width, unsigned int height) { diff --git a/dgl/src/pugl/pugl_internal.h b/dgl/src/pugl/pugl_internal.h index 8cdada87..411bb9b8 100644 --- a/dgl/src/pugl/pugl_internal.h +++ b/dgl/src/pugl/pugl_internal.h @@ -27,6 +27,9 @@ typedef struct PuglInternalsImpl PuglInternals; struct PuglViewImpl { + int width; + int height; + PuglHandle handle; PuglCloseFunc closeFunc; PuglDisplayFunc displayFunc; @@ -39,8 +42,6 @@ struct PuglViewImpl { PuglInternals* impl; - int width; - int height; int mods; bool mouse_in_view; bool ignoreKeyRepeat; diff --git a/examples/Makefile b/examples/Makefile index f87c026e..b4721f8e 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -16,7 +16,7 @@ LINK_FLAGS += -L.. -ldgl $(DGL_LIBS) ifeq ($(WIN32),true) TARGETS = app.exe cairo.exe color images.exe nekobi-ui.exe else -TARGETS = app cairo color images nekobi-ui +TARGETS = app color images nekobi-ui endif # --------------------------------------------------------------