[Vm-dev] [commit][3499]
Fix for Mantix 7833 by Nicolai Hess to support return from full screen
commits at squeakvm.org
commits at squeakvm.org
Sun Nov 15 17:33:08 UTC 2015
Revision: 3499
Author: lewis
Date: 2015-11-15 09:33:07 -0800 (Sun, 15 Nov 2015)
Log Message:
-----------
Fix for Mantix 7833 by Nicolai Hess to support return from full screen
mode on certain window managers that do not handle it properly. Also add
command line parameter -fullscreenDirect and matching environment variable
SQUEAK_FULLSCREEN_DIRECT to allow original behavior to be specified in
the case of a simple window manager (e.g. twm) than does not understand
the _NET_WM_STATE_FULLSCREEN window manager hint.
Modified Paths:
--------------
branches/Cog/platforms/unix/vm/sqUnixMain.c
branches/Cog/platforms/unix/vm-display-X11/sqUnixX11.c
Modified: branches/Cog/platforms/unix/vm/sqUnixMain.c
===================================================================
--- branches/Cog/platforms/unix/vm/sqUnixMain.c 2015-11-15 17:32:03 UTC (rev 3498)
+++ branches/Cog/platforms/unix/vm/sqUnixMain.c 2015-11-15 17:33:07 UTC (rev 3499)
@@ -1370,11 +1370,13 @@
if (!strcmp(argv[0], arg)) \
return parseModuleArgument(argc, argv, &type##Module, #type, name);
- moduleArg("-nodisplay", display, "null");
- moduleArg("-display", display, "X11");
- moduleArg("-headless", display, "X11");
- moduleArg("-quartz", display, "Quartz");
- moduleArg("-nosound", sound, "null");
+ moduleArg("-nodisplay", display, "null");
+ moduleArg("-display", display, "X11");
+ moduleArg("-headless", display, "X11");
+ moduleArg("-fullscreen", display, "X11");
+ moduleArg("-fullscreenDirect", display, "X11");
+ moduleArg("-quartz", display, "Quartz");
+ moduleArg("-nosound", sound, "null");
# undef moduleArg
Modified: branches/Cog/platforms/unix/vm-display-X11/sqUnixX11.c
===================================================================
--- branches/Cog/platforms/unix/vm-display-X11/sqUnixX11.c 2015-11-15 17:32:03 UTC (rev 3498)
+++ branches/Cog/platforms/unix/vm-display-X11/sqUnixX11.c 2015-11-15 17:33:07 UTC (rev 3499)
@@ -336,6 +336,7 @@
int sleepWhenUnmapped= 0;
int noTitle= 0;
int fullScreen= 0;
+int fullScreenDirect= 0;
int iconified= 0;
int withSpy= 0;
@@ -5084,6 +5085,57 @@
}
+static void enterFullScreenMode(Window root)
+{
+ XSynchronize(stDisplay, True);
+ overrideRedirect(stDisplay, stWindow, True);
+ XReparentWindow(stDisplay, stWindow, root, 0, 0);
+#if 1
+ XResizeWindow(stDisplay, stWindow, scrW, scrH);
+#else
+ XResizeWindow(stDisplay, stParent, scrW, scrH);
+#endif
+ XLowerWindow(stDisplay, stParent);
+ XRaiseWindow(stDisplay, stWindow);
+ XSetInputFocus(stDisplay, stWindow, RevertToPointerRoot, CurrentTime);
+ XSynchronize(stDisplay, False);
+}
+
+
+static void returnFromFullScreenMode()
+{
+ XSynchronize(stDisplay, True);
+ XRaiseWindow(stDisplay, stParent);
+ XReparentWindow(stDisplay, stWindow, stParent, 0, 0);
+ overrideRedirect(stDisplay, stWindow, False);
+#if 1
+ XResizeWindow(stDisplay, stWindow, scrW, scrH);
+#else
+ XResizeWindow(stDisplay, stParent, winW, winH);
+#endif
+ XSetInputFocus(stDisplay, stWindow, RevertToPointerRoot, CurrentTime);
+ XSynchronize(stDisplay, False);
+}
+
+
+static void sendFullScreenHint(int enable)
+{
+ XEvent xev;
+ Atom wm_state = XInternAtom(stDisplay, "_NET_WM_STATE", False);
+ Atom fullscreen = XInternAtom(stDisplay, "_NET_WM_STATE_FULLSCREEN", False);
+
+ memset(&xev, 0, sizeof(xev));
+ xev.type = ClientMessage;
+ xev.xclient.window = stParent;
+ xev.xclient.message_type = wm_state;
+ xev.xclient.format = 32;
+ xev.xclient.data.l[0] = enable; /* 1 enable, 0 disable fullscreen */
+ xev.xclient.data.l[1] = fullscreen;
+ xev.xclient.data.l[2] = 0;
+ XSendEvent(stDisplay, DefaultRootWindow(stDisplay), False, SubstructureNotifyMask, &xev);
+}
+
+
static sqInt display_ioSetFullScreen(sqInt fullScreen)
{
int winX, winY;
@@ -5110,18 +5162,10 @@
winW= (winW / sizeof(void *)) * sizeof(void *);
setSavedWindowSize((winW << 16) + (winH & 0xFFFF));
savedWindowOrigin= (winX << 16) + (winY & 0xFFFF);
- XSynchronize(stDisplay, True);
- overrideRedirect(stDisplay, stWindow, True);
- XReparentWindow(stDisplay, stWindow, root, 0, 0);
-# if 1
- XResizeWindow(stDisplay, stWindow, scrW, scrH);
-# else
- XResizeWindow(stDisplay, stParent, scrW, scrH);
-# endif
- XLowerWindow(stDisplay, stParent);
- XRaiseWindow(stDisplay, stWindow);
- XSetInputFocus(stDisplay, stWindow, RevertToPointerRoot, CurrentTime);
- XSynchronize(stDisplay, False);
+ if (fullScreenDirect)
+ enterFullScreenMode(root); /* simple window manager, e.g. twm */
+ else
+ sendFullScreenHint(1); /* Required for Compiz window manager */
windowState= WIN_ZOOMED;
fullDisplayUpdate();
}
@@ -5142,17 +5186,10 @@
winX= savedWindowOrigin >> 16;
winY= savedWindowOrigin & 0xFFFF;
savedWindowOrigin= -1; /* prevents consecutive full-screen disables */
- XSynchronize(stDisplay, True);
- XRaiseWindow(stDisplay, stParent);
- XReparentWindow(stDisplay, stWindow, stParent, 0, 0);
- overrideRedirect(stDisplay, stWindow, False);
-# if 1
- XResizeWindow(stDisplay, stWindow, scrW, scrH);
-# else
- XResizeWindow(stDisplay, stParent, winW, winH);
-# endif
- XSetInputFocus(stDisplay, stWindow, RevertToPointerRoot, CurrentTime);
- XSynchronize(stDisplay, False);
+ if (fullScreenDirect)
+ returnFromFullScreenMode(); /* simple window manager, e.g. twm */
+ else
+ sendFullScreenHint(0); /* Required for Compiz window manager */
windowState= WIN_CHANGED;
}
}
@@ -7266,6 +7303,7 @@
printf(" -compositioninput enable overlay window for composed characters\n");
printf(" -display <dpy> display on <dpy> (default: $DISPLAY)\n");
printf(" -fullscreen occupy the entire screen\n");
+ printf(" -fullscreenDirect simple window manager support for fullscreen\n");
#if (USE_X11_GLX)
printf(" -glxdebug <n> set GLX debug verbosity level to <n>\n");
#endif
@@ -7325,6 +7363,7 @@
if (getenv("SQUEAK_NOTITLE")) noTitle= 1;
if (getenv("SQUEAK_NOXDND")) useXdnd= 0;
if (getenv("SQUEAK_FULLSCREEN")) fullScreen= 1;
+ if (getenv("SQUEAK_FULLSCREEN_DIRECT")) fullScreenDirect= 1;
if (getenv("SQUEAK_ICONIC")) iconified= 1;
if (getenv("SQUEAK_MAPDELBS")) mapDelBs= 1;
if (getenv("SQUEAK_SWAPBTN")) swapBtn= 1;
@@ -7356,6 +7395,7 @@
else if (!strcmp(arg, "-mapdelbs")) mapDelBs= 1;
else if (!strcmp(arg, "-swapbtn")) swapBtn= 1;
else if (!strcmp(arg, "-fullscreen")) fullScreen= 1;
+ else if (!strcmp(arg, "-fullscreenDirect")) fullScreenDirect= 1;
else if (!strcmp(arg, "-iconic")) iconified= 1;
#if !defined (INIT_INPUT_WHEN_KEY_PRESSED)
else if (!strcmp(arg, "-nointl")) initInput= initInputNone;
More information about the Vm-dev
mailing list