#include <stdlib.h>
#include <iostream>
-#include "glimports.hpp"
#include "glws.hpp"
+#include <X11/Xlib.h>
+#include <GL/gl.h>
+#include <GL/glx.h>
+
namespace glws {
display, window, name, name,
None, (char **)NULL, 0, &sizehints);
- XMapWindow(display, window);
-
- waitForEvent(window, Expose);
glXWaitX();
}
XResizeWindow(display, window, w, h);
+ // Tell the window manager to respect the requested size
+ XSizeHints *size_hints;
+ size_hints = XAllocSizeHints();
+ size_hints->max_width = size_hints->min_width = w;
+ size_hints->max_height = size_hints->min_height = h;
+ size_hints->flags = PMinSize | PMaxSize;
+ XSetWMNormalHints(display, window, size_hints);
+ XFree(size_hints);
+
waitForEvent(window, ConfigureNotify);
glXWaitX();
}
+ void show(void) {
+ if (!visible) {
+ XMapWindow(display, window);
+
+ waitForEvent(window, Expose);
+
+ Drawable::show();
+ }
+ }
+
void swapBuffers(void) {
glXSwapBuffers(display, window);
}
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
+ GLX_ALPHA_SIZE, 1,
GLX_DEPTH_SIZE, 1,
GLX_STENCIL_SIZE, 1,
None
GLX_RED_SIZE, 1,
GLX_GREEN_SIZE, 1,
GLX_BLUE_SIZE, 1,
+ GLX_ALPHA_SIZE, 1,
GLX_DOUBLEBUFFER,
GLX_DEPTH_SIZE, 1,
GLX_STENCIL_SIZE, 1,