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;
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);


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

@@ -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)
{


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

@@ -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;


+ 1
- 1
examples/Makefile View File

@@ -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

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


Loading…
Cancel
Save