mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 22:29:39 -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:
@ -101,9 +101,7 @@ bool g_bStopping = false;
|
||||
bool g_bHwInit = false;
|
||||
bool g_bRealWiimote = false;
|
||||
HWND g_pWindowHandle = NULL;
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
void *g_pXWindow = NULL;
|
||||
#endif
|
||||
|
||||
Common::Thread* g_EmuThread = NULL;
|
||||
|
||||
static Common::Thread* cpuThread = NULL;
|
||||
@ -154,13 +152,6 @@ void *GetWindowHandle()
|
||||
return g_pWindowHandle;
|
||||
}
|
||||
|
||||
#if defined HAVE_X11 && HAVE_X11
|
||||
void *GetXWindow()
|
||||
{
|
||||
return g_pXWindow;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool GetRealWiimote()
|
||||
{
|
||||
return g_bRealWiimote;
|
||||
@ -370,11 +361,8 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||
|
||||
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;
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
g_pXWindow = (void *)VideoInitialize.pXWindow;
|
||||
#endif
|
||||
Callback_PeekMessages = VideoInitialize.pPeekMessages;
|
||||
g_pUpdateFPSDisplay = VideoInitialize.pUpdateFPSDisplay;
|
||||
|
||||
@ -397,20 +385,13 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||
|
||||
Plugins.GetDSP()->Initialize((void *)&dspInit);
|
||||
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
GCPad_Init(g_pXWindow);
|
||||
#else
|
||||
GCPad_Init(g_pWindowHandle);
|
||||
#endif
|
||||
|
||||
// Load and Init WiimotePlugin - only if we are booting in wii mode
|
||||
if (_CoreParameter.bWii)
|
||||
{
|
||||
SWiimoteInitialize WiimoteInitialize;
|
||||
WiimoteInitialize.hWnd = g_pWindowHandle;
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
WiimoteInitialize.pXWindow = g_pXWindow;
|
||||
#endif
|
||||
WiimoteInitialize.ISOId = Ascii2Hex(_CoreParameter.m_strUniqueID);
|
||||
WiimoteInitialize.pLog = Callback_WiimoteLog;
|
||||
WiimoteInitialize.pWiimoteInterruptChannel = Callback_WiimoteInterruptChannel;
|
||||
|
@ -62,9 +62,7 @@ namespace Core
|
||||
void Callback_WiimoteInterruptChannel(int _number, u16 _channelID, const void* _pData, u32 _Size);
|
||||
|
||||
void* GetWindowHandle();
|
||||
#if defined HAVE_X11 && HAVE_X11
|
||||
void* GetXWindow();
|
||||
#endif
|
||||
|
||||
bool GetRealWiimote();
|
||||
|
||||
extern bool bReadTrace;
|
||||
|
@ -880,7 +880,7 @@ void CFrame::OnKeyDown(wxKeyEvent& event)
|
||||
#ifdef _WIN32
|
||||
PostMessage((HWND)Core::GetWindowHandle(), WM_USER, WM_USER_KEYDOWN, event.GetKeyCode());
|
||||
#elif defined(HAVE_X11) && HAVE_X11
|
||||
X11Utils::SendKeyEvent(event.GetKeyCode());
|
||||
X11Utils::SendKeyEvent(X11Utils::XDisplayFromHandle(GetHandle()), event.GetKeyCode());
|
||||
#endif
|
||||
}
|
||||
#ifdef _WIN32
|
||||
|
@ -702,7 +702,8 @@ void CFrame::OnRenderParentResize(wxSizeEvent& event)
|
||||
int x, y;
|
||||
m_RenderParent->GetSize(&width, &height);
|
||||
m_RenderParent->GetPosition(&x, &y);
|
||||
X11Utils::SendClientEvent("RESIZE", x, y, width, height);
|
||||
X11Utils::SendClientEvent(X11Utils::XDisplayFromHandle(GetHandle()),
|
||||
"RESIZE", x, y, width, height);
|
||||
#endif
|
||||
}
|
||||
event.Skip();
|
||||
@ -956,7 +957,7 @@ void CFrame::OnPluginPAD(wxCommandEvent& WXUNUSED (event))
|
||||
{
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
Window win = X11Utils::XWindowFromHandle(GetHandle());
|
||||
GCPad_Init(&win);
|
||||
GCPad_Init((void *)win);
|
||||
#else
|
||||
GCPad_Init(GetHandle());
|
||||
#endif
|
||||
|
@ -139,7 +139,7 @@ void X11_MainLoop()
|
||||
updateMainFrameEvent.Wait();
|
||||
|
||||
Display *dpy = XOpenDisplay(0);
|
||||
Window win = *(Window *)Core::GetXWindow();
|
||||
Window win = (Window)Core::GetWindowHandle();
|
||||
XSelectInput(dpy, win, KeyPressMask | KeyReleaseMask | FocusChangeMask);
|
||||
|
||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
@ -161,7 +161,7 @@ void X11_MainLoop()
|
||||
|
||||
if (fullscreen)
|
||||
{
|
||||
X11Utils::EWMH_Fullscreen(_NET_WM_STATE_TOGGLE);
|
||||
X11Utils::EWMH_Fullscreen(dpy, _NET_WM_STATE_TOGGLE);
|
||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
XRRConfig->ToggleDisplayMode(True);
|
||||
#endif
|
||||
@ -197,7 +197,7 @@ void X11_MainLoop()
|
||||
else if ((key == XK_Return) && (event.xkey.state & Mod1Mask))
|
||||
{
|
||||
fullscreen = !fullscreen;
|
||||
X11Utils::EWMH_Fullscreen(_NET_WM_STATE_TOGGLE);
|
||||
X11Utils::EWMH_Fullscreen(dpy, _NET_WM_STATE_TOGGLE);
|
||||
#if defined(HAVE_XRANDR) && HAVE_XRANDR
|
||||
XRRConfig->ToggleDisplayMode(fullscreen);
|
||||
#endif
|
||||
|
@ -20,12 +20,11 @@
|
||||
namespace X11Utils
|
||||
{
|
||||
|
||||
void SendClientEvent(const char *message,
|
||||
void SendClientEvent(Display *dpy, const char *message,
|
||||
int data1, int data2, int data3, int data4)
|
||||
{
|
||||
XEvent event;
|
||||
Display *dpy = (Display *)Core::GetWindowHandle();
|
||||
Window win = *(Window *)Core::GetXWindow();
|
||||
Window win = (Window)Core::GetWindowHandle();
|
||||
|
||||
// Init X event structure for client message
|
||||
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);
|
||||
}
|
||||
|
||||
void SendKeyEvent(int key)
|
||||
void SendKeyEvent(Display *dpy, int key)
|
||||
{
|
||||
XEvent event;
|
||||
Display *dpy = (Display *)Core::GetWindowHandle();
|
||||
Window win = *(Window *)Core::GetXWindow();
|
||||
Window win = (Window)Core::GetWindowHandle();
|
||||
|
||||
// Init X event structure for key press event
|
||||
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.");
|
||||
}
|
||||
|
||||
void EWMH_Fullscreen(int action)
|
||||
void EWMH_Fullscreen(Display *dpy, int action)
|
||||
{
|
||||
_assert_(action == _NET_WM_STATE_REMOVE || action == _NET_WM_STATE_ADD
|
||||
|| action == _NET_WM_STATE_TOGGLE);
|
||||
|
||||
Display *dpy = (Display *)Core::GetWindowHandle();
|
||||
Window win = *(Window *)Core::GetXWindow();
|
||||
Window win = (Window)Core::GetWindowHandle();
|
||||
|
||||
// Init X event structure for _NET_WM_STATE_FULLSCREEN client message
|
||||
XEvent event;
|
||||
|
@ -43,10 +43,10 @@
|
||||
namespace X11Utils
|
||||
{
|
||||
|
||||
void SendClientEvent(const char *message,
|
||||
void SendClientEvent(Display *dpy, const char *message,
|
||||
int data1, int data2, int data3, int data4);
|
||||
void SendKeyEvent(int key);
|
||||
void EWMH_Fullscreen(int action);
|
||||
void SendKeyEvent(Display *dpy, int key);
|
||||
void EWMH_Fullscreen(Display *dpy, int action);
|
||||
#if defined(HAVE_WX) && HAVE_WX
|
||||
Window XWindowFromHandle(void *Handle);
|
||||
Display *XDisplayFromHandle(void *Handle);
|
||||
|
@ -7,7 +7,7 @@ namespace Xlib
|
||||
|
||||
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)
|
||||
|
Reference in New Issue
Block a user