aboutsummaryrefslogtreecommitdiffstats
path: root/pugl/pugl_x11.c
diff options
context:
space:
mode:
Diffstat (limited to 'pugl/pugl_x11.c')
-rw-r--r--pugl/pugl_x11.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/pugl/pugl_x11.c b/pugl/pugl_x11.c
index 5844f2d..f85e18b 100644
--- a/pugl/pugl_x11.c
+++ b/pugl/pugl_x11.c
@@ -62,7 +62,11 @@ static int attrListDbl[] = {
};
PuglWindow*
-puglCreate(PuglNativeWindow parent, const char* title, int width, int height)
+puglCreate(PuglNativeWindow parent,
+ const char* title,
+ int width,
+ int height,
+ bool resizable)
{
PuglWindow* win = (PuglWindow*)calloc(1, sizeof(PuglWindow));
@@ -112,6 +116,17 @@ puglCreate(PuglNativeWindow parent, const char* title, int width, int height)
0, 0, win->width, win->height, 0, vi->depth, InputOutput, vi->visual,
CWBorderPixel | CWColormap | CWEventMask, &attr);
+ XSizeHints sizeHints;
+ memset(&sizeHints, 0, sizeof(sizeHints));
+ if (!resizable) {
+ sizeHints.flags = PMinSize|PMaxSize;
+ sizeHints.min_width = width;
+ sizeHints.min_height = height;
+ sizeHints.max_width = width;
+ sizeHints.max_height = height;
+ XSetNormalHints(impl->display, impl->win, &sizeHints);
+ }
+
if (title) {
XStoreName(impl->display, impl->win, title);
}
@@ -187,6 +202,8 @@ puglProcessEvents(PuglWindow* win)
event.xconfigure.width,
event.xconfigure.height);
}
+ win->width = event.xconfigure.width;
+ win->height = event.xconfigure.height;
}
break;
case MotionNotify: