diff --git a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp index 2c27a21372..93489f863d 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/GLUtil.cpp @@ -476,7 +476,7 @@ bool OpenGL_MakeCurrent() // better for pad plugin key input (thc) XSelectInput(GLWin.dpy, GLWin.win, ExposureMask | KeyPressMask | ButtonPressMask | KeyReleaseMask | ButtonReleaseMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask | - FocusChangeMask | PointerMotionMask ); + FocusChangeMask ); #endif return true; } @@ -651,7 +651,7 @@ void OpenGL_Shutdown() /* switch back to original desktop resolution if we were in fs */ if ((GLWin.dpy != NULL) && GLWin.fs) { XUngrabKeyboard (GLWin.dpy, CurrentTime); - XUngrabButton (GLWin.dpy, AnyButton, AnyModifier, GLWin.win); + XUngrabPointer (GLWin.dpy, CurrentTime); XF86VidModeSwitchToMode(GLWin.dpy, GLWin.screen, &GLWin.deskMode); XF86VidModeSetViewPort(GLWin.dpy, GLWin.screen, 0, 0); } diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp index 8aa5b8e2e1..82d915d8b1 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.cpp @@ -197,7 +197,7 @@ void LoadRecordedMovements() } #if defined(HAVE_X11) && HAVE_X11 -MousePosition MousePos; +Window GLWin; #endif /* Calibrate the mouse position to the emulation window. g_WiimoteInitialize.hWnd is the rendering window handle. */ @@ -220,9 +220,19 @@ void GetMousePos(float& x, float& y) float PictureWidth = WinWidth, PictureHeight = WinHeight; #else #if defined(HAVE_X11) && HAVE_X11 - float WinWidth = (float)MousePos.WinWidth; - float WinHeight = (float)MousePos.WinHeight; + float WinWidth = 0, WinHeight = 0; float XOffset = 0, YOffset = 0; + int root_x, root_y, win_x, win_y; + if (GLWin != 0) + { + XWindowAttributes WinAttribs; + XGetWindowAttributes (WMdisplay, GLWin, &WinAttribs); + WinWidth = (float)WinAttribs.width; + WinHeight = (float)WinAttribs.height; + Window rootDummy, childWin; + unsigned int mask; + XQueryPointer(WMdisplay, GLWin, &rootDummy, &childWin, &root_x, &root_y, &win_x, &win_y, &mask); + } float PictureWidth = WinWidth, PictureHeight = WinHeight; #endif #endif @@ -305,8 +315,8 @@ void GetMousePos(float& x, float& y) */ #else #if defined(HAVE_X11) && HAVE_X11 - x = ((float)MousePos.x - XOffset) / PictureWidth; - y = ((float)MousePos.y - YOffset) / PictureHeight; + x = ((float)win_x - XOffset) / PictureWidth; + y = ((float)win_y - YOffset) / PictureHeight; #endif #endif } @@ -674,6 +684,7 @@ void ReadLinuxKeyboard() for (num_events = XPending(WMdisplay); num_events > 0; num_events--) { XNextEvent(WMdisplay, &E); + GLWin = E.xany.window; switch (E.type) { case KeyPress: @@ -735,16 +746,6 @@ void ReadLinuxKeyboard() XPutBackEvent(WMdisplay, &E); break; } - case MotionNotify: - { - MousePos.x = E.xmotion.x; - MousePos.y = E.xmotion.y; - XWindowAttributes WinAttribs; - XGetWindowAttributes (E.xmotion.display, E.xmotion.window, &WinAttribs); - MousePos.WinWidth = WinAttribs.width; - MousePos.WinHeight = WinAttribs.height; - break; - } case ConfigureNotify: case ClientMessage: XPutBackEvent(WMdisplay, &E); diff --git a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.h b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.h index 3afca7ec3c..feb7542c43 100644 --- a/Source/Plugins/Plugin_Wiimote/Src/EmuMain.h +++ b/Source/Plugins/Plugin_Wiimote/Src/EmuMain.h @@ -62,15 +62,6 @@ void TiltToAccelerometer(int &_x, int &_y, int &_z, STiltData &_TiltData); void AdjustAngles(int &Roll, int &Pitch); void RotateIRDot(int &_x, int &_y, STiltData &_TiltData); -#if defined(HAVE_X11) && HAVE_X11 -struct MousePosition -{ - int x, y; - int WinWidth, WinHeight; -}; -extern MousePosition MousePos; -#endif - // Accelerometer //void PitchAccelerometerToDegree(u8 _x, u8 _y, u8 _z, int &_Roll, int &_Pitch, int&, int&); //float AccelerometerToG(float Current, float Neutral, float G);