aboutsummaryrefslogtreecommitdiffstats
path: root/pugl/pugl_x11.c
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2015-09-12 15:22:49 -0400
committerDavid Robillard <d@drobilla.net>2015-09-12 15:22:49 -0400
commit6b4a5a128ef5d87374dfef017cd20e069c068a4b (patch)
tree6c869caad82ef1eb39a4c8bff8b2bad85540436c /pugl/pugl_x11.c
parentae2153511097fc0cc34c0456ebbb13fd4f5c79ec (diff)
downloadpugl-6b4a5a128ef5d87374dfef017cd20e069c068a4b.tar.gz
pugl-6b4a5a128ef5d87374dfef017cd20e069c068a4b.tar.bz2
pugl-6b4a5a128ef5d87374dfef017cd20e069c068a4b.zip
Add support for aspect ratio constraints.
Currently only implemented on X11.
Diffstat (limited to 'pugl/pugl_x11.c')
-rw-r--r--pugl/pugl_x11.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/pugl/pugl_x11.c b/pugl/pugl_x11.c
index bd85b37..6375609 100644
--- a/pugl/pugl_x11.c
+++ b/pugl/pugl_x11.c
@@ -214,10 +214,20 @@ puglCreateWindow(PuglView* view, const char* title)
sizeHints.max_width = view->width;
sizeHints.max_height = view->height;
XSetNormalHints(impl->display, impl->win, &sizeHints);
- } else if (view->min_width || view->min_height) {
- sizeHints.flags = PMinSize;
- sizeHints.min_width = view->min_width;
- sizeHints.min_height = view->min_height;
+ } else {
+ if (view->min_width || view->min_height) {
+ sizeHints.flags = PMinSize;
+ sizeHints.min_width = view->min_width;
+ sizeHints.min_height = view->min_height;
+ }
+ if (view->min_aspect_x) {
+ sizeHints.flags |= PAspect;
+ sizeHints.min_aspect.x = view->min_aspect_x;
+ sizeHints.min_aspect.y = view->min_aspect_y;
+ sizeHints.max_aspect.x = view->max_aspect_x;
+ sizeHints.max_aspect.y = view->max_aspect_y;
+ }
+
XSetNormalHints(impl->display, impl->win, &sizeHints);
}