import changes from CYGWIN branch

This commit is contained in:
Alexander Gottwald 2004-12-08 15:48:15 +00:00
parent 6c317c1c13
commit 081b33d73f
6 changed files with 194 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2004-12-08 Alexander Gottwald <ago at freedesktop dot org>
* InitOutput.c:
* winprocarg.c:
Added support for placing the main window with the @<monitor#>.
Patch by Mark Fisher, small changes by Alexander Gottwald
2004-12-06 Alexander Gottwald <ago at freedesktop dot org>
* XWin.rc:
@ -43,6 +50,15 @@
* winconfig.c:
Fix warning about undefined macro max
2004-12-04 Earle Philhower
* InitOutput.c:
* win.h:
* wincreatewnd.c:
* winprocarg.c:
Optional position -screen parameter (-screen n WxH+X+Y or
-screen n W H X Y)
2004-12-03 Alexander Gottwald <ago at freedesktop dot org>
* windialogs.c:
@ -130,6 +146,11 @@
Bufzilla #1802, http://freedesktop.org/bugzilla/show_bug.cgi?id=1802
Added mingw (Win32) port
2004-11-11 Alexander Gottwald <ago at freedesktop dot org>
* winconfig.c:
added keyboard layout "French (Switzerland)"
2004-11-06 Alexander Gottwald <ago at freedesktop dot org>
* winwndproc.c, wintrayicon.c, winscrinit.c:

View File

@ -747,9 +747,15 @@ winUseMsg (void)
"\tSpecify an optional refresh rate to use in fullscreen mode\n"
"\twith a DirectDraw engine.\n");
ErrorF ("-screen scr_num [width height]\n"
ErrorF ("-screen scr_num [width height [x y] | [[WxH[+X+Y]][@m]] ]\n"
"\tEnable screen scr_num and optionally specify a width and\n"
"\theight for that screen.\n");
"\theight and initial position for that screen. Additionally\n"
"\ta monitor number can be specified to start the server on,\n"
"\tat which point, all coordinates become relative to that\n"
"\tmonitor. Examples:\n"
"\t -screen 0 800x600+100+100@2 ; 2nd monitor offset 100,100 size 800x600\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");
ErrorF ("-lesspointer\n"
"\tHide the windows mouse pointer when it is over an inactive\n"

View File

@ -391,6 +391,11 @@ typedef struct
DWORD dwHeight_mm;
DWORD dwPaddedWidth;
/* Did the user specify a screen position? */
Bool fUserGavePosition;
DWORD dwInitialX;
DWORD dwInitialY;
/*
* dwStride is the number of whole pixels that occupy a scanline,
* including those pixels that are not displayed. This is basically

View File

@ -247,6 +247,7 @@ WinKBLayoutRec winKBLayouts[] = {
{ 0x40b, -1, "pc105", "fi", NULL, NULL, "Finnish"},
{ 0x40c, -1, "pc105", "fr", NULL, NULL, "French (Standard)"},
{ 0x80c, -1, "pc105", "be", NULL, NULL, "French (Belgian)"},
{ 0x100c, -1, "pc105", "fr_CH", NULL, NULL, "French (Switzerland)"},
{ 0x410, -1, "pc105", "it", NULL, NULL, "Italian"},
{ 0x411, 7, "jp106", "jp", NULL, NULL, "Japanese"},
{ 0x813, -1, "pc105", "be", NULL, NULL, "Dutch (Belgian)"},

View File

@ -142,6 +142,8 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
int iWidth = pScreenInfo->dwUserWidth;
int iHeight = pScreenInfo->dwUserHeight;
int iPosX;
int iPosY;
HWND *phwnd = &pScreenPriv->hwndScreen;
WNDCLASS wc;
RECT rcClient, rcWorkArea;
@ -193,6 +195,18 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
/* Adjust for auto-hide taskbars */
winAdjustForAutoHide (&rcWorkArea);
/* Did the user specify a position? */
if (pScreenInfo->fUserGavePosition)
{
iPosX = pScreenInfo->dwInitialX;
iPosY = pScreenInfo->dwInitialY;
}
else
{
iPosX = rcWorkArea.left;
iPosY = rcWorkArea.top;
}
/* Did the user specify a height and width? */
if (pScreenInfo->fUserGaveHeightAndWidth)
{
@ -314,8 +328,8 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen)
WINDOW_CLASS, /* Class name */
szTitle, /* Window name */
dwWindowStyle,
rcWorkArea.left, /* Horizontal position */
rcWorkArea.top, /* Vertical position */
iPosX, /* Horizontal position */
iPosY, /* Vertical position */
iWidth, /* Right edge */
iHeight, /* Bottom edge */
(HWND) NULL, /* No parent or owner window */

View File

@ -55,6 +55,17 @@ extern Bool g_fNoHelpMessageBox;
extern Bool g_fSoftwareCursor;
extern Bool g_fSilentDupError;
/* globals required by callback function for monitor information */
struct GetMonitorInfoData {
int requestedMonitor;
int monitorNum;
Bool bUserSpecifiedMonitor;
Bool bMonitorSpecifiedExists;
int monitorOffsetX;
int monitorOffsetY;
int monitorHeight;
int monitorWidth;
};
/*
* Function prototypes
@ -73,6 +84,7 @@ void OsVendorVErrorF (const char *pszFormat, va_list va_args);
void
winInitializeDefaultScreens (void);
wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM data);
/*
* Process arguments on the command line
@ -115,6 +127,7 @@ winInitializeDefaultScreens (void)
g_ScreenInfo[i].dwUserHeight = dwHeight;
g_ScreenInfo[i].fUserGaveHeightAndWidth
= WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH;
g_ScreenInfo[i].fUserGavePosition = FALSE;
g_ScreenInfo[i].dwBPP = WIN_DEFAULT_BPP;
g_ScreenInfo[i].dwClipUpdatesNBoxes = WIN_DEFAULT_CLIP_UPDATES_NBOXES;
#ifdef XWIN_EMULATEPSEUDO
@ -254,7 +267,8 @@ ddxProcessArgument (int argc, char *argv[], int i)
{
int iArgsProcessed = 1;
int nScreenNum;
int iWidth, iHeight;
int iWidth, iHeight, iX, iY;
int iMonitor;
#if CYGDEBUG
winDebug ("ddxProcessArgument - screen - argc: %d i: %d\n",
@ -279,8 +293,40 @@ ddxProcessArgument (int argc, char *argv[], int i)
return 0;
}
/* look for @m where m is monitor number */
if (i + 2 < argc
&& 1 == sscanf(argv[i + 2], "@%d", (int *) &iMonitor))
{
struct GetMonitorInfoData data;
memset(&data, 0, sizeof(data));
data.requestedMonitor = iMonitor;
EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) &data);
if (data.bMonitorSpecifiedExists == TRUE)
{
winErrorFVerb(2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor);
iArgsProcessed = 3;
g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE;
g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
g_ScreenInfo[nScreenNum].dwWidth = data.monitorWidth;
g_ScreenInfo[nScreenNum].dwHeight = data.monitorHeight;
g_ScreenInfo[nScreenNum].dwUserWidth = data.monitorWidth;
g_ScreenInfo[nScreenNum].dwUserHeight = data.monitorHeight;
g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX;
g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY;
}
else
{
/* monitor does not exist, error out */
ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n",
iMonitor);
UseMsg ();
exit (0);
return 0;
}
}
/* Look for 'WxD' or 'W D' */
if (i + 2 < argc
else if (i + 2 < argc
&& 2 == sscanf (argv[i + 2], "%dx%d",
(int *) &iWidth,
(int *) &iHeight))
@ -292,6 +338,68 @@ ddxProcessArgument (int argc, char *argv[], int i)
g_ScreenInfo[nScreenNum].dwHeight = iHeight;
g_ScreenInfo[nScreenNum].dwUserWidth = iWidth;
g_ScreenInfo[nScreenNum].dwUserHeight = iHeight;
/* Look for WxD+X+Y */
if (2 == sscanf (argv[i + 2], "%*dx%*d+%d+%d",
(int *) &iX,
(int *) &iY))
{
winErrorFVerb (2, "ddxProcessArgument - screen - Found ``X+Y'' arg\n");
g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
g_ScreenInfo[nScreenNum].dwInitialX = iX;
g_ScreenInfo[nScreenNum].dwInitialY = iY;
/* look for WxD+X+Y@m where m is monitor number. take X,Y to be offsets from monitor's root position */
if (1 == sscanf (argv[i + 2], "%*dx%*d+%*d+%*d@%d",
(int *) &iMonitor))
{
struct GetMonitorInfoData data;
memset(&data, 0, sizeof(data));
data.requestedMonitor = iMonitor;
EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) &data);
if (data.bMonitorSpecifiedExists == TRUE)
{
g_ScreenInfo[nScreenNum].dwInitialX += data.monitorOffsetX;
g_ScreenInfo[nScreenNum].dwInitialY += data.monitorOffsetY;
}
else
{
/* monitor does not exist, error out */
ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n",
iMonitor);
UseMsg ();
exit (0);
return 0;
}
}
}
/* look for WxD@m where m is monitor number */
else if (1 == sscanf(argv[i + 2], "%*dx%*d@%d",
(int *) &iMonitor))
{
struct GetMonitorInfoData data;
memset(&data, 0, sizeof(data));
data.requestedMonitor = iMonitor;
EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) &data);
if (data.bMonitorSpecifiedExists == TRUE)
{
winErrorFVerb (2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor);
g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX;
g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY;
}
else
{
/* monitor does not exist, error out */
ErrorF ("ddxProcessArgument - screen - Invalid monitor number %d\n",
iMonitor);
UseMsg ();
exit (0);
return 0;
}
}
}
else if (i + 3 < argc
&& 1 == sscanf (argv[i + 2], "%d",
@ -306,6 +414,18 @@ ddxProcessArgument (int argc, char *argv[], int i)
g_ScreenInfo[nScreenNum].dwHeight = iHeight;
g_ScreenInfo[nScreenNum].dwUserWidth = iWidth;
g_ScreenInfo[nScreenNum].dwUserHeight = iHeight;
if (i + 5 < argc
&& 1 == sscanf (argv[i + 4], "%d",
(int *) &iX)
&& 1 == sscanf (argv[i + 5], "%d",
(int *) &iY))
{
winErrorFVerb (2, "ddxProcessArgument - screen - Found ``X Y'' arg\n");
iArgsProcessed = 6;
g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE;
g_ScreenInfo[nScreenNum].dwInitialX = iX;
g_ScreenInfo[nScreenNum].dwInitialY = iY;
}
}
else
{
@ -1371,3 +1491,24 @@ winLogVersionInfo (void)
ErrorF ("Release: %s\n\n", VERSION_STRING);
ErrorF ("Contact: %s\n\n", VENDOR_CONTACT);
}
/*
* getMonitorInfo - callback function used to return information from the enumeration of monitors attached
*/
wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data)
{
struct GetMonitorInfoData* data = (struct GetMonitorInfoData*)_data;
// only get data for monitor number specified in <data>
data->monitorNum++;
if (data->monitorNum == data->requestedMonitor)
{
data->bMonitorSpecifiedExists = TRUE;
data->monitorOffsetX = rect->left;
data->monitorOffsetY = rect->top;
data->monitorHeight = rect->bottom - rect->top;
data->monitorWidth = rect->right - rect->left;
return FALSE;
}
return TRUE;
}