Rewrite of fullscreen toggling in linux. This goes back to using the EWMH specifications. I wasn't using it right before, but now it should work on all EWMH compliant window managers (like KDE, Metacity, Compiz, etc). Since this doesn't need an override redirect Alt-Tab works even in fullscreen mode. This also allows for some other nice things to be done.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5199 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
1 parent
c5d4c2c1b1
commit
2015d252f0
12 files changed
+387
-300
No files matched your search
@@ -29,11 +29,6 @@
|
||||
#include "MathUtil.h"
|
||||
#include "MemoryUtil.h"
|
||||
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/keysym.h>
|
||||
#endif
|
||||
|
||||
#include "Console.h"
|
||||
#include "Core.h"
|
||||
#include "CPUDetect.h"
|
||||
@@ -252,47 +247,6 @@ void Stop() // - Hammertime!
|
||||
g_EmuThread = 0;
|
||||
}
|
||||
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
void ProcessXEvents(void)
|
||||
{
|
||||
if (GetState() == CORE_PAUSE)
|
||||
{
|
||||
Display *dpy = (Display *)g_pWindowHandle;
|
||||
XEvent event;
|
||||
KeySym key;
|
||||
int num_events;
|
||||
for (num_events = XPending(dpy);num_events > 0;num_events--)
|
||||
{
|
||||
XNextEvent(dpy, &event);
|
||||
switch(event.type) {
|
||||
case KeyPress:
|
||||
key = XLookupKeysym((XKeyEvent*)&event, 0);
|
||||
if (key == XK_Escape)
|
||||
Host_Message(WM_USER_PAUSE);
|
||||
case ClientMessage:
|
||||
if ((ulong) event.xclient.data.l[0] == XInternAtom(dpy, "WM_DELETE_WINDOW", False))
|
||||
Host_Message(WM_USER_STOP);
|
||||
if ((ulong) event.xclient.data.l[0] == XInternAtom(dpy, "WINDOW_REFOCUS", False))
|
||||
XSetInputFocus(dpy, *(Window *)g_pXWindow, RevertToPointerRoot, CurrentTime);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
THREAD_RETURN XEventThread(void *pArg)
|
||||
{
|
||||
while (PowerPC::GetState() != PowerPC::CPU_POWERDOWN)
|
||||
{
|
||||
ProcessXEvents();
|
||||
Common::SleepCurrentThread(200);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Create the CPU thread. which would be a CPU + Video thread in Single Core mode.
|
||||
|
||||
THREAD_RETURN CpuThread(void *pArg)
|
||||
@@ -368,6 +322,9 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||
VideoInitialize.pScheduleEvent_Threadsafe = CoreTiming::ScheduleEvent_Threadsafe;
|
||||
// This is first the m_Panel handle, then it is updated to have the new window handle
|
||||
VideoInitialize.pWindowHandle = _CoreParameter.hMainWindow;
|
||||
#if defined(HAVE_X11) && HAVE_X11 && defined(HAVE_GTK2) && HAVE_GTK2
|
||||
VideoInitialize.pPanel = _CoreParameter.hMainWindow;
|
||||
#endif
|
||||
VideoInitialize.pLog = Callback_VideoLog;
|
||||
VideoInitialize.pSysMessage = Host_SysMessage;
|
||||
VideoInitialize.pRequestWindowSize = NULL; //Callback_VideoRequestWindowSize;
|
||||
@@ -388,7 +345,7 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||
// Under linux, this is an X11 Display, not a HWND!
|
||||
g_pWindowHandle = (HWND)VideoInitialize.pWindowHandle;
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
g_pXWindow = (Window *)VideoInitialize.pXWindow;
|
||||
g_pXWindow = (void *)VideoInitialize.pXWindow;
|
||||
#endif
|
||||
Callback_PeekMessages = VideoInitialize.pPeekMessages;
|
||||
g_pUpdateFPSDisplay = VideoInitialize.pUpdateFPSDisplay;
|
||||
@@ -417,6 +374,9 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||
PADInitialize.hWnd = g_pWindowHandle;
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
PADInitialize.pXWindow = g_pXWindow;
|
||||
#if defined(HAVE_GTK2) && HAVE_GTK2
|
||||
PADInitialize.pPanel = VideoInitialize.pPanel;
|
||||
#endif
|
||||
#endif
|
||||
PADInitialize.pLog = Callback_PADLog;
|
||||
// This is may be needed to avoid a SDL problem
|
||||
@@ -429,6 +389,9 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||
SWiimoteInitialize WiimoteInitialize;
|
||||
WiimoteInitialize.hWnd = g_pWindowHandle;
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
#if defined(HAVE_GTK2) && HAVE_GTK2
|
||||
WiimoteInitialize.pPanel = VideoInitialize.pPanel;
|
||||
#endif
|
||||
WiimoteInitialize.pXWindow = g_pXWindow;
|
||||
#endif
|
||||
WiimoteInitialize.ISOId = Ascii2Hex(_CoreParameter.m_strUniqueID);
|
||||
@@ -459,10 +422,6 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||
|
||||
// Spawn the CPU thread
|
||||
Common::Thread *cpuThread = NULL;
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
Common::Thread *xEventThread = NULL;
|
||||
#endif
|
||||
|
||||
// ENTER THE VIDEO THREAD LOOP
|
||||
if (_CoreParameter.bCPUThread)
|
||||
{
|
||||
@@ -471,9 +430,6 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||
|
||||
Plugins.GetVideo()->Video_Prepare(); // wglMakeCurrent
|
||||
cpuThread = new Common::Thread(CpuThread, pArg);
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
xEventThread = new Common::Thread(XEventThread, pArg);
|
||||
#endif
|
||||
Common::SetCurrentThreadName("Video thread");
|
||||
|
||||
if (g_pUpdateFPSDisplay != NULL)
|
||||
@@ -508,9 +464,6 @@ THREAD_RETURN EmuThread(void *pArg)
|
||||
{
|
||||
if (Callback_PeekMessages)
|
||||
Callback_PeekMessages();
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
ProcessXEvents();
|
||||
#endif
|
||||
Common::SleepCurrentThread(20);
|
||||
}
|
||||
|
||||
@@ -817,11 +770,15 @@ void Callback_KeyPress(int key, bool shift, bool control)
|
||||
State_UndoLoadState();
|
||||
}
|
||||
#if defined(HAVE_X11) && HAVE_X11
|
||||
if (key == 0)
|
||||
Host_Message(WM_USER_CREATE);
|
||||
// 0x1b == VK_ESCAPE
|
||||
if (key == 0x1b)
|
||||
Host_Message(WM_USER_STOP);
|
||||
if (key == 0x1c)
|
||||
Host_Message(WM_USER_PAUSE);
|
||||
if (key == 0x1d)
|
||||
Host_Message(TOGGLE_FULLSCREEN);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user