diff options
author | David Robillard <d@drobilla.net> | 2014-05-13 15:30:36 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2014-05-13 15:30:36 +0000 |
commit | a739e6116f026e2fe334f447082616712a1cfd78 (patch) | |
tree | 8b6b3fb3bcfb9cd41dae872d5789a54fc5a4c3c5 /pugl/pugl_internal.h | |
parent | e86043f765dd18a51cb2450f45d1d204fd4cb4d9 (diff) | |
download | pugl-a739e6116f026e2fe334f447082616712a1cfd78.tar.gz pugl-a739e6116f026e2fe334f447082616712a1cfd78.tar.bz2 pugl-a739e6116f026e2fe334f447082616712a1cfd78.zip |
Fix non-extensible puglInit API.
Fix memory leak.
Diffstat (limited to 'pugl/pugl_internal.h')
-rw-r--r-- | pugl/pugl_internal.h | 48 |
1 files changed, 46 insertions, 2 deletions
diff --git a/pugl/pugl_internal.h b/pugl/pugl_internal.h index 74aae55..6813fef 100644 --- a/pugl/pugl_internal.h +++ b/pugl/pugl_internal.h @@ -39,8 +39,6 @@ # define PUGL_LOGF(fmt, ...) #endif -void puglDefaultReshape(PuglView* view, int width, int height); - typedef struct PuglInternalsImpl PuglInternals; struct PuglViewImpl { @@ -56,15 +54,61 @@ struct PuglViewImpl { PuglInternals* impl; + PuglNativeWindow parent; + int width; int height; int mods; bool mouse_in_view; bool ignoreKeyRepeat; bool redisplay; + bool resizable; uint32_t event_timestamp_ms; }; +PuglInternals* puglInitInternals(); + +void puglDefaultReshape(PuglView* view, int width, int height); + +PuglView* +puglInit(int* pargc, char** argv) +{ + PuglView* view = (PuglView*)calloc(1, sizeof(PuglView)); + if (!view) { + return NULL; + } + + PuglInternals* impl = puglInitInternals(); + if (!impl) { + return NULL; + } + + view->impl = impl; + view->width = 640; + view->height = 480; + + return view; +} + +void +puglInitWindowSize(PuglView* view, int width, int height) +{ + view->width = width; + view->height = height; +} + +void +puglInitWindowParent(PuglView* view, PuglNativeWindow parent) +{ + view->parent = parent; +} + +void +puglInitResizable(PuglView* view, bool resizable) +{ + view->resizable = true; +} + void puglSetHandle(PuglView* view, PuglHandle handle) { |