summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/main.cpp b/main.cpp
index 87f5060..76838a2 100644
--- a/main.cpp
+++ b/main.cpp
@@ -41,13 +41,14 @@ void resize(int width, int height)
height=1;
}
- glViewport(0, 0, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
- gluPerspective(50.0f,(GLfloat)width/(GLfloat)height, 0.1, 1000);
+ gluPerspective(50.0f, (GLfloat)width/(GLfloat)height, 0.1, 1000);
glMatrixMode(GL_MODELVIEW);
+
+ glViewport(0, 0, width, height);
}
@@ -284,7 +285,7 @@ bool GLXinit(Display *disp, Atom windele, Window *wnd, GLXContext *gc, bool *mul
XSetWindowAttributes swa;
swa.colormap = cmap;
swa.border_pixel = 0;
- swa.event_mask = /*PointerMotionMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask*/0;
+ swa.event_mask = StructureNotifyMask/* | PointerMotionMask | KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask*/;
*wnd = XCreateWindow(disp, RootWindow(disp, vi->screen), 0, 0, DEFAULT_WIDTH, DEFAULT_HEIGHT, 0, vi->depth, InputOutput,
vi->visual, CWBorderPixel|CWColormap|CWEventMask, &swa);
@@ -353,10 +354,13 @@ int main() {
XEvent event;
XNextEvent(disp, &event);
switch(event.type) {
+ case ConfigureNotify:
+ resize(event.xconfigure.width, event.xconfigure.height);
+ break;
+
case ClientMessage:
if(static_cast<Atom>(event.xclient.data.l[0]) == windele)
running = false;
- break;
}
}