Host: Add Host_RendererIsFullscreen().

This commit is contained in:
Jules Blok 2015-01-04 17:09:56 +01:00
parent 3b9c070ee0
commit b7e056c74d
9 changed files with 33 additions and 4 deletions

View File

@ -25,6 +25,7 @@
bool Host_UIHasFocus(); bool Host_UIHasFocus();
bool Host_RendererHasFocus(); bool Host_RendererHasFocus();
bool Host_RendererIsFullscreen();
void Host_ConnectWiimote(int wm_idx, bool connect); void Host_ConnectWiimote(int wm_idx, bool connect);
void Host_Message(int Id); void Host_Message(int Id);
void Host_NotifyMapLoaded(); void Host_NotifyMapLoaded();

View File

@ -48,6 +48,11 @@ bool Host_UIHasFocus()
return g_main_window->isActiveWindow(); return g_main_window->isActiveWindow();
} }
bool Host_RendererIsFullscreen()
{
return false; // TODO
}
void Host_RequestFullscreen(bool enable) void Host_RequestFullscreen(bool enable)
{ {
// TODO // TODO

View File

@ -119,6 +119,7 @@ public:
void OnRenderParentMove(wxMoveEvent& event); void OnRenderParentMove(wxMoveEvent& event);
bool RendererHasFocus(); bool RendererHasFocus();
bool UIHasFocus(); bool UIHasFocus();
bool RendererIsFullscreen();
void DoFullscreen(bool bF); void DoFullscreen(bool bF);
void ToggleDisplayMode (bool bFullscreen); void ToggleDisplayMode (bool bFullscreen);
void UpdateWiiMenuChoice(wxMenuItem *WiiMenuItem=nullptr); void UpdateWiiMenuChoice(wxMenuItem *WiiMenuItem=nullptr);
@ -329,7 +330,6 @@ private:
void OnGameListCtrl_ItemActivated(wxListEvent& event); void OnGameListCtrl_ItemActivated(wxListEvent& event);
void OnRenderParentResize(wxSizeEvent& event); void OnRenderParentResize(wxSizeEvent& event);
bool RendererIsFullscreen();
void StartGame(const std::string& filename); void StartGame(const std::string& filename);
void OnChangeColumnsVisible(wxCommandEvent& event); void OnChangeColumnsVisible(wxCommandEvent& event);

View File

@ -572,6 +572,11 @@ bool Host_RendererHasFocus()
return main_frame->RendererHasFocus(); return main_frame->RendererHasFocus();
} }
bool Host_RendererIsFullscreen()
{
return main_frame->RendererIsFullscreen();
}
void Host_ConnectWiimote(int wm_idx, bool connect) void Host_ConnectWiimote(int wm_idx, bool connect)
{ {
CFrame::ConnectWiimote(wm_idx, connect); CFrame::ConnectWiimote(wm_idx, connect);

View File

@ -94,6 +94,11 @@ bool Host_RendererHasFocus()
return true; return true;
} }
bool Host_RendererIsFullscreen()
{
return false;
}
void Host_ConnectWiimote(int wm_idx, bool connect) {} void Host_ConnectWiimote(int wm_idx, bool connect) {}
void Host_SetWiiMoteConnectionState(int _State) {} void Host_SetWiiMoteConnectionState(int _State) {}

View File

@ -26,6 +26,7 @@
#include "VideoCommon/VideoBackendBase.h" #include "VideoCommon/VideoBackendBase.h"
static bool rendererHasFocus = true; static bool rendererHasFocus = true;
static bool rendererIsFullscreen = false;
static bool running = true; static bool running = true;
class Platform class Platform
@ -89,6 +90,11 @@ bool Host_RendererHasFocus()
return rendererHasFocus; return rendererHasFocus;
} }
bool Host_RendererIsFullscreen()
{
return rendererIsFullscreen;
}
void Host_ConnectWiimote(int wm_idx, bool connect) {} void Host_ConnectWiimote(int wm_idx, bool connect) {}
void Host_SetWiiMoteConnectionState(int _State) {} void Host_SetWiiMoteConnectionState(int _State) {}
@ -158,7 +164,7 @@ class PlatformX11 : public Platform
if (fullscreen) if (fullscreen)
{ {
X11Utils::ToggleFullscreen(dpy, win); rendererIsFullscreen = X11Utils::ToggleFullscreen(dpy, win);
#if defined(HAVE_XRANDR) && HAVE_XRANDR #if defined(HAVE_XRANDR) && HAVE_XRANDR
XRRConfig->ToggleDisplayMode(True); XRRConfig->ToggleDisplayMode(True);
#endif #endif
@ -246,6 +252,7 @@ class PlatformX11 : public Platform
(unsigned int *)&SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth, (unsigned int *)&SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowWidth,
(unsigned int *)&SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight, (unsigned int *)&SConfig::GetInstance().m_LocalCoreStartupParameter.iRenderWindowHeight,
&borderDummy, &depthDummy); &borderDummy, &depthDummy);
rendererIsFullscreen = false;
} }
usleep(100000); usleep(100000);
} }

View File

@ -24,7 +24,7 @@ extern char **environ;
namespace X11Utils namespace X11Utils
{ {
void ToggleFullscreen(Display *dpy, Window win) bool ToggleFullscreen(Display *dpy, Window win)
{ {
// Init X event structure for _NET_WM_STATE_FULLSCREEN client message // Init X event structure for _NET_WM_STATE_FULLSCREEN client message
XEvent event; XEvent event;
@ -38,7 +38,12 @@ void ToggleFullscreen(Display *dpy, Window win)
// Send the event // Send the event
if (!XSendEvent(dpy, DefaultRootWindow(dpy), False, if (!XSendEvent(dpy, DefaultRootWindow(dpy), False,
SubstructureRedirectMask | SubstructureNotifyMask, &event)) SubstructureRedirectMask | SubstructureNotifyMask, &event))
{
ERROR_LOG(VIDEO, "Failed to switch fullscreen/windowed mode."); ERROR_LOG(VIDEO, "Failed to switch fullscreen/windowed mode.");
return false;
}
return true;
} }
void InhibitScreensaver(Display *dpy, Window win, bool suspend) void InhibitScreensaver(Display *dpy, Window win, bool suspend)

View File

@ -34,7 +34,7 @@
namespace X11Utils namespace X11Utils
{ {
void ToggleFullscreen(Display *dpy, Window win); bool ToggleFullscreen(Display *dpy, Window win);
#if defined(HAVE_WX) && HAVE_WX #if defined(HAVE_WX) && HAVE_WX
Window XWindowFromHandle(void *Handle); Window XWindowFromHandle(void *Handle);
Display *XDisplayFromHandle(void *Handle); Display *XDisplayFromHandle(void *Handle);

View File

@ -22,6 +22,7 @@ void Host_RequestFullscreen(bool) {}
void Host_SetStartupDebuggingParameters() {} void Host_SetStartupDebuggingParameters() {}
bool Host_UIHasFocus() { return false; } bool Host_UIHasFocus() { return false; }
bool Host_RendererHasFocus() { return false; } bool Host_RendererHasFocus() { return false; }
bool Host_RendererIsFullscreen() { return false; }
void Host_ConnectWiimote(int, bool) {} void Host_ConnectWiimote(int, bool) {}
void Host_SetWiiMoteConnectionState(int) {} void Host_SetWiiMoteConnectionState(int) {}
void Host_ShowVideoConfig(void*, const std::string&, const std::string&) {} void Host_ShowVideoConfig(void*, const std::string&, const std::string&) {}