Skip to content

Commit

Permalink
[0.4.12][WIN32SS] WindowSnap must not affect the taskbar
Browse files Browse the repository at this point in the history
This fixes regression CORE-16289 where we could not longer
move the taskbar at a different than default location,
as WindowSnap would interfere.

Many Thanks to the patches author Doug Lyons.

Eventually the heuristic that we use here to identify the
taskbar via used window-styles could be improved later.
Theoretically possible that it bails out on some other windows.

The regression was introduced by 0.4.12-dev-373-g
7e39678

patch is a backport from master 0.4.13-dev-962-g
4193b8d
  • Loading branch information
JoachimHenze committed Aug 20, 2019
1 parent 3fa352b commit 9286a1f
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
20 changes: 19 additions & 1 deletion win32ss/user/ntuser/defwnd.c
Expand Up @@ -539,6 +539,9 @@ IntDefWindowProc(
PTHREADINFO pti = PsGetCurrentThreadWin32Thread(); PTHREADINFO pti = PsGetCurrentThreadWin32Thread();
LRESULT lResult = 0; LRESULT lResult = 0;
USER_REFERENCE_ENTRY Ref; USER_REFERENCE_ENTRY Ref;
BOOL IsTaskBar;
DWORD Style;
DWORD ExStyle;


if (Msg > WM_USER) return 0; if (Msg > WM_USER) return 0;


Expand Down Expand Up @@ -785,7 +788,22 @@ IntDefWindowProc(
{ {
HWND hwndTop = UserGetForegroundWindow(); HWND hwndTop = UserGetForegroundWindow();
PWND topWnd = UserGetWindowObject(hwndTop); PWND topWnd = UserGetWindowObject(hwndTop);
if (topWnd)
/* Test for typical TaskBar ExStyle Values */
ExStyle = (topWnd->ExStyle & WS_EX_TOOLWINDOW);
TRACE("ExStyle is '%x'.\n", ExStyle);

/* Test for typical TaskBar Style Values */
Style = (topWnd->style & (WS_POPUP | WS_VISIBLE |
WS_CLIPSIBLINGS | WS_CLIPCHILDREN));
TRACE("Style is '%x'.\n", Style);

/* Test for masked typical TaskBar Style and ExStyles to detect TaskBar */
IsTaskBar = (Style == (WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN))
&& (ExStyle == WS_EX_TOOLWINDOW);
TRACE("This %s the TaskBar.\n", IsTaskBar ? "is" : "is not");

if (topWnd && !IsTaskBar) /* Second test is so we are not touching the Taskbar */
{ {
if ((topWnd->style & WS_THICKFRAME) == 0) if ((topWnd->style & WS_THICKFRAME) == 0)
{ {
Expand Down
21 changes: 21 additions & 0 deletions win32ss/user/ntuser/nonclient.c
Expand Up @@ -256,6 +256,8 @@ DefWndDoSizeMove(PWND pwnd, WORD wParam)
//PMONITOR mon = 0; Don't port sync from wine!!! This breaks explorer task bar sizing!! //PMONITOR mon = 0; Don't port sync from wine!!! This breaks explorer task bar sizing!!
// The task bar can grow in size and can not reduce due to the change // The task bar can grow in size and can not reduce due to the change
// in the work area. // in the work area.
DWORD ExStyleTB, StyleTB;
BOOL IsTaskBar;


Style = pwnd->style; Style = pwnd->style;
ExStyle = pwnd->ExStyle; ExStyle = pwnd->ExStyle;
Expand Down Expand Up @@ -394,13 +396,32 @@ DefWndDoSizeMove(PWND pwnd, WORD wParam)
/* Exit on button-up */ /* Exit on button-up */
if (msg.message == WM_LBUTTONUP) if (msg.message == WM_LBUTTONUP)
{ {
/* Test for typical TaskBar ExStyle Values */
ExStyleTB = (ExStyle & WS_EX_TOOLWINDOW);
TRACE("ExStyle is '%x'.\n", ExStyleTB);

/* Test for typical TaskBar Style Values */
StyleTB = (Style & (WS_POPUP | WS_VISIBLE |
WS_CLIPSIBLINGS | WS_CLIPCHILDREN));
TRACE("Style is '%x'.\n", StyleTB);

/* Test for masked typical TaskBar Style and ExStyles to detect TaskBar */
IsTaskBar = (StyleTB == (WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN))
&& (ExStyleTB == WS_EX_TOOLWINDOW);
TRACE("This %s the TaskBar.\n", IsTaskBar ? "is" : "is not");

// check for snapping if was moved by caption // check for snapping if was moved by caption
if (hittest == HTCAPTION && thickframe && (ExStyle & WS_EX_MDICHILD) == 0) if (hittest == HTCAPTION && thickframe && (ExStyle & WS_EX_MDICHILD) == 0)
{ {
RECT snapRect; RECT snapRect;
BOOL doSideSnap = FALSE; BOOL doSideSnap = FALSE;
UserSystemParametersInfo(SPI_GETWORKAREA, 0, &snapRect, 0); UserSystemParametersInfo(SPI_GETWORKAREA, 0, &snapRect, 0);


/* if this is the taskbar, then we want to just exit */
if (IsTaskBar)
{
break;
}
// snap to left // snap to left
if (pt.x <= snapRect.left) if (pt.x <= snapRect.left)
{ {
Expand Down

0 comments on commit 9286a1f

Please sign in to comment.