#else\r
\r
\r
+\r
#if defined(_winmajor)\r
#define oldDialog (_winmajor < 4)\r
#else\r
\r
/* Set by InitInstance, used by EnsureOnScreen */\r
int screenHeight, screenWidth;\r
+RECT screenGeometry;\r
\r
void\r
EnsureOnScreen(int *x, int *y, int minX, int minY)\r
{\r
// int gap = GetSystemMetrics(SM_CYFRAME) + GetSystemMetrics(SM_CYCAPTION);\r
/* Be sure window at (x,y) is not off screen (or even mostly off screen) */\r
- if (*x > screenWidth - 32) *x = 0;\r
- if (*y > screenHeight - 32) *y = 0;\r
- if (*x < minX) *x = minX;\r
- if (*y < minY) *y = minY;\r
+ if (*x > screenGeometry.right - 32) *x = screenGeometry.left;\r
+ if (*y > screenGeometry.bottom - 32) *y = screenGeometry.top;\r
+ if (*x < screenGeometry.left + minX) *x = screenGeometry.left + minX;\r
+ if (*y < screenGeometry.top + minY) *y = screenGeometry.top + minY;\r
}\r
\r
VOID\r
}\r
}\r
\r
+#ifndef SM_CXVIRTUALSCREEN\r
+#define SM_CXVIRTUALSCREEN 78\r
+#endif\r
+#ifndef SM_CYVIRTUALSCREEN\r
+#define SM_CYVIRTUALSCREEN 79\r
+#endif\r
+#ifndef SM_XVIRTUALSCREEN \r
+#define SM_XVIRTUALSCREEN 76\r
+#endif\r
+#ifndef SM_YVIRTUALSCREEN \r
+#define SM_YVIRTUALSCREEN 77\r
+#endif\r
+\r
+VOID\r
+InitGeometry()\r
+{\r
+ screenHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN);\r
+ if( !screenHeight ) screenHeight = GetSystemMetrics(SM_CYSCREEN);\r
+ screenWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN);\r
+ if( !screenWidth ) screenWidth = GetSystemMetrics(SM_CXSCREEN);\r
+ screenGeometry.left = GetSystemMetrics(SM_XVIRTUALSCREEN);\r
+ screenGeometry.top = GetSystemMetrics(SM_YVIRTUALSCREEN);\r
+ screenGeometry.right = screenGeometry.left + screenWidth;\r
+ screenGeometry.bottom = screenGeometry.top + screenHeight;\r
+}\r
+\r
BOOL\r
InitInstance(HINSTANCE hInstance, int nCmdShow, LPSTR lpCmdLine)\r
{\r
GetCurrentDirectory(MSG_SIZ, installDir);\r
}\r
gameInfo.boardWidth = gameInfo.boardHeight = 8; // [HGM] won't have open window otherwise\r
- screenWidth = screenHeight = 1000; // [HGM] placement: kludge to allow calling EnsureOnScreen from InitAppData\r
+ InitGeometry();\r
InitAppData(lpCmdLine); /* Get run-time parameters */\r
/* xboard, and older WinBoards, controlled the move sound with the\r
appData.ringBellAfterMoves option. In the current WinBoard, we\r
iconBlack = LoadIcon(hInstance, "icon_black");\r
iconCurrent = iconWhite;\r
InitDrawingColors();\r
- screenHeight = GetSystemMetrics(SM_CYSCREEN);\r
- screenWidth = GetSystemMetrics(SM_CXSCREEN);\r
+\r
InitPosition(0); // to set nr of ranks and files, which might be non-default through command-line args\r
for (ibs = (int) NUM_SIZES - 1; ibs >= 0; ibs--) {\r
/* Compute window size for each board size, and use the largest\r
extern WindowPlacement placementTab[NUM_WINDOWS];\r
extern HWND hwndTab[NUM_WINDOWS]; // this remains pure front-end.\r
\r
-void Translate( HWND hDlg, int id);
+void Translate( HWND hDlg, int id);\r
VOID InitWindowPlacement( WindowPlacement * wp );\r
VOID RestoreWindowPlacement( HWND hWnd, WindowPlacement * wp );\r
VOID ReattachAfterMove( LPRECT lprcOldPos, int new_x, int new_y, HWND hWndChild, WindowPlacement * pwpChild );\r
\r
VOID EditTagsProc(void);\r
extern HWND editTagsDialog;\r
-extern int screenWidth, screenHeight;
+extern int screenWidth, screenHeight;\r
+extern RECT screenGeometry; // Top-left coordiate of the screen can be different from (0,0)\r
+\r
\r
/* Adjust size & placement */\r
if(pwpChild->x + pwpChild->width >= lprcOldPos->right &&\r
- (pwpChild->x + pwpChild->width < screenWidth - 5 || delta_x > 0) ) // keep right edge glued to display edge if touching\r
+ (pwpChild->x + pwpChild->width < screenGeometry.right - 5 || delta_x > 0) ) // keep right edge glued to display edge if touching\r
pwpChild->width += delta_x;\r
- if(pwpChild->x + pwpChild->width >= screenWidth ) // don't move right edge off screen\r
- pwpChild->width = screenWidth - pwpChild->x;\r
+ if(pwpChild->x + pwpChild->width >= screenGeometry.right ) // don't move right edge off screen\r
+ pwpChild->width = screenGeometry.right - pwpChild->x;\r
if(pwpChild->y + pwpChild->height >= lprcOldPos->bottom &&\r
- (pwpChild->y + pwpChild->height < screenHeight - 35 || delta_y > 0) ) // keep bottom edge glued to display edge if touching\r
+ (pwpChild->y + pwpChild->height < screenGeometry.bottom - 35 || delta_y > 0) ) // keep bottom edge glued to display edge if touching\r
pwpChild->height += delta_y;\r
- if(pwpChild->y + pwpChild->height >= screenHeight - 30 ) // don't move bottom edge off screen\r
- pwpChild->height = screenHeight - 30 - pwpChild->y;\r
+ if(pwpChild->y + pwpChild->height >= screenGeometry.bottom - 30 ) // don't move bottom edge off screen\r
+ pwpChild->height = screenGeometry.bottom - 30 - pwpChild->y;\r
if(pwpChild->x >= lprcOldPos->right) pwpChild->width -= delta_x, pwpChild->x += delta_x;\r
if(pwpChild->y >= lprcOldPos->bottom) pwpChild->height -= delta_y, pwpChild->y += delta_y;\r
if(pwpChild->width < 30) pwpChild->width = 30; // force minimum width\r