Browse Source

Small hack in pugl headers to expose size vars in MacOS

gh-pages
falkTX 11 years ago
parent
commit
3d2d6fb29c
4 changed files with 8 additions and 16 deletions
  1. +0
    -2
      dgl/Window.hpp
  2. +4
    -11
      dgl/src/Window.cpp
  3. +3
    -2
      dgl/src/pugl/pugl_internal.h
  4. +1
    -1
      examples/Makefile

+ 0
- 2
dgl/Window.hpp View File

@@ -54,11 +54,9 @@ public:
bool isResizable() const noexcept; bool isResizable() const noexcept;
void setResizable(bool yesNo); void setResizable(bool yesNo);


#ifndef DGL_OS_MAC
int getWidth() const noexcept; int getWidth() const noexcept;
int getHeight() const noexcept; int getHeight() const noexcept;
Size<int> getSize() const noexcept; Size<int> getSize() const noexcept;
#endif
void setSize(unsigned int width, unsigned int height); void setSize(unsigned int width, unsigned int height);


void setTitle(const char* title); void setTitle(const char* title);


+ 4
- 11
dgl/src/Window.cpp View File

@@ -29,7 +29,10 @@
#elif DGL_OS_MAC #elif DGL_OS_MAC
extern "C" { extern "C" {
# include "pugl/pugl_osx_extended.h" # include "pugl/pugl_osx_extended.h"
}
struct PuglViewImpl {
int width;
int height;
};}
#elif DGL_OS_LINUX #elif DGL_OS_LINUX
extern "C" { extern "C" {
# include "pugl/pugl_x11.c" # include "pugl/pugl_x11.c"
@@ -275,10 +278,8 @@ public:


fVisible = yesNo; fVisible = yesNo;


#ifndef DGL_OS_MAC
if (yesNo && fFirstInit) if (yesNo && fFirstInit)
setSize(fView->width, fView->height, true); setSize(fView->width, fView->height, true);
#endif


#if DGL_OS_WINDOWS #if DGL_OS_WINDOWS
if (yesNo) if (yesNo)
@@ -336,14 +337,11 @@ public:


fResizable = yesNo; fResizable = yesNo;


#ifndef DGL_OS_MAC
setSize(fView->width, fView->height, true); setSize(fView->width, fView->height, true);
#endif
} }


// ------------------------------------------------------------------- // -------------------------------------------------------------------


#ifndef DGL_OS_MAC
int getWidth() const noexcept int getWidth() const noexcept
{ {
return fView->width; return fView->width;
@@ -358,7 +356,6 @@ public:
{ {
return Size<int>(fView->width, fView->height); return Size<int>(fView->width, fView->height);
} }
#endif


void setSize(unsigned int width, unsigned int height, const bool forced = false) void setSize(unsigned int width, unsigned int height, const bool forced = false)
{ {
@@ -367,7 +364,6 @@ public:
if (height == 0) if (height == 0)
height = 1; height = 1;


#ifndef DGL_OS_MAC
if (fView->width == (int)width && fView->height == (int)height && ! forced) if (fView->width == (int)width && fView->height == (int)height && ! forced)
{ {
DBG("Window setSize ignored!\n"); DBG("Window setSize ignored!\n");
@@ -376,7 +372,6 @@ public:


fView->width = width; fView->width = width;
fView->height = height; fView->height = height;
#endif


DBG("Window setSize called\n"); DBG("Window setSize called\n");


@@ -811,7 +806,6 @@ void Window::setResizable(bool yesNo)
pData->setResizable(yesNo); pData->setResizable(yesNo);
} }


#ifndef DGL_OS_MAC
int Window::getWidth() const noexcept int Window::getWidth() const noexcept
{ {
return pData->getWidth(); return pData->getWidth();
@@ -826,7 +820,6 @@ Size<int> Window::getSize() const noexcept
{ {
return pData->getSize(); return pData->getSize();
} }
#endif


void Window::setSize(unsigned int width, unsigned int height) void Window::setSize(unsigned int width, unsigned int height)
{ {


+ 3
- 2
dgl/src/pugl/pugl_internal.h View File

@@ -27,6 +27,9 @@
typedef struct PuglInternalsImpl PuglInternals; typedef struct PuglInternalsImpl PuglInternals;


struct PuglViewImpl { struct PuglViewImpl {
int width;
int height;

PuglHandle handle; PuglHandle handle;
PuglCloseFunc closeFunc; PuglCloseFunc closeFunc;
PuglDisplayFunc displayFunc; PuglDisplayFunc displayFunc;
@@ -39,8 +42,6 @@ struct PuglViewImpl {


PuglInternals* impl; PuglInternals* impl;


int width;
int height;
int mods; int mods;
bool mouse_in_view; bool mouse_in_view;
bool ignoreKeyRepeat; bool ignoreKeyRepeat;


+ 1
- 1
examples/Makefile View File

@@ -16,7 +16,7 @@ LINK_FLAGS += -L.. -ldgl $(DGL_LIBS)
ifeq ($(WIN32),true) ifeq ($(WIN32),true)
TARGETS = app.exe cairo.exe color images.exe nekobi-ui.exe TARGETS = app.exe cairo.exe color images.exe nekobi-ui.exe
else else
TARGETS = app cairo color images nekobi-ui
TARGETS = app color images nekobi-ui
endif endif


# -------------------------------------------------------------- # --------------------------------------------------------------


Loading…
Cancel
Save