Index: traywnd.cpp =================================================================== --- traywnd.cpp (révision 72232) +++ traywnd.cpp (copie de travail) @@ -643,6 +643,12 @@ IN DWORD Position, IN OUT RECT *pRect) { +#define DESKTOPBARBAR_HEIGHT (GetSystemMetrics(SM_CYSIZE) + 5 * (GetSystemMetrics(SM_CYEDGE) + GetSystemMetrics(SM_CYDLGFRAME))) +#define REBARBAND_HEIGHT (GetSystemMetrics(SM_CYSIZE) + 2 * (GetSystemMetrics(SM_CYEDGE) + GetSystemMetrics(SM_CYDLGFRAME))) + +#define DESKTOPBARBAR_WIDTH (GetSystemMetrics(SM_CXSIZE) + 5 * (GetSystemMetrics(SM_CXEDGE) + GetSystemMetrics(SM_CXDLGFRAME))) +#define REBARBAND_WIDTH (GetSystemMetrics(SM_CXSIZE) + 2 * (GetSystemMetrics(SM_CXEDGE) + GetSystemMetrics(SM_CXDLGFRAME))) + RECT rcScreen; //BOOL Horizontal; HMONITOR hMon; @@ -667,8 +673,32 @@ if (szWnd.cy > szMax.cy) szWnd.cy = szMax.cy; + if (szWnd.cx < 5) + szWnd.cx = 5; + if (szWnd.cy < 5) + szWnd.cy = 5; + /* FIXME - calculate */ + switch (Position) + { + case ABE_LEFT: + szWnd.cx = ((szWnd.cx + REBARBAND_WIDTH/2) / REBARBAND_WIDTH) * REBARBAND_WIDTH; // DESKTOPBARBAR_WIDTH + break; + case ABE_TOP: + szWnd.cy = ((szWnd.cy + REBARBAND_HEIGHT/2) / REBARBAND_HEIGHT) * REBARBAND_HEIGHT; // DESKTOPBARBAR_HEIGHT + break; + + case ABE_RIGHT: + szWnd.cx = ((szWnd.cx + REBARBAND_WIDTH/2) / REBARBAND_WIDTH) * REBARBAND_WIDTH; // DESKTOPBARBAR_WIDTH + break; + + case ABE_BOTTOM: + default: + szWnd.cy = ((szWnd.cy + REBARBAND_HEIGHT/2) / REBARBAND_HEIGHT) * REBARBAND_HEIGHT; // DESKTOPBARBAR_HEIGHT + break; + } + GetTrayRectFromScreenRect(Position, &rcScreen, &szWnd, @@ -675,6 +705,12 @@ pRect); return hMon; + +#undef REBARBAND_WIDTH +#undef DESKTOPBARBAR_WIDTH +#undef REBARBAND_HEIGHT +#undef DESKTOPBARBAR_HEIGHT + } #if 0 @@ -1013,10 +1049,16 @@ } } + rcWorkArea.left = 50; + rcWorkArea.top = 50; + rcWorkArea.bottom -= 50; + rcWorkArea.right -= 50; + /* * Resize the current monitor work area. Win32k will also send * a WM_SIZE message to automatically resize the desktop. */ + ::MessageBoxW(NULL, L"ResizeWorkArea", L"ResizeWorkArea", 0); SystemParametersInfoW(SPI_SETWORKAREA, 1, &rcWorkArea, @@ -1046,6 +1088,7 @@ rcTray.bottom - rcTray.top, SWP_NOZORDER | SWP_NOACTIVATE); + ::MessageBoxW(NULL, L"CheckTrayWndPosition calls ResizeWorkArea", L"sdf", 0); ResizeWorkArea(); ApplyClipping(TRUE); @@ -2235,8 +2278,7 @@ pt.x = (SHORT) LOWORD(lParam); pt.y = (SHORT) HIWORD(lParam); - if (PtInRect(&rcClient, - pt)) + if (PtInRect(&rcClient, pt)) { /* The user is trying to drag the tray window */ return HTCAPTION; @@ -2265,8 +2307,8 @@ break; } } - return HTBORDER; - return TRUE; + return HTCAPTION;// HTBORDER; + // return TRUE; } LRESULT OnMoving(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) @@ -2334,6 +2376,7 @@ InvalidateRect(NULL, TRUE); if (wParam == SIZE_RESTORED && lParam == 0) { + ::MessageBoxW(NULL, L"OnSize calls ResizeWorkArea", L"sdf", 0); ResizeWorkArea(); /* Clip the tray window on multi monitor systems so the edges can't overlap into another monitor */