Cygwin/X: Add -resize command line option
Add -resize command line option to configure how native window sizing frame is used. In additions to the existing fixed and scrollbars modes, add a new mode to allow framebuffer to be resized using native window frame Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Colin Harrison <colin.harrison@virgin.net> Tested-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
parent
46c5778853
commit
873abef315
|
@ -826,6 +826,11 @@ winUseMsg (void)
|
||||||
"\tSpecify an optional refresh rate to use in fullscreen mode\n"
|
"\tSpecify an optional refresh rate to use in fullscreen mode\n"
|
||||||
"\twith a DirectDraw engine.\n");
|
"\twith a DirectDraw engine.\n");
|
||||||
|
|
||||||
|
ErrorF ("-resize=none|scrollbars|randr"
|
||||||
|
"\tIn windowed mode, [don't] allow resizing of the window. 'scrollbars'\n"
|
||||||
|
"\tmode gives the window scrollbars as needed, 'randr' mode uses the RANR\n"
|
||||||
|
"\textension to resize the X screen.\n");
|
||||||
|
|
||||||
ErrorF ("-rootless\n"
|
ErrorF ("-rootless\n"
|
||||||
"\tRun the server in rootless mode.\n");
|
"\tRun the server in rootless mode.\n");
|
||||||
|
|
||||||
|
@ -839,11 +844,6 @@ winUseMsg (void)
|
||||||
"\t -screen 0 1024x768@3 ; 3rd monitor size 1024x768\n"
|
"\t -screen 0 1024x768@3 ; 3rd monitor size 1024x768\n"
|
||||||
"\t -screen 0 @1 ; on 1st monitor using its full resolution (the default)\n");
|
"\t -screen 0 @1 ; on 1st monitor using its full resolution (the default)\n");
|
||||||
|
|
||||||
ErrorF ("-scrollbars\n"
|
|
||||||
"\tIn windowed mode, allow screens bigger than the Windows desktop.\n"
|
|
||||||
"\tMoreover, if the window has decorations, one can now resize\n"
|
|
||||||
"\tit.\n");
|
|
||||||
|
|
||||||
ErrorF ("-silent-dup-error\n"
|
ErrorF ("-silent-dup-error\n"
|
||||||
"\tIf another instance of " EXECUTABLE_NAME " with the same display number is running\n"
|
"\tIf another instance of " EXECUTABLE_NAME " with the same display number is running\n"
|
||||||
"\texit silently and don't display any error message.\n");
|
"\texit silently and don't display any error message.\n");
|
||||||
|
|
|
@ -103,7 +103,7 @@ Examples:
|
||||||
|
|
||||||
.SH OPTIONS CONTROLLING THE APPEARANCE OF THE X SCREEN WINDOWS
|
.SH OPTIONS CONTROLLING THE APPEARANCE OF THE X SCREEN WINDOWS
|
||||||
These parameters only apply to windowed mode screens i.e. not
|
These parameters only apply to windowed mode screens i.e. not
|
||||||
in \fB-multwindow\fP or \fB-rootless\fP mode
|
in \fB-multiwindow\fP or \fB-rootless\fP mode.
|
||||||
.TP 8
|
.TP 8
|
||||||
.B "\-fullscreen"
|
.B "\-fullscreen"
|
||||||
The X server window takes the full screen, covering completely the
|
The X server window takes the full screen, covering completely the
|
||||||
|
@ -115,10 +115,52 @@ etc.
|
||||||
This parameter is ignored when the \fB\-fullscreen\fP parameter is specified.
|
This parameter is ignored when the \fB\-fullscreen\fP parameter is specified.
|
||||||
.TP 8
|
.TP 8
|
||||||
.B \-scrollbars
|
.B \-scrollbars
|
||||||
In windowed mode, allow screens bigger than the \fIWindows\fP desktop.
|
Alternative name for \fB\-resize=scrollbars\fP.
|
||||||
Moreover, if the window has decorations, one can now resize it.
|
|
||||||
This parameter is ignored when the \fB\-fullscreen\fP parameter is specified.
|
|
||||||
|
|
||||||
|
.SH OPTIONS CONTROLLING RESIZE BEHAVIOUR
|
||||||
|
.TP 8
|
||||||
|
.B \-resize[=none|scrollbars|randr]
|
||||||
|
Select the resize mode of an X screen.
|
||||||
|
|
||||||
|
.RS
|
||||||
|
.IP \fB\-resize=none\fP 8
|
||||||
|
(default). The screen is not resizable.
|
||||||
|
|
||||||
|
In windowed mode, if the window has decorations, a fixed frame is used.
|
||||||
|
|
||||||
|
.IP \fB\-resize=scrollbars\fP 8
|
||||||
|
The screen window is resizeable, but the screen is not resizable.
|
||||||
|
|
||||||
|
In windowed mode, if the window has decorations, a resizing frame is used.
|
||||||
|
Scrollbars are drawn when needed to allow the entire X screen
|
||||||
|
to viewed by adjusting them.
|
||||||
|
|
||||||
|
This also permits screens bigger than the \fIWindows\fP virtual desktop to be used.
|
||||||
|
|
||||||
|
This parameter is ignored in \fB-multiwindow\fP or \fB-rootless\fP mode.
|
||||||
|
Alternative name is \fB\-scrollbars\fP.
|
||||||
|
|
||||||
|
.IP \fB\-resize=randr\fP 8
|
||||||
|
The screen is resizable and the screen window is resizeable.
|
||||||
|
|
||||||
|
In windowed mode, if the window has decorations, a resizing frame is used.
|
||||||
|
|
||||||
|
Resizing the \fIWindows\fP window will use the RANDR extension to change
|
||||||
|
the size of the X screen. Likewise, changing the size of
|
||||||
|
the X screen using the RANDR extension will cause the size
|
||||||
|
of the \fIWindows\fP window containing the X screen to be changed.
|
||||||
|
|
||||||
|
In \fB-multiwindow\fP or \fB-rootless\fP mode, if the X screen is
|
||||||
|
of the same dimensions as a Windows monitor or the virtual desktop,
|
||||||
|
the X server will respond to the WM_DISPLAYCHANGED sent when those
|
||||||
|
dimensions change by resizing the X screen. Changing the size
|
||||||
|
of the X screen using the RANDR extension is not permitted.
|
||||||
|
|
||||||
|
The maximum dimensions of the screen are the dimensions of the \fIWindows\fP virtual desktop.
|
||||||
|
|
||||||
|
.IP \fB\--resize\fP 8
|
||||||
|
on its own is equivalent to \fB\--resize=randr\fP
|
||||||
|
.RE
|
||||||
|
|
||||||
.SH OPTIONS CONTROLLING WINDOWS INTEGRATION
|
.SH OPTIONS CONTROLLING WINDOWS INTEGRATION
|
||||||
.TP 8
|
.TP 8
|
||||||
|
|
|
@ -378,6 +378,15 @@ typedef struct {
|
||||||
miPointerSpriteFuncPtr spriteFuncs;
|
miPointerSpriteFuncPtr spriteFuncs;
|
||||||
} winCursorRec;
|
} winCursorRec;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Resize modes
|
||||||
|
*/
|
||||||
|
typedef enum {
|
||||||
|
notAllowed,
|
||||||
|
resizeWithScrollbars,
|
||||||
|
resizeWithRandr
|
||||||
|
} winResizeMode;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Screen information structure that we need before privates are available
|
* Screen information structure that we need before privates are available
|
||||||
* in the server startup sequence.
|
* in the server startup sequence.
|
||||||
|
@ -439,7 +448,7 @@ typedef struct
|
||||||
#endif
|
#endif
|
||||||
Bool fMultipleMonitors;
|
Bool fMultipleMonitors;
|
||||||
Bool fLessPointer;
|
Bool fLessPointer;
|
||||||
Bool fScrollbars;
|
winResizeMode iResizeMode;
|
||||||
Bool fNoTrayIcon;
|
Bool fNoTrayIcon;
|
||||||
int iE3BTimeout;
|
int iE3BTimeout;
|
||||||
/* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */
|
/* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */
|
||||||
|
|
|
@ -192,7 +192,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
|
||||||
fForceShowWindow = TRUE;
|
fForceShowWindow = TRUE;
|
||||||
}
|
}
|
||||||
dwWindowStyle |= WS_CAPTION;
|
dwWindowStyle |= WS_CAPTION;
|
||||||
if (pScreenInfo->fScrollbars)
|
if (pScreenInfo->iResizeMode != notAllowed)
|
||||||
dwWindowStyle |= WS_THICKFRAME | WS_MAXIMIZEBOX;
|
dwWindowStyle |= WS_THICKFRAME | WS_MAXIMIZEBOX;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -233,6 +233,22 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
|
||||||
iPosY = rcWorkArea.top;
|
iPosY = rcWorkArea.top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Clean up the scrollbars flag, if necessary */
|
||||||
|
if ((!pScreenInfo->fDecoration
|
||||||
|
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||||
|
|| pScreenInfo->fMWExtWM
|
||||||
|
#endif
|
||||||
|
|| pScreenInfo->fRootless
|
||||||
|
#ifdef XWIN_MULTIWINDOW
|
||||||
|
|| pScreenInfo->fMultiWindow
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
&& (pScreenInfo->iResizeMode == resizeWithScrollbars))
|
||||||
|
{
|
||||||
|
/* We cannot have scrollbars if we do not have a window border */
|
||||||
|
pScreenInfo->iResizeMode = notAllowed;
|
||||||
|
}
|
||||||
|
|
||||||
/* Did the user specify a height and width? */
|
/* Did the user specify a height and width? */
|
||||||
if (pScreenInfo->fUserGaveHeightAndWidth)
|
if (pScreenInfo->fUserGaveHeightAndWidth)
|
||||||
{
|
{
|
||||||
|
@ -256,12 +272,12 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
|
||||||
#if CYGDEBUG
|
#if CYGDEBUG
|
||||||
winDebug ("winCreateBoundingWindowWindowed - Window has decoration\n");
|
winDebug ("winCreateBoundingWindowWindowed - Window has decoration\n");
|
||||||
#endif
|
#endif
|
||||||
/* Are we using scrollbars? */
|
|
||||||
if (pScreenInfo->fScrollbars)
|
/* Are we resizable */
|
||||||
|
if (pScreenInfo->iResizeMode != notAllowed)
|
||||||
{
|
{
|
||||||
#if CYGDEBUG
|
#if CYGDEBUG
|
||||||
winDebug ("winCreateBoundingWindowWindowed - Window has "
|
winDebug ("winCreateBoundingWindowWindowed - Window is resizable\n");
|
||||||
"scrollbars\n");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
iWidth += 2 * GetSystemMetrics (SM_CXSIZEFRAME);
|
iWidth += 2 * GetSystemMetrics (SM_CXSIZEFRAME);
|
||||||
|
@ -271,8 +287,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if CYGDEBUG
|
#if CYGDEBUG
|
||||||
winDebug ("winCreateBoundingWindowWindowed - Window does not have "
|
winDebug ("winCreateBoundingWindowWindowed - Window is not resizable\n");
|
||||||
"scrollbars\n");
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
iWidth += 2 * GetSystemMetrics (SM_CXFIXEDFRAME);
|
iWidth += 2 * GetSystemMetrics (SM_CXFIXEDFRAME);
|
||||||
|
@ -296,22 +311,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Clean up the scrollbars flag, if necessary */
|
/* Make sure window is no bigger than work area */
|
||||||
if ((!pScreenInfo->fDecoration
|
|
||||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
|
||||||
|| pScreenInfo->fMWExtWM
|
|
||||||
#endif
|
|
||||||
|| pScreenInfo->fRootless
|
|
||||||
#ifdef XWIN_MULTIWINDOW
|
|
||||||
|| pScreenInfo->fMultiWindow
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
&& pScreenInfo->fScrollbars)
|
|
||||||
{
|
|
||||||
/* We cannot have scrollbars if we do not have a window border */
|
|
||||||
pScreenInfo->fScrollbars = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (TRUE
|
if (TRUE
|
||||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||||
&& !pScreenInfo->fMWExtWM
|
&& !pScreenInfo->fMWExtWM
|
||||||
|
@ -396,7 +396,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
|
||||||
rcClient.bottom, rcClient.top);
|
rcClient.bottom, rcClient.top);
|
||||||
|
|
||||||
/* We adjust the visual size if the user did not specify it */
|
/* We adjust the visual size if the user did not specify it */
|
||||||
if (!(pScreenInfo->fScrollbars && pScreenInfo->fUserGaveHeightAndWidth))
|
if (!((pScreenInfo->iResizeMode == resizeWithScrollbars) && pScreenInfo->fUserGaveHeightAndWidth))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* User did not give a height and width with scrollbars enabled,
|
* User did not give a height and width with scrollbars enabled,
|
||||||
|
|
|
@ -123,7 +123,7 @@ winInitializeScreenDefaults(void)
|
||||||
#endif
|
#endif
|
||||||
defaultScreenInfo.fMultipleMonitors = FALSE;
|
defaultScreenInfo.fMultipleMonitors = FALSE;
|
||||||
defaultScreenInfo.fLessPointer = FALSE;
|
defaultScreenInfo.fLessPointer = FALSE;
|
||||||
defaultScreenInfo.fScrollbars = FALSE;
|
defaultScreenInfo.iResizeMode = notAllowed;
|
||||||
defaultScreenInfo.fNoTrayIcon = FALSE;
|
defaultScreenInfo.fNoTrayIcon = FALSE;
|
||||||
defaultScreenInfo.iE3BTimeout = WIN_E3B_OFF;
|
defaultScreenInfo.iE3BTimeout = WIN_E3B_OFF;
|
||||||
defaultScreenInfo.fUseWinKillKey = WIN_DEFAULT_WIN_KILL;
|
defaultScreenInfo.fUseWinKillKey = WIN_DEFAULT_WIN_KILL;
|
||||||
|
@ -656,12 +656,51 @@ ddxProcessArgument (int argc, char *argv[], int i)
|
||||||
*/
|
*/
|
||||||
if (IS_OPTION ("-scrollbars"))
|
if (IS_OPTION ("-scrollbars"))
|
||||||
{
|
{
|
||||||
screenInfoPtr->fScrollbars = TRUE;
|
|
||||||
|
screenInfoPtr->iResizeMode = resizeWithScrollbars;
|
||||||
|
|
||||||
/* Indicate that we have processed this argument */
|
/* Indicate that we have processed this argument */
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Look for the '-resize' argument
|
||||||
|
*/
|
||||||
|
if (IS_OPTION ("-resize") || IS_OPTION ("-noresize") ||
|
||||||
|
(strncmp(argv[i], "-resize=",strlen("-resize=")) == 0))
|
||||||
|
{
|
||||||
|
winResizeMode mode;
|
||||||
|
|
||||||
|
if (IS_OPTION ("-resize"))
|
||||||
|
mode = resizeWithRandr;
|
||||||
|
else if (IS_OPTION ("-noresize"))
|
||||||
|
mode = notAllowed;
|
||||||
|
else if (strncmp(argv[i], "-resize=",strlen("-resize=")) == 0)
|
||||||
|
{
|
||||||
|
char *option = argv[i] + strlen("-resize=");
|
||||||
|
if (strcmp(option, "randr") == 0)
|
||||||
|
mode = resizeWithRandr;
|
||||||
|
else if (strcmp(option, "scrollbars") == 0)
|
||||||
|
mode = resizeWithScrollbars;
|
||||||
|
else if (strcmp(option, "none") == 0)
|
||||||
|
mode = notAllowed;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ErrorF ("ddxProcessArgument - resize - Invalid resize mode %s\n", option);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ErrorF ("ddxProcessArgument - resize - Invalid resize option %s\n", argv[i]);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
screenInfoPtr->iResizeMode = mode;
|
||||||
|
|
||||||
|
/* Indicate that we have processed this argument */
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef XWIN_CLIPBOARD
|
#ifdef XWIN_CLIPBOARD
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -164,12 +164,12 @@ 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].fScrollbars
|
&& ((g_ScreenInfo[i].iResizeMode != notAllowed)
|
||||||
|| !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 "
|
||||||
"-scrollbars, -nodecoration, or -lesspointer.\n");
|
"-scrollbars, -resize, -nodecoration, or -lesspointer.\n");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -304,7 +304,7 @@ winWindowProc (HWND hwnd, UINT message,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Break if we do not use scrollbars */
|
/* Break if we do not use scrollbars */
|
||||||
if (!s_pScreenInfo->fScrollbars
|
if ((s_pScreenInfo->iResizeMode == notAllowed)
|
||||||
|| !s_pScreenInfo->fDecoration
|
|| !s_pScreenInfo->fDecoration
|
||||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||||
|| s_pScreenInfo->fMWExtWM
|
|| s_pScreenInfo->fMWExtWM
|
||||||
|
@ -579,7 +579,7 @@ winWindowProc (HWND hwnd, UINT message,
|
||||||
|
|
||||||
/* Can't do anything without screen info */
|
/* Can't do anything without screen info */
|
||||||
if (s_pScreenInfo == NULL
|
if (s_pScreenInfo == NULL
|
||||||
|| !s_pScreenInfo->fScrollbars
|
|| (s_pScreenInfo->iResizeMode != resizeWithScrollbars)
|
||||||
|| s_pScreenInfo->fFullScreen
|
|| s_pScreenInfo->fFullScreen
|
||||||
|| !s_pScreenInfo->fDecoration
|
|| !s_pScreenInfo->fDecoration
|
||||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||||
|
|
Loading…
Reference in New Issue