commit 3d2d6fb29c87e60a4e6762be1774d10f338d3b04
parent ec8997b058fcf26b6f8dab1f1394ac0fb60ce1df
Author: falkTX <falktx@gmail.com>
Date: Sat, 18 Jan 2014 16:20:41 -0800
Small hack in pugl headers to expose size vars in MacOS
Diffstat:
4 files changed, 8 insertions(+), 16 deletions(-)
diff --git 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<int> 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
@@ -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<int>(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<int> 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
@@ -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
@@ -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
# --------------------------------------------------------------