mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-31 01:59:52 -06:00
This is basicall linux code cleanup. We don not need to pass the X display handle from the video plugin anymore. The wiimote plugins now open their own display handles, and the GUI uses the display handle of the main window frame. Only the window handle from the video plugin is needed. The pWindowHandle variable now passes this instead of the display handle.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5884 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@ -127,7 +127,8 @@ void CreateXWindow (void)
|
||||
GLWin.attr.colormap = XCreateColormap(GLWin.dpy,
|
||||
GLWin.parent, GLWin.vi->visual, AllocNone);
|
||||
GLWin.attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask |
|
||||
StructureNotifyMask | ResizeRedirectMask;
|
||||
StructureNotifyMask | ResizeRedirectMask | EnterWindowMask |
|
||||
LeaveWindowMask | FocusChangeMask;
|
||||
GLWin.attr.background_pixel = BlackPixel(GLWin.dpy, GLWin.screen);
|
||||
GLWin.attr.border_pixel = 0;
|
||||
|
||||
@ -138,8 +139,6 @@ void CreateXWindow (void)
|
||||
wmProtocols[0] = XInternAtom(GLWin.dpy, "WM_DELETE_WINDOW", True);
|
||||
XSetWMProtocols(GLWin.dpy, GLWin.win, wmProtocols, 1);
|
||||
XSetStandardProperties(GLWin.dpy, GLWin.win, "GPU", "GPU", None, NULL, 0, NULL);
|
||||
XSelectInput(GLWin.dpy, GLWin.win, ExposureMask | KeyPressMask | KeyReleaseMask |
|
||||
StructureNotifyMask | EnterWindowMask | LeaveWindowMask | FocusChangeMask );
|
||||
XMapRaised(GLWin.dpy, GLWin.win);
|
||||
XSync(GLWin.dpy, True);
|
||||
|
||||
@ -359,7 +358,6 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
||||
|
||||
GLWin.dpy = XOpenDisplay(0);
|
||||
GLWin.parent = (Window)g_VideoInitialize.pWindowHandle;
|
||||
g_VideoInitialize.pWindowHandle = (Display *)GLWin.dpy;
|
||||
GLWin.screen = DefaultScreen(GLWin.dpy);
|
||||
if (GLWin.parent == 0)
|
||||
GLWin.parent = RootWindow(GLWin.dpy, GLWin.screen);
|
||||
@ -404,7 +402,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
||||
GLWin.height = _theight;
|
||||
|
||||
CreateXWindow();
|
||||
g_VideoInitialize.pXWindow = (Window *) &GLWin.win;
|
||||
g_VideoInitialize.pWindowHandle = (void *)GLWin.win;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
@ -226,9 +226,6 @@ void Initialize(void *init)
|
||||
|
||||
// Now the window handle is written
|
||||
_pVideoInitialize->pWindowHandle = g_VideoInitialize.pWindowHandle;
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
_pVideoInitialize->pXWindow = g_VideoInitialize.pXWindow;
|
||||
#endif
|
||||
|
||||
OSD::AddMessage("Dolphin OpenGL Video Plugin", 5000);
|
||||
}
|
||||
|
@ -271,7 +271,6 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _twidth, int _theight
|
||||
|
||||
GLWin.dpy = XOpenDisplay(0);
|
||||
GLWin.parent = (Window)g_VideoInitialize.pWindowHandle;
|
||||
g_VideoInitialize.pWindowHandle = (HWND)GLWin.dpy;
|
||||
GLWin.screen = DefaultScreen(GLWin.dpy);
|
||||
|
||||
/* get an appropriate visual */
|
||||
@ -316,7 +315,8 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _twidth, int _theight
|
||||
|
||||
// create a window in window mode
|
||||
GLWin.attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask |
|
||||
StructureNotifyMask | ResizeRedirectMask;
|
||||
StructureNotifyMask | ResizeRedirectMask | EnterWindowMask |
|
||||
LeaveWindowMask | FocusChangeMask;
|
||||
GLWin.win = XCreateWindow(GLWin.dpy, GLWin.parent,
|
||||
xPos, yPos, _twidth, _theight, 0, vi->depth, InputOutput, vi->visual,
|
||||
CWBorderPixel | CWColormap | CWEventMask, &GLWin.attr);
|
||||
@ -327,7 +327,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;
|
||||
g_VideoInitialize.pWindowHandle = (void *)GLWin.win;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
@ -337,27 +337,11 @@ bool OpenGL_MakeCurrent()
|
||||
#if defined(USE_WX) && USE_WX
|
||||
GLWin.glCanvas->SetCurrent(*GLWin.glCtxt);
|
||||
#elif defined(_WIN32)
|
||||
if (!wglMakeCurrent(hDC,hRC)) {
|
||||
PanicAlert("(5) Can't Activate The GL Rendering Context.");
|
||||
return false;
|
||||
}
|
||||
return wglMakeCurrent(hDC,hRC) ? true : false;
|
||||
#elif defined(HAVE_X11) && HAVE_X11
|
||||
Window winDummy;
|
||||
unsigned int borderDummy;
|
||||
// connect the glx-context to the window
|
||||
glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx);
|
||||
XGetGeometry(GLWin.dpy, GLWin.win, &winDummy, &GLWin.x, &GLWin.y,
|
||||
&GLWin.width, &GLWin.height, &borderDummy, &GLWin.depth);
|
||||
NOTICE_LOG(VIDEO, "GLWin Depth %d", GLWin.depth)
|
||||
if (glXIsDirect(GLWin.dpy, GLWin.ctx)) {
|
||||
NOTICE_LOG(VIDEO, "detected direct rendering");
|
||||
} else {
|
||||
ERROR_LOG(VIDEO, "no Direct Rendering possible!");
|
||||
}
|
||||
|
||||
// better for pad plugin key input (thc)
|
||||
XSelectInput(GLWin.dpy, GLWin.win, ExposureMask | KeyPressMask | KeyReleaseMask |
|
||||
StructureNotifyMask | EnterWindowMask | LeaveWindowMask | FocusChangeMask );
|
||||
g_VideoInitialize.pRequestWindowSize(GLWin.x, GLWin.y, (int&)GLWin.width, (int&)GLWin.height);
|
||||
XMoveResizeWindow(GLWin.dpy, GLWin.win, GLWin.x, GLWin.y, GLWin.width, GLWin.height);
|
||||
return glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx);
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
@ -40,9 +40,6 @@ 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()
|
||||
|
@ -230,7 +230,7 @@ void GetMousePos(float& x, float& y)
|
||||
int root_x, root_y, win_x, win_y;
|
||||
if (IsFocus())
|
||||
{
|
||||
Window GLWin = *(Window *)g_WiimoteInitialize.pXWindow;
|
||||
Window GLWin = (Window)g_WiimoteInitialize.hWnd;
|
||||
XWindowAttributes WinAttribs;
|
||||
XGetWindowAttributes (WMdisplay, GLWin, &WinAttribs);
|
||||
WinWidth = (float)WinAttribs.width;
|
||||
|
@ -358,7 +358,7 @@ bool IsKey(int Key)
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
if (Key == EWM_SHAKE || Key == EWM_A || Key == EWM_B)
|
||||
{
|
||||
Window GLWin = *(Window *)g_WiimoteInitialize.pXWindow;
|
||||
Window GLWin = (Window)g_WiimoteInitialize.hWnd;
|
||||
int root_x, root_y, win_x, win_y;
|
||||
Window rootDummy, childWin;
|
||||
unsigned int mask;
|
||||
|
@ -40,7 +40,7 @@
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
Display* WMdisplay;
|
||||
Display* WMdisplay = NULL;
|
||||
#endif
|
||||
SWiimoteInitialize g_WiimoteInitialize;
|
||||
PLUGIN_GLOBALS* globals = NULL;
|
||||
@ -208,7 +208,7 @@ void Initialize(void *init)
|
||||
g_Config.Load();
|
||||
#endif
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
WMdisplay = (Display*)g_WiimoteInitialize.hWnd;
|
||||
WMdisplay = XOpenDisplay(NULL);
|
||||
#endif
|
||||
|
||||
g_ISOId = g_WiimoteInitialize.ISOId;
|
||||
@ -254,6 +254,11 @@ void Shutdown(void)
|
||||
WiiMoteReal::Shutdown();
|
||||
#endif
|
||||
WiiMoteEmu::Shutdown();
|
||||
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
if (WMdisplay)
|
||||
XCloseDisplay(WMdisplay);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -281,7 +281,7 @@ void DllConfig(HWND _hParent)
|
||||
{
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
Window win = GDK_WINDOW_XID(GTK_WIDGET(_hParent)->window);
|
||||
InitPlugin(&win);
|
||||
InitPlugin((void *)win);
|
||||
#else
|
||||
InitPlugin(_hParent);
|
||||
#endif
|
||||
@ -346,11 +346,7 @@ void Initialize(void *init)
|
||||
{
|
||||
g_WiimoteInitialize = *(SWiimoteInitialize*)init;
|
||||
if ( false == g_plugin.controller_interface.IsInit() )
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
InitPlugin( g_WiimoteInitialize.pXWindow );
|
||||
#else
|
||||
InitPlugin( g_WiimoteInitialize.hWnd );
|
||||
#endif
|
||||
}
|
||||
|
||||
// ___________________________________________________________________________
|
||||
|
Reference in New Issue
Block a user