aboutsummaryrefslogtreecommitdiffstats
path: root/pugl/detail
diff options
context:
space:
mode:
Diffstat (limited to 'pugl/detail')
-rw-r--r--pugl/detail/implementation.c20
-rw-r--r--pugl/detail/mac.m34
-rw-r--r--pugl/detail/win.c22
-rw-r--r--pugl/detail/x11.c38
4 files changed, 94 insertions, 20 deletions
diff --git a/pugl/detail/implementation.c b/pugl/detail/implementation.c
index d6e4b86..f971284 100644
--- a/pugl/detail/implementation.c
+++ b/pugl/detail/implementation.c
@@ -128,26 +128,6 @@ puglInitWindowHint(PuglView* view, PuglWindowHint hint, int value)
}
void
-puglInitWindowMinSize(PuglView* view, int width, int height)
-{
- view->minWidth = width;
- view->minHeight = height;
-}
-
-void
-puglInitWindowAspectRatio(PuglView* view,
- int minX,
- int minY,
- int maxX,
- int maxY)
-{
- view->minAspectX = minX;
- view->minAspectY = minY;
- view->maxAspectX = maxX;
- view->maxAspectY = maxY;
-}
-
-void
puglInitWindowClass(PuglView* view, const char* name)
{
const size_t len = strlen(name);
diff --git a/pugl/detail/mac.m b/pugl/detail/mac.m
index ea55c0f..6d156c6 100644
--- a/pugl/detail/mac.m
+++ b/pugl/detail/mac.m
@@ -966,3 +966,37 @@ puglSetFrame(PuglView* view, const PuglRect frame)
return PUGL_SUCCESS;
}
+
+PuglStatus
+puglSetMinSize(PuglView* const view, const int width, const int height)
+{
+ view->minWidth = width;
+ view->minHeight = height;
+
+ if (view->impl->window && (view->minWidth || view->minHeight)) {
+ [view->impl->window
+ setContentMinSize:NSMakeSize(view->minWidth, view->minHeight)];
+ }
+
+ return PUGL_SUCCESS;
+}
+
+PuglStatus
+puglSetAspectRatio(PuglView* const view,
+ const int minX,
+ const int minY,
+ const int maxX,
+ const int maxY)
+{
+ view->minAspectX = minX;
+ view->minAspectY = minY;
+ view->maxAspectX = maxX;
+ view->maxAspectY = maxY;
+
+ if (view->impl->window && view->minAspectX && view->minAspectY) {
+ [view->impl->window setContentAspectRatio:NSMakeSize(view->minAspectX,
+ view->minAspectY)];
+ }
+
+ return PUGL_SUCCESS;
+}
diff --git a/pugl/detail/win.c b/pugl/detail/win.c
index 2c4074c..96642cc 100644
--- a/pugl/detail/win.c
+++ b/pugl/detail/win.c
@@ -804,3 +804,25 @@ puglSetFrame(PuglView* view, const PuglRect frame)
return PUGL_SUCCESS;
}
+
+PuglStatus
+puglSetMinSize(PuglView* const view, const int width, const int height)
+{
+ view->minWidth = width;
+ view->minHeight = height;
+ return PUGL_SUCCESS;
+}
+
+PuglStatus
+puglSetAspectRatio(PuglView* const view,
+ const int minX,
+ const int minY,
+ const int maxX,
+ const int maxY)
+{
+ view->minAspectX = minX;
+ view->minAspectY = minY;
+ view->maxAspectX = maxX;
+ view->maxAspectY = maxY;
+ return PUGL_SUCCESS;
+}
diff --git a/pugl/detail/x11.c b/pugl/detail/x11.c
index 1e1f96f..d7b7677 100644
--- a/pugl/detail/x11.c
+++ b/pugl/detail/x11.c
@@ -723,3 +723,41 @@ puglSetFrame(PuglView* view, const PuglRect frame)
return PUGL_SUCCESS;
}
+
+PuglStatus
+puglSetMinSize(PuglView* const view, const int width, const int height)
+{
+ Display* display = view->world->impl->display;
+
+ view->minWidth = width;
+ view->minHeight = height;
+
+ if (view->impl->win) {
+ XSizeHints sizeHints = getSizeHints(view);
+ XSetNormalHints(display, view->impl->win, &sizeHints);
+ }
+
+ return PUGL_SUCCESS;
+}
+
+PuglStatus
+puglSetAspectRatio(PuglView* const view,
+ const int minX,
+ const int minY,
+ const int maxX,
+ const int maxY)
+{
+ Display* display = view->world->impl->display;
+
+ view->minAspectX = minX;
+ view->minAspectY = minY;
+ view->maxAspectX = maxX;
+ view->maxAspectY = maxY;
+
+ if (view->impl->win) {
+ XSizeHints sizeHints = getSizeHints(view);
+ XSetNormalHints(display, view->impl->win, &sizeHints);
+ }
+
+ return PUGL_SUCCESS;
+}