Minor tweaks to fullscreen in linux, and make FullScr button in GUI work.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5074 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
parent
bd1b12e357
commit
634f6e512e
|
@ -148,7 +148,14 @@ void *GetWindowHandle()
|
|||
{
|
||||
return g_pWindowHandle;
|
||||
}
|
||||
|
||||
|
||||
#if defined HAVE_X11 && HAVE_X11
|
||||
void *GetXWindow()
|
||||
{
|
||||
return g_pXWindow;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool GetRealWiimote()
|
||||
{
|
||||
return g_bRealWiimote;
|
||||
|
|
|
@ -59,6 +59,9 @@ namespace Core
|
|||
extern SCoreStartupParameter g_CoreStartupParameter;
|
||||
|
||||
void* GetWindowHandle();
|
||||
#if defined HAVE_X11 && HAVE_X11
|
||||
void* GetXWindow();
|
||||
#endif
|
||||
bool GetRealWiimote();
|
||||
|
||||
extern bool bReadTrace;
|
||||
|
|
|
@ -50,6 +50,10 @@
|
|||
|
||||
#include <wx/datetime.h> // wxWidgets
|
||||
|
||||
#if defined HAVE_X11 && HAVE_X11
|
||||
#include <X11/Xlib.h>
|
||||
#endif
|
||||
|
||||
// Resources
|
||||
|
||||
extern "C" {
|
||||
|
@ -906,9 +910,32 @@ wxAuiNotebook* CFrame::CreateEmptyNotebook()
|
|||
return NB;
|
||||
}
|
||||
|
||||
#if defined HAVE_X11 && HAVE_X11
|
||||
void X11_ShowFullScreen(bool bF)
|
||||
{
|
||||
XEvent event;
|
||||
Display *dpy = (Display *)Core::GetWindowHandle();
|
||||
Window win = *(Window *)Core::GetXWindow();
|
||||
|
||||
// Init X event structure for TOGGLE_FULLSCREEN client message
|
||||
event.xclient.type = ClientMessage;
|
||||
event.xclient.format = 32;
|
||||
event.xclient.data.l[0] = XInternAtom(dpy, "TOGGLE_FULLSCREEN", False);;
|
||||
|
||||
// Send the event
|
||||
if (!XSendEvent(dpy, win, False, False, &event))
|
||||
{
|
||||
ERROR_LOG(VIDEO, "Failed to switch fullscreen/windowed mode.\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void CFrame::DoFullscreen(bool bF)
|
||||
{
|
||||
#if defined HAVE_X11 && HAVE_X11
|
||||
if ((Core::GetState() == Core::CORE_RUN) && !m_bModalDialogOpen)
|
||||
X11_ShowFullScreen(bF);
|
||||
#endif
|
||||
// Only switch this to fullscreen if we're rendering to main AND if we're running a game
|
||||
// plus if a modal dialog is open, this will still process the keyboard events, and may cause
|
||||
// the main window to become unresponsive, so we have to avoid that.
|
||||
|
|
|
@ -660,9 +660,7 @@ bool IsFocus()
|
|||
Window FocusWin;
|
||||
int Revert;
|
||||
XGetInputFocus(GCdisplay, &FocusWin, &Revert);
|
||||
XWindowAttributes WinAttribs;
|
||||
XGetWindowAttributes (GCdisplay, GLWin, &WinAttribs);
|
||||
return (GLWin != 0 && (GLWin == FocusWin || WinAttribs.override_redirect));
|
||||
return (GLWin != 0 && GLWin == FocusWin);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
|
|
|
@ -122,7 +122,7 @@ void UpdateFPSDisplay(const char *text)
|
|||
#if defined(HAVE_X11) && HAVE_X11
|
||||
void CreateXWindow (void)
|
||||
{
|
||||
Atom wmDelete;
|
||||
Atom wmProtocols[3];
|
||||
int width, height;
|
||||
|
||||
if (GLWin.fs)
|
||||
|
@ -153,8 +153,10 @@ void CreateXWindow (void)
|
|||
GLWin.win = XCreateWindow(GLWin.dpy, RootWindow(GLWin.dpy, GLWin.vi->screen),
|
||||
0, 0, width, height, 0, GLWin.vi->depth, InputOutput, GLWin.vi->visual,
|
||||
CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect, &GLWin.attr);
|
||||
wmDelete = XInternAtom(GLWin.dpy, "WM_DELETE_WINDOW", True);
|
||||
XSetWMProtocols(GLWin.dpy, GLWin.win, &wmDelete, 1);
|
||||
wmProtocols[0] = XInternAtom(GLWin.dpy, "WM_DELETE_WINDOW", True);
|
||||
wmProtocols[1] = XInternAtom(GLWin.dpy, "WM_TAKE_FOCUS", True);
|
||||
wmProtocols[2] = XInternAtom(GLWin.dpy, "TOGGLE_FULLSCREEN", False);
|
||||
XSetWMProtocols(GLWin.dpy, GLWin.win, wmProtocols, 3);
|
||||
XSetStandardProperties(GLWin.dpy, GLWin.win, "GPU", "GPU", None, NULL, 0, NULL);
|
||||
XMapRaised(GLWin.dpy, GLWin.win);
|
||||
if (GLWin.fs)
|
||||
|
@ -162,6 +164,7 @@ void CreateXWindow (void)
|
|||
XGrabKeyboard(GLWin.dpy, GLWin.win, True, GrabModeAsync, GrabModeAsync, CurrentTime);
|
||||
XGrabPointer(GLWin.dpy, GLWin.win, True, NULL,
|
||||
GrabModeAsync, GrabModeAsync, GLWin.win, None, CurrentTime);
|
||||
XSetInputFocus(GLWin.dpy, GLWin.win, RevertToPointerRoot, CurrentTime);
|
||||
}
|
||||
XSync(GLWin.dpy, True);
|
||||
}
|
||||
|
@ -186,16 +189,17 @@ void DestroyXWindow(void)
|
|||
GLWin.deskSize, GLWin.screenRotation, CurrentTime);
|
||||
#endif
|
||||
}
|
||||
XUndefineCursor(GLWin.dpy, GLWin.win);
|
||||
XUnmapWindow(GLWin.dpy, GLWin.win);
|
||||
XSync(GLWin.dpy, True);
|
||||
}
|
||||
|
||||
void ToggleFullscreenMode (void)
|
||||
{
|
||||
DestroyXWindow();
|
||||
GLWin.fs = !GLWin.fs;
|
||||
CreateXWindow();
|
||||
OpenGL_MakeCurrent();
|
||||
DestroyXWindow();
|
||||
GLWin.fs = !GLWin.fs;
|
||||
CreateXWindow();
|
||||
OpenGL_MakeCurrent();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -623,6 +627,8 @@ void OpenGL_Update()
|
|||
case ClientMessage:
|
||||
if ((ulong) event.xclient.data.l[0] == XInternAtom(GLWin.dpy, "WM_DELETE_WINDOW", False))
|
||||
g_VideoInitialize.pKeyPress(0x1b, False, False);
|
||||
if ((ulong) event.xclient.data.l[0] == XInternAtom(GLWin.dpy, "TOGGLE_FULLSCREEN", False))
|
||||
ToggleFullscreenMode();
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
|
@ -678,10 +684,7 @@ void OpenGL_Shutdown()
|
|||
XRRFreeScreenConfigInfo(GLWin.screenConfig);
|
||||
#endif
|
||||
if (g_Config.bHideCursor)
|
||||
{
|
||||
XUndefineCursor(GLWin.dpy, GLWin.win);
|
||||
XFreeCursor(GLWin.dpy, GLWin.blankCursor);
|
||||
}
|
||||
XFreeCursor(GLWin.dpy, GLWin.blankCursor);
|
||||
if (GLWin.ctx)
|
||||
{
|
||||
glXDestroyContext(GLWin.dpy, GLWin.ctx);
|
||||
|
|
|
@ -419,9 +419,7 @@ bool IsFocus()
|
|||
Window FocusWin;
|
||||
int Revert;
|
||||
XGetInputFocus(WMdisplay, &FocusWin, &Revert);
|
||||
XWindowAttributes WinAttribs;
|
||||
XGetWindowAttributes (WMdisplay, GLWin, &WinAttribs);
|
||||
return (GLWin != 0 && (GLWin == FocusWin || WinAttribs.override_redirect));
|
||||
return (GLWin != 0 && GLWin == FocusWin);
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue