Fix mouse emulation in fullscreen mode in linux. The window doesn't have focus then.
Also minor tweak to mouse hiding. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5063 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
b245c398a3
commit
666a33eeed
|
@ -660,7 +660,9 @@ bool IsFocus()
|
||||||
Window FocusWin;
|
Window FocusWin;
|
||||||
int Revert;
|
int Revert;
|
||||||
XGetInputFocus(GCdisplay, &FocusWin, &Revert);
|
XGetInputFocus(GCdisplay, &FocusWin, &Revert);
|
||||||
return (GLWin != 0 && GLWin == FocusWin);
|
XWindowAttributes WinAttribs;
|
||||||
|
XGetWindowAttributes (GCdisplay, GLWin, &WinAttribs);
|
||||||
|
return (GLWin != 0 && (GLWin == FocusWin || WinAttribs.override_redirect));
|
||||||
#else
|
#else
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -411,9 +411,8 @@ bool OpenGL_Create(SVideoInitialize &_VideoInitialize, int _iwidth, int _iheight
|
||||||
char ZeroData[1] = {0};
|
char ZeroData[1] = {0};
|
||||||
Cursor MouseCursor;
|
Cursor MouseCursor;
|
||||||
Blank = XCreateBitmapFromData (GLWin.dpy, GLWin.win, ZeroData, 1, 1);
|
Blank = XCreateBitmapFromData (GLWin.dpy, GLWin.win, ZeroData, 1, 1);
|
||||||
MouseCursor = XCreatePixmapCursor(GLWin.dpy, Blank, Blank, &DummyColor, &DummyColor, 0, 0);
|
GLWin.blankCursor = XCreatePixmapCursor(GLWin.dpy, Blank, Blank, &DummyColor, &DummyColor, 0, 0);
|
||||||
XFreePixmap (GLWin.dpy, Blank);
|
XFreePixmap (GLWin.dpy, Blank);
|
||||||
XDefineCursor (GLWin.dpy, GLWin.win, MouseCursor);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return true;
|
return true;
|
||||||
|
@ -474,6 +473,10 @@ bool OpenGL_MakeCurrent()
|
||||||
} else {
|
} else {
|
||||||
ERROR_LOG(VIDEO, "no Direct Rendering possible!");
|
ERROR_LOG(VIDEO, "no Direct Rendering possible!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hide the cursor now
|
||||||
|
if (g_Config.bHideCursor)
|
||||||
|
XDefineCursor (GLWin.dpy, GLWin.win, GLWin.blankCursor);
|
||||||
|
|
||||||
// better for pad plugin key input (thc)
|
// better for pad plugin key input (thc)
|
||||||
XSelectInput(GLWin.dpy, GLWin.win, ExposureMask | KeyPressMask | KeyReleaseMask |
|
XSelectInput(GLWin.dpy, GLWin.win, ExposureMask | KeyPressMask | KeyReleaseMask |
|
||||||
|
@ -579,6 +582,14 @@ void OpenGL_Update()
|
||||||
case ButtonPress:
|
case ButtonPress:
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
break;
|
break;
|
||||||
|
case FocusIn:
|
||||||
|
if (g_Config.bHideCursor)
|
||||||
|
XDefineCursor(GLWin.dpy, GLWin.win, GLWin.blankCursor);
|
||||||
|
break;
|
||||||
|
case FocusOut:
|
||||||
|
if (g_Config.bHideCursor)
|
||||||
|
XUndefineCursor(GLWin.dpy, GLWin.win);
|
||||||
|
break;
|
||||||
case ConfigureNotify:
|
case ConfigureNotify:
|
||||||
Window winDummy;
|
Window winDummy;
|
||||||
unsigned int borderDummy;
|
unsigned int borderDummy;
|
||||||
|
|
|
@ -93,6 +93,7 @@ typedef struct {
|
||||||
Window win;
|
Window win;
|
||||||
Display *dpy;
|
Display *dpy;
|
||||||
GLXContext ctx;
|
GLXContext ctx;
|
||||||
|
Cursor blankCursor;
|
||||||
XSetWindowAttributes attr;
|
XSetWindowAttributes attr;
|
||||||
Bool fs;
|
Bool fs;
|
||||||
Bool doubleBuffered;
|
Bool doubleBuffered;
|
||||||
|
|
|
@ -216,7 +216,6 @@ void GetMousePos(float& x, float& y)
|
||||||
float PictureWidth = WinWidth, PictureHeight = WinHeight;
|
float PictureWidth = WinWidth, PictureHeight = WinHeight;
|
||||||
#else
|
#else
|
||||||
#if defined(HAVE_X11) && HAVE_X11
|
#if defined(HAVE_X11) && HAVE_X11
|
||||||
Window GLWin = *(Window *)g_WiimoteInitialize.pXWindow;
|
|
||||||
float WinWidth = 0, WinHeight = 0;
|
float WinWidth = 0, WinHeight = 0;
|
||||||
float XOffset = 0, YOffset = 0;
|
float XOffset = 0, YOffset = 0;
|
||||||
int root_x, root_y, win_x, win_y;
|
int root_x, root_y, win_x, win_y;
|
||||||
|
|
|
@ -419,7 +419,9 @@ bool IsFocus()
|
||||||
Window FocusWin;
|
Window FocusWin;
|
||||||
int Revert;
|
int Revert;
|
||||||
XGetInputFocus(WMdisplay, &FocusWin, &Revert);
|
XGetInputFocus(WMdisplay, &FocusWin, &Revert);
|
||||||
return (GLWin != 0 && GLWin == FocusWin);
|
XWindowAttributes WinAttribs;
|
||||||
|
XGetWindowAttributes (WMdisplay, GLWin, &WinAttribs);
|
||||||
|
return (GLWin != 0 && (GLWin == FocusWin || WinAttribs.override_redirect));
|
||||||
#else
|
#else
|
||||||
return true;
|
return true;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue