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:
parent
5e5e03daeb
commit
2c7b484869
|
@ -5,6 +5,7 @@
|
||||||
#ifndef _VIDEO_H_INCLUDED__
|
#ifndef _VIDEO_H_INCLUDED__
|
||||||
#define _VIDEO_H_INCLUDED__
|
#define _VIDEO_H_INCLUDED__
|
||||||
|
|
||||||
|
#include "Common.h"
|
||||||
#include "PluginSpecs.h"
|
#include "PluginSpecs.h"
|
||||||
|
|
||||||
#include "ExportProlog.h"
|
#include "ExportProlog.h"
|
||||||
|
|
|
@ -385,7 +385,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _twidth, int _theight
|
||||||
|
|
||||||
/* 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 | KeyReleaseMask | ButtonReleaseMask | StructureNotifyMask;
|
GLWin.attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask | 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,
|
||||||
|
@ -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);
|
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, NULL,
|
||||||
GrabModeAsync, GrabModeAsync, GLWin.win, None, CurrentTime);
|
GrabModeAsync, GrabModeAsync, GLWin.win, None, CurrentTime);
|
||||||
}
|
}
|
||||||
else {
|
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;
|
//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 | KeyPressMask | ButtonPressMask | KeyReleaseMask | ButtonReleaseMask |
|
GLWin.attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask |
|
||||||
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,
|
||||||
|
@ -425,6 +425,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _twidth, int _theight
|
||||||
"GPU", None, NULL, 0, NULL);
|
"GPU", None, NULL, 0, NULL);
|
||||||
XMapRaised(GLWin.dpy, GLWin.win);
|
XMapRaised(GLWin.dpy, GLWin.win);
|
||||||
}
|
}
|
||||||
|
g_VideoInitialize.pXWindow = (Window *) &GLWin.win;
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -455,8 +456,8 @@ bool OpenGL_MakeCurrent()
|
||||||
}
|
}
|
||||||
|
|
||||||
// better for pad plugin key input (thc)
|
// better for pad plugin key input (thc)
|
||||||
XSelectInput(GLWin.dpy, GLWin.win, ExposureMask | KeyPressMask | ButtonPressMask | KeyReleaseMask | ButtonReleaseMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask |
|
XSelectInput(GLWin.dpy, GLWin.win, ExposureMask | KeyPressMask | KeyReleaseMask |
|
||||||
FocusChangeMask );
|
StructureNotifyMask | EnterWindowMask | LeaveWindowMask | FocusChangeMask );
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -507,7 +508,6 @@ void OpenGL_Update()
|
||||||
// We just check all of our events here
|
// We just check all of our events here
|
||||||
XEvent event;
|
XEvent event;
|
||||||
KeySym key;
|
KeySym key;
|
||||||
static RECT rcWindow;
|
|
||||||
static bool ShiftPressed = false;
|
static bool ShiftPressed = false;
|
||||||
static bool ControlPressed = false;
|
static bool ControlPressed = false;
|
||||||
static int FKeyPressed = -1;
|
static int FKeyPressed = -1;
|
||||||
|
@ -525,8 +525,6 @@ void OpenGL_Update()
|
||||||
ShiftPressed = false;
|
ShiftPressed = false;
|
||||||
else if(key == XK_Control_L || key == XK_Control_R)
|
else if(key == XK_Control_L || key == XK_Control_R)
|
||||||
ControlPressed = false;
|
ControlPressed = false;
|
||||||
else
|
|
||||||
XPutBackEvent(GLWin.dpy, &event);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
|
@ -538,13 +536,10 @@ void OpenGL_Update()
|
||||||
ShiftPressed = true;
|
ShiftPressed = true;
|
||||||
else if(key == XK_Control_L || key == XK_Control_R)
|
else if(key == XK_Control_L || key == XK_Control_R)
|
||||||
ControlPressed = true;
|
ControlPressed = true;
|
||||||
else
|
|
||||||
XPutBackEvent(GLWin.dpy, &event);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ButtonPress:
|
case ButtonPress:
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
XPutBackEvent(GLWin.dpy, &event);
|
|
||||||
break;
|
break;
|
||||||
case ConfigureNotify:
|
case ConfigureNotify:
|
||||||
Window winDummy;
|
Window winDummy;
|
||||||
|
@ -553,20 +548,13 @@ void OpenGL_Update()
|
||||||
&GLWin.width, &GLWin.height, &borderDummy, &GLWin.depth);
|
&GLWin.width, &GLWin.height, &borderDummy, &GLWin.depth);
|
||||||
s_backbuffer_width = GLWin.width;
|
s_backbuffer_width = GLWin.width;
|
||||||
s_backbuffer_height = GLWin.height;
|
s_backbuffer_height = GLWin.height;
|
||||||
rcWindow.left = 0;
|
|
||||||
rcWindow.top = 0;
|
|
||||||
rcWindow.right = GLWin.width;
|
|
||||||
rcWindow.bottom = GLWin.height;
|
|
||||||
break;
|
break;
|
||||||
case ClientMessage: //TODO: We aren't reading this correctly, It could be anything, highest chance is that it's a close event though
|
case ClientMessage:
|
||||||
Shutdown(); // Calling from here since returning false does nothing
|
if ((ulong) event.xclient.data.l[0] == XInternAtom(GLWin.dpy, "WM_DELETE_WINDOW", False))
|
||||||
|
g_VideoInitialize.pKeyPress(0x1b, False, False);
|
||||||
return;
|
return;
|
||||||
break;
|
break;
|
||||||
default:
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -614,11 +602,12 @@ void OpenGL_Shutdown()
|
||||||
if ((GLWin.dpy != NULL) && GLWin.fs) {
|
if ((GLWin.dpy != NULL) && GLWin.fs) {
|
||||||
XUngrabKeyboard (GLWin.dpy, CurrentTime);
|
XUngrabKeyboard (GLWin.dpy, CurrentTime);
|
||||||
XUngrabPointer (GLWin.dpy, CurrentTime);
|
XUngrabPointer (GLWin.dpy, CurrentTime);
|
||||||
XRRSetScreenConfig(GLWin.dpy, GLWin.screenConfig, RootWindow(GLWin.dpy, GLWin.screen),
|
XRRSetScreenConfig(GLWin.dpy, GLWin.screenConfig, RootWindow(GLWin.dpy, GLWin.screen),
|
||||||
GLWin.deskSize, GLWin.screenRotation, CurrentTime);
|
GLWin.deskSize, GLWin.screenRotation, CurrentTime);
|
||||||
XRRFreeScreenConfigInfo(GLWin.screenConfig);
|
XRRFreeScreenConfigInfo(GLWin.screenConfig);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
printf ("Unmapping window\n");
|
||||||
if (GLWin.ctx)
|
if (GLWin.ctx)
|
||||||
{
|
{
|
||||||
if (!glXMakeCurrent(GLWin.dpy, None, NULL))
|
if (!glXMakeCurrent(GLWin.dpy, None, NULL))
|
||||||
|
|
|
@ -40,6 +40,9 @@ void Renderer::Init(SVideoInitialize *_pVideoInitialize)
|
||||||
_pVideoInitialize->pPeekMessages = g_VideoInitialize.pPeekMessages;
|
_pVideoInitialize->pPeekMessages = g_VideoInitialize.pPeekMessages;
|
||||||
_pVideoInitialize->pUpdateFPSDisplay = g_VideoInitialize.pUpdateFPSDisplay;
|
_pVideoInitialize->pUpdateFPSDisplay = g_VideoInitialize.pUpdateFPSDisplay;
|
||||||
_pVideoInitialize->pWindowHandle = g_VideoInitialize.pWindowHandle;
|
_pVideoInitialize->pWindowHandle = g_VideoInitialize.pWindowHandle;
|
||||||
|
#if defined(HAVE_X11) && HAVE_X11
|
||||||
|
_pVideoInitialize->pXWindow = g_VideoInitialize.pXWindow;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::Shutdown()
|
void Renderer::Shutdown()
|
||||||
|
|
|
@ -98,6 +98,7 @@ void EmuStateChange(PLUGIN_EMUSTATE newState)
|
||||||
|
|
||||||
void Shutdown(void)
|
void Shutdown(void)
|
||||||
{
|
{
|
||||||
|
OpenGL_Shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is called after Video_Initialize() from the Core
|
// This is called after Video_Initialize() from the Core
|
||||||
|
|
Loading…
Reference in New Issue