ReactOS  0.4.13-dev-92-gf251225
nonclient.c File Reference
#include <user32.h>
Include dependency graph for nonclient.c:

Go to the source code of this file.

Macros

#define HASSIZEGRIP(Style, ExStyle, ParentStyle, WindowRect, ParentClientRect)
 
#define DOUBLE_BUFFER_CAPTION
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (user32)
 
BOOL UserHasWindowEdge (DWORD Style, DWORD ExStyle)
 
VOID UserGetWindowBorders (DWORD Style, DWORD ExStyle, SIZE *Size, BOOL WithClient)
 
BOOL WINAPI RealUserDrawCaption (HWND hWnd, HDC hDC, LPCRECT lpRc, UINT uFlags)
 
BOOL WINAPI RealAdjustWindowRectEx (LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle)
 
BOOL WINAPI DECLSPEC_HOTPATCH AdjustWindowRectEx (LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle)
 
BOOL WINAPI DECLSPEC_HOTPATCH AdjustWindowRect (LPRECT lpRect, DWORD dwStyle, BOOL bMenu)
 
BOOL WINAPI DrawCaption (HWND hWnd, HDC hDC, LPCRECT lprc, UINT uFlags)
 
BOOL WINAPI DrawCaptionTempW (HWND hWnd, HDC hDC, const RECT *rect, HFONT hFont, HICON hIcon, LPCWSTR str, UINT uFlags)
 
BOOL WINAPI DrawCaptionTempA (HWND hwnd, HDC hdc, const RECT *rect, HFONT hFont, HICON hIcon, LPCSTR str, UINT uFlags)
 

Macro Definition Documentation

◆ DOUBLE_BUFFER_CAPTION

#define DOUBLE_BUFFER_CAPTION

Definition at line 166 of file nonclient.c.

◆ HASSIZEGRIP

#define HASSIZEGRIP (   Style,
  ExStyle,
  ParentStyle,
  WindowRect,
  ParentClientRect 
)
Value:
((!(Style & WS_CHILD) && (Style & WS_THICKFRAME) && !(Style & WS_MAXIMIZE)) || \
((Style & WS_CHILD) && (ParentStyle & WS_THICKFRAME) && !(ParentStyle & WS_MAXIMIZE) && \
(WindowRect.right - WindowRect.left == ParentClientRect.right) && \
(WindowRect.bottom - WindowRect.top == ParentClientRect.bottom)))
#define WS_THICKFRAME
Definition: pedump.c:630
#define WS_CHILD
Definition: pedump.c:617
const DWORD Style
Definition: appswitch.c:71
#define WS_MAXIMIZE
Definition: pedump.c:623

Definition at line 26 of file nonclient.c.

Function Documentation

◆ AdjustWindowRect()

BOOL WINAPI DECLSPEC_HOTPATCH AdjustWindowRect ( LPRECT  lpRect,
DWORD  dwStyle,
BOOL  bMenu 
)

Definition at line 158 of file nonclient.c.

161 {
162  return AdjustWindowRectEx(lpRect, dwStyle, bMenu, 0);
163 }
BOOL WINAPI DECLSPEC_HOTPATCH AdjustWindowRectEx(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle)
Definition: nonclient.c:123

◆ AdjustWindowRectEx()

BOOL WINAPI DECLSPEC_HOTPATCH AdjustWindowRectEx ( LPRECT  lpRect,
DWORD  dwStyle,
BOOL  bMenu,
DWORD  dwExStyle 
)

Definition at line 123 of file nonclient.c.

127 {
128  BOOL Hook, Ret = FALSE;
129 
130  LoadUserApiHook();
131 
132  Hook = BeginIfHookedUserApiHook();
133 
134  /* Bypass SEH and go direct. */
135  if (!Hook) return RealAdjustWindowRectEx(lpRect, dwStyle, bMenu, dwExStyle);
136 
137  _SEH2_TRY
138  {
139  Ret = guah.AdjustWindowRectEx(lpRect, dwStyle, bMenu, dwExStyle);
140  }
142  {
143  }
144  _SEH2_END;
145 
146  EndUserApiHook();
147 
148  return Ret;
149 }
BOOL FASTCALL EndUserApiHook(VOID)
Definition: usrapihk.c:164
USERAPIHOOK guah
Definition: usrapihk.c:344
_SEH2_TRY
Definition: create.c:4250
BOOL WINAPI RealAdjustWindowRectEx(LPRECT lpRect, DWORD dwStyle, BOOL bMenu, DWORD dwExStyle)
Definition: nonclient.c:90
ADJUSTWINDOWRECTEX AdjustWindowRectEx
Definition: undocuser.h:337
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
_SEH2_END
Definition: create.c:4424
static __inline void LoadUserApiHook()
Definition: user_x.h:85
BOOL FASTCALL BeginIfHookedUserApiHook(VOID)
Definition: usrapihk.c:106
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6

Referenced by AdjustWindowRect().

◆ DrawCaption()

BOOL WINAPI DrawCaption ( HWND  hWnd,
HDC  hDC,
LPCRECT  lprc,
UINT  uFlags 
)

Definition at line 172 of file nonclient.c.

173 {
174  BOOL Hook, Ret = FALSE;
175 
176  LoadUserApiHook();
177 
178  Hook = BeginIfHookedUserApiHook();
179 
180  /* Bypass SEH and go direct. */
181  if (!Hook) return NtUserDrawCaption(hWnd, hDC, lprc, uFlags);
182 
183  _SEH2_TRY
184  {
185  Ret = guah.DrawCaption(hWnd, hDC, lprc, uFlags);
186  }
188  {
189  }
190  _SEH2_END;
191 
192  EndUserApiHook();
193 
194  return Ret;
195 }
BOOL FASTCALL EndUserApiHook(VOID)
Definition: usrapihk.c:164
_In_ int _Inout_ LPRECT lprc
Definition: winuser.h:4334
USERAPIHOOK guah
Definition: usrapihk.c:344
HWND hWnd
Definition: settings.c:17
UINT uFlags
Definition: api.c:60
_SEH2_TRY
Definition: create.c:4250
DRAWCAPTION DrawCaption
Definition: undocuser.h:350
unsigned int BOOL
Definition: ntddk_ex.h:94
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
static HDC hDC
Definition: 3dtext.c:33
_SEH2_END
Definition: create.c:4424
static __inline void LoadUserApiHook()
Definition: user_x.h:85
BOOL FASTCALL BeginIfHookedUserApiHook(VOID)
Definition: usrapihk.c:106
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
BOOL NTAPI NtUserDrawCaption(HWND hWnd, HDC hDc, LPCRECT lpRc, UINT uFlags)
Definition: painting.c:2447

◆ DrawCaptionTempA()

BOOL WINAPI DrawCaptionTempA ( HWND  hwnd,
HDC  hdc,
const RECT rect,
HFONT  hFont,
HICON  hIcon,
LPCSTR  str,
UINT  uFlags 
)

Definition at line 222 of file nonclient.c.

231 {
232  LPWSTR strW;
233  INT len;
234  BOOL ret = FALSE;
235 
236  if (!(uFlags & DC_TEXT) || !str)
238 
239  len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
240  if ((strW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
241  {
242  MultiByteToWideChar(CP_ACP, 0, str, -1, strW, len );
245  }
246  return ret;
247 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define CP_ACP
Definition: compat.h:99
UINT uFlags
Definition: api.c:60
int32_t INT
Definition: typedefs.h:56
& rect
Definition: startmenu.cpp:1413
HFONT hFont
Definition: main.c:53
BOOL WINAPI DrawCaptionTempW(HWND hWnd, HDC hDC, const RECT *rect, HFONT hFont, HICON hIcon, LPCWSTR str, UINT uFlags)
Definition: nonclient.c:202
unsigned int BOOL
Definition: ntddk_ex.h:94
WCHAR strW[12]
Definition: clipboard.c:2029
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
HDC hdc
Definition: main.c:9
GLenum GLsizei len
Definition: glext.h:6722
HICON hIcon
Definition: msconfig.c:44
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
#define DC_TEXT
Definition: winuser.h:430

◆ DrawCaptionTempW()

BOOL WINAPI DrawCaptionTempW ( HWND  hWnd,
HDC  hDC,
const RECT rect,
HFONT  hFont,
HICON  hIcon,
LPCWSTR  str,
UINT  uFlags 
)

Definition at line 202 of file nonclient.c.

211 {
212  UNICODE_STRING Text = {0};
215 }
HWND hWnd
Definition: settings.c:17
UINT uFlags
Definition: api.c:60
& rect
Definition: startmenu.cpp:1413
HFONT hFont
Definition: main.c:53
const WCHAR * str
BOOL NTAPI NtUserDrawCaptionTemp(HWND hWnd, HDC hDC, LPCRECT lpRc, HFONT hFont, HICON hIcon, const PUNICODE_STRING str, UINT uFlags)
Definition: painting.c:2364
static HDC hDC
Definition: 3dtext.c:33
HICON hIcon
Definition: msconfig.c:44
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
char * Text
Definition: combotst.c:136

Referenced by DrawCaptionTempA().

◆ RealAdjustWindowRectEx()

BOOL WINAPI RealAdjustWindowRectEx ( LPRECT  lpRect,
DWORD  dwStyle,
BOOL  bMenu,
DWORD  dwExStyle 
)

Definition at line 90 of file nonclient.c.

94 {
95  SIZE BorderSize;
96 
97  if (bMenu)
98  {
99  lpRect->top -= GetSystemMetrics(SM_CYMENU);
100  }
101  if ((dwStyle & WS_CAPTION) == WS_CAPTION)
102  {
103  if (dwExStyle & WS_EX_TOOLWINDOW)
104  lpRect->top -= GetSystemMetrics(SM_CYSMCAPTION);
105  else
106  lpRect->top -= GetSystemMetrics(SM_CYCAPTION);
107  }
108  UserGetWindowBorders(dwStyle, dwExStyle, &BorderSize, TRUE);
109  InflateRect(
110  lpRect,
111  BorderSize.cx,
112  BorderSize.cy);
113 
114  return TRUE;
115 }
BOOL WINAPI InflateRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define TRUE
Definition: types.h:120
LONG top
Definition: windef.h:292
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
LONG cx
Definition: windef.h:319
VOID UserGetWindowBorders(DWORD Style, DWORD ExStyle, SIZE *Size, BOOL WithClient)
Definition: nonclient.c:53
#define WS_CAPTION
Definition: pedump.c:624
#define SM_CYCAPTION
Definition: winuser.h:953
int WINAPI GetSystemMetrics(_In_ int)
#define SM_CYMENU
Definition: winuser.h:966
#define SM_CYSMCAPTION
Definition: winuser.h:1004
LONG cy
Definition: windef.h:320

Referenced by AdjustWindowRectEx(), and ResetUserApiHook().

◆ RealUserDrawCaption()

BOOL WINAPI RealUserDrawCaption ( HWND  hWnd,
HDC  hDC,
LPCRECT  lpRc,
UINT  uFlags 
)

Definition at line 80 of file nonclient.c.

81 {
82  ERR("Real DC flags %08x\n",uFlags);
83  return NtUserDrawCaption(hWnd, hDC, lpRc, uFlags);
84 }
HWND hWnd
Definition: settings.c:17
UINT uFlags
Definition: api.c:60
#define ERR(fmt,...)
Definition: debug.h:109
static HDC hDC
Definition: 3dtext.c:33
BOOL NTAPI NtUserDrawCaption(HWND hWnd, HDC hDc, LPCRECT lpRc, UINT uFlags)
Definition: painting.c:2447

Referenced by ResetUserApiHook().

◆ UserGetWindowBorders()

VOID UserGetWindowBorders ( DWORD  Style,
DWORD  ExStyle,
SIZE Size,
BOOL  WithClient 
)

Definition at line 53 of file nonclient.c.

54 {
55  DWORD Border = 0;
56 
58  Border += 2;
59  else if (ExStyle & WS_EX_STATICEDGE)
60  Border += 1;
61  if ((ExStyle & WS_EX_CLIENTEDGE) && WithClient)
62  Border += 2;
64  Border ++;
65  Size->cx = Size->cy = Border;
66  if ((Style & WS_THICKFRAME) && !(Style & WS_MINIMIZE))
67  {
70  }
73 }
#define WS_THICKFRAME
Definition: pedump.c:630
BOOL UserHasWindowEdge(DWORD Style, DWORD ExStyle)
Definition: nonclient.c:36
#define SM_CYFRAME
Definition: winuser.h:986
#define SM_CXFRAME
Definition: winuser.h:984
#define WS_MINIMIZE
Definition: pedump.c:622
#define SM_CYDLGFRAME
Definition: winuser.h:958
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
#define WS_CAPTION
Definition: pedump.c:624
const DWORD Style
Definition: appswitch.c:71
#define SM_CXDLGFRAME
Definition: winuser.h:956
int WINAPI GetSystemMetrics(_In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SM_CYBORDER
Definition: winuser.h:955
#define SM_CXBORDER
Definition: winuser.h:954
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
#define WS_EX_CLIENTEDGE
Definition: winuser.h:384
#define WS_EX_STATICEDGE
Definition: winuser.h:403
const DWORD ExStyle
Definition: appswitch.c:72

Referenced by NC_HandleNCCalcSize(), RealAdjustWindowRectEx(), and UserDrawCaptionButtonWnd().

◆ UserHasWindowEdge()

BOOL UserHasWindowEdge ( DWORD  Style,
DWORD  ExStyle 
)

Definition at line 36 of file nonclient.c.

37 {
38  if (Style & WS_MINIMIZE)
39  return TRUE;
41  return TRUE;
43  return FALSE;
44  if (Style & WS_THICKFRAME)
45  return TRUE;
46  Style &= WS_CAPTION;
47  if (Style == WS_DLGFRAME || Style == WS_CAPTION)
48  return TRUE;
49  return FALSE;
50 }
#define WS_THICKFRAME
Definition: pedump.c:630
#define TRUE
Definition: types.h:120
#define WS_DLGFRAME
Definition: pedump.c:626
#define WS_MINIMIZE
Definition: pedump.c:622
#define WS_EX_DLGMODALFRAME
Definition: pedump.c:645
#define WS_CAPTION
Definition: pedump.c:624
const DWORD Style
Definition: appswitch.c:71
#define WS_EX_STATICEDGE
Definition: winuser.h:403
const DWORD ExStyle
Definition: appswitch.c:72

Referenced by NC_DoNCPaint(), NC_HandleNCCalcSize(), UserDrawCaptionBar(), and UserGetWindowBorders().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( user32  )