From ecbf1d926dd863b53275eac10f16fd96b62edc8e Mon Sep 17 00:00:00 2001 From: Pascal Lessard Date: Sat, 21 Aug 1999 13:09:16 +0000 Subject: [PATCH] Added the case of a user defined icon for the sysbutton hittest. --- windows/nonclient.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/windows/nonclient.c b/windows/nonclient.c index 2363857331c..beb10f80625 100644 --- a/windows/nonclient.c +++ b/windows/nonclient.c @@ -861,8 +861,18 @@ NC_DoNCHitTest95 (WND *wndPtr, POINT16 pt ) if (!PtInRect16( &rect, pt )) { /* Check system menu */ - if ((wndPtr->dwStyle & WS_SYSMENU) && (!(wndPtr->dwStyle & DS_MODALFRAME))) - rect.left += GetSystemMetrics(SM_CYCAPTION) - 1; + if(wndPtr->dwStyle & WS_SYSMENU) + { + /* Check if there is an user icon */ + HICON hIcon = (HICON) GetClassLongA(wndPtr->hwndSelf, GCL_HICONSM); + if(!hIcon) hIcon = (HICON) GetClassLongA(wndPtr->hwndSelf, GCL_HICON); + + /* If there is an icon associated with the window OR */ + /* If there is no hIcon specified and this is not a modal dialog, */ + /* there is a system menu icon. */ + if((hIcon != 0) || (!(wndPtr->dwStyle & DS_MODALFRAME))) + rect.left += GetSystemMetrics(SM_CYCAPTION) - 1; + } if (pt.x < rect.left) return HTSYSMENU; /* Check close button */ -- 2.11.4.GIT