Linux: Moved resize to the callback function, where the Xevents are being checked on, possibly fixing the random freezing bug

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@468 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Sonicadvance1 2008-09-07 18:09:38 +00:00
parent 8f7c509a13
commit d6ac59f1cc
1 changed files with 26 additions and 10 deletions

View File

@ -92,8 +92,30 @@ BOOL Callback_PeekMessages()
XEvent event; XEvent event;
while (XPending(GLWin.dpy) > 0) { while (XPending(GLWin.dpy) > 0) {
XNextEvent(GLWin.dpy, &event); XNextEvent(GLWin.dpy, &event);
if(event.type == KeyPress || event.type == KeyRelease) switch(event.type)
XPutBackEvent(GLWin.dpy, &event); // We Don't want to deal with these types, This is a video plugin! {
case KeyPress:
case KeyRelease:
case ButtonPress:
case ButtonRelease:
XPutBackEvent(GLWin.dpy, &event); // We Don't want to deal with these types, This is a video plugin!
break;
case ConfigureNotify:
Window winDummy;
unsigned int borderDummy;
XGetGeometry(GLWin.dpy, GLWin.win, &winDummy, &GLWin.x, &GLWin.y,
&GLWin.width, &GLWin.height, &borderDummy, &GLWin.depth);
nBackbufferWidth = GLWin.width;
nBackbufferHeight = GLWin.height;
break;
case ClientMessage: //TODO: We aren't reading this correctly, It could be anything, highest change is that it's a close event though
Video_Shutdown(); // Calling from here since returning false does nothing
return false;
break;
default:
//TODO: Should we put the event back if we don't handle it?
break;
}
} }
return TRUE; return TRUE;
#endif #endif
@ -385,7 +407,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
/* create a fullscreen window */ /* create a fullscreen window */
GLWin.attr.override_redirect = True; GLWin.attr.override_redirect = True;
GLWin.attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask | GLWin.attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask |
StructureNotifyMask; StructureNotifyMask | ResizeRedirectMask;
GLWin.win = XCreateWindow(GLWin.dpy, RootWindow(GLWin.dpy, vi->screen), GLWin.win = XCreateWindow(GLWin.dpy, RootWindow(GLWin.dpy, vi->screen),
0, 0, dpyWidth, dpyHeight, 0, vi->depth, InputOutput, vi->visual, 0, 0, dpyWidth, dpyHeight, 0, vi->depth, InputOutput, vi->visual,
CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect, CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect,
@ -508,13 +530,7 @@ void OpenGL_Update()
nBackbufferHeight = height; nBackbufferHeight = height;
#else // GLX #else // GLX
Window winDummy; // We do our resizing inside of the Callback function
unsigned int borderDummy;
XGetGeometry(GLWin.dpy, GLWin.win, &winDummy, &GLWin.x, &GLWin.y,
&GLWin.width, &GLWin.height, &borderDummy, &GLWin.depth);
nBackbufferWidth = GLWin.width;
nBackbufferHeight = GLWin.height;
#endif #endif
float FactorW = 640.0f / (float)nBackbufferWidth; float FactorW = 640.0f / (float)nBackbufferWidth;