Fix software plugin in linux. I broke it in revision 5048.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5077 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Glenn Rice 2010-02-17 23:15:58 +00:00
parent 5e5e03daeb
commit 2c7b484869
4 changed files with 18 additions and 24 deletions

View File

@ -5,6 +5,7 @@
#ifndef _VIDEO_H_INCLUDED__
#define _VIDEO_H_INCLUDED__
#include "Common.h"
#include "PluginSpecs.h"
#include "ExportProlog.h"

View File

@ -385,7 +385,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _twidth, int _theight
/* create a fullscreen window */
GLWin.attr.override_redirect = True;
GLWin.attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask | KeyReleaseMask | ButtonReleaseMask | StructureNotifyMask;
GLWin.attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask | StructureNotifyMask;
GLWin.win = XCreateWindow(GLWin.dpy, RootWindow(GLWin.dpy, vi->screen),
0, 0, dpyWidth, dpyHeight, 0, vi->depth, InputOutput, vi->visual,
CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect,
@ -393,7 +393,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _twidth, int _theight
XWarpPointer(GLWin.dpy, None, GLWin.win, 0, 0, 0, 0, 0, 0);
XMapRaised(GLWin.dpy, GLWin.win);
XGrabKeyboard(GLWin.dpy, GLWin.win, True, GrabModeAsync, GrabModeAsync, CurrentTime);
XGrabPointer(GLWin.dpy, GLWin.win, True, ButtonPressMask,
XGrabPointer(GLWin.dpy, GLWin.win, True, NULL,
GrabModeAsync, GrabModeAsync, GLWin.win, None, CurrentTime);
}
else {
@ -413,7 +413,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _twidth, int _theight
//int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
// create a window in window mode
GLWin.attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask | KeyReleaseMask | ButtonReleaseMask |
GLWin.attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask |
StructureNotifyMask | ResizeRedirectMask;
GLWin.win = XCreateWindow(GLWin.dpy, RootWindow(GLWin.dpy, vi->screen),
0, 0, _twidth, _theight, 0, vi->depth, InputOutput, vi->visual,
@ -425,6 +425,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _twidth, int _theight
"GPU", None, NULL, 0, NULL);
XMapRaised(GLWin.dpy, GLWin.win);
}
g_VideoInitialize.pXWindow = (Window *) &GLWin.win;
#endif
return true;
}
@ -455,8 +456,8 @@ bool OpenGL_MakeCurrent()
}
// better for pad plugin key input (thc)
XSelectInput(GLWin.dpy, GLWin.win, ExposureMask | KeyPressMask | ButtonPressMask | KeyReleaseMask | ButtonReleaseMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask |
FocusChangeMask );
XSelectInput(GLWin.dpy, GLWin.win, ExposureMask | KeyPressMask | KeyReleaseMask |
StructureNotifyMask | EnterWindowMask | LeaveWindowMask | FocusChangeMask );
#endif
return true;
}
@ -507,7 +508,6 @@ void OpenGL_Update()
// We just check all of our events here
XEvent event;
KeySym key;
static RECT rcWindow;
static bool ShiftPressed = false;
static bool ControlPressed = false;
static int FKeyPressed = -1;
@ -525,8 +525,6 @@ void OpenGL_Update()
ShiftPressed = false;
else if(key == XK_Control_L || key == XK_Control_R)
ControlPressed = false;
else
XPutBackEvent(GLWin.dpy, &event);
}
break;
case KeyPress:
@ -538,13 +536,10 @@ void OpenGL_Update()
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;
@ -553,20 +548,13 @@ void OpenGL_Update()
&GLWin.width, &GLWin.height, &borderDummy, &GLWin.depth);
s_backbuffer_width = GLWin.width;
s_backbuffer_height = GLWin.height;
rcWindow.left = 0;
rcWindow.top = 0;
rcWindow.right = GLWin.width;
rcWindow.bottom = GLWin.height;
break;
case ClientMessage: //TODO: We aren't reading this correctly, It could be anything, highest chance is that it's a close event though
Shutdown(); // Calling from here since returning false does nothing
case ClientMessage:
if ((ulong) event.xclient.data.l[0] == XInternAtom(GLWin.dpy, "WM_DELETE_WINDOW", False))
g_VideoInitialize.pKeyPress(0x1b, False, False);
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;
}
}
@ -619,6 +607,7 @@ void OpenGL_Shutdown()
XRRFreeScreenConfigInfo(GLWin.screenConfig);
}
#endif
printf ("Unmapping window\n");
if (GLWin.ctx)
{
if (!glXMakeCurrent(GLWin.dpy, None, NULL))

View File

@ -40,6 +40,9 @@ void Renderer::Init(SVideoInitialize *_pVideoInitialize)
_pVideoInitialize->pPeekMessages = g_VideoInitialize.pPeekMessages;
_pVideoInitialize->pUpdateFPSDisplay = g_VideoInitialize.pUpdateFPSDisplay;
_pVideoInitialize->pWindowHandle = g_VideoInitialize.pWindowHandle;
#if defined(HAVE_X11) && HAVE_X11
_pVideoInitialize->pXWindow = g_VideoInitialize.pXWindow;
#endif
}
void Renderer::Shutdown()

View File

@ -98,6 +98,7 @@ void EmuStateChange(PLUGIN_EMUSTATE newState)
void Shutdown(void)
{
OpenGL_Shutdown();
}
// This is called after Video_Initialize() from the Core