Cygwin/X: Remove an attempt at detecting if WM_DISPLAYCHANGE affects the X screen
Remove an attempt at the rather difficult optimization of detecting if WM_DISPLAYCHANGE affects any of the monitors which intersect the native window for the X screen. We'll always act as if it does, which it probably usually the case. 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
a46146af5f
commit
73b02e9647
|
@ -481,11 +481,6 @@ typedef struct _winPrivScreenRec
|
||||||
/* Handle to icons that must be freed */
|
/* Handle to icons that must be freed */
|
||||||
HICON hiconNotifyIcon;
|
HICON hiconNotifyIcon;
|
||||||
|
|
||||||
/* Last width, height, and depth of the Windows display */
|
|
||||||
DWORD dwLastWindowsWidth;
|
|
||||||
DWORD dwLastWindowsHeight;
|
|
||||||
DWORD dwLastWindowsBitsPixel;
|
|
||||||
|
|
||||||
/* Palette management */
|
/* Palette management */
|
||||||
ColormapPtr pcmapInstalled;
|
ColormapPtr pcmapInstalled;
|
||||||
|
|
||||||
|
|
|
@ -482,11 +482,11 @@ winChangeDepthDlgProc (HWND hwndDialog, UINT message,
|
||||||
|
|
||||||
#if CYGDEBUG
|
#if CYGDEBUG
|
||||||
winDebug ("winChangeDepthDlgProc - WM_INITDIALOG - orig bpp: %d, "
|
winDebug ("winChangeDepthDlgProc - WM_INITDIALOG - orig bpp: %d, "
|
||||||
"last bpp: %d\n",
|
"current bpp: %d\n",
|
||||||
s_pScreenInfo->dwBPP,
|
s_pScreenInfo->dwBPP,
|
||||||
s_pScreenPriv->dwLastWindowsBitsPixel);
|
GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
winInitDialog( hwndDialog );
|
winInitDialog( hwndDialog );
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -494,14 +494,13 @@ winChangeDepthDlgProc (HWND hwndDialog, UINT message,
|
||||||
case WM_DISPLAYCHANGE:
|
case WM_DISPLAYCHANGE:
|
||||||
#if CYGDEBUG
|
#if CYGDEBUG
|
||||||
winDebug ("winChangeDepthDlgProc - WM_DISPLAYCHANGE - orig bpp: %d, "
|
winDebug ("winChangeDepthDlgProc - WM_DISPLAYCHANGE - orig bpp: %d, "
|
||||||
"last bpp: %d, new bpp: %d\n",
|
"new bpp: %d\n",
|
||||||
s_pScreenInfo->dwBPP,
|
s_pScreenInfo->dwBPP,
|
||||||
s_pScreenPriv->dwLastWindowsBitsPixel,
|
GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL));
|
||||||
wParam);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Dismiss the dialog if the display returns to the original depth */
|
/* Dismiss the dialog if the display returns to the original depth */
|
||||||
if (wParam == s_pScreenInfo->dwBPP)
|
if (GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL) == s_pScreenInfo->dwBPP)
|
||||||
{
|
{
|
||||||
ErrorF ("winChangeDelthDlgProc - wParam == s_pScreenInfo->dwBPP\n");
|
ErrorF ("winChangeDelthDlgProc - wParam == s_pScreenInfo->dwBPP\n");
|
||||||
|
|
||||||
|
|
|
@ -175,13 +175,9 @@ winScreenInit (int index,
|
||||||
/* Get a device context */
|
/* Get a device context */
|
||||||
hdc = GetDC (pScreenPriv->hwndScreen);
|
hdc = GetDC (pScreenPriv->hwndScreen);
|
||||||
|
|
||||||
/* Store the initial height, width, and depth of the display */
|
|
||||||
/* Are we using multiple monitors? */
|
/* Are we using multiple monitors? */
|
||||||
if (pScreenInfo->fMultipleMonitors)
|
if (pScreenInfo->fMultipleMonitors)
|
||||||
{
|
{
|
||||||
pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN);
|
|
||||||
pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* In this case, some of the defaults set in
|
* In this case, some of the defaults set in
|
||||||
* winInitializeScreenDefaults() are not correct ...
|
* winInitializeScreenDefaults() are not correct ...
|
||||||
|
@ -192,14 +188,6 @@ winScreenInit (int index,
|
||||||
pScreenInfo->dwHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN);
|
pScreenInfo->dwHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXSCREEN);
|
|
||||||
pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYSCREEN);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Save the original bits per pixel */
|
|
||||||
pScreenPriv->dwLastWindowsBitsPixel = GetDeviceCaps (hdc, BITSPIXEL);
|
|
||||||
|
|
||||||
/* Release the device context */
|
/* Release the device context */
|
||||||
ReleaseDC (pScreenPriv->hwndScreen, hdc);
|
ReleaseDC (pScreenPriv->hwndScreen, hdc);
|
||||||
|
|
|
@ -148,6 +148,13 @@ winWindowProc (HWND hwnd, UINT message,
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case WM_DISPLAYCHANGE:
|
case WM_DISPLAYCHANGE:
|
||||||
|
/*
|
||||||
|
WM_DISPLAYCHANGE seems to be sent when the monitor layout or
|
||||||
|
any monitor's resolution or depth changes, but it's lParam and
|
||||||
|
wParam always indicate the resolution and bpp for the primary
|
||||||
|
monitor (so ignore that as we could be on any monitor...)
|
||||||
|
*/
|
||||||
|
|
||||||
/* We cannot handle a display mode change during initialization */
|
/* We cannot handle a display mode change during initialization */
|
||||||
if (s_pScreenInfo == NULL)
|
if (s_pScreenInfo == NULL)
|
||||||
FatalError ("winWindowProc - WM_DISPLAYCHANGE - The display "
|
FatalError ("winWindowProc - WM_DISPLAYCHANGE - The display "
|
||||||
|
@ -167,22 +174,10 @@ winWindowProc (HWND hwnd, UINT message,
|
||||||
#endif
|
#endif
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* Store the new display dimensions and depth.
|
|
||||||
* We do this here for future compatibility in case we
|
|
||||||
* ever allow switching from fullscreen to windowed mode.
|
|
||||||
*/
|
|
||||||
s_pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXSCREEN);
|
|
||||||
s_pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYSCREEN);
|
|
||||||
s_pScreenPriv->dwLastWindowsBitsPixel
|
|
||||||
= GetDeviceCaps (s_pScreenPriv->hdcScreen, BITSPIXEL);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorF ("winWindowProc - WM_DISPLAYCHANGE - orig bpp: %d, last bpp: %d, "
|
ErrorF ("winWindowProc - WM_DISPLAYCHANGE - new bpp: %d\n",
|
||||||
"new bpp: %d\n",
|
|
||||||
(int) s_pScreenInfo->dwBPP,
|
|
||||||
(int) s_pScreenPriv->dwLastWindowsBitsPixel,
|
|
||||||
wParam);
|
wParam);
|
||||||
|
|
||||||
ErrorF ("winWindowProc - WM_DISPLAYCHANGE - new width: %d "
|
ErrorF ("winWindowProc - WM_DISPLAYCHANGE - new width: %d "
|
||||||
|
@ -216,7 +211,11 @@ winWindowProc (HWND hwnd, UINT message,
|
||||||
* We can only display a message for a disruptive depth change,
|
* We can only display a message for a disruptive depth change,
|
||||||
* we cannot do anything to correct the situation.
|
* we cannot do anything to correct the situation.
|
||||||
*/
|
*/
|
||||||
if ((s_pScreenInfo->dwBPP != wParam)
|
/*
|
||||||
|
XXX: maybe we need to check if GetSystemMetrics(SM_SAMEDISPLAYFORMAT)
|
||||||
|
has changed as well...
|
||||||
|
*/
|
||||||
|
if ((s_pScreenInfo->dwBPP != GetDeviceCaps (s_pScreenPriv->hdcScreen, BITSPIXEL))
|
||||||
&& (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
|
&& (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
|
||||||
|| s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
|
|| s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL
|
||||||
#ifdef XWIN_PRIMARYFB
|
#ifdef XWIN_PRIMARYFB
|
||||||
|
@ -227,7 +226,7 @@ winWindowProc (HWND hwnd, UINT message,
|
||||||
/* Cannot display the visual until the depth is restored */
|
/* Cannot display the visual until the depth is restored */
|
||||||
ErrorF ("winWindowProc - Disruptive change in depth\n");
|
ErrorF ("winWindowProc - Disruptive change in depth\n");
|
||||||
|
|
||||||
/* Display Exit dialog */
|
/* Display depth change dialog */
|
||||||
winDisplayDepthChangeDialog (s_pScreenPriv);
|
winDisplayDepthChangeDialog (s_pScreenPriv);
|
||||||
|
|
||||||
/* Flag that we have an invalid screen depth */
|
/* Flag that we have an invalid screen depth */
|
||||||
|
@ -241,14 +240,19 @@ winWindowProc (HWND hwnd, UINT message,
|
||||||
/* Flag that we have a valid screen depth */
|
/* Flag that we have a valid screen depth */
|
||||||
s_pScreenPriv->fBadDepth = FALSE;
|
s_pScreenPriv->fBadDepth = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
If we could cheaply check if this WM_DISPLAYCHANGE change
|
||||||
|
affects the monitor(s) which this X screen is displayed on
|
||||||
|
then we should do so here. For the moment, assume it does.
|
||||||
|
(this is probably usually the case so that might be an
|
||||||
|
overoptimization)
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check for a change in display dimensions.
|
|
||||||
* We can simply recreate the same-sized primary surface when
|
* We can simply recreate the same-sized primary surface when
|
||||||
* the display dimensions change.
|
* the display dimensions change.
|
||||||
*/
|
*/
|
||||||
if (s_pScreenPriv->dwLastWindowsWidth != LOWORD (lParam)
|
|
||||||
|| s_pScreenPriv->dwLastWindowsHeight != HIWORD (lParam))
|
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* NOTE: The non-DirectDraw engines set the ReleasePrimarySurface
|
* NOTE: The non-DirectDraw engines set the ReleasePrimarySurface
|
||||||
|
@ -261,7 +265,7 @@ winWindowProc (HWND hwnd, UINT message,
|
||||||
#if CYGDEBUG
|
#if CYGDEBUG
|
||||||
winDebug ("winWindowProc - WM_DISPLAYCHANGE - Dimensions changed\n");
|
winDebug ("winWindowProc - WM_DISPLAYCHANGE - Dimensions changed\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Release the old primary surface */
|
/* Release the old primary surface */
|
||||||
(*s_pScreenPriv->pwinReleasePrimarySurface) (s_pScreen);
|
(*s_pScreenPriv->pwinReleasePrimarySurface) (s_pScreen);
|
||||||
|
|
||||||
|
@ -284,33 +288,9 @@ winWindowProc (HWND hwnd, UINT message,
|
||||||
{
|
{
|
||||||
RRSetScreenConfig ();
|
RRSetScreenConfig ();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
#if CYGDEBUG
|
|
||||||
winDebug ("winWindowProc - WM_DISPLAYCHANGE - Dimensions did not "
|
|
||||||
"change\n");
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store the new display dimensions and depth */
|
|
||||||
if (s_pScreenInfo->fMultipleMonitors)
|
|
||||||
{
|
|
||||||
s_pScreenPriv->dwLastWindowsWidth
|
|
||||||
= GetSystemMetrics (SM_CXVIRTUALSCREEN);
|
|
||||||
s_pScreenPriv->dwLastWindowsHeight
|
|
||||||
= GetSystemMetrics (SM_CYVIRTUALSCREEN);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
s_pScreenPriv->dwLastWindowsWidth
|
|
||||||
= GetSystemMetrics (SM_CXSCREEN);
|
|
||||||
s_pScreenPriv->dwLastWindowsHeight
|
|
||||||
= GetSystemMetrics (SM_CYSCREEN);
|
|
||||||
}
|
|
||||||
s_pScreenPriv->dwLastWindowsBitsPixel
|
|
||||||
= GetDeviceCaps (s_pScreenPriv->hdcScreen, BITSPIXEL);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
|
|
Loading…
Reference in New Issue