Author: hbelusca
Date: Fri Feb 12 22:10:29 2016
New Revision: 70718
URL:
http://svn.reactos.org/svn/reactos?rev=70718&view=rev
Log:
[WIN32K][USER32]
- Both functions UserGetInsideRectNC and NC_GetInsideRect are the same: remove the
redundant code and keep only NC_GetInsideRect.
- Move default WM_NCHITTEST into kernel side, getting rid of half-broken DefWndNCHitTest
in user32. Note that we use a DefWndNCHitTest version almost unmodified in uxtheme.dll.
I did this move also because otherwise, we didn't correctly checked for the presence
of the window system menu icon. On the contrary the function GetNCHitEx (obviously taken
from Wine's NC_HandleNCHitTest) correctly checks for this.
James, please review!
Modified:
trunk/reactos/win32ss/user/ntuser/defwnd.c
trunk/reactos/win32ss/user/ntuser/menu.c
trunk/reactos/win32ss/user/ntuser/nonclient.c
trunk/reactos/win32ss/user/ntuser/userfuncs.h
trunk/reactos/win32ss/user/user32/include/user32p.h
trunk/reactos/win32ss/user/user32/windows/defwnd.c
trunk/reactos/win32ss/user/user32/windows/nonclient.c
Modified: trunk/reactos/win32ss/user/ntuser/defwnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/defwnd…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/defwnd.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/defwnd.c [iso-8859-1] Fri Feb 12 22:10:29 2016
@@ -629,8 +629,8 @@
co_WinPosShowWindow(Wnd, wParam ? SW_SHOWNOACTIVATE : SW_HIDE);
}
- }
- break;
+ break;
+ }
case WM_CLIENTSHUTDOWN:
return IntClientShutdown(Wnd, wParam, lParam);
@@ -688,16 +688,16 @@
break;
case WM_NCLBUTTONDOWN:
- return (NC_HandleNCLButtonDown( Wnd, wParam, lParam));
+ return NC_HandleNCLButtonDown(Wnd, wParam, lParam);
+
+ case WM_NCRBUTTONDOWN:
+ return NC_HandleNCRButtonDown(Wnd, wParam, lParam);
case WM_LBUTTONDBLCLK:
- return (NC_HandleNCLButtonDblClk( Wnd, HTCLIENT, lParam));
+ return NC_HandleNCLButtonDblClk(Wnd, HTCLIENT, lParam);
case WM_NCLBUTTONDBLCLK:
- return (NC_HandleNCLButtonDblClk( Wnd, wParam, lParam));
-
- case WM_NCRBUTTONDOWN:
- return NC_HandleNCRButtonDown( Wnd, wParam, lParam );
+ return NC_HandleNCLButtonDblClk(Wnd, wParam, lParam);
case WM_RBUTTONUP:
{
Modified: trunk/reactos/win32ss/user/ntuser/menu.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/menu.c…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/menu.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/menu.c [iso-8859-1] Fri Feb 12 22:10:29 2016
@@ -2212,7 +2212,7 @@
{
if ( (Wnd->style & WS_MINIMIZE))
{
- UserGetInsideRectNC(Wnd, &rect);
+ NC_GetInsideRect(Wnd, &rect);
UserDrawSysMenuButton(Wnd, hdc, &rect, lpitem->fState & (MF_HILITE |
MF_MOUSESELECT));
}
return;
Modified: trunk/reactos/win32ss/user/ntuser/nonclient.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/noncli…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/nonclient.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/nonclient.c [iso-8859-1] Fri Feb 12 22:10:29 2016
@@ -67,7 +67,7 @@
* Get the 'inside' rectangle of a window, i.e. the whole window rectangle
* but without the borders (if any).
*/
-void FASTCALL
+void FASTCALL // Previously known as "UserGetInsideRectNC"
NC_GetInsideRect(PWND Wnd, RECT *rect)
{
ULONG Style;
@@ -83,27 +83,22 @@
if (Style & WS_ICONIC) return;
/* Remove frame from rectangle */
- if (UserHasThickFrameStyle(Style, ExStyle ))
+ if (UserHasThickFrameStyle(Style, ExStyle))
{
RECTL_vInflateRect(rect, -UserGetSystemMetrics(SM_CXFRAME),
-UserGetSystemMetrics(SM_CYFRAME));
}
- else
+ else if (UserHasDlgFrameStyle(Style, ExStyle))
{
- if (UserHasDlgFrameStyle(Style, ExStyle ))
- {
- RECTL_vInflateRect(rect, -UserGetSystemMetrics(SM_CXDLGFRAME),
-UserGetSystemMetrics(SM_CYDLGFRAME));
- /* FIXME: this isn't in NC_AdjustRect? why not? */
- if (ExStyle & WS_EX_DLGMODALFRAME)
- RECTL_vInflateRect( rect, -1, 0 );
- }
- else
- {
- if (UserHasThinFrameStyle(Style, ExStyle))
- {
- RECTL_vInflateRect(rect, -UserGetSystemMetrics(SM_CXBORDER),
-UserGetSystemMetrics(SM_CYBORDER));
- }
- }
+ RECTL_vInflateRect(rect, -UserGetSystemMetrics(SM_CXDLGFRAME),
-UserGetSystemMetrics(SM_CYDLGFRAME));
+ /* FIXME: this isn't in NC_AdjustRect? why not? */
+ if (ExStyle & WS_EX_DLGMODALFRAME)
+ RECTL_vInflateRect( rect, -1, 0 );
}
+ else if (UserHasThinFrameStyle(Style, ExStyle))
+ {
+ RECTL_vInflateRect(rect, -UserGetSystemMetrics(SM_CXBORDER),
-UserGetSystemMetrics(SM_CYBORDER));
+ }
+
/* We have additional border information if the window
* is a child (but not an MDI child) */
if ((Style & WS_CHILD) && !(ExStyle & WS_EX_MDICHILD))
@@ -672,57 +667,6 @@
return Ret;
}
-void
-UserGetInsideRectNC(PWND Wnd, RECT *rect)
-{
- ULONG Style;
- ULONG ExStyle;
-
- Style = Wnd->style;
- ExStyle = Wnd->ExStyle;
-
- rect->top = rect->left = 0;
- rect->right = Wnd->rcWindow.right - Wnd->rcWindow.left;
- rect->bottom = Wnd->rcWindow.bottom - Wnd->rcWindow.top;
-
- if (Style & WS_ICONIC)
- {
- return;
- }
-
- /* Remove frame from rectangle */
- if (UserHasThickFrameStyle(Style, ExStyle ))
- {
- RECTL_vInflateRect(rect, -UserGetSystemMetrics(SM_CXFRAME),
-UserGetSystemMetrics(SM_CYFRAME));
- }
- else
- {
- if (UserHasDlgFrameStyle(Style, ExStyle ))
- {
- RECTL_vInflateRect(rect, -UserGetSystemMetrics(SM_CXDLGFRAME),
-UserGetSystemMetrics(SM_CYDLGFRAME));
- /* FIXME: this isn't in NC_AdjustRect? why not? */
- if (ExStyle & WS_EX_DLGMODALFRAME)
- RECTL_vInflateRect( rect, -1, 0 );
- }
- else
- {
- if (UserHasThinFrameStyle(Style, ExStyle))
- {
- RECTL_vInflateRect(rect, -UserGetSystemMetrics(SM_CXBORDER),
-UserGetSystemMetrics(SM_CYBORDER));
- }
- }
- }
- /* We have additional border information if the window
- * is a child (but not an MDI child) */
- if ((Style & WS_CHILD) && !(ExStyle & WS_EX_MDICHILD))
- {
- if (ExStyle & WS_EX_CLIENTEDGE)
- RECTL_vInflateRect (rect, -UserGetSystemMetrics(SM_CXEDGE),
-UserGetSystemMetrics(SM_CYEDGE));
- if (ExStyle & WS_EX_STATICEDGE)
- RECTL_vInflateRect (rect, -UserGetSystemMetrics(SM_CXBORDER),
-UserGetSystemMetrics(SM_CYBORDER));
- }
-}
-
BOOL
IntIsScrollBarVisible(PWND pWnd, INT hBar)
{
@@ -1588,7 +1532,7 @@
{
RECT rect;
HDC hDC = UserGetWindowDC(pWnd);
- UserGetInsideRectNC(pWnd, &rect);
+ NC_GetInsideRect(pWnd, &rect);
UserDrawSysMenuButton(pWnd, hDC, &rect, TRUE);
UserReleaseDC( pWnd, hDC, FALSE );
}
@@ -1720,6 +1664,229 @@
}
+#if 0 // Old version, kept there for reference, which is also used
+ // almost unmodified in uxtheme.dll (in nonclient.c)
+/*
+ * FIXME:
+ * - Check the scrollbar handling
+ */
+LRESULT
+DefWndNCHitTest(HWND hWnd, POINT Point)
+{
+ RECT WindowRect, ClientRect, OrigWndRect;
+ POINT ClientPoint;
+ SIZE WindowBorders;
+ DWORD Style = GetWindowLongPtrW(hWnd, GWL_STYLE);
+ DWORD ExStyle = GetWindowLongPtrW(hWnd, GWL_EXSTYLE);
+
+ GetWindowRect(hWnd, &WindowRect);
+ if (!PtInRect(&WindowRect, Point))
+ {
+ return HTNOWHERE;
+ }
+ OrigWndRect = WindowRect;
+
+ if (UserHasWindowEdge(Style, ExStyle))
+ {
+ LONG XSize, YSize;
+
+ UserGetWindowBorders(Style, ExStyle, &WindowBorders, FALSE);
+ InflateRect(&WindowRect, -WindowBorders.cx, -WindowBorders.cy);
+ XSize = GetSystemMetrics(SM_CXSIZE) * GetSystemMetrics(SM_CXBORDER);
+ YSize = GetSystemMetrics(SM_CYSIZE) * GetSystemMetrics(SM_CYBORDER);
+ if (!PtInRect(&WindowRect, Point))
+ {
+ BOOL ThickFrame;
+
+ ThickFrame = (Style & WS_THICKFRAME);
+ if (Point.y < WindowRect.top)
+ {
+ if(Style & WS_MINIMIZE)
+ return HTCAPTION;
+ if(!ThickFrame)
+ return HTBORDER;
+ if (Point.x < (WindowRect.left + XSize))
+ return HTTOPLEFT;
+ if (Point.x >= (WindowRect.right - XSize))
+ return HTTOPRIGHT;
+ return HTTOP;
+ }
+ if (Point.y >= WindowRect.bottom)
+ {
+ if(Style & WS_MINIMIZE)
+ return HTCAPTION;
+ if(!ThickFrame)
+ return HTBORDER;
+ if (Point.x < (WindowRect.left + XSize))
+ return HTBOTTOMLEFT;
+ if (Point.x >= (WindowRect.right - XSize))
+ return HTBOTTOMRIGHT;
+ return HTBOTTOM;
+ }
+ if (Point.x < WindowRect.left)
+ {
+ if(Style & WS_MINIMIZE)
+ return HTCAPTION;
+ if(!ThickFrame)
+ return HTBORDER;
+ if (Point.y < (WindowRect.top + YSize))
+ return HTTOPLEFT;
+ if (Point.y >= (WindowRect.bottom - YSize))
+ return HTBOTTOMLEFT;
+ return HTLEFT;
+ }
+ if (Point.x >= WindowRect.right)
+ {
+ if(Style & WS_MINIMIZE)
+ return HTCAPTION;
+ if(!ThickFrame)
+ return HTBORDER;
+ if (Point.y < (WindowRect.top + YSize))
+ return HTTOPRIGHT;
+ if (Point.y >= (WindowRect.bottom - YSize))
+ return HTBOTTOMRIGHT;
+ return HTRIGHT;
+ }
+ }
+ }
+ else
+ {
+ if (ExStyle & WS_EX_STATICEDGE)
+ InflateRect(&WindowRect,
+ -GetSystemMetrics(SM_CXBORDER),
+ -GetSystemMetrics(SM_CYBORDER));
+ if (!PtInRect(&WindowRect, Point))
+ return HTBORDER;
+ }
+
+ if ((Style & WS_CAPTION) == WS_CAPTION)
+ {
+ if (ExStyle & WS_EX_TOOLWINDOW)
+ WindowRect.top += GetSystemMetrics(SM_CYSMCAPTION);
+ else
+ WindowRect.top += GetSystemMetrics(SM_CYCAPTION);
+ if (!PtInRect(&WindowRect, Point))
+ {
+ if (Style & WS_SYSMENU)
+ {
+ if (ExStyle & WS_EX_TOOLWINDOW)
+ {
+ WindowRect.right -= GetSystemMetrics(SM_CXSMSIZE);
+ }
+ else
+ {
+ // if(!(ExStyle & WS_EX_DLGMODALFRAME))
+ // FIXME: The real test should check whether there is
+ // an icon for the system window, and if so, do the
+ // rect.left increase.
+ // See dll/win32/uxtheme/nonclient.c!DefWndNCHitTest
+ // and win32ss/user/ntuser/nonclient.c!GetNCHitEx which does
+ // the test better.
+ WindowRect.left += GetSystemMetrics(SM_CXSIZE);
+ WindowRect.right -= GetSystemMetrics(SM_CXSIZE);
+ }
+ }
+ if (Point.x < WindowRect.left)
+ return HTSYSMENU;
+ if (WindowRect.right <= Point.x)
+ return HTCLOSE;
+ if (Style & WS_MAXIMIZEBOX || Style & WS_MINIMIZEBOX)
+ WindowRect.right -= GetSystemMetrics(SM_CXSIZE);
+ if (Point.x >= WindowRect.right)
+ return HTMAXBUTTON;
+ if (Style & WS_MINIMIZEBOX)
+ WindowRect.right -= GetSystemMetrics(SM_CXSIZE);
+ if (Point.x >= WindowRect.right)
+ return HTMINBUTTON;
+ return HTCAPTION;
+ }
+ }
+
+ if(!(Style & WS_MINIMIZE))
+ {
+ ClientPoint = Point;
+ ScreenToClient(hWnd, &ClientPoint);
+ GetClientRect(hWnd, &ClientRect);
+
+ if (PtInRect(&ClientRect, ClientPoint))
+ {
+ return HTCLIENT;
+ }
+
+ if (GetMenu(hWnd) && !(Style & WS_CHILD))
+ {
+ if (Point.x > 0 && Point.x < WindowRect.right &&
ClientPoint.y < 0)
+ return HTMENU;
+ }
+
+ if (ExStyle & WS_EX_CLIENTEDGE)
+ {
+ InflateRect(&WindowRect, -2 * GetSystemMetrics(SM_CXBORDER),
+ -2 * GetSystemMetrics(SM_CYBORDER));
+ }
+
+ if ((Style & WS_VSCROLL) && (Style & WS_HSCROLL) &&
+ (WindowRect.bottom - WindowRect.top) > GetSystemMetrics(SM_CYHSCROLL))
+ {
+ RECT ParentRect, TempRect = WindowRect, TempRect2 = WindowRect;
+ HWND Parent = GetParent(hWnd);
+
+ TempRect.bottom -= GetSystemMetrics(SM_CYHSCROLL);
+ if ((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
+ TempRect.right = TempRect.left + GetSystemMetrics(SM_CXVSCROLL);
+ else
+ TempRect.left = TempRect.right - GetSystemMetrics(SM_CXVSCROLL);
+ if (PtInRect(&TempRect, Point))
+ return HTVSCROLL;
+
+ TempRect2.top = TempRect2.bottom - GetSystemMetrics(SM_CYHSCROLL);
+ if ((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
+ TempRect2.left += GetSystemMetrics(SM_CXVSCROLL);
+ else
+ TempRect2.right -= GetSystemMetrics(SM_CXVSCROLL);
+ if (PtInRect(&TempRect2, Point))
+ return HTHSCROLL;
+
+ TempRect.top = TempRect2.top;
+ TempRect.bottom = TempRect2.bottom;
+ if(Parent)
+ GetClientRect(Parent, &ParentRect);
+ if (PtInRect(&TempRect, Point) && HASSIZEGRIP(Style, ExStyle,
+ GetWindowLongPtrW(Parent, GWL_STYLE), OrigWndRect, ParentRect))
+ {
+ if ((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
+ return HTBOTTOMLEFT;
+ else
+ return HTBOTTOMRIGHT;
+ }
+ }
+ else
+ {
+ if (Style & WS_VSCROLL)
+ {
+ RECT TempRect = WindowRect;
+
+ if ((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
+ TempRect.right = TempRect.left + GetSystemMetrics(SM_CXVSCROLL);
+ else
+ TempRect.left = TempRect.right - GetSystemMetrics(SM_CXVSCROLL);
+ if (PtInRect(&TempRect, Point))
+ return HTVSCROLL;
+ } else
+ if (Style & WS_HSCROLL)
+ {
+ RECT TempRect = WindowRect;
+ TempRect.top = TempRect.bottom - GetSystemMetrics(SM_CYHSCROLL);
+ if (PtInRect(&TempRect, Point))
+ return HTHSCROLL;
+ }
+ }
+ }
+
+ return HTNOWHERE;
+}
+#endif
+
DWORD FASTCALL
GetNCHitEx(PWND pWnd, POINT pt)
{
Modified: trunk/reactos/win32ss/user/ntuser/userfuncs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/userfu…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/userfuncs.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/userfuncs.h [iso-8859-1] Fri Feb 12 22:10:29 2016
@@ -134,7 +134,7 @@
LRESULT NC_HandleNCCalcSize( PWND wnd, WPARAM wparam, RECTL *winRect, BOOL Suspended );
VOID NC_DrawFrame( HDC hDC, RECT *CurrentRect, BOOL Active, DWORD Style, DWORD ExStyle);
VOID UserDrawCaptionBar( PWND pWnd, HDC hDC, INT Flags);
-void UserGetInsideRectNC(PWND Wnd, RECT *rect);
+void FASTCALL NC_GetInsideRect(PWND Wnd, RECT *rect);
LRESULT NC_HandleNCLButtonDown(PWND Wnd, WPARAM wParam, LPARAM lParam);
LRESULT NC_HandleNCLButtonDblClk(PWND Wnd, WPARAM wParam, LPARAM lParam);
LRESULT NC_HandleNCRButtonDown( PWND wnd, WPARAM wParam, LPARAM lParam );
Modified: trunk/reactos/win32ss/user/user32/include/user32p.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/includ…
==============================================================================
--- trunk/reactos/win32ss/user/user32/include/user32p.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/include/user32p.h [iso-8859-1] Fri Feb 12 22:10:29
2016
@@ -125,7 +125,6 @@
VOID FASTCALL IntNotifyWinEvent(DWORD, HWND, LONG, LONG, DWORD);
UINT WINAPI WinPosGetMinMaxInfo(HWND hWnd, POINT* MaxSize, POINT* MaxPos, POINT*
MinTrack, POINT* MaxTrack);
VOID UserGetWindowBorders(DWORD, DWORD, SIZE *, BOOL);
-void UserGetInsideRectNC(PWND Wnd, RECT *rect);
VOID FASTCALL GetConnected(VOID);
extern BOOL FASTCALL EnumNamesA(HWINSTA WindowStation, NAMEENUMPROCA EnumFunc, LPARAM
Context, BOOL Desktops);
extern BOOL FASTCALL EnumNamesW(HWINSTA WindowStation, NAMEENUMPROCW EnumFunc, LPARAM
Context, BOOL Desktops);
Modified: trunk/reactos/win32ss/user/user32/windows/defwnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/window…
==============================================================================
--- trunk/reactos/win32ss/user/user32/windows/defwnd.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/windows/defwnd.c [iso-8859-1] Fri Feb 12 22:10:29
2016
@@ -16,8 +16,6 @@
#include <wine/debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(user32);
-LRESULT DefWndNCHitTest(HWND hWnd, POINT Point);
-
/* GLOBALS *******************************************************************/
/* FUNCTIONS *****************************************************************/
@@ -86,57 +84,6 @@
Ret = NtUserDefSetText(hWnd, (String ? &lsString : NULL));
return Ret;
-}
-
-void
-UserGetInsideRectNC(PWND Wnd, RECT *rect)
-{
- ULONG Style;
- ULONG ExStyle;
-
- Style = Wnd->style;
- ExStyle = Wnd->ExStyle;
-
- rect->top = rect->left = 0;
- rect->right = Wnd->rcWindow.right - Wnd->rcWindow.left;
- rect->bottom = Wnd->rcWindow.bottom - Wnd->rcWindow.top;
-
- if (Style & WS_ICONIC)
- {
- return;
- }
-
- /* 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));
- }
- }
- }
- /* We have additional border information if the window
- * is a child (but not an MDI child) */
- if ((Style & WS_CHILD) && !(ExStyle & WS_EX_MDICHILD))
- {
- if (ExStyle & WS_EX_CLIENTEDGE)
- InflateRect (rect, -GetSystemMetrics(SM_CXEDGE),
-GetSystemMetrics(SM_CYEDGE));
- if (ExStyle & WS_EX_STATICEDGE)
- InflateRect (rect, -GetSystemMetrics(SM_CXBORDER),
-GetSystemMetrics(SM_CYBORDER));
- }
}
HWND FASTCALL
@@ -412,10 +359,10 @@
LRESULT WINAPI
User32DefWindowProc(HWND hWnd,
- UINT Msg,
- WPARAM wParam,
- LPARAM lParam,
- BOOL bUnicode)
+ UINT Msg,
+ WPARAM wParam,
+ LPARAM lParam,
+ BOOL bUnicode)
{
PWND pWnd = NULL;
if (hWnd)
@@ -438,14 +385,6 @@
return 0;
}
- case WM_NCHITTEST:
- {
- POINT Point;
- Point.x = GET_X_LPARAM(lParam);
- Point.y = GET_Y_LPARAM(lParam);
- return (DefWndNCHitTest(hWnd, Point));
- }
-
case WM_RBUTTONUP:
{
POINT Pt;
@@ -489,7 +428,7 @@
}
else
{
- goto GoSS;
+ goto GoSS;
}
break;
}
@@ -553,7 +492,7 @@
case WM_CTLCOLORDLG:
case WM_CTLCOLORSTATIC:
case WM_CTLCOLORSCROLLBAR:
- return (LRESULT) DefWndControlColor((HDC)wParam, Msg - WM_CTLCOLORMSGBOX);
+ return (LRESULT) DefWndControlColor((HDC)wParam, Msg - WM_CTLCOLORMSGBOX);
case WM_CTLCOLOR:
return (LRESULT) DefWndControlColor((HDC)wParam, HIWORD(lParam));
@@ -852,9 +791,9 @@
case WM_RBUTTONDOWN:
case WM_MBUTTONDOWN:
case WM_NCLBUTTONDOWN:
+ case WM_NCRBUTTONDOWN:
case WM_LBUTTONDBLCLK:
case WM_NCLBUTTONDBLCLK:
- case WM_NCRBUTTONDOWN:
case WM_KEYF1:
case WM_KEYUP:
case WM_SYSKEYUP:
@@ -872,6 +811,7 @@
case WM_NCPAINT:
case WM_NCACTIVATE:
case WM_NCCALCSIZE:
+ case WM_NCHITTEST:
case WM_SYNCPAINT:
case WM_SETREDRAW:
case WM_CLIENTSHUTDOWN:
Modified: trunk/reactos/win32ss/user/user32/windows/nonclient.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/window…
==============================================================================
--- trunk/reactos/win32ss/user/user32/windows/nonclient.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/windows/nonclient.c [iso-8859-1] Fri Feb 12 22:10:29
2016
@@ -25,17 +25,6 @@
#include <wine/debug.h>
WINE_DEFAULT_DEBUG_CHANNEL(user32);
-
-#define HAS_DLGFRAME(Style, ExStyle) \
- (((ExStyle) & WS_EX_DLGMODALFRAME) || \
- (((Style) & WS_DLGFRAME) && (!((Style) & (WS_THICKFRAME |
WS_MINIMIZE)))))
-
-#define HAS_THICKFRAME(Style, ExStyle) \
- (((Style) & WS_THICKFRAME) && !((Style) & WS_MINIMIZE)
&& \
- (!(((Style) & (WS_DLGFRAME | WS_BORDER)) == WS_DLGFRAME)))
-
-#define HAS_THINFRAME(Style, ExStyle) \
- (((Style) & (WS_BORDER | WS_MINIMIZE)) || (!((Style) & (WS_CHILD |
WS_POPUP))))
#define HASSIZEGRIP(Style, ExStyle, ParentStyle, WindowRect, ParentClientRect) \
((!(Style & WS_CHILD) && (Style & WS_THICKFRAME) &&
!(Style & WS_MAXIMIZE)) || \
@@ -87,220 +76,6 @@
}
/*
- * FIXME:
- * - Check the scrollbar handling
- */
-LRESULT
-DefWndNCHitTest(HWND hWnd, POINT Point)
-{
- RECT WindowRect, ClientRect, OrigWndRect;
- POINT ClientPoint;
- SIZE WindowBorders;
- DWORD Style = GetWindowLongPtrW(hWnd, GWL_STYLE);
- DWORD ExStyle = GetWindowLongPtrW(hWnd, GWL_EXSTYLE);
-
- GetWindowRect(hWnd, &WindowRect);
- if (!PtInRect(&WindowRect, Point))
- {
- return HTNOWHERE;
- }
- OrigWndRect = WindowRect;
-
- if (UserHasWindowEdge(Style, ExStyle))
- {
- LONG XSize, YSize;
-
- UserGetWindowBorders(Style, ExStyle, &WindowBorders, FALSE);
- InflateRect(&WindowRect, -WindowBorders.cx, -WindowBorders.cy);
- XSize = GetSystemMetrics(SM_CXSIZE) * GetSystemMetrics(SM_CXBORDER);
- YSize = GetSystemMetrics(SM_CYSIZE) * GetSystemMetrics(SM_CYBORDER);
- if (!PtInRect(&WindowRect, Point))
- {
- BOOL ThickFrame;
-
- ThickFrame = (Style & WS_THICKFRAME);
- if (Point.y < WindowRect.top)
- {
- if(Style & WS_MINIMIZE)
- return HTCAPTION;
- if(!ThickFrame)
- return HTBORDER;
- if (Point.x < (WindowRect.left + XSize))
- return HTTOPLEFT;
- if (Point.x >= (WindowRect.right - XSize))
- return HTTOPRIGHT;
- return HTTOP;
- }
- if (Point.y >= WindowRect.bottom)
- {
- if(Style & WS_MINIMIZE)
- return HTCAPTION;
- if(!ThickFrame)
- return HTBORDER;
- if (Point.x < (WindowRect.left + XSize))
- return HTBOTTOMLEFT;
- if (Point.x >= (WindowRect.right - XSize))
- return HTBOTTOMRIGHT;
- return HTBOTTOM;
- }
- if (Point.x < WindowRect.left)
- {
- if(Style & WS_MINIMIZE)
- return HTCAPTION;
- if(!ThickFrame)
- return HTBORDER;
- if (Point.y < (WindowRect.top + YSize))
- return HTTOPLEFT;
- if (Point.y >= (WindowRect.bottom - YSize))
- return HTBOTTOMLEFT;
- return HTLEFT;
- }
- if (Point.x >= WindowRect.right)
- {
- if(Style & WS_MINIMIZE)
- return HTCAPTION;
- if(!ThickFrame)
- return HTBORDER;
- if (Point.y < (WindowRect.top + YSize))
- return HTTOPRIGHT;
- if (Point.y >= (WindowRect.bottom - YSize))
- return HTBOTTOMRIGHT;
- return HTRIGHT;
- }
- }
- }
- else
- {
- if (ExStyle & WS_EX_STATICEDGE)
- InflateRect(&WindowRect,
- -GetSystemMetrics(SM_CXBORDER),
- -GetSystemMetrics(SM_CYBORDER));
- if (!PtInRect(&WindowRect, Point))
- return HTBORDER;
- }
-
- if ((Style & WS_CAPTION) == WS_CAPTION)
- {
- if (ExStyle & WS_EX_TOOLWINDOW)
- WindowRect.top += GetSystemMetrics(SM_CYSMCAPTION);
- else
- WindowRect.top += GetSystemMetrics(SM_CYCAPTION);
- if (!PtInRect(&WindowRect, Point))
- {
- if (Style & WS_SYSMENU)
- {
- if (ExStyle & WS_EX_TOOLWINDOW)
- {
- WindowRect.right -= GetSystemMetrics(SM_CXSMSIZE);
- }
- else
- {
- if(!(ExStyle & WS_EX_DLGMODALFRAME))
- WindowRect.left += GetSystemMetrics(SM_CXSIZE);
- WindowRect.right -= GetSystemMetrics(SM_CXSIZE);
- }
- }
- if (Point.x < WindowRect.left)
- return HTSYSMENU;
- if (WindowRect.right <= Point.x)
- return HTCLOSE;
- if (Style & WS_MAXIMIZEBOX || Style & WS_MINIMIZEBOX)
- WindowRect.right -= GetSystemMetrics(SM_CXSIZE);
- if (Point.x >= WindowRect.right)
- return HTMAXBUTTON;
- if (Style & WS_MINIMIZEBOX)
- WindowRect.right -= GetSystemMetrics(SM_CXSIZE);
- if (Point.x >= WindowRect.right)
- return HTMINBUTTON;
- return HTCAPTION;
- }
- }
-
- if(!(Style & WS_MINIMIZE))
- {
- ClientPoint = Point;
- ScreenToClient(hWnd, &ClientPoint);
- GetClientRect(hWnd, &ClientRect);
-
- if (PtInRect(&ClientRect, ClientPoint))
- {
- return HTCLIENT;
- }
-
- if (GetMenu(hWnd) && !(Style & WS_CHILD))
- {
- if (Point.x > 0 && Point.x < WindowRect.right &&
ClientPoint.y < 0)
- return HTMENU;
- }
-
- if (ExStyle & WS_EX_CLIENTEDGE)
- {
- InflateRect(&WindowRect, -2 * GetSystemMetrics(SM_CXBORDER),
- -2 * GetSystemMetrics(SM_CYBORDER));
- }
-
- if ((Style & WS_VSCROLL) && (Style & WS_HSCROLL) &&
- (WindowRect.bottom - WindowRect.top) > GetSystemMetrics(SM_CYHSCROLL))
- {
- RECT ParentRect, TempRect = WindowRect, TempRect2 = WindowRect;
- HWND Parent = GetParent(hWnd);
-
- TempRect.bottom -= GetSystemMetrics(SM_CYHSCROLL);
- if ((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
- TempRect.right = TempRect.left + GetSystemMetrics(SM_CXVSCROLL);
- else
- TempRect.left = TempRect.right - GetSystemMetrics(SM_CXVSCROLL);
- if (PtInRect(&TempRect, Point))
- return HTVSCROLL;
-
- TempRect2.top = TempRect2.bottom - GetSystemMetrics(SM_CYHSCROLL);
- if ((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
- TempRect2.left += GetSystemMetrics(SM_CXVSCROLL);
- else
- TempRect2.right -= GetSystemMetrics(SM_CXVSCROLL);
- if (PtInRect(&TempRect2, Point))
- return HTHSCROLL;
-
- TempRect.top = TempRect2.top;
- TempRect.bottom = TempRect2.bottom;
- if(Parent)
- GetClientRect(Parent, &ParentRect);
- if (PtInRect(&TempRect, Point) && HASSIZEGRIP(Style, ExStyle,
- GetWindowLongPtrW(Parent, GWL_STYLE), OrigWndRect, ParentRect))
- {
- if ((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
- return HTBOTTOMLEFT;
- else
- return HTBOTTOMRIGHT;
- }
- }
- else
- {
- if (Style & WS_VSCROLL)
- {
- RECT TempRect = WindowRect;
-
- if ((ExStyle & WS_EX_LEFTSCROLLBAR) != 0)
- TempRect.right = TempRect.left + GetSystemMetrics(SM_CXVSCROLL);
- else
- TempRect.left = TempRect.right - GetSystemMetrics(SM_CXVSCROLL);
- if (PtInRect(&TempRect, Point))
- return HTVSCROLL;
- } else
- if (Style & WS_HSCROLL)
- {
- RECT TempRect = WindowRect;
- TempRect.top = TempRect.bottom - GetSystemMetrics(SM_CYHSCROLL);
- if (PtInRect(&TempRect, Point))
- return HTHSCROLL;
- }
- }
- }
-
- return HTNOWHERE;
-}
-
-/*
RealUserDrawCaption: This function is passed through RegisterUserApiHook to uxtheme
to call it when the classic caption is needed to be drawn.
*/