mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 06:39:46 -06:00
all this to make stop work without message passing
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@744 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -76,10 +76,10 @@ void OpenGL_SetWindowText(const char *text)
|
||||
BOOL Callback_PeekMessages()
|
||||
{
|
||||
#if USE_SDL
|
||||
// TODO: There is no documentation of this function and the calling code
|
||||
// ignores the return value, so I have no idea what would be the
|
||||
// TODO: There is no documentation of this function and the calling code
|
||||
// ignores the return value, so I have no idea what would be the
|
||||
// proper value to return.
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
#elif defined(_WIN32)
|
||||
//TODO: peekmessage
|
||||
MSG msg;
|
||||
@ -94,7 +94,7 @@ BOOL Callback_PeekMessages()
|
||||
#else // GLX
|
||||
// This is called from Outside of our video thread, from EmuThread
|
||||
// The calls are NOT thread safe, so it breaks everything
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -427,8 +427,8 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OpenGL_MakeCurrent()
|
||||
{
|
||||
bool OpenGL_MakeCurrent()
|
||||
{
|
||||
#if USE_SDL
|
||||
// Note: The reason for having the call to SDL_SetVideoMode in here instead
|
||||
// of in OpenGL_Create() is that "make current" is part of the video
|
||||
@ -504,70 +504,70 @@ void OpenGL_Update()
|
||||
nBackbufferWidth = width;
|
||||
nBackbufferHeight = height;
|
||||
|
||||
#else // GLX
|
||||
// We just check all of our events here
|
||||
XEvent event;
|
||||
KeySym key;
|
||||
static bool ShiftPressed = false;
|
||||
static bool ControlPressed = false;
|
||||
static int FKeyPressed = -1;
|
||||
int num_events;
|
||||
for (num_events = XPending(GLWin.dpy);num_events > 0;num_events--) {
|
||||
XNextEvent(GLWin.dpy, &event);
|
||||
switch(event.type) {
|
||||
case KeyRelease:
|
||||
key = XLookupKeysym((XKeyEvent*)&event, 0);
|
||||
if(key >= XK_F1 && key <= XK_F9) {
|
||||
g_VideoInitialize.pKeyPress(FKeyPressed, ShiftPressed, ControlPressed);
|
||||
FKeyPressed = -1;
|
||||
} else {
|
||||
if(key == XK_Shift_L || key == XK_Shift_R)
|
||||
ShiftPressed = false;
|
||||
else if(key == XK_Control_L || key == XK_Control_R)
|
||||
ControlPressed = false;
|
||||
else
|
||||
XPutBackEvent(GLWin.dpy, &event);
|
||||
}
|
||||
break;
|
||||
case KeyPress:
|
||||
key = XLookupKeysym((XKeyEvent*)&event, 0);
|
||||
if(key >= XK_F1 && key <= XK_F9)
|
||||
FKeyPressed = key - 0xff4e;
|
||||
else {
|
||||
if(key == XK_Shift_L || key == XK_Shift_R)
|
||||
ShiftPressed = true;
|
||||
else if(key == XK_Control_L || key == XK_Control_R)
|
||||
ControlPressed = true;
|
||||
else
|
||||
XPutBackEvent(GLWin.dpy, &event);
|
||||
}
|
||||
break;
|
||||
case ButtonPress:
|
||||
case ButtonRelease:
|
||||
XPutBackEvent(GLWin.dpy, &event);
|
||||
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;
|
||||
break;
|
||||
default:
|
||||
//TODO: Should we put the event back if we don't handle it?
|
||||
// I think we handle all the needed ones, the rest shouldn't matter
|
||||
// But to be safe, let's but them back anyway
|
||||
//XPutBackEvent(GLWin.dpy, &event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
#endif
|
||||
#else // GLX
|
||||
// We just check all of our events here
|
||||
XEvent event;
|
||||
KeySym key;
|
||||
static bool ShiftPressed = false;
|
||||
static bool ControlPressed = false;
|
||||
static int FKeyPressed = -1;
|
||||
int num_events;
|
||||
for (num_events = XPending(GLWin.dpy);num_events > 0;num_events--) {
|
||||
XNextEvent(GLWin.dpy, &event);
|
||||
switch(event.type) {
|
||||
case KeyRelease:
|
||||
key = XLookupKeysym((XKeyEvent*)&event, 0);
|
||||
if(key >= XK_F1 && key <= XK_F9) {
|
||||
g_VideoInitialize.pKeyPress(FKeyPressed, ShiftPressed, ControlPressed);
|
||||
FKeyPressed = -1;
|
||||
} else {
|
||||
if(key == XK_Shift_L || key == XK_Shift_R)
|
||||
ShiftPressed = false;
|
||||
else if(key == XK_Control_L || key == XK_Control_R)
|
||||
ControlPressed = false;
|
||||
else
|
||||
XPutBackEvent(GLWin.dpy, &event);
|
||||
}
|
||||
break;
|
||||
case KeyPress:
|
||||
key = XLookupKeysym((XKeyEvent*)&event, 0);
|
||||
if(key >= XK_F1 && key <= XK_F9)
|
||||
FKeyPressed = key - 0xff4e;
|
||||
else {
|
||||
if(key == XK_Shift_L || key == XK_Shift_R)
|
||||
ShiftPressed = true;
|
||||
else if(key == XK_Control_L || key == XK_Control_R)
|
||||
ControlPressed = true;
|
||||
else
|
||||
XPutBackEvent(GLWin.dpy, &event);
|
||||
}
|
||||
break;
|
||||
case ButtonPress:
|
||||
case ButtonRelease:
|
||||
XPutBackEvent(GLWin.dpy, &event);
|
||||
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;
|
||||
break;
|
||||
default:
|
||||
//TODO: Should we put the event back if we don't handle it?
|
||||
// I think we handle all the needed ones, the rest shouldn't matter
|
||||
// But to be safe, let's but them back anyway
|
||||
//XPutBackEvent(GLWin.dpy, &event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
#endif
|
||||
|
||||
float FactorW = 640.0f / (float)nBackbufferWidth;
|
||||
float FactorH = 480.0f / (float)nBackbufferHeight;
|
||||
|
Reference in New Issue
Block a user