X11Utils: Simplify the Fullscreen interface

Since we only use the toggle action, only keep that.
This commit is contained in:
Jasper St. Pierre 2014-08-06 22:16:28 -04:00
parent 09eb30ea3b
commit 2eacf229ed
3 changed files with 5 additions and 9 deletions

View file

@ -168,7 +168,7 @@ class PlatformX11 : public Platform
if (fullscreen) if (fullscreen)
{ {
X11Utils::EWMH_Fullscreen(dpy, _NET_WM_STATE_TOGGLE); X11Utils::ToggleFullscreen(dpy);
#if defined(HAVE_XRANDR) && HAVE_XRANDR #if defined(HAVE_XRANDR) && HAVE_XRANDR
XRRConfig->ToggleDisplayMode(True); XRRConfig->ToggleDisplayMode(True);
#endif #endif
@ -204,7 +204,7 @@ class PlatformX11 : public Platform
else if ((key == XK_Return) && (event.xkey.state & Mod1Mask)) else if ((key == XK_Return) && (event.xkey.state & Mod1Mask))
{ {
fullscreen = !fullscreen; fullscreen = !fullscreen;
X11Utils::EWMH_Fullscreen(dpy, _NET_WM_STATE_TOGGLE); X11Utils::ToggleFullscreen(dpy);
#if defined(HAVE_XRANDR) && HAVE_XRANDR #if defined(HAVE_XRANDR) && HAVE_XRANDR
XRRConfig->ToggleDisplayMode(fullscreen); XRRConfig->ToggleDisplayMode(fullscreen);
#endif #endif

View file

@ -24,12 +24,8 @@ extern char **environ;
namespace X11Utils namespace X11Utils
{ {
void EWMH_Fullscreen(Display *dpy, int action) void ToggleFullscreen(Display *dpy)
{ {
_assert_(action == _NET_WM_STATE_REMOVE ||
action == _NET_WM_STATE_ADD ||
action == _NET_WM_STATE_TOGGLE);
Window win = (Window)Core::GetWindowHandle(); Window win = (Window)Core::GetWindowHandle();
// Init X event structure for _NET_WM_STATE_FULLSCREEN client message // Init X event structure for _NET_WM_STATE_FULLSCREEN client message
@ -38,7 +34,7 @@ void EWMH_Fullscreen(Display *dpy, int action)
event.xclient.message_type = XInternAtom(dpy, "_NET_WM_STATE", False); event.xclient.message_type = XInternAtom(dpy, "_NET_WM_STATE", False);
event.xclient.window = win; event.xclient.window = win;
event.xclient.format = 32; event.xclient.format = 32;
event.xclient.data.l[0] = action; event.xclient.data.l[0] = _NET_WM_STATE_TOGGLE;
event.xclient.data.l[1] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False); event.xclient.data.l[1] = XInternAtom(dpy, "_NET_WM_STATE_FULLSCREEN", False);
// Send the event // Send the event

View file

@ -34,7 +34,7 @@
namespace X11Utils namespace X11Utils
{ {
void EWMH_Fullscreen(Display *dpy, int action); void ToggleFullscreen(Display *dpy);
#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);