From 6f5012a900f7e4aa4df781b4dab1257614bfa9c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20van=20Geldorp?= Date: Fri, 29 Aug 2003 09:29:11 +0000 Subject: [PATCH] Various fixes by Filip Navara svn path=/trunk/; revision=5912 --- reactos/lib/user32/misc/desktop.c | 99 +- reactos/lib/user32/windows/defwnd.c | 1674 ++++++++++++----------- reactos/lib/user32/windows/menu.c | 3 +- reactos/lib/user32/windows/messagebox.c | 4 +- reactos/subsys/win32k/ntuser/metric.c | 4 +- reactos/subsys/win32k/ntuser/misc.c | 52 +- reactos/subsys/win32k/ntuser/window.c | 29 +- reactos/subsys/win32k/ntuser/winpos.c | 10 +- reactos/subsys/win32k/objects/brush.c | 5 +- reactos/subsys/win32k/objects/cliprgn.c | 5 +- reactos/subsys/win32k/objects/dc.c | 10 +- reactos/subsys/win32k/objects/text.c | 12 +- 12 files changed, 988 insertions(+), 919 deletions(-) diff --git a/reactos/lib/user32/misc/desktop.c b/reactos/lib/user32/misc/desktop.c index 34eb3eb8385..12c87ed8231 100644 --- a/reactos/lib/user32/misc/desktop.c +++ b/reactos/lib/user32/misc/desktop.c @@ -1,4 +1,4 @@ -/* $Id: desktop.c,v 1.26 2003/08/28 18:04:59 weiden Exp $ +/* $Id: desktop.c,v 1.27 2003/08/29 09:29:11 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS user32.dll @@ -41,34 +41,49 @@ SystemParametersInfoA(UINT uiAction, PVOID pvParam, UINT fWinIni) { - WINBOOL Ret; - NONCLIENTMETRICSA *nclma; - NONCLIENTMETRICSW nclmw; - switch (uiAction) { + case SPI_GETWORKAREA: + { + return SystemParametersInfoW(uiAction, uiParam, pvParam, fWinIni); + } case SPI_GETNONCLIENTMETRICS: - nclma = pvParam; - nclmw.cbSize = sizeof(NONCLIENTMETRICSW); - uiParam = sizeof(NONCLIENTMETRICSW); - pvParam = &nclmw; - break; - } - Ret = SystemParametersInfoW(uiAction, uiParam, pvParam, fWinIni); - if (! Ret) - { - return FALSE; + { + LPNONCLIENTMETRICSA nclma = (LPNONCLIENTMETRICSA)pvParam; + NONCLIENTMETRICSW nclmw; + nclmw.cbSize = sizeof(NONCLIENTMETRICSW); + + if (!SystemParametersInfoW(uiAction, sizeof(NONCLIENTMETRICSW), + &nclmw, fWinIni)) + return FALSE; + + nclma->iBorderWidth = nclmw.iBorderWidth; + nclma->iScrollWidth = nclmw.iScrollWidth; + nclma->iScrollHeight = nclmw.iScrollHeight; + nclma->iCaptionWidth = nclmw.iCaptionWidth; + nclma->iCaptionHeight = nclmw.iCaptionHeight; + nclma->iSmCaptionWidth = nclmw.iSmCaptionWidth; + nclma->iSmCaptionHeight = nclmw.iSmCaptionHeight; + nclma->iMenuWidth = nclmw.iMenuWidth; + nclma->iMenuHeight = nclmw.iMenuHeight; + RosRtlLogFontW2A(&(nclma->lfCaptionFont), &(nclmw.lfCaptionFont)); + RosRtlLogFontW2A(&(nclma->lfSmCaptionFont), &(nclmw.lfSmCaptionFont)); + RosRtlLogFontW2A(&(nclma->lfMenuFont), &(nclmw.lfMenuFont)); + RosRtlLogFontW2A(&(nclma->lfStatusFont), &(nclmw.lfStatusFont)); + RosRtlLogFontW2A(&(nclma->lfMessageFont), &(nclmw.lfMessageFont)); + return TRUE; + } + case SPI_GETICONTITLELOGFONT: + { + LOGFONTW lfw; + if (!SystemParametersInfoW(uiAction, 0, &lfw, fWinIni)) + return FALSE; + RosRtlLogFontW2A(pvParam, &lfw); + return TRUE; + } } - switch (uiAction) - { - case SPI_GETNONCLIENTMETRICS: - RosRtlLogFontW2A(&(nclma->lfCaptionFont), &(nclmw.lfCaptionFont)); - RosRtlLogFontW2A(&(nclma->lfSmCaptionFont), &(nclmw.lfSmCaptionFont)); - return TRUE; - } - - return TRUE; + return FALSE; } @@ -81,41 +96,7 @@ SystemParametersInfoW(UINT uiAction, PVOID pvParam, UINT fWinIni) { - NONCLIENTMETRICSW *nclm; - - /* FIXME: This should be obtained from the registry */ - static LOGFONTW CaptionFont = - { 12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, OEM_CHARSET, - 0, 0, DEFAULT_QUALITY, FF_MODERN, L"Bitstream Vera Sans Bold" }; - - switch (uiAction) - { - case SPI_GETWORKAREA: - { - /* FIXME we should obtain the information using GetMonitorInfo(), - besides it is not the whole screen size! */ - ((PRECT)pvParam)->left = 0; - ((PRECT)pvParam)->top = 0; - ((PRECT)pvParam)->right = 640; - ((PRECT)pvParam)->bottom = 480; - return(TRUE); - } - case SPI_GETNONCLIENTMETRICS: - { - nclm = pvParam; - memcpy(&nclm->lfCaptionFont, &CaptionFont, sizeof(CaptionFont)); - memcpy(&nclm->lfSmCaptionFont, &CaptionFont, sizeof(CaptionFont)); - return(TRUE); - } - default: - { - return NtUserSystemParametersInfo(uiAction, - uiParam, - pvParam, - fWinIni); - } - } - return(FALSE); + return NtUserSystemParametersInfo(uiAction, uiParam, pvParam, fWinIni); } diff --git a/reactos/lib/user32/windows/defwnd.c b/reactos/lib/user32/windows/defwnd.c index 88a4f80df63..59ffdea1fb9 100644 --- a/reactos/lib/user32/windows/defwnd.c +++ b/reactos/lib/user32/windows/defwnd.c @@ -1,4 +1,4 @@ -/* $Id: defwnd.c,v 1.73 2003/08/20 21:42:27 gvg Exp $ +/* $Id: defwnd.c,v 1.74 2003/08/29 09:29:11 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS user32.dll @@ -84,81 +84,80 @@ static ATOM AtomInternalPos; BOOL IsMaxBoxActive(HWND hWnd) { - ULONG uStyle = GetWindowLongW( hWnd, GWL_STYLE ); + ULONG uStyle = GetWindowLongW(hWnd, GWL_STYLE); return (uStyle & WS_MAXIMIZEBOX); } BOOL -IsCloseBoxActive( HWND hWnd ) +IsCloseBoxActive(HWND hWnd) { - ULONG uStyle = GetWindowLongW(hWnd, GWL_STYLE ); - return ( uStyle & WS_SYSMENU ); + ULONG uStyle = GetWindowLongW(hWnd, GWL_STYLE); + return (uStyle & WS_SYSMENU); } BOOL -IsMinBoxActive( HWND hWnd ) +IsMinBoxActive(HWND hWnd) { - ULONG uStyle = GetWindowLongW( hWnd, GWL_STYLE ); + ULONG uStyle = GetWindowLongW(hWnd, GWL_STYLE); return (uStyle & WS_MINIMIZEBOX); } INT -UIGetFrameSizeX( HWND hWnd ) +UIGetFrameSizeX(HWND hWnd) { - ULONG uStyle = GetWindowLongW( hWnd, GWL_STYLE ); + ULONG uStyle = GetWindowLongW(hWnd, GWL_STYLE); if ( uStyle & WS_THICKFRAME ) - return GetSystemMetrics( SM_CXSIZEFRAME ); + return GetSystemMetrics(SM_CXSIZEFRAME); else - return GetSystemMetrics( SM_CXFRAME ); + return GetSystemMetrics(SM_CXFRAME); } INT -UIGetFrameSizeY( HWND hWnd ) +UIGetFrameSizeY(HWND hWnd) { - ULONG uStyle = GetWindowLongW( hWnd, GWL_STYLE ); + ULONG uStyle = GetWindowLongW(hWnd, GWL_STYLE); - if ( uStyle & WS_THICKFRAME ) - return GetSystemMetrics( SM_CYSIZEFRAME ); + if (uStyle & WS_THICKFRAME) + return GetSystemMetrics(SM_CYSIZEFRAME); else - return GetSystemMetrics( SM_CYFRAME ); + return GetSystemMetrics(SM_CYFRAME); } VOID -UserSetupInternalPos( VOID ) +UserSetupInternalPos(VOID) { - LPSTR Str = "SysIP"; - AtomInternalPos = GlobalAddAtomA(Str); + LPSTR Str = "SysIP"; + AtomInternalPos = GlobalAddAtomA(Str); } - /* * @implemented */ DWORD STDCALL GetSysColor(int nIndex) { - return SysColours[nIndex]; + return SysColours[nIndex]; } - +/* + * @implemented + */ HPEN STDCALL -GetSysColorPen( int nIndex ) +GetSysColorPen(int nIndex) { - return(CreatePen(PS_SOLID, 1, SysColours[nIndex])); + return CreatePen(PS_SOLID, 1, SysColours[nIndex]); } - /* * @implemented */ HBRUSH STDCALL -GetSysColorBrush( int nIndex ) +GetSysColorBrush(int nIndex) { - return(CreateSolidBrush(SysColours[nIndex])); + return CreateSolidBrush(SysColours[nIndex]); } - /* * @unimplemented */ @@ -169,8 +168,8 @@ DefFrameProcA( HWND hWnd, WPARAM wParam, LPARAM lParam ) { - UNIMPLEMENTED; - return((LRESULT)0); + UNIMPLEMENTED; + return ((LRESULT)0); } /* @@ -183,231 +182,219 @@ DefFrameProcW(HWND hWnd, WPARAM wParam, LPARAM lParam) { - UNIMPLEMENTED; - return((LRESULT)0); + UNIMPLEMENTED; + return ((LRESULT)0); } PINTERNALPOS UserGetInternalPos(HWND hWnd) { - PINTERNALPOS lpPos; - lpPos = (PINTERNALPOS)GetPropA(hWnd, (LPSTR)(DWORD)AtomInternalPos); - return(lpPos); + PINTERNALPOS lpPos; + lpPos = (PINTERNALPOS)GetPropA(hWnd, (LPSTR)(DWORD)AtomInternalPos); + return(lpPos); } BOOL DefWndRedrawIconTitle(HWND hWnd) { - PINTERNALPOS lpPos = (PINTERNALPOS)GetPropA(hWnd, - (LPSTR)(DWORD)AtomInternalPos); - if (lpPos != NULL) - { - if (lpPos->IconTitle != NULL) - { - SendMessageA(lpPos->IconTitle, WM_SHOWWINDOW, TRUE, 0); - InvalidateRect(lpPos->IconTitle, NULL, TRUE); - return(TRUE); - } - } - return(FALSE); -} + PINTERNALPOS lpPos = (PINTERNALPOS)GetPropA(hWnd, (LPSTR)(DWORD)AtomInternalPos); + if (lpPos != NULL) + { + if (lpPos->IconTitle != NULL) + { + SendMessageA(lpPos->IconTitle, WM_SHOWWINDOW, TRUE, 0); + InvalidateRect(lpPos->IconTitle, NULL, TRUE); + return(TRUE); + } + } + return(FALSE); +} BOOL UserHasMenu(HWND hWnd, ULONG Style) { - return(!(Style & WS_CHILD) && GetMenu(hWnd) != 0); + return (!(Style & WS_CHILD) && GetMenu(hWnd) != 0); } - ULONG UserHasAnyFrameStyle(ULONG Style, ULONG ExStyle) { - return((Style & (WS_THICKFRAME | WS_DLGFRAME | WS_BORDER)) || - (ExStyle & WS_EX_DLGMODALFRAME) || - (!(Style & (WS_CHILD | WS_POPUP)))); + return ((Style & (WS_THICKFRAME | WS_DLGFRAME | WS_BORDER)) || + (ExStyle & WS_EX_DLGMODALFRAME) || + (!(Style & (WS_CHILD | WS_POPUP)))); } - ULONG UserHasDlgFrameStyle(ULONG Style, ULONG ExStyle) { - return((ExStyle & WS_EX_DLGMODALFRAME) || - ((Style & WS_DLGFRAME) && (!(Style & WS_THICKFRAME)))); + return ((ExStyle & WS_EX_DLGMODALFRAME) || + ((Style & WS_DLGFRAME) && (!(Style & WS_THICKFRAME)))); } - ULONG UserHasThickFrameStyle(ULONG Style, ULONG ExStyle) { - return((Style & WS_THICKFRAME) && - (!((Style & (WS_DLGFRAME | WS_BORDER)) == WS_DLGFRAME))); + return ((Style & WS_THICKFRAME) && + (!((Style & (WS_DLGFRAME | WS_BORDER)) == WS_DLGFRAME))); } - ULONG UserHasThinFrameStyle(ULONG Style, ULONG ExStyle) { - return((Style & WS_BORDER) || - (!(Style & (WS_CHILD | WS_POPUP)))); + return ((Style & WS_BORDER) || (!(Style & (WS_CHILD | WS_POPUP)))); } - ULONG UserHasBigFrameStyle(ULONG Style, ULONG ExStyle) { - return((Style & (WS_THICKFRAME | WS_DLGFRAME)) || - (ExStyle & WS_EX_DLGMODALFRAME)); + return ((Style & (WS_THICKFRAME | WS_DLGFRAME)) || + (ExStyle & WS_EX_DLGMODALFRAME)); } void -UserGetInsideRectNC( HWND hWnd, RECT *rect ) +UserGetInsideRectNC(HWND hWnd, RECT *rect) { - RECT WindowRect; - ULONG Style; - ULONG ExStyle; + RECT WindowRect; + ULONG Style; + ULONG ExStyle; - Style = GetWindowLongW(hWnd, GWL_STYLE); - ExStyle = GetWindowLongW(hWnd, GWL_EXSTYLE); - GetWindowRect(hWnd, &WindowRect); - rect->top = rect->left = 0; - rect->right = WindowRect.right - WindowRect.left; - rect->bottom = WindowRect.bottom - WindowRect.top; + Style = GetWindowLongW(hWnd, GWL_STYLE); + ExStyle = GetWindowLongW(hWnd, GWL_EXSTYLE); + GetWindowRect(hWnd, &WindowRect); + rect->top = rect->left = 0; + rect->right = WindowRect.right - WindowRect.left; + rect->bottom = WindowRect.bottom - WindowRect.top; - if (Style & WS_ICONIC) + if (Style & WS_ICONIC) { - return; + return; } - /* Remove frame from rectangle */ - if (UserHasThickFrameStyle(Style, ExStyle )) - { - InflateRect( rect, -GetSystemMetrics(SM_CXFRAME), - -GetSystemMetrics(SM_CYFRAME) ); - } + /* Remove frame from rectangle */ + if (UserHasThickFrameStyle(Style, ExStyle )) + { + InflateRect(rect, -GetSystemMetrics(SM_CXFRAME), + -GetSystemMetrics(SM_CYFRAME)); + } else - { - if (UserHasDlgFrameStyle(Style, ExStyle )) - { - InflateRect( rect, -GetSystemMetrics(SM_CXDLGFRAME), - -GetSystemMetrics(SM_CYDLGFRAME)); - /* FIXME: this isn't in NC_AdjustRect? why not? */ - if (ExStyle & WS_EX_DLGMODALFRAME) - InflateRect( rect, -1, 0 ); - } - else - { - if (UserHasThinFrameStyle(Style, ExStyle)) - { - InflateRect(rect, -GetSystemMetrics(SM_CXBORDER), - -GetSystemMetrics(SM_CYBORDER)); - } - } - } + { + if (UserHasDlgFrameStyle(Style, ExStyle )) + { + InflateRect(rect, -GetSystemMetrics(SM_CXDLGFRAME), + -GetSystemMetrics(SM_CYDLGFRAME)); + /* FIXME: this isn't in NC_AdjustRect? why not? */ + if (ExStyle & WS_EX_DLGMODALFRAME) + InflateRect( rect, -1, 0 ); + } + else + { + if (UserHasThinFrameStyle(Style, ExStyle)) + { + InflateRect(rect, -GetSystemMetrics(SM_CXBORDER), + -GetSystemMetrics(SM_CYBORDER)); + } + } + } } WINBOOL -UserDrawSysMenuButton( HWND hWnd, HDC hDC, LPRECT Rect, BOOL down ) +UserDrawSysMenuButton(HWND hWnd, HDC hDC, LPRECT Rect, BOOL down) { HDC hDcMem; HBITMAP hSavedBitmap; - WINBOOL result = FALSE; - hbSysMenu = (HBITMAP)LoadBitmapW(0, MAKEINTRESOURCEW(OBM_CLOSE)); + if (!hbSysMenu) + { + hbSysMenu = (HBITMAP)LoadBitmapW(0, MAKEINTRESOURCEW(OBM_CLOSE)); + } hDcMem = CreateCompatibleDC(hDC); - if (! hDcMem) goto cleanup; + if (!hDcMem) + { + return FALSE; + } hSavedBitmap = SelectObject(hDcMem, hbSysMenu); - if (! hSavedBitmap) goto cleanup; - - BitBlt(hDC, Rect->left + 2, Rect->top + - 2, 16, 16, hDcMem, - (GetWindowLongW(hWnd, GWL_STYLE) & WS_CHILD) ? - GetSystemMetrics(SM_CXSIZE): 0, 0, SRCCOPY); - - result = TRUE; - - cleanup: - if (hDcMem) - { - if(hSavedBitmap) SelectObject(hDcMem, hSavedBitmap); - DeleteDC(hDcMem); - } - return result; - } - -/* FIXME: Cache bitmaps, then just bitblt instead of calling DFC() (and - wasting precious CPU cycles) every time */ - -static void -UserDrawCaptionButton( HWND hWnd, HDC hDC, BOOL bDown, ULONG Type ) -{ - RECT rect; - INT iBmpWidth = GetSystemMetrics(SM_CXSIZE) - 2; - INT iBmpHeight = GetSystemMetrics(SM_CYSIZE) - 4; - - INT OffsetX = UIGetFrameSizeX( hWnd ); - INT OffsetY = UIGetFrameSizeY( hWnd ); - - if(!(GetWindowLongW( hWnd, GWL_STYLE ) & WS_SYSMENU)) - { - return; - } - - GetWindowRect( hWnd, &rect ); - - rect.right = rect.right - rect.left; - rect.bottom = rect.bottom - rect.top; - rect.left = rect.top = 0; - - switch(Type) - { - case DFCS_CAPTIONMIN: + if (!hSavedBitmap) { - if ((GetWindowLongW( hWnd, GWL_EXSTYLE ) & WS_EX_TOOLWINDOW) == TRUE) - return; /* ToolWindows don't have min/max buttons */ + DeleteDC(hDcMem); + return FALSE; + } - SetRect(&rect, - rect.right - OffsetX - (iBmpWidth*3) - 5, - OffsetY + 2, - rect.right - (iBmpWidth * 2) - OffsetX - 5, - rect.top + iBmpHeight + OffsetY + 2 ); - DrawFrameControl( hDC, &rect, DFC_CAPTION, - DFCS_CAPTIONMIN | (bDown ? DFCS_PUSHED : 0) | - (IsMinBoxActive(hWnd) ? 0 : DFCS_INACTIVE) ); - break; - } - case DFCS_CAPTIONMAX: - { - if ((GetWindowLongW( hWnd, GWL_EXSTYLE ) & WS_EX_TOOLWINDOW) == TRUE) - return; /* ToolWindows don't have min/max buttons */ - SetRect(&rect, - rect.right - OffsetX - (iBmpWidth*2) - 5, - OffsetY + 2, - rect.right - iBmpWidth - OffsetX - 5, - rect.top + iBmpHeight + OffsetY + 2 ); - - DrawFrameControl( hDC, &rect, DFC_CAPTION, - (IsZoomed(hWnd) ? DFCS_CAPTIONRESTORE : DFCS_CAPTIONMAX) | - (bDown ? DFCS_PUSHED : 0) | - (IsMaxBoxActive(hWnd) ? 0 : DFCS_INACTIVE) ); - break; - } - case DFCS_CAPTIONCLOSE: - { - SetRect(&rect, - rect.right - OffsetX - iBmpWidth - 3, - OffsetY + 2, - rect.right - OffsetX - 3, - rect.top + iBmpHeight + OffsetY + 2 ); - - DrawFrameControl( hDC, &rect, DFC_CAPTION, - (DFCS_CAPTIONCLOSE | - (bDown ? DFCS_PUSHED : 0) | - (IsCloseBoxActive(hWnd) ? 0 : DFCS_INACTIVE)) ); - } - } + BitBlt(hDC, Rect->left + 2, Rect->top + 2, 16, 16, hDcMem, + (GetWindowLongW(hWnd, GWL_STYLE) & WS_CHILD) ? + GetSystemMetrics(SM_CXSIZE): 0, 0, SRCCOPY); + + SelectObject(hDcMem, hSavedBitmap); + DeleteDC(hDcMem); + return TRUE; } +/* + * FIXME: + * Cache bitmaps, then just bitblt instead of calling DFC() (and + * wasting precious CPU cycles) every time + */ +static void +UserDrawCaptionButton(HWND hWnd, HDC hDC, BOOL bDown, ULONG Type) +{ + RECT rect; + INT iBmpWidth = GetSystemMetrics(SM_CXSIZE) - 2; + INT iBmpHeight = GetSystemMetrics(SM_CYSIZE) - 4; + INT OffsetX = UIGetFrameSizeX(hWnd); + INT OffsetY = UIGetFrameSizeY(hWnd); + + if (!(GetWindowLongW(hWnd, GWL_STYLE) & WS_SYSMENU)) + { + return; + } + + GetWindowRect(hWnd, &rect); + + rect.right = rect.right - rect.left; + rect.bottom = rect.bottom - rect.top; + rect.left = rect.top = 0; + + switch(Type) + { + case DFCS_CAPTIONMIN: + { + if ((GetWindowLongW(hWnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) == TRUE) + return; /* ToolWindows don't have min/max buttons */ + + SetRect(&rect, rect.right - OffsetX - (iBmpWidth * 3) - 5, + OffsetY + 2, rect.right - (iBmpWidth * 2) - OffsetX - 5, + rect.top + iBmpHeight + OffsetY + 2); + DrawFrameControl(hDC, &rect, DFC_CAPTION, + DFCS_CAPTIONMIN | (bDown ? DFCS_PUSHED : 0) | + (IsMinBoxActive(hWnd) ? 0 : DFCS_INACTIVE)); + break; + } + case DFCS_CAPTIONMAX: + { + if ((GetWindowLongW(hWnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) == TRUE) + return; /* ToolWindows don't have min/max buttons */ + + SetRect(&rect, rect.right - OffsetX - (iBmpWidth * 2) - 5, + OffsetY + 2, rect.right - iBmpWidth - OffsetX - 5, + rect.top + iBmpHeight + OffsetY + 2); + DrawFrameControl(hDC, &rect, DFC_CAPTION, + (IsZoomed(hWnd) ? DFCS_CAPTIONRESTORE : DFCS_CAPTIONMAX) | + (bDown ? DFCS_PUSHED : 0) | + (IsMaxBoxActive(hWnd) ? 0 : DFCS_INACTIVE)); + break; + } + case DFCS_CAPTIONCLOSE: + { + SetRect(&rect, rect.right - OffsetX - iBmpWidth - 3, + OffsetY + 2, rect.right - OffsetX - 3, + rect.top + iBmpHeight + OffsetY + 2 ); + DrawFrameControl(hDC, &rect, DFC_CAPTION, + (DFCS_CAPTIONCLOSE | (bDown ? DFCS_PUSHED : 0) | + (IsCloseBoxActive(hWnd) ? 0 : DFCS_INACTIVE))); + break; + } + } +} // Enabling this will cause captions to draw smoother, but slower: // #define DOUBLE_BUFFER_CAPTION @@ -416,8 +403,7 @@ UserDrawCaptionButton( HWND hWnd, HDC hDC, BOOL bDown, ULONG Type ) /* * @implemented */ -WINBOOL -STDCALL +WINBOOL STDCALL DrawCaption( HWND hWnd, HDC hDC, @@ -429,14 +415,13 @@ DrawCaption( RECT r = *lprc; UINT VCenter = 0, Padding = 0; WCHAR buffer[256]; - HFONT hFont = NULL, - hOldFont = NULL; - HBRUSH OldBrush = NULL; - HDC MemDC = NULL; + HFONT hFont = NULL; + HFONT hOldFont = NULL; + HBRUSH OldBrush = NULL; + HDC MemDC = NULL; #ifdef DOUBLE_BUFFER_CAPTION - HBITMAP MemBMP = NULL, - OldBMP = NULL; + HBITMAP MemBMP = NULL, OldBMP = NULL; MemDC = CreateCompatibleDC(hDC); if (! MemDC) goto cleanup; @@ -500,7 +485,7 @@ DrawCaption( r.right = (lprc->right - lprc->left); nclm.cbSize = sizeof(nclm); - if (! SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, 0, &nclm, 0)) goto cleanup; + if (! SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSW), &nclm, 0)) goto cleanup; if (uFlags & DC_INBUTTON) SetTextColor(MemDC, SysColours[ uFlags & DC_ACTIVE ? COLOR_BTNTEXT : COLOR_GRAYTEXT]); @@ -1541,50 +1526,89 @@ DefWndAdjustRect(RECT* Rect, ULONG Style, BOOL Menu, ULONG ExStyle) } } - LRESULT STDCALL DefWndNCCalcSize(HWND hWnd, RECT* Rect) { - LRESULT Result = 0; - LONG Style = GetClassLongW(hWnd, GCL_STYLE); - RECT TmpRect = {0, 0, 0, 0}; + LRESULT Result = 0; + LONG Style = GetClassLongW(hWnd, GCL_STYLE); + RECT TmpRect = {0, 0, 0, 0}; - if (Style & CS_VREDRAW) + if (Style & CS_VREDRAW) { - Result |= WVR_VREDRAW; + Result |= WVR_VREDRAW; } - if (Style & CS_HREDRAW) + if (Style & CS_HREDRAW) { - Result |= WVR_HREDRAW; + Result |= WVR_HREDRAW; } - if (!(GetWindowLongW(hWnd, GWL_STYLE) & WS_MINIMIZE)) + if (!(GetWindowLongW(hWnd, GWL_STYLE) & WS_MINIMIZE)) { - DefWndAdjustRect(&TmpRect, GetWindowLongW(hWnd, GWL_STYLE), - FALSE, GetWindowLongW(hWnd, GWL_EXSTYLE)); - Rect->left -= TmpRect.left; - Rect->top -= TmpRect.top; - Rect->right -= TmpRect.right; - Rect->bottom -= TmpRect.bottom; - if (UserHasMenu(hWnd, GetWindowLongW(hWnd, GWL_EXSTYLE))) - { - Rect->top += MenuGetMenuBarHeight(hWnd, - Rect->right - Rect->left, - -TmpRect.left, - -TmpRect.top) + 1; - } - Rect->bottom = max(Rect->top, Rect->bottom); - Rect->right = max(Rect->left, Rect->right); + DefWndAdjustRect(&TmpRect, GetWindowLongW(hWnd, GWL_STYLE), + FALSE, GetWindowLongW(hWnd, GWL_EXSTYLE)); + Rect->left -= TmpRect.left; + Rect->top -= TmpRect.top; + Rect->right -= TmpRect.right; + Rect->bottom -= TmpRect.bottom; + if (UserHasMenu(hWnd, GetWindowLongW(hWnd, GWL_STYLE))) + { + Rect->top += MenuGetMenuBarHeight(hWnd, Rect->right - Rect->left, + -TmpRect.left, -TmpRect.top) + 1; + } + if (Rect->top > Rect->bottom) + Rect->bottom = Rect->top; + if (Rect->left > Rect->right) + Rect->right = Rect->left; } - return(Result); + + return (Result); } - LRESULT DefWndHandleWindowPosChanging(HWND hWnd, WINDOWPOS* Pos) { - UNIMPLEMENTED; - return 0; + POINT maxSize, minTrack; + LONG style = GetWindowLongA(hWnd, GWL_STYLE); + + if (Pos->flags & SWP_NOSIZE) return 0; + if ((style & WS_THICKFRAME) || ((style & (WS_POPUP | WS_CHILD)) == 0)) + { + WinPosGetMinMaxInfo(hWnd, &maxSize, NULL, &minTrack, NULL); + Pos->cx = min(Pos->cx, maxSize.x); + Pos->cy = min(Pos->cy, maxSize.y); + if (!(style & WS_MINIMIZE)) + { + if (Pos->cx < minTrack.x) Pos->cx = minTrack.x; + if (Pos->cy < minTrack.y) Pos->cy = minTrack.y; + } + } + return 0; +} + +/* Undocumented flags. */ +#define SWP_NOCLIENTMOVE 0x0800 +#define SWP_NOCLIENTSIZE 0x1000 + +LRESULT +DefWndHandleWindowPosChanged(HWND hWnd, WINDOWPOS* Pos) +{ + RECT rect; + + GetClientRect(hWnd, &rect); + + if (!(Pos->flags & SWP_NOCLIENTMOVE)) + SendMessageW(hWnd, WM_MOVE, 0, MAKELONG(rect.left, rect.top)); + + if (!(Pos->flags & SWP_NOCLIENTSIZE)) + { + WPARAM wp = SIZE_RESTORED; + if (IsZoomed(hWnd)) wp = SIZE_MAXIMIZED; + else if (IsIconic(hWnd)) wp = SIZE_MINIMIZED; + SendMessageW(hWnd, WM_SIZE, wp, + MAKELONG(rect.right - rect.left, rect.bottom - rect.top)); + } + + return 0; } @@ -1595,434 +1619,450 @@ User32DefWindowProc(HWND hWnd, LPARAM lParam, BOOL bUnicode) { - switch (Msg) + switch (Msg) { - case WM_NCPAINT: - { - return(DefWndPaintNC(hWnd, (HRGN)wParam)); - } - case WM_WINDOWPOSCHANGING: - { - break; - } - case WM_NCHITTEST: - { - POINT Point; - Point.x = SLOWORD(lParam); - Point.y = SHIWORD(lParam); - return(DefWndHitTestNC(hWnd, Point)); - } + case WM_NCPAINT: + { + return (DefWndPaintNC(hWnd, (HRGN)wParam)); + } - case WM_NCLBUTTONDOWN: - { - return(DefWndHandleLButtonDownNC(hWnd, wParam, lParam)); - } + case WM_NCCALCSIZE: + { + return (DefWndNCCalcSize(hWnd, (RECT*)lParam)); + } - case WM_NCLBUTTONUP: - { - return(DefWndHandleLButtonUpNC(hWnd, wParam, lParam)); - } + case WM_WINDOWPOSCHANGING: + { + return (DefWndHandleWindowPosChanging(hWnd, (WINDOWPOS*)lParam)); + } - case WM_LBUTTONDBLCLK: - case WM_NCLBUTTONDBLCLK: - { - return(DefWndHandleLButtonDblClkNC(hWnd, wParam, lParam)); - } + case WM_WINDOWPOSCHANGED: + { + return (DefWndHandleWindowPosChanged(hWnd, (WINDOWPOS*)lParam)); + } - case WM_NCRBUTTONDOWN: - { - if (wParam == HTCAPTION) - { - SetCapture(hWnd); - } - break; - } - case WM_LBUTTONUP: - { - break; - } - case WM_RBUTTONUP: - { - POINT Pt; - if (hWnd == GetCapture()) - { - ReleaseCapture(); - } - Pt.x = SLOWORD(lParam); - Pt.y = SHIWORD(lParam); - ClientToScreen(hWnd, &Pt); - lParam = MAKELPARAM(Pt.x, Pt.y); - if (bUnicode) - { - SendMessageW(hWnd, WM_CONTEXTMENU, (WPARAM)hWnd, lParam); - } - else - { - SendMessageA (hWnd, WM_CONTEXTMENU, (WPARAM)hWnd, lParam); - } - break; - } + case WM_NCHITTEST: + { + POINT Point; + Point.x = SLOWORD(lParam); + Point.y = SHIWORD(lParam); + return (DefWndHitTestNC(hWnd, Point)); + } - case WM_NCRBUTTONUP: - { - /* Wine does nothing here. */ - break; - } + case WM_NCLBUTTONDOWN: + { + return (DefWndHandleLButtonDownNC(hWnd, wParam, lParam)); + } - case WM_CONTEXTMENU: - { - if (GetWindowLongW(hWnd, GWL_STYLE) & WS_CHILD) - { - if (bUnicode) - { - SendMessageW(GetParent(hWnd), Msg, wParam, lParam); - } - else - { - SendMessageA(hWnd, WM_CONTEXTMENU, wParam, lParam); - } - } - else - { - LONG HitCode; - POINT Pt; + case WM_NCLBUTTONUP: + { + return (DefWndHandleLButtonUpNC(hWnd, wParam, lParam)); + } - Pt.x = SLOWORD(lParam); - Pt.y = SHIWORD(lParam); + case WM_LBUTTONDBLCLK: + case WM_NCLBUTTONDBLCLK: + { + return (DefWndHandleLButtonDblClkNC(hWnd, wParam, lParam)); + } - if (GetWindowLongW(hWnd, GWL_STYLE) & WS_CHILD) - { - ScreenToClient(GetParent(hWnd), &Pt); - } + case WM_NCRBUTTONDOWN: + { + if (wParam == HTCAPTION) + { + SetCapture(hWnd); + } + break; + } - HitCode = DefWndHitTestNC(hWnd, Pt); + case WM_RBUTTONUP: + { + POINT Pt; + if (hWnd == GetCapture()) + { + ReleaseCapture(); + } + Pt.x = SLOWORD(lParam); + Pt.y = SHIWORD(lParam); + ClientToScreen(hWnd, &Pt); + lParam = MAKELPARAM(Pt.x, Pt.y); + if (bUnicode) + { + SendMessageW(hWnd, WM_CONTEXTMENU, (WPARAM)hWnd, lParam); + } + else + { + SendMessageA(hWnd, WM_CONTEXTMENU, (WPARAM)hWnd, lParam); + } + break; + } - if (HitCode == HTCAPTION || HitCode == HTSYSMENU) - { - TrackPopupMenu(GetSystemMenu(hWnd, FALSE), - TPM_LEFTBUTTON | TPM_RIGHTBUTTON, - Pt.x, Pt.y, 0, hWnd, NULL); - } - } - break; - } - - case WM_NCACTIVATE: - { - return(DefWndHandleActiveNC(hWnd, wParam)); - } - - case WM_NCDESTROY: - { - return(0); - } - - case WM_PRINT: - { - return(0); - } - - case WM_PAINTICON: - case WM_PAINT: - { - PAINTSTRUCT Ps; - HDC hDC = BeginPaint(hWnd, &Ps); - if (hDC) - { - HICON hIcon; - if (GetWindowLongW(hWnd, GWL_STYLE) & WS_MINIMIZE && - (hIcon = (HICON)GetClassLongW(hWnd, GCL_HICON)) != NULL) - { - RECT WindowRect; - INT x, y; - GetWindowRect(hWnd, &WindowRect); - x = (WindowRect.right - WindowRect.left - - GetSystemMetrics(SM_CXICON)) / 2; - y = (WindowRect.bottom - WindowRect.top - - GetSystemMetrics(SM_CYICON)) / 2; - DrawIcon(hDC, x, y, hIcon); - } - if (GetWindowLongW(hWnd, GWL_EXSTYLE) & WS_EX_CLIENTEDGE) - { - RECT WindowRect; - GetClientRect(hWnd, &WindowRect); - DrawEdge(hDC, &WindowRect, EDGE_SUNKEN, BF_RECT); - } - EndPaint(hWnd, &Ps); - } - return(0); - } - - case WM_SYNCPAINT: - { - HRGN hRgn; - hRgn = CreateRectRgn(0, 0, 0, 0); - if (GetUpdateRgn(hWnd, hRgn, FALSE) != NULLREGION) - { - RedrawWindow(hWnd, NULL, hRgn, - RDW_ERASENOW | RDW_ERASE | RDW_FRAME | - RDW_ALLCHILDREN); - } - DeleteObject(hRgn); - return(0); - } - - case WM_SETREDRAW: - { - DefWndSetRedraw(hWnd, wParam); - return(0); - } - - case WM_CLOSE: - { - DestroyWindow(hWnd); - return(0); - } - - case WM_MOUSEACTIVATE: - { - if (GetWindowLongW(hWnd, GWL_STYLE) & WS_CHILD) - { - LONG Ret; - if (bUnicode) - { - Ret = SendMessageW(GetParent(hWnd), WM_MOUSEACTIVATE, - wParam, lParam); - } - else - { - Ret = SendMessageA(GetParent(hWnd), WM_MOUSEACTIVATE, - wParam, lParam); - } - if (Ret) - { - return(Ret); - } - } - return((LOWORD(lParam) >= HTCLIENT) ? MA_ACTIVATE : MA_NOACTIVATE); - } - - case WM_ACTIVATE: - { - /* Check if the window is minimized. */ - if (LOWORD(lParam) != WA_INACTIVE && - !(GetWindowLongW(hWnd, GWL_STYLE) & WS_MINIMIZE)) - { - SetFocus(hWnd); - } - break; - } - - case WM_MOUSEWHEEL: - { - if (GetWindowLongW(hWnd, GWL_STYLE & WS_CHILD)) - { - if (bUnicode) - { - return(SendMessageW(GetParent(hWnd), WM_MOUSEWHEEL, - wParam, lParam)); - } - else - { - return(SendMessageA(GetParent(hWnd), WM_MOUSEWHEEL, - wParam, lParam)); - } - } - break; - } - - case WM_ERASEBKGND: - case WM_ICONERASEBKGND: - { - - RECT Rect; - HBRUSH hBrush = (HBRUSH)GetClassLongW(hWnd, GCL_HBRBACKGROUND); - if (NULL == hBrush) - { - return 0; - } - if (0 == (((DWORD) hBrush) & 0xffff0000)) - { - hBrush = GetSysColorBrush((DWORD) hBrush - 1); - } - GetClipBox((HDC)wParam, &Rect); - FillRect((HDC)wParam, &Rect, hBrush); - return(1); - } - - case WM_GETDLGCODE: - { - return(0); - } - - /* FIXME: Implement colour controls. */ - - case WM_SETCURSOR: - { - if (GetWindowLongW(hWnd, GWL_STYLE) & WS_CHILD) - { - if (LOWORD(lParam) < HTLEFT || LOWORD(lParam) > HTBOTTOMRIGHT) - { - BOOL bResult; - if (bUnicode) - { - bResult = SendMessageW(GetParent(hWnd), WM_SETCURSOR, - wParam, lParam); - } - else - { - bResult = SendMessageA(GetParent(hWnd), WM_SETCURSOR, - wParam, lParam); - } - if (bResult) - { - return(TRUE); - } - } - } - return(DefWndHandleSetCursor(hWnd, wParam, lParam)); - } - - case WM_SYSCOMMAND: - { - POINT Pt; - Pt.x = SLOWORD(lParam); - Pt.y = SHIWORD(lParam); - return(DefWndHandleSysCommand(hWnd, wParam, Pt)); - } - - /* FIXME: Handle key messages. */ - - case WM_SHOWWINDOW: - { - if (lParam) - { - return(0); - } - /* FIXME: Not done correctly */ - if ((GetWindowLongW(hWnd, GWL_STYLE) & WS_VISIBLE && !wParam) || - (!(GetWindowLongW(hWnd, GWL_STYLE) & WS_VISIBLE) && wParam)) - { - return(0); - } - ShowWindow(hWnd, wParam ? SW_SHOWNA : SW_HIDE); - break; - } - - case WM_CANCELMODE: - { - /* FIXME: Check for a desktop. */ - if (GetCapture() == hWnd) - { - ReleaseCapture(); - } - break; - } - - case WM_VKEYTOITEM: - case WM_CHARTOITEM: - return(-1); - - case WM_DROPOBJECT: - /* FIXME: Implement this. */ - break; - - case WM_QUERYDROPOBJECT: - { - if (GetWindowLongW(hWnd, GWL_EXSTYLE) & WS_EX_ACCEPTFILES) - { - return(1); - } - break; - } - - case WM_QUERYDRAGICON: - { - UINT Len; - HICON hIcon; - - hIcon = (HICON)GetClassLongW(hWnd, GCL_HICON); - if (hIcon) - { - return((LRESULT)hIcon); - } - for (Len = 1; Len < 64; Len++) - { - if ((hIcon = LoadIconW(NULL, MAKEINTRESOURCEW(Len))) != NULL) - { - return((LRESULT)hIcon); - } - } - return((LRESULT)LoadIconW(0, IDI_APPLICATION)); - } - - /* FIXME: WM_ISACTIVEICON */ - - case WM_NOTIFYFORMAT: - { - if (IsWindowUnicode(hWnd)) - { - return(NFR_UNICODE); - } - else - { - return(NFR_ANSI); - } - } - - case WM_SETICON: - { - INT Index = (wParam != 0) ? GCL_HICON : GCL_HICONSM; - HICON hOldIcon = (HICON)GetClassLongW(hWnd, Index); - SetClassLongW(hWnd, Index, lParam); - SetWindowPos(hWnd, 0, 0, 0, 0, 0, - SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | - SWP_NOACTIVATE | SWP_NOZORDER); - return((LRESULT)hOldIcon); - } - - case WM_GETICON: - { - INT Index = (wParam != 0) ? GCL_HICON : GCL_HICONSM; - return(GetClassLongW(hWnd, Index)); - } - - case WM_HELP: - { - if (bUnicode) - { - SendMessageW(GetParent(hWnd), Msg, wParam, lParam); - } - else - { - SendMessageA(GetParent(hWnd), Msg, wParam, lParam); - } - break; - } - - case WM_SYSKEYDOWN: - if (HIWORD(lParam) & KEYDATA_ALT) - { - if (wParam == VK_F4) /* Try to close the window */ - { - //HWND hTopWnd = GetAncestor(hWnd, GA_ROOT); - HWND hTopWnd = hWnd; - if (!(GetClassLongW(hTopWnd, GCL_STYLE) & CS_NOCLOSE)) + case WM_CONTEXTMENU: + { + if (GetWindowLongW(hWnd, GWL_STYLE) & WS_CHILD) + { + if (bUnicode) { - if (bUnicode) - { - PostMessageW(hTopWnd, WM_SYSCOMMAND, SC_CLOSE, 0); - } - else - { - PostMessageA(hTopWnd, WM_SYSCOMMAND, SC_CLOSE, 0); - } + SendMessageW(GetParent(hWnd), Msg, wParam, lParam); + } + else + { + SendMessageA(GetParent(hWnd), WM_CONTEXTMENU, wParam, lParam); } } - } - break; + else + { + LONG HitCode; + POINT Pt; + + Pt.x = SLOWORD(lParam); + Pt.y = SHIWORD(lParam); + if (GetWindowLongW(hWnd, GWL_STYLE) & WS_CHILD) + { + ScreenToClient(GetParent(hWnd), &Pt); + } + + HitCode = DefWndHitTestNC(hWnd, Pt); + + if (HitCode == HTCAPTION || HitCode == HTSYSMENU) + { + TrackPopupMenu(GetSystemMenu(hWnd, FALSE), + TPM_LEFTBUTTON | TPM_RIGHTBUTTON, + Pt.x, Pt.y, 0, hWnd, NULL); + } + } + break; + } + + case WM_NCACTIVATE: + { + return (DefWndHandleActiveNC(hWnd, wParam)); + } + + case WM_PRINT: + { + /* FIXME: Implement. */ + return (0); + } + + case WM_PAINTICON: + case WM_PAINT: + { + PAINTSTRUCT Ps; + HDC hDC = BeginPaint(hWnd, &Ps); + if (hDC) + { + HICON hIcon; + if (GetWindowLongW(hWnd, GWL_STYLE) & WS_MINIMIZE && + (hIcon = (HICON)GetClassLongW(hWnd, GCL_HICON)) != NULL) + { + RECT WindowRect; + INT x, y; + GetWindowRect(hWnd, &WindowRect); + x = (WindowRect.right - WindowRect.left - + GetSystemMetrics(SM_CXICON)) / 2; + y = (WindowRect.bottom - WindowRect.top - + GetSystemMetrics(SM_CYICON)) / 2; + DrawIcon(hDC, x, y, hIcon); + } + if (GetWindowLongW(hWnd, GWL_EXSTYLE) & WS_EX_CLIENTEDGE) + { + RECT WindowRect; + GetClientRect(hWnd, &WindowRect); + DrawEdge(hDC, &WindowRect, EDGE_SUNKEN, BF_RECT); + } + EndPaint(hWnd, &Ps); + } + return (0); + } + + case WM_SYNCPAINT: + { + HRGN hRgn; + hRgn = CreateRectRgn(0, 0, 0, 0); + if (GetUpdateRgn(hWnd, hRgn, FALSE) != NULLREGION) + { + RedrawWindow(hWnd, NULL, hRgn, + RDW_ERASENOW | RDW_ERASE | RDW_FRAME | + RDW_ALLCHILDREN); + } + DeleteObject(hRgn); + return (0); + } + + case WM_SETREDRAW: + { + DefWndSetRedraw(hWnd, wParam); + return (0); + } + + case WM_CLOSE: + { + DestroyWindow(hWnd); + return (0); + } + + case WM_MOUSEACTIVATE: + { + if (GetWindowLongW(hWnd, GWL_STYLE) & WS_CHILD) + { + LONG Ret; + if (bUnicode) + { + Ret = SendMessageW(GetParent(hWnd), WM_MOUSEACTIVATE, + wParam, lParam); + } + else + { + Ret = SendMessageA(GetParent(hWnd), WM_MOUSEACTIVATE, + wParam, lParam); + } + if (Ret) + { + return (Ret); + } + } + return ((LOWORD(lParam) >= HTCLIENT) ? MA_ACTIVATE : MA_NOACTIVATE); + } + + case WM_ACTIVATE: + { + /* Check if the window is minimized. */ + if (LOWORD(lParam) != WA_INACTIVE && + !(GetWindowLongW(hWnd, GWL_STYLE) & WS_MINIMIZE)) + { + SetFocus(hWnd); + } + break; + } + + case WM_MOUSEWHEEL: + { + if (GetWindowLongW(hWnd, GWL_STYLE & WS_CHILD)) + { + if (bUnicode) + { + return (SendMessageW(GetParent(hWnd), WM_MOUSEWHEEL, + wParam, lParam)); + } + else + { + return (SendMessageA(GetParent(hWnd), WM_MOUSEWHEEL, + wParam, lParam)); + } + } + break; + } + + case WM_ERASEBKGND: + case WM_ICONERASEBKGND: + { + RECT Rect; + HBRUSH hBrush = (HBRUSH)GetClassLongW(hWnd, GCL_HBRBACKGROUND); + + if (NULL == hBrush) + { + return 0; + } + if (0 == (((DWORD) hBrush) & 0xffff0000)) + { + hBrush = GetSysColorBrush((DWORD) hBrush - 1); + } + GetClipBox((HDC)wParam, &Rect); + FillRect((HDC)wParam, &Rect, hBrush); + return (1); + } + + /* FIXME: Implement colour controls. */ +/* + case WM_CTLCOLORMSGBOX: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORBTN: + case WM_CTLCOLORDLG: + case WM_CTLCOLORSTATIC: + case WM_CTLCOLORSCROLLBAR: + case WM_CTLCOLOR: +*/ + + case WM_SETCURSOR: + { + if (GetWindowLongW(hWnd, GWL_STYLE) & WS_CHILD) + { + if (LOWORD(lParam) < HTLEFT || LOWORD(lParam) > HTBOTTOMRIGHT) + { + BOOL bResult; + if (bUnicode) + { + bResult = SendMessageW(GetParent(hWnd), WM_SETCURSOR, + wParam, lParam); + } + else + { + bResult = SendMessageA(GetParent(hWnd), WM_SETCURSOR, + wParam, lParam); + } + if (bResult) + { + return(TRUE); + } + } + } + return (DefWndHandleSetCursor(hWnd, wParam, lParam)); + } + + case WM_SYSCOMMAND: + { + POINT Pt; + Pt.x = SLOWORD(lParam); + Pt.y = SHIWORD(lParam); + return (DefWndHandleSysCommand(hWnd, wParam, Pt)); + } + + /* FIXME: Handle key messages. */ +/* + case WM_KEYDOWN: + case WM_KEYUP: + case WM_SYSKEYUP: + case WM_SYSCHAR: +*/ + + /* FIXME: This is also incomplete. */ + case WM_SYSKEYDOWN: + { + if (HIWORD(lParam) & KEYDATA_ALT) + { + if (wParam == VK_F4) /* Try to close the window */ + { + HWND top = GetAncestor(hWnd, GA_ROOT); + if (!(GetClassLongW(top, GCL_STYLE) & CS_NOCLOSE)) + { + if (bUnicode) + PostMessageW(top, WM_SYSCOMMAND, SC_CLOSE, 0); + else + PostMessageA(top, WM_SYSCOMMAND, SC_CLOSE, 0); + } + } + } + break; + } + + case WM_SHOWWINDOW: + { + LONG Style; + + if (!lParam) + return 0; + Style = GetWindowLongW(hWnd, GWL_STYLE); + if (!(Style & WS_POPUP)) + return 0; + if ((Style & WS_VISIBLE) && wParam) + return 0; + if (!(Style & WS_VISIBLE) && !wParam) + return 0; + if (!GetWindow(hWnd, GW_OWNER)) + return 0; + ShowWindow(hWnd, wParam ? SW_SHOWNA : SW_HIDE); + break; + } + + case WM_CANCELMODE: + { + /* FIXME: Check for a desktop. */ + if (GetCapture() == hWnd) + { + ReleaseCapture(); + } + break; + } + + case WM_VKEYTOITEM: + case WM_CHARTOITEM: + return (-1); + + case WM_DROPOBJECT: + /* FIXME: Implement this. */ + break; + + case WM_QUERYDROPOBJECT: + { + if (GetWindowLongW(hWnd, GWL_EXSTYLE) & WS_EX_ACCEPTFILES) + { + return(1); + } + break; + } + + case WM_QUERYDRAGICON: + { + UINT Len; + HICON hIcon; + + hIcon = (HICON)GetClassLongW(hWnd, GCL_HICON); + if (hIcon) + { + return ((LRESULT)hIcon); + } + for (Len = 1; Len < 64; Len++) + { + if ((hIcon = LoadIconW(NULL, MAKEINTRESOURCEW(Len))) != NULL) + { + return((LRESULT)hIcon); + } + } + return ((LRESULT)LoadIconW(0, IDI_APPLICATION)); + } + + /* FIXME: WM_ISACTIVEICON */ + + case WM_NOTIFYFORMAT: + { + if (IsWindowUnicode(hWnd)) + { + return(NFR_UNICODE); + } + else + { + return(NFR_ANSI); + } + } + + case WM_SETICON: + { + INT Index = (wParam != 0) ? GCL_HICON : GCL_HICONSM; + HICON hOldIcon = (HICON)GetClassLongW(hWnd, Index); + SetClassLongW(hWnd, Index, lParam); + SetWindowPos(hWnd, 0, 0, 0, 0, 0, + SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOMOVE | + SWP_NOACTIVATE | SWP_NOZORDER); + return ((LRESULT)hOldIcon); + } + + case WM_GETICON: + { + INT Index = (wParam != 0) ? GCL_HICON : GCL_HICONSM; + return (GetClassLongW(hWnd, Index)); + } + + case WM_HELP: + { + if (bUnicode) + { + SendMessageW(GetParent(hWnd), Msg, wParam, lParam); + } + else + { + SendMessageA(GetParent(hWnd), Msg, wParam, lParam); + } + break; + } + + case WM_QUERYOPEN: + case WM_QUERYENDSESSION: + { + return (1); + } } - return 0; + return 0; } @@ -2032,105 +2072,101 @@ DefWindowProcA(HWND hWnd, WPARAM wParam, LPARAM lParam) { - LRESULT Result; - static LPSTR WindowTextAtom = 0; - PSTR WindowText; + static LPSTR WindowTextAtom = 0; + PSTR WindowText; - switch (Msg) + switch (Msg) { - case WM_NCCREATE: - { - CREATESTRUCTA* Cs = (CREATESTRUCTA*)lParam; - if (HIWORD(Cs->lpszName)) - { - if (0 == WindowTextAtom) - { - WindowTextAtom = - (LPSTR)(ULONG)GlobalAddAtomA("USER32!WindowTextAtomA"); - } - WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0, - strlen(Cs->lpszName) * sizeof(CHAR)); - strcpy(WindowText, Cs->lpszName); - SetPropA(hWnd, WindowTextAtom, WindowText); - } - return(1); - } + case WM_NCCREATE: + { + CREATESTRUCTA *Cs = (CREATESTRUCTA*)lParam; + if (HIWORD(Cs->lpszName)) + { + if (0 == WindowTextAtom) + { + WindowTextAtom = + (LPSTR)(ULONG)GlobalAddAtomA("USER32!WindowTextAtomA"); + } + WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0, + strlen(Cs->lpszName) * sizeof(CHAR)); + strcpy(WindowText, Cs->lpszName); + SetPropA(hWnd, WindowTextAtom, WindowText); + } + return (1); + } - case WM_NCCALCSIZE: - { - return(DefWndNCCalcSize(hWnd, (RECT*)lParam)); - } + case WM_GETTEXTLENGTH: + { + if (WindowTextAtom == 0 || + (WindowText = GetPropA(hWnd, WindowTextAtom)) == NULL) + { + return(0); + } + return (strlen(WindowText)); + } - case WM_WINDOWPOSCHANGING: - { - return(DefWndHandleWindowPosChanging(hWnd, (WINDOWPOS*)lParam)); - } + case WM_GETTEXT: + { + if (WindowTextAtom == 0 || + (WindowText = GetPropA(hWnd, WindowTextAtom)) == NULL) + { + if (wParam > 1) + { + *((PSTR)lParam) = '\0'; + } + return (0); + } + strncpy((LPSTR)lParam, WindowText, wParam); + return (min(wParam, strlen(WindowText))); + } - case WM_GETTEXTLENGTH: - { - if (WindowTextAtom == 0 || - (WindowText = GetPropA(hWnd, WindowTextAtom)) == NULL) - { - return(0); - } - return(strlen(WindowText)); - } + case WM_SETTEXT: + { + if (0 == WindowTextAtom) + { + WindowTextAtom = + (LPSTR)(DWORD)GlobalAddAtomA("USER32!WindowTextAtomA"); + } + if (WindowTextAtom != 0 && + (WindowText = GetPropA(hWnd, WindowTextAtom)) == NULL) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, WindowText); + } + WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0, + strlen((PSTR)lParam) * sizeof(CHAR)); + strcpy(WindowText, (PSTR)lParam); + SetPropA(hWnd, WindowTextAtom, WindowText); + if (0 != (GetWindowLongW(hWnd, GWL_STYLE) & WS_CAPTION)) + { + DefWndPaintNC(hWnd, (HRGN) 1); + } + return (1); + } - case WM_GETTEXT: - { - if (WindowTextAtom == 0 || - (WindowText = GetPropA(hWnd, WindowTextAtom)) == NULL) - { - if (wParam > 1) - { - *((PSTR)lParam) = '\0'; - } - return(0); - } - strncpy((LPSTR)lParam, WindowText, wParam); - return(min(wParam, strlen(WindowText))); - } +/* + FIXME: Implement these. + case WM_IME_CHAR: + case WM_IME_KEYDOWN: + case WM_IME_KEYUP: + case WM_IME_STARTCOMPOSITION: + case WM_IME_COMPOSITION: + case WM_IME_ENDCOMPOSITION: + case WM_IME_SELECT: + case WM_IME_SETCONTEXT: +*/ - case WM_SETTEXT: - { - if (0 == WindowTextAtom) - { - WindowTextAtom = - (LPSTR)(DWORD)GlobalAddAtomA("USER32!WindowTextAtomA"); - } - if (WindowTextAtom != 0 && - (WindowText = GetPropA(hWnd, WindowTextAtom)) == NULL) - { - RtlFreeHeap(RtlGetProcessHeap(), 0, WindowText); - } - WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0, - strlen((PSTR)lParam) * sizeof(CHAR)); - strcpy(WindowText, (PSTR)lParam); - SetPropA(hWnd, WindowTextAtom, WindowText); - if (0 != (GetWindowLongW(hWnd, GWL_STYLE) & WS_CAPTION)) - { - DefWndPaintNC(hWnd, (HRGN) 1); - } - Result = (LPARAM) TRUE; - break; - } - - case WM_NCDESTROY: - { - if (WindowTextAtom != 0 && - (WindowText = RemovePropA(hWnd, WindowTextAtom)) == NULL) - { - RtlFreeHeap(GetProcessHeap(), 0, WindowText); - } - return(0); - } - - default: - Result = User32DefWindowProc(hWnd, Msg, wParam, lParam, FALSE); - break; + case WM_NCDESTROY: + { + if (WindowTextAtom != 0 && + (WindowText = RemovePropA(hWnd, WindowTextAtom)) == NULL) + { + RtlFreeHeap(GetProcessHeap(), 0, WindowText); + } + return(0); + } } - return(Result); + return User32DefWindowProc(hWnd, Msg, wParam, lParam, FALSE); } @@ -2140,103 +2176,99 @@ DefWindowProcW(HWND hWnd, WPARAM wParam, LPARAM lParam) { - LRESULT Result; - static LPWSTR WindowTextAtom = 0; - PWSTR WindowText; + static LPWSTR WindowTextAtom = 0; + PWSTR WindowText; - switch (Msg) + switch (Msg) { - case WM_NCCREATE: - { - CREATESTRUCTW* Cs = (CREATESTRUCTW*)lParam; - if (HIWORD(Cs->lpszName)) - { - if (0 == WindowTextAtom) - { - WindowTextAtom = - (LPWSTR)(DWORD)GlobalAddAtomW(L"USER32!WindowTextAtomW"); - } - WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0, - wcslen(Cs->lpszName) * sizeof(WCHAR)); - wcscpy(WindowText, Cs->lpszName); - SetPropW(hWnd, WindowTextAtom, WindowText); - } - return(1); - } + case WM_NCCREATE: + { + CREATESTRUCTW* CreateStruct = (CREATESTRUCTW*)lParam; + if (HIWORD(CreateStruct->lpszName)) + { + if (0 == WindowTextAtom) + { + WindowTextAtom = + (LPWSTR)(DWORD)GlobalAddAtomW(L"USER32!WindowTextAtomW"); + } + WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0, + wcslen(CreateStruct->lpszName) * sizeof(WCHAR)); + wcscpy(WindowText, CreateStruct->lpszName); + SetPropW(hWnd, WindowTextAtom, WindowText); + } + return (1); + } - case WM_NCCALCSIZE: - { - return(DefWndNCCalcSize(hWnd, (RECT*)lParam)); - } + case WM_GETTEXTLENGTH: + { + if (WindowTextAtom == 0 || + (WindowText = GetPropW(hWnd, WindowTextAtom)) == NULL) + { + return(0); + } + return (wcslen(WindowText)); + } - case WM_WINDOWPOSCHANGING: - { - return(DefWndHandleWindowPosChanging(hWnd, (WINDOWPOS*)lParam)); - } + case WM_GETTEXT: + { + if (WindowTextAtom == 0 || + (WindowText = GetPropW(hWnd, WindowTextAtom)) == NULL) + { + if (wParam > 1) + { + ((PWSTR)lParam) = '\0'; + } + return (0); + } + wcsncpy((PWSTR)lParam, WindowText, wParam); + return (min(wParam, wcslen(WindowText))); + } - case WM_GETTEXTLENGTH: - { - if (WindowTextAtom == 0 || - (WindowText = GetPropW(hWnd, WindowTextAtom)) == NULL) - { - return(0); - } - return(wcslen(WindowText)); - } + case WM_SETTEXT: + { + if (WindowTextAtom == 0) + { + WindowTextAtom = + (LPWSTR)(DWORD)GlobalAddAtomW(L"USER32!WindowTextAtomW"); + } + if (WindowTextAtom != 0 && + (WindowText = GetPropW(hWnd, WindowTextAtom)) == NULL) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, WindowText); + } + WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0, + wcslen((PWSTR)lParam) * sizeof(WCHAR)); + wcscpy(WindowText, (PWSTR)lParam); + SetPropW(hWnd, WindowTextAtom, WindowText); + if ((GetWindowLongW(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION) + { + DefWndPaintNC(hWnd, (HRGN)1); + } + return (1); + } - case WM_GETTEXT: - { - if (WindowTextAtom == 0 || - (WindowText = GetPropW(hWnd, WindowTextAtom)) == NULL) - { - if (wParam > 1) - { - ((PWSTR)lParam) = '\0'; - } - return(0); - } - wcsncpy((PWSTR)lParam, WindowText, wParam); - return(min(wParam, wcslen(WindowText))); - } + case WM_IME_CHAR: + { + SendMessageW(hWnd, WM_CHAR, wParam, lParam); + return (0); + } - case WM_SETTEXT: - { - if (WindowTextAtom == 0) - { - WindowTextAtom = - (LPWSTR)(DWORD)GlobalAddAtomW(L"USER32!WindowTextAtomW"); - } - if (WindowTextAtom != 0 && - (WindowText = GetPropW(hWnd, WindowTextAtom)) == NULL) - { - RtlFreeHeap(RtlGetProcessHeap(), 0, WindowText); - } - WindowText = RtlAllocateHeap(RtlGetProcessHeap(), 0, - wcslen((PWSTR)lParam) * sizeof(WCHAR)); - wcscpy(WindowText, (PWSTR)lParam); - SetPropW(hWnd, WindowTextAtom, WindowText); - if (0 != (GetWindowLongW(hWnd, GWL_STYLE) & WS_CAPTION)) - { - DefWndPaintNC(hWnd, (HRGN) 1); - } - Result = (LPARAM) TRUE; - break; - } + case WM_IME_SETCONTEXT: + { + /* FIXME */ + return (0); + } - case WM_NCDESTROY: - { - if (WindowTextAtom != 0 && - (WindowText = RemovePropW(hWnd, WindowTextAtom)) == NULL) - { - RtlFreeHeap(RtlGetProcessHeap(), 0, WindowText); - } - return(0); - } - - default: - Result = User32DefWindowProc(hWnd, Msg, wParam, lParam, TRUE); - break; + case WM_NCDESTROY: + { + if (WindowTextAtom != 0 && + (WindowText = RemovePropW(hWnd, WindowTextAtom)) == NULL) + { + RtlFreeHeap(RtlGetProcessHeap(), 0, WindowText); + } + return (0); + } } - return(Result); + return User32DefWindowProc(hWnd, Msg, wParam, lParam, TRUE); } diff --git a/reactos/lib/user32/windows/menu.c b/reactos/lib/user32/windows/menu.c index 9ef4f8d98c0..b843c140f9b 100644 --- a/reactos/lib/user32/windows/menu.c +++ b/reactos/lib/user32/windows/menu.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: menu.c,v 1.31 2003/08/28 10:39:44 weiden Exp $ +/* $Id: menu.c,v 1.32 2003/08/29 09:29:11 gvg Exp $ * * PROJECT: ReactOS user32.dll * FILE: lib/user32/windows/menu.c @@ -262,6 +262,7 @@ MenuInit(VOID) /* get the menu font */ if(!hMenuFont || !hMenuFontBold) { + ncm.cbSize = sizeof(ncm); if(!SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0)) { DbgPrint("MenuInit(): SystemParametersInfoW(SPI_GETNONCLIENTMETRICS) failed!\n"); diff --git a/reactos/lib/user32/windows/messagebox.c b/reactos/lib/user32/windows/messagebox.c index 46a2eaac2f7..a0ee0bf080c 100644 --- a/reactos/lib/user32/windows/messagebox.c +++ b/reactos/lib/user32/windows/messagebox.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: messagebox.c,v 1.15 2003/08/22 16:01:01 weiden Exp $ +/* $Id: messagebox.c,v 1.16 2003/08/29 09:29:11 gvg Exp $ * * PROJECT: ReactOS user32.dll * FILE: lib/user32/windows/messagebox.c @@ -88,7 +88,7 @@ static HFONT MSGBOX_OnInit(HWND hwnd, LPMSGBOXPARAMS lpmb) NONCLIENTMETRICSW nclm; nclm.cbSize = sizeof(nclm); - SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, 0, &nclm, 0); + SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, sizeof(nclm), &nclm, 0); hFont = CreateFontIndirectW (&nclm.lfMessageFont); /* set button font */ for (i = 1; i < 10; i++) diff --git a/reactos/subsys/win32k/ntuser/metric.c b/reactos/subsys/win32k/ntuser/metric.c index 51e0ec50a72..d9157b0ebe3 100644 --- a/reactos/subsys/win32k/ntuser/metric.c +++ b/reactos/subsys/win32k/ntuser/metric.c @@ -16,12 +16,12 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: metric.c,v 1.11 2003/08/28 18:04:59 weiden Exp $ +/* $Id: metric.c,v 1.12 2003/08/29 09:29:11 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * PURPOSE: Window classes - * FILE: subsys/win32k/ntuser/class.c + * FILE: subsys/win32k/ntuser/metric.c * PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net) * REVISION HISTORY: * 06-06-2001 CSH Created diff --git a/reactos/subsys/win32k/ntuser/misc.c b/reactos/subsys/win32k/ntuser/misc.c index dbb61a93255..be20606e299 100644 --- a/reactos/subsys/win32k/ntuser/misc.c +++ b/reactos/subsys/win32k/ntuser/misc.c @@ -1,4 +1,4 @@ -/* $Id: misc.c,v 1.14 2003/08/28 18:04:59 weiden Exp $ +/* $Id: misc.c,v 1.15 2003/08/29 09:29:11 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -239,6 +239,12 @@ NtUserSystemParametersInfo( PVOID pvParam, UINT fWinIni) { + /* FIXME: This should be obtained from the registry */ + static LOGFONTW CaptionFont = + { 14, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET, + 0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, L"" }; +/* { 12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, OEM_CHARSET, + 0, 0, DEFAULT_QUALITY, FF_MODERN, L"Bitstream Vera Sans Bold" };*/ NTSTATUS Status; PWINSTATION_OBJECT WinStaObject; @@ -274,6 +280,50 @@ NtUserSystemParametersInfo( ObDereferenceObject(WinStaObject); return TRUE; + + case SPI_GETWORKAREA: + { + ((PRECT)pvParam)->left = 0; + ((PRECT)pvParam)->top = 0; + ((PRECT)pvParam)->right = 640; + ((PRECT)pvParam)->bottom = 480; + return TRUE; + } + case SPI_GETICONTITLELOGFONT: + { + memcpy(pvParam, &CaptionFont, sizeof(CaptionFont)); + return TRUE; + } + case SPI_GETNONCLIENTMETRICS: + { + LPNONCLIENTMETRICSW pMetrics = (LPNONCLIENTMETRICSW)pvParam; + + if (pMetrics->cbSize != sizeof(NONCLIENTMETRICSW) || + uiParam != sizeof(NONCLIENTMETRICSW)) + { + return FALSE; + } + + memset((char *)pvParam + sizeof(pMetrics->cbSize), 0, + pMetrics->cbSize - sizeof(pMetrics->cbSize)); + + pMetrics->iBorderWidth = 1; + pMetrics->iScrollWidth = NtUserGetSystemMetrics(SM_CXVSCROLL); + pMetrics->iScrollHeight = NtUserGetSystemMetrics(SM_CYHSCROLL); + pMetrics->iCaptionWidth = NtUserGetSystemMetrics(SM_CXSIZE); + pMetrics->iCaptionHeight = NtUserGetSystemMetrics(SM_CYSIZE); + memcpy((LPVOID)&(pMetrics->lfCaptionFont), &CaptionFont, sizeof(CaptionFont)); + pMetrics->lfCaptionFont.lfWeight = FW_BOLD; + pMetrics->iSmCaptionWidth = NtUserGetSystemMetrics(SM_CXSMSIZE); + pMetrics->iSmCaptionHeight = NtUserGetSystemMetrics(SM_CYSMSIZE); + memcpy((LPVOID)&(pMetrics->lfSmCaptionFont), &CaptionFont, sizeof(CaptionFont)); + pMetrics->iMenuWidth = NtUserGetSystemMetrics(SM_CXMENUSIZE); + pMetrics->iMenuHeight = NtUserGetSystemMetrics(SM_CYMENUSIZE); + memcpy((LPVOID)&(pMetrics->lfMenuFont), &CaptionFont, sizeof(CaptionFont)); + memcpy((LPVOID)&(pMetrics->lfStatusFont), &CaptionFont, sizeof(CaptionFont)); + memcpy((LPVOID)&(pMetrics->lfMessageFont), &CaptionFont, sizeof(CaptionFont)); + return TRUE; + } } return FALSE; diff --git a/reactos/subsys/win32k/ntuser/window.c b/reactos/subsys/win32k/ntuser/window.c index 01c887b6c9c..ab9d9262924 100644 --- a/reactos/subsys/win32k/ntuser/window.c +++ b/reactos/subsys/win32k/ntuser/window.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: window.c,v 1.105 2003/08/28 13:38:24 gvg Exp $ +/* $Id: window.c,v 1.106 2003/08/29 09:29:11 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -1347,30 +1347,29 @@ NtUserCreateWindowEx(DWORD dwExStyle, } /* Send move and size messages. */ - /* FIXME: Breaks Solitaire, probably shouldn't be there. FiN */ -#if 0 if (!(WindowObject->Flags & WINDOWOBJECT_NEED_SIZE)) { LONG lParam; + + DPRINT("NtUserCreateWindow(): About to send WM_SIZE\n"); + + if ((WindowObject->ClientRect.right - WindowObject->ClientRect.left) < 0 || + (WindowObject->ClientRect.bottom - WindowObject->ClientRect.top) < 0) + DPRINT("Sending bogus WM_SIZE\n"); - lParam = - MAKE_LONG(WindowObject->ClientRect.right - + lParam = MAKE_LONG(WindowObject->ClientRect.right - WindowObject->ClientRect.left, WindowObject->ClientRect.bottom - WindowObject->ClientRect.top); - - DPRINT("NtUserCreateWindow(): About to send WM_SIZE\n"); IntCallWindowProc(NULL, WindowObject->Self, WM_SIZE, SIZE_RESTORED, - lParam); - lParam = - MAKE_LONG(WindowObject->ClientRect.left, - WindowObject->ClientRect.top); - DPRINT("NtUserCreateWindow(): About to send WM_MOVE\n"); - IntCallWindowProc(NULL, WindowObject->Self, WM_MOVE, 0, lParam); + lParam); - WindowObject->Flags &= ~WINDOWOBJECT_NEED_SIZE; + DPRINT("NtUserCreateWindow(): About to send WM_MOVE\n"); + + lParam = MAKE_LONG(WindowObject->ClientRect.left, + WindowObject->ClientRect.top); + IntCallWindowProc(NULL, WindowObject->Self, WM_MOVE, 0, lParam); } -#endif /* Move from parent-client to screen coordinates */ if (0 != (WindowObject->Style & WS_CHILD)) diff --git a/reactos/subsys/win32k/ntuser/winpos.c b/reactos/subsys/win32k/ntuser/winpos.c index 359433b1084..01a738272a0 100644 --- a/reactos/subsys/win32k/ntuser/winpos.c +++ b/reactos/subsys/win32k/ntuser/winpos.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: winpos.c,v 1.28 2003/08/24 16:20:30 gvg Exp $ +/* $Id: winpos.c,v 1.29 2003/08/29 09:29:11 gvg Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -409,14 +409,18 @@ WinPosDoWinPosChanging(PWINDOW_OBJECT WindowObject, WindowRect->top = WinPos->y; WindowRect->right += WinPos->x - WindowObject->WindowRect.left; WindowRect->bottom += WinPos->y - WindowObject->WindowRect.top; + NtGdiOffsetRect(ClientRect, + WinPos->x - WindowObject->WindowRect.left, + WinPos->y - WindowObject->WindowRect.top); } + WinPos->flags |= SWP_NOCLIENTMOVE | SWP_NOCLIENTSIZE; + if (!(WinPos->flags & SWP_NOSIZE) || !(WinPos->flags & SWP_NOMOVE)) { WinPosGetNonClientSize(WindowObject->Self, WindowRect, ClientRect); } - WinPos->flags |= SWP_NOCLIENTMOVE | SWP_NOCLIENTSIZE; return(TRUE); } @@ -957,7 +961,7 @@ WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx, } /* FIXME: Check some conditions before doing this. */ - IntSendWINDOWPOSCHANGEDMessage(Window->Self, &WinPos); + IntSendWINDOWPOSCHANGEDMessage(WinPos.hwnd, &WinPos); ObmDereferenceObject(Window); return(TRUE); diff --git a/reactos/subsys/win32k/objects/brush.c b/reactos/subsys/win32k/objects/brush.c index 4fbd2b6f852..463a692833c 100644 --- a/reactos/subsys/win32k/objects/brush.c +++ b/reactos/subsys/win32k/objects/brush.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: brush.c,v 1.25 2003/08/20 07:45:02 gvg Exp $ +/* $Id: brush.c,v 1.26 2003/08/29 09:29:11 gvg Exp $ */ @@ -45,7 +45,8 @@ HBRUSH STDCALL NtGdiCreateBrushIndirect(CONST LOGBRUSH *lb) } brushPtr = BRUSHOBJ_LockBrush (hBrush); - ASSERT( brushPtr ); //I want to know if this ever occurs +/* FIXME: Occurs! FiN */ +/* ASSERT( brushPtr ); *///I want to know if this ever occurs if( brushPtr ){ brushPtr->iSolidColor = lb->lbColor; diff --git a/reactos/subsys/win32k/objects/cliprgn.c b/reactos/subsys/win32k/objects/cliprgn.c index 80144632c82..bb3bf356891 100644 --- a/reactos/subsys/win32k/objects/cliprgn.c +++ b/reactos/subsys/win32k/objects/cliprgn.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: cliprgn.c,v 1.21 2003/08/20 07:45:02 gvg Exp $ */ +/* $Id: cliprgn.c,v 1.22 2003/08/29 09:29:11 gvg Exp $ */ #undef WIN32_LEAN_AND_MEAN #include @@ -43,6 +43,9 @@ CLIPPING_UpdateGCRegion(DC* Dc) Dc->w.hGCClipRgn = NtGdiCreateRectRgn(0, 0, 0, 0); } + if (Dc->w.hGCClipRgn == NULL) + return; + if (Dc->w.hClipRgn == NULL) { NtGdiCombineRgn(Dc->w.hGCClipRgn, Dc->w.hVisRgn, 0, RGN_COPY); diff --git a/reactos/subsys/win32k/objects/dc.c b/reactos/subsys/win32k/objects/dc.c index bf1ec249258..677ff94356d 100644 --- a/reactos/subsys/win32k/objects/dc.c +++ b/reactos/subsys/win32k/objects/dc.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: dc.c,v 1.75 2003/08/28 12:35:59 gvg Exp $ +/* $Id: dc.c,v 1.76 2003/08/29 09:29:11 gvg Exp $ * * DC.C - Device context functions * @@ -363,12 +363,6 @@ NtGdiCreatePrimarySurface(LPCWSTR Driver, DPRINT("Enabling PDev\n"); -#ifdef TODO -PrimarySurface.DMW.dmBitsPerPel = 16; -PrimarySurface.DMW.dmPelsWidth = 1024; -PrimarySurface.DMW.dmPelsHeight = 768; -PrimarySurface.DMW.dmDisplayFrequency = 60; -#endif PrimarySurface.PDev = PrimarySurface.DriverFunctions.EnablePDev(&PrimarySurface.DMW, L"", @@ -1525,7 +1519,7 @@ NtGdiSetDCState16 ( HDC hDC, HDC hDCSave ) // ---------------------------------------------------- Private Interface HDC FASTCALL -DC_AllocDC(LPCWSTR Driver) +DC_AllocDC(LPCWSTR Driver) { PDC NewDC; HDC hDC; diff --git a/reactos/subsys/win32k/objects/text.c b/reactos/subsys/win32k/objects/text.c index bda31f075ea..adbe54dc768 100644 --- a/reactos/subsys/win32k/objects/text.c +++ b/reactos/subsys/win32k/objects/text.c @@ -16,7 +16,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/* $Id: text.c,v 1.47 2003/08/28 21:40:26 gvg Exp $ */ +/* $Id: text.c,v 1.48 2003/08/29 09:29:11 gvg Exp $ */ #undef WIN32_LEAN_AND_MEAN @@ -253,8 +253,9 @@ TextIntCreateFontIndirect(CONST LPLOGFONTW lf, HFONT *NewFont) } else { - ASSERT(FALSE); - Status = STATUS_INVALID_HANDLE; +/* FIXME */ +/* ASSERT(FALSE);*/ + Status = STATUS_INVALID_HANDLE; } } else @@ -302,7 +303,10 @@ NtGdiCreateFont(int Height, if (NULL != Face) { - Status = MmCopyFromCaller(logfont.lfFaceName, Face, sizeof(logfont.lfFaceName)); + int Size = sizeof(logfont.lfFaceName) / sizeof(WCHAR); + wcsncpy((wchar_t *)logfont.lfFaceName, Face, Size - 1); + /* Be 101% sure to have '\0' at end of string */ + logfont.lfFaceName[Size - 1] = '\0'; } else {