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"
|
||||
"\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"
|
||||
"\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 @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"
|
||||
"\tIf another instance of " EXECUTABLE_NAME " with the same display number is running\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
|
||||
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
|
||||
.B "\-fullscreen"
|
||||
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.
|
||||
.TP 8
|
||||
.B \-scrollbars
|
||||
In windowed mode, allow screens bigger than the \fIWindows\fP desktop.
|
||||
Moreover, if the window has decorations, one can now resize it.
|
||||
This parameter is ignored when the \fB\-fullscreen\fP parameter is specified.
|
||||
Alternative name for \fB\-resize=scrollbars\fP.
|
||||
|
||||
.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
|
||||
.TP 8
|
||||
|
|
|
@ -378,6 +378,15 @@ typedef struct {
|
|||
miPointerSpriteFuncPtr spriteFuncs;
|
||||
} winCursorRec;
|
||||
|
||||
/*
|
||||
* Resize modes
|
||||
*/
|
||||
typedef enum {
|
||||
notAllowed,
|
||||
resizeWithScrollbars,
|
||||
resizeWithRandr
|
||||
} winResizeMode;
|
||||
|
||||
/*
|
||||
* Screen information structure that we need before privates are available
|
||||
* in the server startup sequence.
|
||||
|
@ -439,7 +448,7 @@ typedef struct
|
|||
#endif
|
||||
Bool fMultipleMonitors;
|
||||
Bool fLessPointer;
|
||||
Bool fScrollbars;
|
||||
winResizeMode iResizeMode;
|
||||
Bool fNoTrayIcon;
|
||||
int iE3BTimeout;
|
||||
/* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */
|
||||
|
|
|
@ -192,7 +192,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
|
|||
fForceShowWindow = TRUE;
|
||||
}
|
||||
dwWindowStyle |= WS_CAPTION;
|
||||
if (pScreenInfo->fScrollbars)
|
||||
if (pScreenInfo->iResizeMode != notAllowed)
|
||||
dwWindowStyle |= WS_THICKFRAME | WS_MAXIMIZEBOX;
|
||||
}
|
||||
else
|
||||
|
@ -233,6 +233,22 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
|
|||
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? */
|
||||
if (pScreenInfo->fUserGaveHeightAndWidth)
|
||||
{
|
||||
|
@ -256,12 +272,12 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
|
|||
#if CYGDEBUG
|
||||
winDebug ("winCreateBoundingWindowWindowed - Window has decoration\n");
|
||||
#endif
|
||||
/* Are we using scrollbars? */
|
||||
if (pScreenInfo->fScrollbars)
|
||||
|
||||
/* Are we resizable */
|
||||
if (pScreenInfo->iResizeMode != notAllowed)
|
||||
{
|
||||
#if CYGDEBUG
|
||||
winDebug ("winCreateBoundingWindowWindowed - Window has "
|
||||
"scrollbars\n");
|
||||
winDebug ("winCreateBoundingWindowWindowed - Window is resizable\n");
|
||||
#endif
|
||||
|
||||
iWidth += 2 * GetSystemMetrics (SM_CXSIZEFRAME);
|
||||
|
@ -271,8 +287,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
|
|||
else
|
||||
{
|
||||
#if CYGDEBUG
|
||||
winDebug ("winCreateBoundingWindowWindowed - Window does not have "
|
||||
"scrollbars\n");
|
||||
winDebug ("winCreateBoundingWindowWindowed - Window is not resizable\n");
|
||||
#endif
|
||||
|
||||
iWidth += 2 * GetSystemMetrics (SM_CXFIXEDFRAME);
|
||||
|
@ -296,22 +311,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
|
|||
}
|
||||
}
|
||||
|
||||
/* 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->fScrollbars)
|
||||
{
|
||||
/* We cannot have scrollbars if we do not have a window border */
|
||||
pScreenInfo->fScrollbars = FALSE;
|
||||
}
|
||||
|
||||
/* Make sure window is no bigger than work area */
|
||||
if (TRUE
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
&& !pScreenInfo->fMWExtWM
|
||||
|
@ -396,7 +396,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
|
|||
rcClient.bottom, rcClient.top);
|
||||
|
||||
/* 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,
|
||||
|
|
|
@ -123,7 +123,7 @@ winInitializeScreenDefaults(void)
|
|||
#endif
|
||||
defaultScreenInfo.fMultipleMonitors = FALSE;
|
||||
defaultScreenInfo.fLessPointer = FALSE;
|
||||
defaultScreenInfo.fScrollbars = FALSE;
|
||||
defaultScreenInfo.iResizeMode = notAllowed;
|
||||
defaultScreenInfo.fNoTrayIcon = FALSE;
|
||||
defaultScreenInfo.iE3BTimeout = WIN_E3B_OFF;
|
||||
defaultScreenInfo.fUseWinKillKey = WIN_DEFAULT_WIN_KILL;
|
||||
|
@ -656,12 +656,51 @@ ddxProcessArgument (int argc, char *argv[], int i)
|
|||
*/
|
||||
if (IS_OPTION ("-scrollbars"))
|
||||
{
|
||||
screenInfoPtr->fScrollbars = TRUE;
|
||||
|
||||
screenInfoPtr->iResizeMode = resizeWithScrollbars;
|
||||
|
||||
/* Indicate that we have processed this argument */
|
||||
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
|
||||
/*
|
||||
|
|
|
@ -164,12 +164,12 @@ winValidateArgs (void)
|
|||
|
||||
/* Check for fullscreen and any non-fullscreen parameters */
|
||||
if (g_ScreenInfo[i].fFullScreen
|
||||
&& (g_ScreenInfo[i].fScrollbars
|
||||
&& ((g_ScreenInfo[i].iResizeMode != notAllowed)
|
||||
|| !g_ScreenInfo[i].fDecoration
|
||||
|| g_ScreenInfo[i].fLessPointer))
|
||||
{
|
||||
ErrorF ("winValidateArgs - -fullscreen is invalid with "
|
||||
"-scrollbars, -nodecoration, or -lesspointer.\n");
|
||||
"-scrollbars, -resize, -nodecoration, or -lesspointer.\n");
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -304,7 +304,7 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
#endif
|
||||
|
||||
/* Break if we do not use scrollbars */
|
||||
if (!s_pScreenInfo->fScrollbars
|
||||
if ((s_pScreenInfo->iResizeMode == notAllowed)
|
||||
|| !s_pScreenInfo->fDecoration
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
|| s_pScreenInfo->fMWExtWM
|
||||
|
@ -579,7 +579,7 @@ winWindowProc (HWND hwnd, UINT message,
|
|||
|
||||
/* Can't do anything without screen info */
|
||||
if (s_pScreenInfo == NULL
|
||||
|| !s_pScreenInfo->fScrollbars
|
||||
|| (s_pScreenInfo->iResizeMode != resizeWithScrollbars)
|
||||
|| s_pScreenInfo->fFullScreen
|
||||
|| !s_pScreenInfo->fDecoration
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
|
|
Loading…
Reference in New Issue
Block a user