hw/xwin: Default to -noresize when -fullscreen is used

Currently, just using -fullscreen fails in winValidateArgs(), as the default
-resize=randr is incompatible with -fullscreen.

Set the default resize mode to -noresize if -fullscreen is used.

Also, rename enum value notAllowed -> resizeNotAllowed for clarity.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
Jon Turney 2014-11-11 11:46:25 +00:00
parent 42f7cd5d92
commit e1b983b55e
7 changed files with 26 additions and 10 deletions

View File

@ -690,6 +690,20 @@ OsVendorInit(void)
} }
} }
} }
/* Work out what the default resize setting should be, and apply it if it
was not explicitly specified */
{
int j;
for (j = 0; j < g_iNumScreens; j++) {
if (g_ScreenInfo[j].iResizeMode == resizeDefault) {
if (g_ScreenInfo[j].fFullScreen)
g_ScreenInfo[j].iResizeMode = resizeNotAllowed;
else
g_ScreenInfo[j].iResizeMode = resizeWithRandr;
}
}
}
} }
static void static void

View File

@ -124,7 +124,8 @@ Alternative name for \fB\-resize=scrollbars\fP.
.SH OPTIONS CONTROLLING RESIZE BEHAVIOUR .SH OPTIONS CONTROLLING RESIZE BEHAVIOUR
.TP 8 .TP 8
.B \-resize[=none|scrollbars|randr] .B \-resize[=none|scrollbars|randr]
Select the resize mode of an X screen. The default is randr. Select the resize mode of an X screen.
The default is \fBnone\fP if \fB\-fullscreen\fP is used, \fBrandr\fP otherwise.
.RS .RS
.IP \fB\-resize=none\fP 8 .IP \fB\-resize=none\fP 8

View File

@ -335,7 +335,8 @@ typedef struct {
* Resize modes * Resize modes
*/ */
typedef enum { typedef enum {
notAllowed, resizeDefault = -1,
resizeNotAllowed,
resizeWithScrollbars, resizeWithScrollbars,
resizeWithRandr resizeWithRandr
} winResizeMode; } winResizeMode;

View File

@ -171,7 +171,7 @@ winCreateBoundingWindowWindowed(ScreenPtr pScreen)
fForceShowWindow = TRUE; fForceShowWindow = TRUE;
} }
dwWindowStyle |= WS_CAPTION; dwWindowStyle |= WS_CAPTION;
if (pScreenInfo->iResizeMode != notAllowed) if (pScreenInfo->iResizeMode != resizeNotAllowed)
dwWindowStyle |= WS_THICKFRAME | WS_MAXIMIZEBOX; dwWindowStyle |= WS_THICKFRAME | WS_MAXIMIZEBOX;
} }
else else
@ -226,7 +226,7 @@ winCreateBoundingWindowWindowed(ScreenPtr pScreen)
) )
&& (pScreenInfo->iResizeMode == resizeWithScrollbars)) { && (pScreenInfo->iResizeMode == resizeWithScrollbars)) {
/* We cannot have scrollbars if we do not have a window border */ /* We cannot have scrollbars if we do not have a window border */
pScreenInfo->iResizeMode = notAllowed; pScreenInfo->iResizeMode = resizeNotAllowed;
} }
/* Did the user specify a height and width? */ /* Did the user specify a height and width? */
@ -253,7 +253,7 @@ winCreateBoundingWindowWindowed(ScreenPtr pScreen)
#endif #endif
/* Are we resizable */ /* Are we resizable */
if (pScreenInfo->iResizeMode != notAllowed) { if (pScreenInfo->iResizeMode != resizeNotAllowed) {
#if CYGDEBUG #if CYGDEBUG
winDebug winDebug
("winCreateBoundingWindowWindowed - Window is resizable\n"); ("winCreateBoundingWindowWindowed - Window is resizable\n");

View File

@ -140,7 +140,7 @@ winInitializeScreenDefaults(void)
#endif #endif
defaultScreenInfo.fMultipleMonitors = FALSE; defaultScreenInfo.fMultipleMonitors = FALSE;
defaultScreenInfo.fLessPointer = FALSE; defaultScreenInfo.fLessPointer = FALSE;
defaultScreenInfo.iResizeMode = resizeWithRandr; defaultScreenInfo.iResizeMode = resizeDefault;
defaultScreenInfo.fNoTrayIcon = FALSE; defaultScreenInfo.fNoTrayIcon = FALSE;
defaultScreenInfo.iE3BTimeout = WIN_E3B_DEFAULT; defaultScreenInfo.iE3BTimeout = WIN_E3B_DEFAULT;
defaultScreenInfo.fUseWinKillKey = WIN_DEFAULT_WIN_KILL; defaultScreenInfo.fUseWinKillKey = WIN_DEFAULT_WIN_KILL;
@ -662,7 +662,7 @@ ddxProcessArgument(int argc, char *argv[], int i)
if (IS_OPTION("-resize")) if (IS_OPTION("-resize"))
mode = resizeWithRandr; mode = resizeWithRandr;
else if (IS_OPTION("-noresize")) else if (IS_OPTION("-noresize"))
mode = notAllowed; mode = resizeNotAllowed;
else if (strncmp(argv[i], "-resize=", strlen("-resize=")) == 0) { else if (strncmp(argv[i], "-resize=", strlen("-resize=")) == 0) {
char *option = argv[i] + strlen("-resize="); char *option = argv[i] + strlen("-resize=");
@ -671,7 +671,7 @@ ddxProcessArgument(int argc, char *argv[], int i)
else if (strcmp(option, "scrollbars") == 0) else if (strcmp(option, "scrollbars") == 0)
mode = resizeWithScrollbars; mode = resizeWithScrollbars;
else if (strcmp(option, "none") == 0) else if (strcmp(option, "none") == 0)
mode = notAllowed; mode = resizeNotAllowed;
else { else {
ErrorF("ddxProcessArgument - resize - Invalid resize mode %s\n", ErrorF("ddxProcessArgument - resize - Invalid resize mode %s\n",
option); option);

View File

@ -153,7 +153,7 @@ winValidateArgs(void)
/* Check for fullscreen and any non-fullscreen parameters */ /* Check for fullscreen and any non-fullscreen parameters */
if (g_ScreenInfo[i].fFullScreen if (g_ScreenInfo[i].fFullScreen
&& ((g_ScreenInfo[i].iResizeMode != notAllowed) && ((g_ScreenInfo[i].iResizeMode != resizeNotAllowed)
|| !g_ScreenInfo[i].fDecoration || !g_ScreenInfo[i].fDecoration
|| g_ScreenInfo[i].fLessPointer)) { || g_ScreenInfo[i].fLessPointer)) {
ErrorF("winValidateArgs - -fullscreen is invalid with " ErrorF("winValidateArgs - -fullscreen is invalid with "

View File

@ -316,7 +316,7 @@ winWindowProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
#endif #endif
/* Break if we do not allow resizing */ /* Break if we do not allow resizing */
if ((s_pScreenInfo->iResizeMode == notAllowed) if ((s_pScreenInfo->iResizeMode == resizeNotAllowed)
|| !s_pScreenInfo->fDecoration || !s_pScreenInfo->fDecoration
#ifdef XWIN_MULTIWINDOWEXTWM #ifdef XWIN_MULTIWINDOWEXTWM
|| s_pScreenInfo->fMWExtWM || s_pScreenInfo->fMWExtWM