mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-26 15:55:31 +01: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:
parent
665d83ed45
commit
02ce753b76
@ -101,9 +101,7 @@ bool g_bStopping = false;
|
|||||||
bool g_bHwInit = false;
|
bool g_bHwInit = false;
|
||||||
bool g_bRealWiimote = false;
|
bool g_bRealWiimote = false;
|
||||||
HWND g_pWindowHandle = NULL;
|
HWND g_pWindowHandle = NULL;
|
||||||
#if defined(HAVE_X11) && HAVE_X11
|
|
||||||
void *g_pXWindow = NULL;
|
|
||||||
#endif
|
|
||||||
Common::Thread* g_EmuThread = NULL;
|
Common::Thread* g_EmuThread = NULL;
|
||||||
|
|
||||||
static Common::Thread* cpuThread = NULL;
|
static Common::Thread* cpuThread = NULL;
|
||||||
@ -154,13 +152,6 @@ void *GetWindowHandle()
|
|||||||
return g_pWindowHandle;
|
return g_pWindowHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined HAVE_X11 && HAVE_X11
|
|
||||||
void *GetXWindow()
|
|
||||||
{
|
|
||||||
return g_pXWindow;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
bool GetRealWiimote()
|
bool GetRealWiimote()
|
||||||
{
|
{
|
||||||
return g_bRealWiimote;
|
return g_bRealWiimote;
|
||||||
@ -370,11 +361,8 @@ THREAD_RETURN EmuThread(void *pArg)
|
|||||||
|
|
||||||
Plugins.GetVideo()->Initialize(&VideoInitialize); // Call the dll
|
Plugins.GetVideo()->Initialize(&VideoInitialize); // Call the dll
|
||||||
|
|
||||||
// Under linux, this is an X11 Display, not a HWND!
|
// Under linux, this is an X11 Window, not a HWND!
|
||||||
g_pWindowHandle = (HWND)VideoInitialize.pWindowHandle;
|
g_pWindowHandle = (HWND)VideoInitialize.pWindowHandle;
|
||||||
#if defined(HAVE_X11) && HAVE_X11
|
|
||||||
g_pXWindow = (void *)VideoInitialize.pXWindow;
|
|
||||||
#endif
|
|
||||||
Callback_PeekMessages = VideoInitialize.pPeekMessages;
|
Callback_PeekMessages = VideoInitialize.pPeekMessages;
|
||||||
g_pUpdateFPSDisplay = VideoInitialize.pUpdateFPSDisplay;
|
g_pUpdateFPSDisplay = VideoInitialize.pUpdateFPSDisplay;
|
||||||
|
|
||||||
@ -397,20 +385,13 @@ THREAD_RETURN EmuThread(void *pArg)
|
|||||||
|
|
||||||
Plugins.GetDSP()->Initialize((void *)&dspInit);
|
Plugins.GetDSP()->Initialize((void *)&dspInit);
|
||||||
|
|
||||||
#if defined(HAVE_X11) && HAVE_X11
|
|
||||||
GCPad_Init(g_pXWindow);
|
|
||||||
#else
|
|
||||||
GCPad_Init(g_pWindowHandle);
|
GCPad_Init(g_pWindowHandle);
|
||||||
#endif
|
|
||||||
|
|
||||||
// Load and Init WiimotePlugin - only if we are booting in wii mode
|
// Load and Init WiimotePlugin - only if we are booting in wii mode
|
||||||
if (_CoreParameter.bWii)
|
if (_CoreParameter.bWii)
|
||||||
{
|
{
|
||||||
SWiimoteInitialize WiimoteInitialize;
|
SWiimoteInitialize WiimoteInitialize;
|
||||||
WiimoteInitialize.hWnd = g_pWindowHandle;
|
WiimoteInitialize.hWnd = g_pWindowHandle;
|
||||||
#if defined(HAVE_X11) && HAVE_X11
|
|
||||||
WiimoteInitialize.pXWindow = g_pXWindow;
|
|
||||||
#endif
|
|
||||||
WiimoteInitialize.ISOId = Ascii2Hex(_CoreParameter.m_strUniqueID);
|
WiimoteInitialize.ISOId = Ascii2Hex(_CoreParameter.m_strUniqueID);
|
||||||
WiimoteInitialize.pLog = Callback_WiimoteLog;
|
WiimoteInitialize.pLog = Callback_WiimoteLog;
|
||||||
WiimoteInitialize.pWiimoteInterruptChannel = Callback_WiimoteInterruptChannel;
|
WiimoteInitialize.pWiimoteInterruptChannel = Callback_WiimoteInterruptChannel;
|
||||||
|
@ -62,9 +62,7 @@ namespace Core
|
|||||||
void Callback_WiimoteInterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size);
|
void Callback_WiimoteInterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size);
|
||||||
|
|
||||||
void* GetWindowHandle();
|
void* GetWindowHandle();
|
||||||
#if defined HAVE_X11 && HAVE_X11
|
|
||||||
void* GetXWindow();
|
|
||||||
#endif
|
|
||||||
bool GetRealWiimote();
|
bool GetRealWiimote();
|
||||||
|
|
||||||
extern bool bReadTrace;
|
extern bool bReadTrace;
|
||||||
|
@ -880,7 +880,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
PostMessage((HWND)Core::GetWindowHandle(), WM_USER, WM_USER_KEYDOWN, event.GetKeyCode());
|
PostMessage((HWND)Core::GetWindowHandle(), WM_USER, WM_USER_KEYDOWN, event.GetKeyCode());
|
||||||
#elif defined(HAVE_X11) && HAVE_X11
|
#elif defined(HAVE_X11) && HAVE_X11
|
||||||
X11Utils::SendKeyEvent(event.GetKeyCode());
|
X11Utils::SendKeyEvent(X11Utils::XDisplayFromHandle(GetHandle()), event.GetKeyCode());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -702,7 +702,8 @@ void CFrame::OnRenderParentResize(wxSizeEvent& event)
|
|||||||
int x, y;
|
int x, y;
|
||||||
m_RenderParent->GetSize(&width, &height);
|
m_RenderParent->GetSize(&width, &height);
|
||||||
m_RenderParent->GetPosition(&x, &y);
|
m_RenderParent->GetPosition(&x, &y);
|
||||||
X11Utils::SendClientEvent("RESIZE", x, y, width, height);
|
X11Utils::SendClientEvent(X11Utils::XDisplayFromHandle(GetHandle()),
|
||||||
|
"RESIZE", x, y, width, height);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
event.Skip();
|
event.Skip();
|
||||||
@ -956,7 +957,7 @@ void CFrame::OnPluginPAD(wxCommandEvent& WXUNUSED (event))
|
|||||||
{
|
{
|
||||||
#if defined(HAVE_X11) && HAVE_X11
|
#if defined(HAVE_X11) && HAVE_X11
|
||||||
Window win = X11Utils::XWindowFromHandle(GetHandle());
|
Window win = X11Utils::XWindowFromHandle(GetHandle());
|
||||||
GCPad_Init(&win);
|
GCPad_Init((void *)win);
|
||||||
#else
|
#else
|
||||||
GCPad_Init(GetHandle());
|
GCPad_Init(GetHandle());
|
||||||
#endif
|
#endif
|
||||||
|
@ -139,7 +139,7 @@ void X11_MainLoop()
|
|||||||
updateMainFrameEvent.Wait();
|
updateMainFrameEvent.Wait();
|
||||||
|
|
||||||
Display *dpy = XOpenDisplay(0);
|
Display *dpy = XOpenDisplay(0);
|
||||||
Window win = *(Window *)Core::GetXWindow();
|
Window win = (Window)Core::GetWindowHandle();
|
||||||
XSelectInput(dpy, win, KeyPressMask | KeyReleaseMask | FocusChangeMask);
|
XSelectInput(dpy, win, KeyPressMask | KeyReleaseMask | FocusChangeMask);
|
||||||
|
|
||||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||||
@ -161,7 +161,7 @@ void X11_MainLoop()
|
|||||||
|
|
||||||
if (fullscreen)
|
if (fullscreen)
|
||||||
{
|
{
|
||||||
X11Utils::EWMH_Fullscreen(_NET_WM_STATE_TOGGLE);
|
X11Utils::EWMH_Fullscreen(dpy, _NET_WM_STATE_TOGGLE);
|
||||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||||
XRRConfig->ToggleDisplayMode(True);
|
XRRConfig->ToggleDisplayMode(True);
|
||||||
#endif
|
#endif
|
||||||
@ -197,7 +197,7 @@ void X11_MainLoop()
|
|||||||
else if ((key == XK_Return) && (event.xkey.state & Mod1Mask))
|
else if ((key == XK_Return) && (event.xkey.state & Mod1Mask))
|
||||||
{
|
{
|
||||||
fullscreen = !fullscreen;
|
fullscreen = !fullscreen;
|
||||||
X11Utils::EWMH_Fullscreen(_NET_WM_STATE_TOGGLE);
|
X11Utils::EWMH_Fullscreen(dpy, _NET_WM_STATE_TOGGLE);
|
||||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||||
XRRConfig->ToggleDisplayMode(fullscreen);
|
XRRConfig->ToggleDisplayMode(fullscreen);
|
||||||
#endif
|
#endif
|
||||||
|
@ -20,12 +20,11 @@
|
|||||||
namespace X11Utils
|
namespace X11Utils
|
||||||
{
|
{
|
||||||
|
|
||||||
void SendClientEvent(const char *message,
|
void SendClientEvent(Display *dpy, const char *message,
|
||||||
int data1, int data2, int data3, int data4)
|
int data1, int data2, int data3, int data4)
|
||||||
{
|
{
|
||||||
XEvent event;
|
XEvent event;
|
||||||
Display *dpy = (Display *)Core::GetWindowHandle();
|
Window win = (Window)Core::GetWindowHandle();
|
||||||
Window win = *(Window *)Core::GetXWindow();
|
|
||||||
|
|
||||||
// Init X event structure for client message
|
// Init X event structure for client message
|
||||||
event.xclient.type = ClientMessage;
|
event.xclient.type = ClientMessage;
|
||||||
@ -41,11 +40,10 @@ void SendClientEvent(const char *message,
|
|||||||
ERROR_LOG(VIDEO, "Failed to send message %s to the emulator window.", message);
|
ERROR_LOG(VIDEO, "Failed to send message %s to the emulator window.", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendKeyEvent(int key)
|
void SendKeyEvent(Display *dpy, int key)
|
||||||
{
|
{
|
||||||
XEvent event;
|
XEvent event;
|
||||||
Display *dpy = (Display *)Core::GetWindowHandle();
|
Window win = (Window)Core::GetWindowHandle();
|
||||||
Window win = *(Window *)Core::GetXWindow();
|
|
||||||
|
|
||||||
// Init X event structure for key press event
|
// Init X event structure for key press event
|
||||||
event.xkey.type = KeyPress;
|
event.xkey.type = KeyPress;
|
||||||
@ -58,13 +56,12 @@ void SendKeyEvent(int key)
|
|||||||
ERROR_LOG(VIDEO, "Failed to send key press event to the emulator window.");
|
ERROR_LOG(VIDEO, "Failed to send key press event to the emulator window.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void EWMH_Fullscreen(int action)
|
void EWMH_Fullscreen(Display *dpy, int action)
|
||||||
{
|
{
|
||||||
_assert_(action == _NET_WM_STATE_REMOVE || action == _NET_WM_STATE_ADD
|
_assert_(action == _NET_WM_STATE_REMOVE || action == _NET_WM_STATE_ADD
|
||||||
|| action == _NET_WM_STATE_TOGGLE);
|
|| action == _NET_WM_STATE_TOGGLE);
|
||||||
|
|
||||||
Display *dpy = (Display *)Core::GetWindowHandle();
|
Window win = (Window)Core::GetWindowHandle();
|
||||||
Window win = *(Window *)Core::GetXWindow();
|
|
||||||
|
|
||||||
// Init X event structure for _NET_WM_STATE_FULLSCREEN client message
|
// Init X event structure for _NET_WM_STATE_FULLSCREEN client message
|
||||||
XEvent event;
|
XEvent event;
|
||||||
|
@ -43,10 +43,10 @@
|
|||||||
namespace X11Utils
|
namespace X11Utils
|
||||||
{
|
{
|
||||||
|
|
||||||
void SendClientEvent(const char *message,
|
void SendClientEvent(Display *dpy, const char *message,
|
||||||
int data1, int data2, int data3, int data4);
|
int data1, int data2, int data3, int data4);
|
||||||
void SendKeyEvent(int key);
|
void SendKeyEvent(Display *dpy, int key);
|
||||||
void EWMH_Fullscreen(int action);
|
void EWMH_Fullscreen(Display *dpy, int action);
|
||||||
#if defined(HAVE_WX) && HAVE_WX
|
#if defined(HAVE_WX) && HAVE_WX
|
||||||
Window XWindowFromHandle(void *Handle);
|
Window XWindowFromHandle(void *Handle);
|
||||||
Display *XDisplayFromHandle(void *Handle);
|
Display *XDisplayFromHandle(void *Handle);
|
||||||
|
@ -7,7 +7,7 @@ namespace Xlib
|
|||||||
|
|
||||||
void Init(std::vector<ControllerInterface::Device*>& devices, void* const hwnd)
|
void Init(std::vector<ControllerInterface::Device*>& devices, void* const hwnd)
|
||||||
{
|
{
|
||||||
devices.push_back(new KeyboardMouse(*(Window*)hwnd));
|
devices.push_back(new KeyboardMouse((Window)hwnd));
|
||||||
}
|
}
|
||||||
|
|
||||||
KeyboardMouse::KeyboardMouse(Window window) : m_window(window)
|
KeyboardMouse::KeyboardMouse(Window window) : m_window(window)
|
||||||
|
@ -5,7 +5,6 @@
|
|||||||
#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"
|
||||||
@ -71,9 +70,6 @@ typedef struct
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
void *pWindowHandle;
|
void *pWindowHandle;
|
||||||
#if defined(HAVE_X11) && HAVE_X11
|
|
||||||
void *pXWindow;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
TSetInterrupt pSetInterrupt;
|
TSetInterrupt pSetInterrupt;
|
||||||
TRegisterEvent pRegisterEvent;
|
TRegisterEvent pRegisterEvent;
|
||||||
|
@ -8,11 +8,6 @@
|
|||||||
#include "PluginSpecs.h"
|
#include "PluginSpecs.h"
|
||||||
#include "ExportProlog.h"
|
#include "ExportProlog.h"
|
||||||
|
|
||||||
#if !defined _WIN32 && !defined __APPLE__
|
|
||||||
#include "Config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
typedef void (*TLogv)(const char* _pMessage, int _v);
|
typedef void (*TLogv)(const char* _pMessage, int _v);
|
||||||
|
|
||||||
// This is called when the Wiimote sends input reports to the Core.
|
// This is called when the Wiimote sends input reports to the Core.
|
||||||
@ -24,9 +19,6 @@ typedef bool (*TRendererHasFocus)(void);
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
#if defined HAVE_X11 && HAVE_X11
|
|
||||||
void *pXWindow;
|
|
||||||
#endif
|
|
||||||
u32 ISOId;
|
u32 ISOId;
|
||||||
TLogv pLog;
|
TLogv pLog;
|
||||||
TWiimoteInterruptChannel pWiimoteInterruptChannel;
|
TWiimoteInterruptChannel pWiimoteInterruptChannel;
|
||||||
|
@ -127,7 +127,8 @@ void CreateXWindow (void)
|
|||||||
GLWin.attr.colormap = XCreateColormap(GLWin.dpy,
|
GLWin.attr.colormap = XCreateColormap(GLWin.dpy,
|
||||||
GLWin.parent, GLWin.vi->visual, AllocNone);
|
GLWin.parent, GLWin.vi->visual, AllocNone);
|
||||||
GLWin.attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask |
|
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.background_pixel = BlackPixel(GLWin.dpy, GLWin.screen);
|
||||||
GLWin.attr.border_pixel = 0;
|
GLWin.attr.border_pixel = 0;
|
||||||
|
|
||||||
@ -138,8 +139,6 @@ void CreateXWindow (void)
|
|||||||
wmProtocols[0] = XInternAtom(GLWin.dpy, "WM_DELETE_WINDOW", True);
|
wmProtocols[0] = XInternAtom(GLWin.dpy, "WM_DELETE_WINDOW", True);
|
||||||
XSetWMProtocols(GLWin.dpy, GLWin.win, wmProtocols, 1);
|
XSetWMProtocols(GLWin.dpy, GLWin.win, wmProtocols, 1);
|
||||||
XSetStandardProperties(GLWin.dpy, GLWin.win, "GPU", "GPU", None, NULL, 0, NULL);
|
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);
|
XMapRaised(GLWin.dpy, GLWin.win);
|
||||||
XSync(GLWin.dpy, True);
|
XSync(GLWin.dpy, True);
|
||||||
|
|
||||||
@ -359,7 +358,6 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
|||||||
|
|
||||||
GLWin.dpy = XOpenDisplay(0);
|
GLWin.dpy = XOpenDisplay(0);
|
||||||
GLWin.parent = (Window)g_VideoInitialize.pWindowHandle;
|
GLWin.parent = (Window)g_VideoInitialize.pWindowHandle;
|
||||||
g_VideoInitialize.pWindowHandle = (Display *)GLWin.dpy;
|
|
||||||
GLWin.screen = DefaultScreen(GLWin.dpy);
|
GLWin.screen = DefaultScreen(GLWin.dpy);
|
||||||
if (GLWin.parent == 0)
|
if (GLWin.parent == 0)
|
||||||
GLWin.parent = RootWindow(GLWin.dpy, GLWin.screen);
|
GLWin.parent = RootWindow(GLWin.dpy, GLWin.screen);
|
||||||
@ -404,7 +402,7 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
|||||||
GLWin.height = _theight;
|
GLWin.height = _theight;
|
||||||
|
|
||||||
CreateXWindow();
|
CreateXWindow();
|
||||||
g_VideoInitialize.pXWindow = (Window *) &GLWin.win;
|
g_VideoInitialize.pWindowHandle = (void *)GLWin.win;
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -226,9 +226,6 @@ void Initialize(void *init)
|
|||||||
|
|
||||||
// Now the window handle is written
|
// Now the window handle is written
|
||||||
_pVideoInitialize->pWindowHandle = g_VideoInitialize.pWindowHandle;
|
_pVideoInitialize->pWindowHandle = g_VideoInitialize.pWindowHandle;
|
||||||
#if defined(HAVE_X11) && HAVE_X11
|
|
||||||
_pVideoInitialize->pXWindow = g_VideoInitialize.pXWindow;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
OSD::AddMessage("Dolphin OpenGL Video Plugin", 5000);
|
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.dpy = XOpenDisplay(0);
|
||||||
GLWin.parent = (Window)g_VideoInitialize.pWindowHandle;
|
GLWin.parent = (Window)g_VideoInitialize.pWindowHandle;
|
||||||
g_VideoInitialize.pWindowHandle = (HWND)GLWin.dpy;
|
|
||||||
GLWin.screen = DefaultScreen(GLWin.dpy);
|
GLWin.screen = DefaultScreen(GLWin.dpy);
|
||||||
|
|
||||||
/* get an appropriate visual */
|
/* get an appropriate visual */
|
||||||
@ -316,7 +315,8 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _twidth, int _theight
|
|||||||
|
|
||||||
// create a window in window mode
|
// create a window in window mode
|
||||||
GLWin.attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask |
|
GLWin.attr.event_mask = ExposureMask | KeyPressMask | KeyReleaseMask |
|
||||||
StructureNotifyMask | ResizeRedirectMask;
|
StructureNotifyMask | ResizeRedirectMask | EnterWindowMask |
|
||||||
|
LeaveWindowMask | FocusChangeMask;
|
||||||
GLWin.win = XCreateWindow(GLWin.dpy, GLWin.parent,
|
GLWin.win = XCreateWindow(GLWin.dpy, GLWin.parent,
|
||||||
xPos, yPos, _twidth, _theight, 0, vi->depth, InputOutput, vi->visual,
|
xPos, yPos, _twidth, _theight, 0, vi->depth, InputOutput, vi->visual,
|
||||||
CWBorderPixel | CWColormap | CWEventMask, &GLWin.attr);
|
CWBorderPixel | CWColormap | CWEventMask, &GLWin.attr);
|
||||||
@ -327,7 +327,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;
|
g_VideoInitialize.pWindowHandle = (void *)GLWin.win;
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -337,27 +337,11 @@ bool OpenGL_MakeCurrent()
|
|||||||
#if defined(USE_WX) && USE_WX
|
#if defined(USE_WX) && USE_WX
|
||||||
GLWin.glCanvas->SetCurrent(*GLWin.glCtxt);
|
GLWin.glCanvas->SetCurrent(*GLWin.glCtxt);
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
if (!wglMakeCurrent(hDC,hRC)) {
|
return wglMakeCurrent(hDC,hRC) ? true : false;
|
||||||
PanicAlert("(5) Can't Activate The GL Rendering Context.");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
#elif defined(HAVE_X11) && HAVE_X11
|
#elif defined(HAVE_X11) && HAVE_X11
|
||||||
Window winDummy;
|
g_VideoInitialize.pRequestWindowSize(GLWin.x, GLWin.y, (int&)GLWin.width, (int&)GLWin.height);
|
||||||
unsigned int borderDummy;
|
XMoveResizeWindow(GLWin.dpy, GLWin.win, GLWin.x, GLWin.y, GLWin.width, GLWin.height);
|
||||||
// connect the glx-context to the window
|
return glXMakeCurrent(GLWin.dpy, GLWin.win, GLWin.ctx);
|
||||||
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 );
|
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -40,9 +40,6 @@ 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()
|
||||||
|
@ -230,7 +230,7 @@ void GetMousePos(float& x, float& y)
|
|||||||
int root_x, root_y, win_x, win_y;
|
int root_x, root_y, win_x, win_y;
|
||||||
if (IsFocus())
|
if (IsFocus())
|
||||||
{
|
{
|
||||||
Window GLWin = *(Window *)g_WiimoteInitialize.pXWindow;
|
Window GLWin = (Window)g_WiimoteInitialize.hWnd;
|
||||||
XWindowAttributes WinAttribs;
|
XWindowAttributes WinAttribs;
|
||||||
XGetWindowAttributes (WMdisplay, GLWin, &WinAttribs);
|
XGetWindowAttributes (WMdisplay, GLWin, &WinAttribs);
|
||||||
WinWidth = (float)WinAttribs.width;
|
WinWidth = (float)WinAttribs.width;
|
||||||
|
@ -358,7 +358,7 @@ bool IsKey(int Key)
|
|||||||
#if defined(HAVE_X11) && HAVE_X11
|
#if defined(HAVE_X11) && HAVE_X11
|
||||||
if (Key == EWM_SHAKE || Key == EWM_A || Key == EWM_B)
|
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;
|
int root_x, root_y, win_x, win_y;
|
||||||
Window rootDummy, childWin;
|
Window rootDummy, childWin;
|
||||||
unsigned int mask;
|
unsigned int mask;
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(HAVE_X11) && HAVE_X11
|
#if defined(HAVE_X11) && HAVE_X11
|
||||||
Display* WMdisplay;
|
Display* WMdisplay = NULL;
|
||||||
#endif
|
#endif
|
||||||
SWiimoteInitialize g_WiimoteInitialize;
|
SWiimoteInitialize g_WiimoteInitialize;
|
||||||
PLUGIN_GLOBALS* globals = NULL;
|
PLUGIN_GLOBALS* globals = NULL;
|
||||||
@ -208,7 +208,7 @@ void Initialize(void *init)
|
|||||||
g_Config.Load();
|
g_Config.Load();
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_X11) && HAVE_X11
|
#if defined(HAVE_X11) && HAVE_X11
|
||||||
WMdisplay = (Display*)g_WiimoteInitialize.hWnd;
|
WMdisplay = XOpenDisplay(NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
g_ISOId = g_WiimoteInitialize.ISOId;
|
g_ISOId = g_WiimoteInitialize.ISOId;
|
||||||
@ -254,6 +254,11 @@ void Shutdown(void)
|
|||||||
WiiMoteReal::Shutdown();
|
WiiMoteReal::Shutdown();
|
||||||
#endif
|
#endif
|
||||||
WiiMoteEmu::Shutdown();
|
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
|
#if defined(HAVE_X11) && HAVE_X11
|
||||||
Window win = GDK_WINDOW_XID(GTK_WIDGET(_hParent)->window);
|
Window win = GDK_WINDOW_XID(GTK_WIDGET(_hParent)->window);
|
||||||
InitPlugin(&win);
|
InitPlugin((void *)win);
|
||||||
#else
|
#else
|
||||||
InitPlugin(_hParent);
|
InitPlugin(_hParent);
|
||||||
#endif
|
#endif
|
||||||
@ -346,11 +346,7 @@ void Initialize(void *init)
|
|||||||
{
|
{
|
||||||
g_WiimoteInitialize = *(SWiimoteInitialize*)init;
|
g_WiimoteInitialize = *(SWiimoteInitialize*)init;
|
||||||
if ( false == g_plugin.controller_interface.IsInit() )
|
if ( false == g_plugin.controller_interface.IsInit() )
|
||||||
#if defined(HAVE_X11) && HAVE_X11
|
|
||||||
InitPlugin( g_WiimoteInitialize.pXWindow );
|
|
||||||
#else
|
|
||||||
InitPlugin( g_WiimoteInitialize.hWnd );
|
InitPlugin( g_WiimoteInitialize.hWnd );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ___________________________________________________________________________
|
// ___________________________________________________________________________
|
||||||
|
Loading…
x
Reference in New Issue
Block a user