aboutsummaryrefslogtreecommitdiffstats
path: root/pugl/detail/implementation.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-07-22 18:49:09 +0200
committerDavid Robillard <d@drobilla.net>2019-09-03 08:34:38 +0200
commit816607027012de0205e144f3edd3fdcfd43db563 (patch)
tree6baafc16e21b6186c51d9ada7c97116b6a30811c /pugl/detail/implementation.c
parentf76954359229c25a6c9d29d6de3e75ab3a25f8dd (diff)
downloadpugl-816607027012de0205e144f3edd3fdcfd43db563.tar.gz
pugl-816607027012de0205e144f3edd3fdcfd43db563.tar.bz2
pugl-816607027012de0205e144f3edd3fdcfd43db563.zip
Add functions to get and set view size and position
Diffstat (limited to 'pugl/detail/implementation.c')
-rw-r--r--pugl/detail/implementation.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/pugl/detail/implementation.c b/pugl/detail/implementation.c
index 6ec19c2..53af30b 100644
--- a/pugl/detail/implementation.c
+++ b/pugl/detail/implementation.c
@@ -89,9 +89,9 @@ puglNewView(PuglWorld* const world)
return NULL;
}
- view->world = world;
- view->width = 640;
- view->height = 480;
+ view->world = world;
+ view->frame.width = 640;
+ view->frame.height = 480;
puglSetDefaultHints(view->hints);
@@ -138,8 +138,8 @@ puglInitWindowHint(PuglView* view, PuglWindowHint hint, int value)
void
puglInitWindowSize(PuglView* view, int width, int height)
{
- view->width = width;
- view->height = height;
+ view->frame.width = width;
+ view->frame.height = height;
}
void
@@ -218,8 +218,14 @@ puglGetVisible(PuglView* view)
void
puglGetSize(PuglView* view, int* width, int* height)
{
- *width = view->width;
- *height = view->height;
+ *width = (int)view->frame.width;
+ *height = (int)view->frame.height;
+}
+
+PuglRect
+puglGetFrame(const PuglView* view)
+{
+ return view->frame;
}
void*
@@ -293,8 +299,6 @@ puglDispatchEvent(PuglView* view, const PuglEvent* event)
case PUGL_NOTHING:
break;
case PUGL_CONFIGURE:
- view->width = (int)event->configure.width;
- view->height = (int)event->configure.height;
puglEnterContext(view, false);
view->eventFunc(view, event);
puglLeaveContext(view, false);