Fix padsimple to work

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@563 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Sonicadvance1 2008-09-17 17:00:53 +00:00
parent f198d550bc
commit bb685d4fb4

View File

@ -380,14 +380,14 @@ 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 | StructureNotifyMask; GLWin.attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask | KeyReleaseMask | ButtonReleaseMask | StructureNotifyMask;
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,
&GLWin.attr); &GLWin.attr);
XWarpPointer(GLWin.dpy, None, GLWin.win, 0, 0, 0, 0, 0, 0); XWarpPointer(GLWin.dpy, None, GLWin.win, 0, 0, 0, 0, 0, 0);
XMapRaised(GLWin.dpy, GLWin.win); XMapRaised(GLWin.dpy, GLWin.win);
//XGrabKeyboard(GLWin.dpy, GLWin.win, True, GrabModeAsync, GrabModeAsync, CurrentTime); XGrabKeyboard(GLWin.dpy, GLWin.win, True, GrabModeAsync, GrabModeAsync, CurrentTime);
XGrabPointer(GLWin.dpy, GLWin.win, True, ButtonPressMask, XGrabPointer(GLWin.dpy, GLWin.win, True, ButtonPressMask,
GrabModeAsync, GrabModeAsync, GLWin.win, None, CurrentTime); GrabModeAsync, GrabModeAsync, GLWin.win, None, CurrentTime);
} }
@ -408,7 +408,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
//int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2; //int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
// create a window in window mode // create a window in window mode
GLWin.attr.event_mask = ExposureMask | GLWin.attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask | KeyReleaseMask | ButtonReleaseMask |
StructureNotifyMask | ResizeRedirectMask; StructureNotifyMask | ResizeRedirectMask;
GLWin.win = XCreateWindow(GLWin.dpy, RootWindow(GLWin.dpy, vi->screen), GLWin.win = XCreateWindow(GLWin.dpy, RootWindow(GLWin.dpy, vi->screen),
0, 0, _twidth, _theight, 0, vi->depth, InputOutput, vi->visual, 0, 0, _twidth, _theight, 0, vi->depth, InputOutput, vi->visual,
@ -475,7 +475,7 @@ bool OpenGL_MakeCurrent()
ERROR_LOG("no Direct Rendering possible!"); ERROR_LOG("no Direct Rendering possible!");
// better for pad plugin key input (thc) // better for pad plugin key input (thc)
XSelectInput(GLWin.dpy, GLWin.win, ExposureMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask | XSelectInput(GLWin.dpy, GLWin.win, ExposureMask | KeyPressMask | ButtonPressMask | KeyReleaseMask | ButtonReleaseMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask |
FocusChangeMask ); FocusChangeMask );
#endif #endif
return true; return true;
@ -504,7 +504,8 @@ void OpenGL_Update()
#else // GLX #else // GLX
// We just check all of our events here // We just check all of our events here
XEvent event; XEvent event;
while (XPending(GLWin.dpy) > 0) { int num_events = XPending(GLWin.dpy);
while (XPending(GLWin.dpy) > 0 && num_events != 0) {
XNextEvent(GLWin.dpy, &event); XNextEvent(GLWin.dpy, &event);
switch(event.type) switch(event.type)
{ {
@ -512,8 +513,8 @@ void OpenGL_Update()
case KeyRelease: case KeyRelease:
case ButtonPress: case ButtonPress:
case ButtonRelease: case ButtonRelease:
printf("You have reached a section of code that you should never reach in a video plugin\n If you think that you are not in error, please contact the devs\n"); //Quickly! Put it back in so padsimple can use it!
//XPutBackEvent(GLWin.dpy, &event); // We Don't want to deal with these types, This is a video plugin! XPutBackEvent(GLWin.dpy, &event);
break; break;
case ConfigureNotify: case ConfigureNotify:
Window winDummy; Window winDummy;
@ -532,6 +533,7 @@ void OpenGL_Update()
// I think we handle all the needed ones, the rest shouldn't matter // I think we handle all the needed ones, the rest shouldn't matter
break; break;
} }
num_events--;
} }
return; return;
#endif #endif