ReactOS 0.4.16-dev-1531-gd958a24
defwnd.c File Reference
#include <win32k.h>
#include <windowsx.h>
Include dependency graph for defwnd.c:

Go to the source code of this file.

Functions

 DBG_DEFAULT_CHANNEL (UserDefwnd)
 
INT WINAPI DrawTextExWorker (HDC hdc, LPWSTR str, INT i_count, LPRECT rect, UINT flags, LPDRAWTEXTPARAMS dtp)
 
INT WINAPI DrawTextW (HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
 
HBRUSH FASTCALL DefWndControlColor (HDC hDC, UINT ctlType)
 
LRESULT FASTCALL DefWndHandleWindowPosChanging (PWND pWnd, WINDOWPOS *Pos)
 
LRESULT FASTCALL DefWndHandleWindowPosChanged (PWND pWnd, WINDOWPOS *Pos)
 
LRESULT FASTCALL DefWndHandleSysCommand (PWND pWnd, WPARAM wParam, LPARAM lParam)
 
PWND FASTCALL co_IntFindChildWindowToOwner (PWND Root, PWND Owner)
 
LRESULT DefWndHandleSetCursor (PWND pWnd, WPARAM wParam, LPARAM lParam)
 
VOID FASTCALL DefWndPrint (PWND pwnd, HDC hdc, ULONG uFlags)
 
BOOL UserPaintCaption (PWND pWnd, INT Flags)
 
LRESULT FASTCALL DefWndSetIcon (PWND pWnd, WPARAM wParam, LPARAM lParam)
 
LRESULT FASTCALL DefWndGetIcon (PWND pWnd, WPARAM wParam, LPARAM lParam)
 
PWND FASTCALL DWP_GetEnabledPopup (PWND pWnd)
 
VOID FASTCALL DefWndScreenshot (PWND pWnd)
 
static BOOL co_UserTrackSystemMenu (_In_ PWND pWnd, _In_ LONG nClickPos, _In_opt_ PUINT puCmdType)
 
LRESULT FASTCALL IntDefWindowProc (PWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL Ansi)
 

Function Documentation

◆ co_IntFindChildWindowToOwner()

PWND FASTCALL co_IntFindChildWindowToOwner ( PWND  Root,
PWND  Owner 
)

Definition at line 216 of file defwnd.c.

217{
218 PWND Ret;
219 PWND Child, OwnerWnd;
220
221 for(Child = Root->spwndChild; Child; Child = Child->spwndNext)
222 {
223 OwnerWnd = Child->spwndOwner;
224 if(!OwnerWnd)
225 continue;
226
227 if (!(Child->style & WS_POPUP) ||
228 !(Child->style & WS_VISIBLE) ||
229 /* Fixes CMD pop up properties window from having foreground. */
230 Owner->head.pti->MessageQueue != Child->head.pti->MessageQueue)
231 continue;
232
233 if(OwnerWnd == Owner)
234 {
235 Ret = Child;
236 return Ret;
237 }
238 }
239 return NULL;
240}
#define NULL
Definition: types.h:112
_Out_writes_bytes_to_opt_ AbsoluteSecurityDescriptorSize PSECURITY_DESCRIPTOR _Inout_ PULONG _Out_writes_bytes_to_opt_ DaclSize PACL _Inout_ PULONG _Out_writes_bytes_to_opt_ SaclSize PACL _Inout_ PULONG _Out_writes_bytes_to_opt_ OwnerSize PSID Owner
Definition: rtlfuncs.h:1621
#define WS_POPUP
Definition: pedump.c:616
#define WS_VISIBLE
Definition: pedump.c:620
root entry for file system trees
Definition: entries.h:148
Definition: ntuser.h:694
struct _WND * spwndOwner
Definition: ntuser.h:715
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:536

Referenced by DefWndHandleSetCursor().

◆ co_UserTrackSystemMenu()

static BOOL co_UserTrackSystemMenu ( _In_ PWND  pWnd,
_In_ LONG  nClickPos,
_In_opt_ PUINT  puCmdType 
)
static

Definition at line 585 of file defwnd.c.

586{
587 USER_REFERENCE_ENTRY MenuRef, WndRef;
588 PMENU pMenu;
589 UINT uDefaultCmd;
590
591 FIXME("co_UserTrackSystemMenu() called\n"); // Useful trace, while working on CORE-3247
592
593 UserRefObjectCo(pWnd, &WndRef);
594
595 // Check style and make window foreground
596 if ((pWnd->style & WS_DISABLED) ||
597 (pWnd->state2 & WNDS2_INDESTROY) ||
598 (pWnd->head.pti->MessageQueue != gpqForeground && !co_IntSetForegroundWindow(pWnd)))
599 {
600 UserDerefObjectCo(pWnd);
601 return FALSE;
602 }
603
604 // Get the window's system menu
605 pMenu = IntGetSystemMenu(pWnd, FALSE);
606 if (!pMenu)
607 {
608 UserDerefObjectCo(pWnd);
609 return FALSE;
610 }
611 UserRefObjectCo(pMenu, &MenuRef);
612
613 // Set default menu item
614 if (puCmdType)
615 uDefaultCmd = *puCmdType;
616 else if (pWnd->style & (WS_MINIMIZE | WS_MAXIMIZE))
617 uDefaultCmd = SC_RESTORE;
618 else
619 uDefaultCmd = SC_MAXIMIZE;
620 UserSetMenuDefaultItem(pMenu, uDefaultCmd, FALSE);
621
622 if (nClickPos == -1) // Input from keyboard?
623 FIXME("Use WM_KLUDGEMINRECT and TPM_VERTICAL\n");
624
625 // Show the menu and wait for menu tracking ending
627 LOWORD(nClickPos), HIWORD(nClickPos), pWnd, NULL);
628
629 UserDerefObjectCo(pMenu);
630 UserDerefObjectCo(pWnd);
631 return TRUE;
632}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
PUSER_MESSAGE_QUEUE gpqForeground
Definition: focus.c:13
BOOL FASTCALL co_IntSetForegroundWindow(PWND Window)
Definition: focus.c:1552
#define WNDS2_INDESTROY
Definition: ntuser.h:648
unsigned int UINT
Definition: ndis.h:50
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:43
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:27
#define LOWORD(l)
Definition: pedump.c:82
#define WS_MAXIMIZE
Definition: pedump.c:623
#define WS_MINIMIZE
Definition: pedump.c:622
#define WS_DISABLED
Definition: pedump.c:621
Definition: object.h:4
#define HIWORD(l)
Definition: typedefs.h:247
#define TPM_SYSTEM_MENU
Definition: undocuser.h:74
PMENU FASTCALL IntGetSystemMenu(PWND Window, BOOL bRevert)
Definition: menu.c:5409
BOOL FASTCALL UserSetMenuDefaultItem(PMENU MenuObject, UINT uItem, UINT fByPos)
Definition: menu.c:1274
BOOL FASTCALL IntTrackPopupMenuEx(_Inout_ PMENU menu, _In_ UINT wFlags, _In_ INT x, _In_ INT y, _In_ PWND pWnd, _In_opt_ const TPMPARAMS *lpTpm)
Definition: menu.c:4575
#define TPM_RIGHTBUTTON
Definition: winuser.h:2416
#define TPM_LEFTBUTTON
Definition: winuser.h:2415
#define SC_RESTORE
Definition: winuser.h:2634
#define SC_MAXIMIZE
Definition: winuser.h:2624

Referenced by IntDefWindowProc().

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( UserDefwnd  )

◆ DefWndControlColor()

HBRUSH FASTCALL DefWndControlColor ( HDC  hDC,
UINT  ctlType 
)

Definition at line 32 of file defwnd.c.

33{
34 if (ctlType == CTLCOLOR_SCROLLBAR)
35 {
40
41 /* if COLOR_WINDOW happens to be the same as COLOR_3DHILIGHT
42 * we better use 0x55aa bitmap brush to make scrollbar's background
43 * look different from the window background.
44 */
45 if ( bk == IntGetSysColor(COLOR_WINDOW))
46 return gpsi->hbrGray;
47
49 return hb;
50 }
51
53
54 if ((ctlType == CTLCOLOR_EDIT) || (ctlType == CTLCOLOR_LISTBOX))
55 {
57 }
58 else
59 {
62 }
63
65}
static HDC hDC
Definition: 3dtext.c:33
COLORREF FASTCALL IntGdiSetBkColor(_In_ HDC hDC, _In_ COLORREF Color)
COLORREF FASTCALL IntGdiSetTextColor(HDC hDC, COLORREF color)
Definition: dcutil.c:172
PSERVERINFO gpsi
Definition: imm.c:18
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
DWORD FASTCALL IntGetSysColor(INT nIndex)
Definition: stockobj.c:323
__kernel_entry W32KAPI BOOL APIENTRY NtGdiUnrealizeObject(_In_ HANDLE h)
DWORD COLORREF
Definition: windef.h:300
#define CTLCOLOR_SCROLLBAR
Definition: winuser.h:967
#define COLOR_WINDOW
Definition: winuser.h:929
#define COLOR_SCROLLBAR
Definition: winuser.h:923
#define COLOR_WINDOWTEXT
Definition: winuser.h:932
#define CTLCOLOR_LISTBOX
Definition: winuser.h:964
#define CTLCOLOR_EDIT
Definition: winuser.h:963
#define COLOR_3DHILIGHT
Definition: winuser.h:948
#define COLOR_3DFACE
Definition: winuser.h:940

Referenced by IntDefWindowProc(), IntDrawScrollInterior(), and User32DefWindowProc().

◆ DefWndGetIcon()

LRESULT FASTCALL DefWndGetIcon ( PWND  pWnd,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 476 of file defwnd.c.

477{
478 HICON hIconRet;
479 if ( wParam > ICON_SMALL2 )
480 {
482 return 0;
483 }
484 switch(wParam)
485 {
486 case ICON_BIG:
487 hIconRet = UserGetProp(pWnd, gpsi->atomIconProp, TRUE);
488 break;
489 case ICON_SMALL:
490 case ICON_SMALL2:
491 hIconRet = UserGetProp(pWnd, gpsi->atomIconSmProp, TRUE);
492 break;
494 }
495 return (LRESULT)hIconRet;
496}
WPARAM wParam
Definition: combotst.c:138
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
static HICON
Definition: imagelist.c:80
#define DEFAULT_UNREACHABLE
ATOM atomIconProp
Definition: ntuser.h:1066
ATOM atomIconSmProp
Definition: ntuser.h:1065
#define ICON_BIG
Definition: tnclass.cpp:51
#define ICON_SMALL
Definition: tnclass.cpp:48
HANDLE FASTCALL UserGetProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
Definition: prop.c:46
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:22
LONG_PTR LRESULT
Definition: windef.h:209

Referenced by IntDefWindowProc(), and User32DefWindowProc().

◆ DefWndHandleSetCursor()

LRESULT DefWndHandleSetCursor ( PWND  pWnd,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 243 of file defwnd.c.

244{
245 PWND pwndPopUP = NULL;
247
248 /* Not for child windows. */
249 if (UserHMGetHandle(pWnd) != (HWND)wParam)
250 {
251 return FALSE;
252 }
253
254 switch((short)LOWORD(lParam))
255 {
256 case HTERROR:
257 {
260
261 if (Msg == WM_LBUTTONDOWN)
262 {
263 // Find a pop up window to bring active.
265 if (pwndPopUP)
266 {
267 // Not a child pop up from desktop.
268 if ( pwndPopUP != UserGetDesktopWindow()->spwndChild )
269 {
270 // Get original active window.
271 PWND pwndOrigActive = gpqForeground->spwndActive;
272
274
275 UserRefObjectCo(pwndPopUP, &Ref);
276 //UserSetActiveWindow(pwndPopUP);
277 co_IntSetForegroundWindow(pwndPopUP); // HACK
278 UserDerefObjectCo(pwndPopUP);
279
280 // If the change was made, break out.
281 if (pwndOrigActive != gpqForeground->spwndActive)
282 break;
283 }
284 }
285 }
287 if (Msg == WM_LBUTTONDOWN || Msg == WM_MBUTTONDOWN ||
288 Msg == WM_RBUTTONDOWN || Msg == WM_XBUTTONDOWN)
289 {
290 if (pwndPopUP)
291 {
292 FLASHWINFO fwi =
293 {sizeof(FLASHWINFO),
294 UserHMGetHandle(pwndPopUP),
295 FLASHW_ALL,
297 (gpsi->dtCaretBlink >> 3)};
298
299 // Now shake that window!
300 IntFlashWindowEx(pwndPopUP, &fwi);
301 }
303 }
304 break;
305 }
306
307 case HTCLIENT:
308 {
309 if (pWnd->pcls->spcur)
310 {
312 }
313 return FALSE;
314 }
315
316 case HTLEFT:
317 case HTRIGHT:
318 {
319 if (pWnd->style & WS_MAXIMIZE)
320 {
321 break;
322 }
324 return TRUE;
325 }
326
327 case HTTOP:
328 case HTBOTTOM:
329 {
330 if (pWnd->style & WS_MAXIMIZE)
331 {
332 break;
333 }
335 return TRUE;
336 }
337
338 case HTTOPLEFT:
339 case HTBOTTOMRIGHT:
340 {
341 if (pWnd->style & WS_MAXIMIZE)
342 {
343 break;
344 }
345 IntSystemSetCursor(SYSTEMCUR(SIZENWSE));
346 return TRUE;
347 }
348
349 case HTBOTTOMLEFT:
350 case HTTOPRIGHT:
351 {
352 if (pWnd->style & WS_MAXIMIZE)
353 {
354 break;
355 }
356 IntSystemSetCursor(SYSTEMCUR(SIZENESW));
357 return TRUE;
358 }
359 }
361 return FALSE;
362}
LPARAM lParam
Definition: combotst.c:139
struct @1766 Msg[]
#define SYSTEMCUR(func)
Definition: cursoricon.h:131
unsigned short WORD
Definition: ntddk_ex.h:93
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
PWND FASTCALL co_IntFindChildWindowToOwner(PWND Root, PWND Owner)
Definition: defwnd.c:216
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1792
HWND hwndSAS
Definition: winsta.c:24
struct _CURICON_OBJECT * spcur
Definition: ntuser.h:586
DWORD dwForegroundFlashCount
Definition: sysparams.h:157
PCLS pcls
Definition: ntuser.h:720
DWORD style
Definition: ntuser.h:706
#define WM_LOGONNOTIFY
Definition: undocuser.h:39
#define LN_MESSAGE_BEEP
Definition: undocuser.h:121
BOOL FASTCALL IntFlashWindowEx(PWND pWnd, PFLASHWINFO pfwi)
Definition: painting.c:1311
PCURICON_OBJECT IntSystemSetCursor(PCURICON_OBJECT pcurNew)
Definition: cursoricon.c:230
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1403
BOOL FASTCALL UserPostMessage(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1395
SPIVALUES gspv
Definition: sysparams.c:17
#define HTTOPRIGHT
Definition: winuser.h:2528
#define SWP_NOACTIVATE
Definition: winuser.h:1253
#define HTTOPLEFT
Definition: winuser.h:2527
#define HTBOTTOM
Definition: winuser.h:2529
#define HTERROR
Definition: winuser.h:2508
#define SWP_NOMOVE
Definition: winuser.h:1255
#define SWP_NOSIZE
Definition: winuser.h:1256
#define WM_LBUTTONDOWN
Definition: winuser.h:1804
#define WM_RBUTTONDOWN
Definition: winuser.h:1807
#define HTRIGHT
Definition: winuser.h:2525
#define HTCLIENT
Definition: winuser.h:2511
#define HTBOTTOMRIGHT
Definition: winuser.h:2531
#define HTBOTTOMLEFT
Definition: winuser.h:2530
#define HTTOP
Definition: winuser.h:2526
#define HTLEFT
Definition: winuser.h:2523
#define WM_MBUTTONDOWN
Definition: winuser.h:1810

Referenced by IntDefWindowProc().

◆ DefWndHandleSysCommand()

LRESULT FASTCALL DefWndHandleSysCommand ( PWND  pWnd,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 125 of file defwnd.c.

126{
127 LRESULT lResult = 0;
128 BOOL Hook = FALSE;
129
130 if (ISITHOOKED(WH_CBT) || (pWnd->head.rpdesk->pDeskInfo->fsHooks & HOOKID_TO_FLAG(WH_CBT)))
131 {
132 Hook = TRUE;
134
135 if (lResult) return lResult;
136 }
137
138 switch (wParam & 0xfff0)
139 {
140 case SC_MOVE:
141 case SC_SIZE:
143 break;
144
145 case SC_MINIMIZE:
147 IntShowOwnedPopups(pWnd,FALSE); // This is done in ShowWindow! Need to retest!
149 break;
150
151 case SC_MAXIMIZE:
152 if (((pWnd->style & WS_MINIMIZE) != 0) && UserHMGetHandle(pWnd) == UserGetActiveWindow())
155 break;
156
157 case SC_RESTORE:
158 if (((pWnd->style & WS_MINIMIZE) != 0) && UserHMGetHandle(pWnd) == UserGetActiveWindow())
161 break;
162
163 case SC_CLOSE:
164 return co_IntSendMessage(UserHMGetHandle(pWnd), WM_CLOSE, 0, 0);
165
166 case SC_SCREENSAVE:
167 ERR("Screensaver Called!\n");
168 UserPostMessage(hwndSAS, WM_LOGONNOTIFY, LN_START_SCREENSAVE, 0); // always lParam 0 == not Secure
169 break;
170
171 case SC_HOTKEY:
172 {
174
176 if (pWnd)
177 {
178 if (pWnd->spwndLastActive)
179 {
180 pWnd = pWnd->spwndLastActive;
181 }
182 UserRefObjectCo(pWnd, &Ref);
184 UserDerefObjectCo(pWnd);
185 if (pWnd->style & WS_MINIMIZE)
186 {
188 }
189 }
190 }
191 break;
192
193// case SC_DEFAULT:
194 case SC_MOUSEMENU:
195 {
196 POINT Pt;
197 Pt.x = (short)LOWORD(lParam);
198 Pt.y = (short)HIWORD(lParam);
199 MENU_TrackMouseMenuBar(pWnd, wParam & 0x000f, Pt);
200 }
201 break;
202
203 case SC_KEYMENU:
205 break;
206
207 default:
208 // We do not support anything else here so we should return normal even when sending a hook.
209 return 0;
210 }
211
212 return(Hook ? 1 : 0); // Don't call us again from user space.
213}
#define ERR(fmt,...)
Definition: precomp.h:57
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
unsigned int BOOL
Definition: ntddk_ex.h:94
HWND FASTCALL UserGetActiveWindow(VOID)
Definition: focus.c:1432
#define ISITHOOKED(HookId)
Definition: hook.h:6
#define HOOKID_TO_FLAG(HookId)
Definition: hook.h:5
#define SC_SCREENSAVE
Definition: mmsystem.h:933
LRESULT APIENTRY co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
Definition: hook.c:1102
BOOLEAN FASTCALL co_WinPosShowWindow(PWND Wnd, INT Cmd)
Definition: winpos.c:2621
struct _DESKTOP * rpdesk
Definition: ntuser.h:194
THRDESKHEAD head
Definition: ntuser.h:695
struct _WND * spwndLastActive
Definition: ntuser.h:739
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define LN_START_SCREENSAVE
Definition: undocuser.h:122
#define ValidateHwndNoErr(hwnd)
Definition: precomp.h:100
VOID MENU_TrackKbdMenuBar(PWND pwnd, UINT wParam, WCHAR wChar)
Definition: menu.c:4516
VOID MENU_TrackMouseMenuBar(PWND pWnd, ULONG ht, POINT pt)
Definition: menu.c:4486
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1495
VOID FASTCALL DefWndDoSizeMove(PWND pwnd, WORD wParam)
Definition: nonclient.c:254
BOOL FASTCALL IntShowOwnedPopups(PWND OwnerWnd, BOOL fShow)
Definition: window.c:4667
#define SC_MOUSEMENU
Definition: winuser.h:2631
#define WM_CLOSE
Definition: winuser.h:1649
#define WM_SYSCOMMAND
Definition: winuser.h:1769
#define SC_KEYMENU
Definition: winuser.h:2632
#define SW_MINIMIZE
Definition: winuser.h:787
#define WH_CBT
Definition: winuser.h:35
#define SC_SIZE
Definition: winuser.h:2620
#define SC_MINIMIZE
Definition: winuser.h:2622
#define SC_HOTKEY
Definition: winuser.h:2637
#define SC_CLOSE
Definition: winuser.h:2628
#define SC_MOVE
Definition: winuser.h:2621
#define SW_RESTORE
Definition: winuser.h:790
#define SW_MAXIMIZE
Definition: winuser.h:783
#define HCBT_SYSCOMMAND
Definition: winuser.h:63
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by IntDefWindowProc(), and User32DefWindowProc().

◆ DefWndHandleWindowPosChanged()

LRESULT FASTCALL DefWndHandleWindowPosChanged ( PWND  pWnd,
WINDOWPOS Pos 
)

Definition at line 95 of file defwnd.c.

96{
97 RECT Rect;
98 LONG style = pWnd->style;
99
100 IntGetClientRect(pWnd, &Rect);
101 IntMapWindowPoints(pWnd, (style & WS_CHILD ? IntGetParent(pWnd) : NULL), (LPPOINT) &Rect, 2);
102
103 if (!(Pos->flags & SWP_NOCLIENTMOVE))
104 {
106 }
107
108 if (!(Pos->flags & SWP_NOCLIENTSIZE) || (Pos->flags & SWP_STATECHANGED))
109 {
111 else
112 {
114 co_IntSendMessage(UserHMGetHandle(pWnd), WM_SIZE, wp, MAKELONG(Rect.right - Rect.left, Rect.bottom - Rect.top));
115 }
116 }
117 return 0;
118}
Arabic default style
Definition: afstyles.h:94
#define SWP_NOCLIENTSIZE
Definition: msg.h:31
#define SWP_NOCLIENTMOVE
Definition: msg.h:32
ush Pos
Definition: deflate.h:92
#define SWP_STATECHANGED
Definition: msg.c:42
#define WS_CHILD
Definition: pedump.c:617
long LONG
Definition: pedump.c:60
#define MAKELONG(a, b)
Definition: typedefs.h:249
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:206
INT FASTCALL IntMapWindowPoints(PWND FromWnd, PWND ToWnd, LPPOINT lpPoints, UINT cPoints)
Definition: winpos.c:144
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:92
UINT_PTR WPARAM
Definition: windef.h:207
#define WM_SIZE
Definition: winuser.h:1639
#define SIZE_MINIMIZED
Definition: winuser.h:2542
#define SIZE_MAXIMIZED
Definition: winuser.h:2543
#define WM_MOVE
Definition: winuser.h:1638
#define SIZE_RESTORED
Definition: winuser.h:2541

Referenced by IntDefWindowProc().

◆ DefWndHandleWindowPosChanging()

LRESULT FASTCALL DefWndHandleWindowPosChanging ( PWND  pWnd,
WINDOWPOS Pos 
)

Definition at line 68 of file defwnd.c.

69{
70 POINT maxTrack, minTrack;
71 LONG style = pWnd->style;
72
73 if (Pos->flags & SWP_NOSIZE) return 0;
74 if ((style & WS_THICKFRAME) || ((style & (WS_POPUP | WS_CHILD)) == 0))
75 {
76 co_WinPosGetMinMaxInfo(pWnd, NULL, NULL, &minTrack, &maxTrack);
77 Pos->cx = min(Pos->cx, maxTrack.x);
78 Pos->cy = min(Pos->cy, maxTrack.y);
79 if (!(style & WS_MINIMIZE))
80 {
81 if (Pos->cx < minTrack.x) Pos->cx = minTrack.x;
82 if (Pos->cy < minTrack.y) Pos->cy = minTrack.y;
83 }
84 }
85 else
86 {
87 Pos->cx = max(Pos->cx, 0);
88 Pos->cy = max(Pos->cy, 0);
89 }
90 return 0;
91}
#define min(a, b)
Definition: monoChain.cc:55
UINT FASTCALL co_WinPosGetMinMaxInfo(PWND Window, POINT *MaxSize, POINT *MaxPos, POINT *MinTrack, POINT *MaxTrack)
Definition: winpos.c:940
#define WS_THICKFRAME
Definition: pedump.c:630
#define max(a, b)
Definition: svc.c:63

Referenced by IntDefWindowProc().

◆ DefWndPrint()

VOID FASTCALL DefWndPrint ( PWND  pwnd,
HDC  hdc,
ULONG  uFlags 
)

Definition at line 365 of file defwnd.c.

366{
367 /*
368 * Visibility flag.
369 */
370 if ( (uFlags & PRF_CHECKVISIBLE) &&
371 !IntIsWindowVisible(pwnd) )
372 return;
373
374 /*
375 * Unimplemented flags.
376 */
377 if ( (uFlags & PRF_CHILDREN) ||
378 (uFlags & PRF_OWNED) ||
380 {
381 FIXME("WM_PRINT message with unsupported flags\n");
382 }
383
384 /*
385 * Background
386 */
387 if ( uFlags & PRF_ERASEBKGND)
389
390 /*
391 * Client area
392 */
393 if ( uFlags & PRF_CLIENT)
395}
UINT uFlags
Definition: api.c:59
HDC hdc
Definition: main.c:9
#define WM_PRINTCLIENT
Definition: richedit.h:70
BOOL FASTCALL IntIsWindowVisible(PWND Wnd)
Definition: window.c:191
#define WM_ERASEBKGND
Definition: winuser.h:1653
#define PRF_NONCLIENT
Definition: winuser.h:2560
#define PRF_ERASEBKGND
Definition: winuser.h:2562
#define PRF_OWNED
Definition: winuser.h:2564
#define PRF_CHILDREN
Definition: winuser.h:2563
#define PRF_CLIENT
Definition: winuser.h:2561
#define PRF_CHECKVISIBLE
Definition: winuser.h:2559

Referenced by IntDefWindowProc().

◆ DefWndScreenshot()

VOID FASTCALL DefWndScreenshot ( PWND  pWnd)

Definition at line 551 of file defwnd.c.

552{
553 RECT rect;
554 HDC hdc;
555 INT w;
556 INT h;
558 HDC hdc2;
559 SETCLIPBDATA scd = {FALSE, FALSE};
560
563
564 hdc = UserGetWindowDC(pWnd);
565 IntGetWindowRect(pWnd, &rect);
566 w = rect.right - rect.left;
567 h = rect.bottom - rect.top;
568
572
573 NtGdiBitBlt(hdc2, 0, 0, w, h, hdc, 0, 0, SRCCOPY, 0, 0);
574
576
577 UserReleaseDC(pWnd, hdc, FALSE);
578 UserReleaseDC(pWnd, hdc2, FALSE);
579
581}
static HBITMAP hbitmap
HDC hdc2
Definition: SelectObject.c:10
#define CF_BITMAP
Definition: constants.h:397
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
__kernel_entry W32KAPI HBITMAP APIENTRY NtGdiCreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
__kernel_entry W32KAPI HDC APIENTRY NtGdiCreateCompatibleDC(_In_opt_ HDC hdc)
__kernel_entry W32KAPI BOOL APIENTRY NtGdiBitBlt(_In_ HDC hdcDst, _In_ INT x, _In_ INT y, _In_ INT cx, _In_ INT cy, _In_opt_ HDC hdcSrc, _In_ INT xSrc, _In_ INT ySrc, _In_ DWORD rop4, _In_ DWORD crBackColor, _In_ FLONG fl)
__kernel_entry W32KAPI HBITMAP APIENTRY NtGdiSelectBitmap(_In_ HDC hdc, _In_ HBITMAP hbm)
BOOL FASTCALL IntGetWindowRect(PWND Wnd, RECTL *Rect)
Definition: winpos.c:121
& rect
Definition: startmenu.cpp:1413
int32_t INT
Definition: typedefs.h:58
HDC FASTCALL UserGetWindowDC(PWND Wnd)
Definition: windc.c:947
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
BOOL NTAPI UserEmptyClipboard(VOID)
Definition: clipboard.c:680
BOOL NTAPI UserCloseClipboard(VOID)
Definition: clipboard.c:545
BOOL NTAPI UserOpenClipboard(HWND hWnd)
Definition: clipboard.c:488
HANDLE NTAPI UserSetClipboardData(UINT fmt, HANDLE hData, PSETCLIPBDATA scd)
Definition: clipboard.c:1023
#define SRCCOPY
Definition: wingdi.h:333

Referenced by IntDefWindowProc().

◆ DefWndSetIcon()

LRESULT FASTCALL DefWndSetIcon ( PWND  pWnd,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 437 of file defwnd.c.

438{
439 HICON hIcon, hIconSmall, hIconOld;
440
441 if ( wParam > ICON_SMALL2 )
442 {
444 return 0;
445 }
446 hIconSmall = UserGetProp(pWnd, gpsi->atomIconSmProp, TRUE);
448
449 hIconOld = wParam == ICON_BIG ? hIcon : hIconSmall;
450
451 switch(wParam)
452 {
453 case ICON_BIG:
454 hIcon = (HICON)lParam;
455 break;
456 case ICON_SMALL:
457 hIconSmall = (HICON)lParam;
458 break;
459 case ICON_SMALL2:
460 ERR("FIXME: Set ICON_SMALL2 support!\n");
461 default:
462 break;
463 }
464
465 UserSetProp(pWnd, gpsi->atomIconProp, hIcon, TRUE);
466 UserSetProp(pWnd, gpsi->atomIconSmProp, hIconSmall, TRUE);
467
468 if ((pWnd->style & WS_CAPTION ) == WS_CAPTION)
470
471 return (LRESULT)hIconOld;
472}
HICON hIcon
Definition: msconfig.c:44
BOOL UserPaintCaption(PWND pWnd, INT Flags)
Definition: defwnd.c:398
#define WS_CAPTION
Definition: pedump.c:624
#define DC_ICON
Definition: winuser.h:429

Referenced by IntDefWindowProc().

◆ DrawTextExWorker()

INT WINAPI DrawTextExWorker ( HDC  hdc,
LPWSTR  str,
INT  i_count,
LPRECT  rect,
UINT  flags,
LPDRAWTEXTPARAMS  dtp 
)

Definition at line 1071 of file text.c.

1077{
1078 SIZE size;
1079 const WCHAR *strPtr;
1080 WCHAR *retstr, *p_retstr;
1081 size_t size_retstr;
1083 int len, lh, count=i_count;
1085 int lmargin = 0, rmargin = 0;
1086 int x = rect->left, y = rect->top;
1087 int width = rect->right - rect->left;
1088 int max_width = 0;
1089 int last_line;
1090 int tabwidth /* to keep gcc happy */ = 0;
1091 int prefix_offset;
1092 ellipsis_data ellip;
1093 BOOL invert_y=FALSE;
1094
1095 HRGN hrgn = 0;
1096
1097#ifdef _WIN32K_
1098 TRACE("%S, %d, %08x\n", str, count, flags);
1099#else
1100 TRACE("%s, %d, [%s] %08x\n", debugstr_wn (str, count), count,
1102#endif
1103 if (dtp) TRACE("Params: iTabLength=%d, iLeftMargin=%d, iRightMargin=%d\n",
1104 dtp->iTabLength, dtp->iLeftMargin, dtp->iRightMargin);
1105
1106 if (!str) return 0;
1107
1108 strPtr = str;
1109
1110 if (flags & DT_SINGLELINE)
1111 flags &= ~DT_WORDBREAK;
1112#ifdef _WIN32K_
1114#else
1116#endif
1118 lh = tm.tmHeight + tm.tmExternalLeading;
1119 else
1120 lh = tm.tmHeight;
1121
1122 if (str[0] && count == 0)
1123 return lh;
1124
1125 if (dtp && dtp->cbSize != sizeof(DRAWTEXTPARAMS))
1126 return 0;
1127#ifdef _WIN32K_
1129 {
1130 SIZE window_ext, viewport_ext;
1131 GreGetWindowExtEx(hdc, &window_ext);
1132 GreGetViewportExtEx(hdc, &viewport_ext);
1133 if ((window_ext.cy > 0) != (viewport_ext.cy > 0))
1134 invert_y = TRUE;
1135 }
1136#else
1138 {
1139 SIZE window_ext, viewport_ext;
1140 GetWindowExtEx(hdc, &window_ext);
1141 GetViewportExtEx(hdc, &viewport_ext);
1142 if ((window_ext.cy > 0) != (viewport_ext.cy > 0))
1143 invert_y = TRUE;
1144 }
1145#endif
1146 if (count == -1)
1147 {
1148#ifdef _WIN32K_
1149 count = wcslen(str);
1150#else
1151 count = strlenW(str);
1152#endif
1153 if (count == 0)
1154 {
1155 if( flags & DT_CALCRECT)
1156 {
1157 rect->right = rect->left;
1158 if( flags & DT_SINGLELINE)
1159 rect->bottom = rect->top + (invert_y ? -lh : lh);
1160 else
1161 rect->bottom = rect->top;
1162 }
1163 return lh;
1164 }
1165 }
1166
1167 if (dtp)
1168 {
1169 lmargin = dtp->iLeftMargin;
1170 rmargin = dtp->iRightMargin;
1171 if (!(flags & (DT_CENTER | DT_RIGHT)))
1172 x += lmargin;
1173 dtp->uiLengthDrawn = 0; /* This param RECEIVES number of chars processed */
1174 }
1175
1176 if (flags & DT_EXPANDTABS)
1177 {
1178 int tabstop = ((flags & DT_TABSTOP) && dtp && dtp->iTabLength) ? dtp->iTabLength : 8;
1179 tabwidth = tm.tmAveCharWidth * tabstop;
1180 }
1181
1182 if (flags & DT_CALCRECT) flags |= DT_NOCLIP;
1183#ifndef _WIN32K_
1184 if (!(flags & DT_NOCLIP) )
1185 {
1186 int hasClip;
1187 hrgn = CreateRectRgn(0,0,0,0);
1188 if (hrgn)
1189 {
1190 hasClip = GetClipRgn(hdc, hrgn);
1191 // If the region to be retrieved is NULL, the return value is 0.
1192 if (hasClip != 1)
1193 {
1195 hrgn = NULL;
1196 }
1197 IntersectClipRect(hdc, rect->left, rect->top, rect->right, rect->bottom);
1198 }
1199 }
1200#else
1201 if (!(flags & DT_NOCLIP) )
1202 {
1203 int hasClip;
1204 hrgn = NtGdiCreateRectRgn(0,0,0,0);
1205 if (hrgn)
1206 {
1207 hasClip = NtGdiGetRandomRgn(hdc, hrgn, CLIPRGN);
1208 if (hasClip != 1)
1209 {
1211 hrgn = NULL;
1212 }
1213 NtGdiIntersectClipRect(hdc, rect->left, rect->top, rect->right, rect->bottom);
1214 }
1215 }
1216#endif
1217 if (flags & DT_MODIFYSTRING)
1218 {
1219 size_retstr = (count + 4) * sizeof (WCHAR);
1220#ifdef _WIN32K_
1221 retstr = ExAllocatePoolWithTag(PagedPool, size_retstr, USERTAG_RTL);
1222#else
1223 retstr = HeapAlloc(GetProcessHeap(), 0, size_retstr);
1224#endif
1225 if (!retstr) return 0;
1226 memcpy (retstr, str, size_retstr);
1227 }
1228 else
1229 {
1230 size_retstr = 0;
1231 retstr = NULL;
1232 }
1233 p_retstr = retstr;
1234
1235 do
1236 {
1237 len = sizeof(line)/sizeof(line[0]);
1238 if (invert_y)
1239 last_line = !(flags & DT_NOCLIP) && y - ((flags & DT_EDITCONTROL) ? 2*lh-1 : lh) < rect->bottom;
1240 else
1241 last_line = !(flags & DT_NOCLIP) && y + ((flags & DT_EDITCONTROL) ? 2*lh-1 : lh) > rect->bottom;
1242 strPtr = TEXT_NextLineW(hdc, strPtr, &count, line, &len, width, flags, &size, last_line, &p_retstr, tabwidth, &prefix_offset, &ellip);
1243
1244#ifdef __REACTOS__
1245 if (flags & DT_CENTER)
1246 {
1247 if (((rect->right - rect->left) < size.cx) && (flags & DT_CALCRECT))
1248 {
1249 x = rect->left + size.cx;
1250 }
1251 else
1252 {
1253 x = (rect->left + rect->right - size.cx) / 2;
1254 }
1255 }
1256#else
1257 if (flags & DT_CENTER) x = (rect->left + rect->right -
1258 size.cx) / 2;
1259#endif
1260 else if (flags & DT_RIGHT) x = rect->right - size.cx;
1261
1262 if (flags & DT_SINGLELINE)
1263 {
1264#ifdef __REACTOS__
1265 if (flags & DT_VCENTER) y = rect->top +
1266 (rect->bottom - rect->top + (invert_y ? size.cy : -size.cy)) / 2;
1267 else if (flags & DT_BOTTOM)
1268 y = rect->bottom + (invert_y ? size.cy : -size.cy);
1269#else
1270 if (flags & DT_VCENTER) y = rect->top +
1271 (rect->bottom - rect->top) / 2 - size.cy / 2;
1272 else if (flags & DT_BOTTOM) y = rect->bottom - size.cy;
1273#endif
1274 }
1275
1276 if (!(flags & DT_CALCRECT))
1277 {
1278 const WCHAR *str = line;
1279 int xseg = x;
1280 while (len)
1281 {
1282 int len_seg;
1283 SIZE size;
1284 if ((flags & DT_EXPANDTABS))
1285 {
1286 const WCHAR *p;
1287 p = str; while (p < str+len && *p != TAB) p++;
1288 len_seg = p - str;
1289 if (len_seg != len &&
1290#ifdef _WIN32K_
1291 !GreGetTextExtentW(hdc, str, len_seg, &size, 0))
1292#else
1293 !GetTextExtentPointW(hdc, str, len_seg, &size))
1294#endif
1295 {
1296#ifdef _WIN32K_
1298#else
1299 HeapFree (GetProcessHeap(), 0, retstr);
1300#endif
1301 return 0;
1302 }
1303 }
1304 else
1305 len_seg = len;
1306#ifdef _WIN32K_
1307 if (!UserExtTextOutW( hdc, xseg, y,
1308 ((flags & DT_NOCLIP) ? 0 : ETO_CLIPPED) |
1309 ((flags & DT_RTLREADING) ? ETO_RTLREADING : 0),
1310 rect, str, len_seg))
1311#else
1312 if (!ExtTextOutW( hdc, xseg, y,
1313 ((flags & DT_NOCLIP) ? 0 : ETO_CLIPPED) |
1314 ((flags & DT_RTLREADING) ? ETO_RTLREADING : 0),
1315 rect, str, len_seg, NULL ))
1316#endif
1317 {
1318#ifdef _WIN32K_
1320#else
1321 HeapFree (GetProcessHeap(), 0, retstr);
1322#endif
1323 return 0;
1324 }
1325 if (prefix_offset != -1 && prefix_offset < len_seg)
1326 {
1327 TEXT_DrawUnderscore (hdc, xseg, y + tm.tmAscent + 1, str, prefix_offset, (flags & DT_NOCLIP) ? NULL : rect);
1328 }
1329 len -= len_seg;
1330 str += len_seg;
1331 if (len)
1332 {
1333 assert ((flags & DT_EXPANDTABS) && *str == TAB);
1334 len--; str++;
1335 xseg += ((size.cx/tabwidth)+1)*tabwidth;
1336 if (prefix_offset != -1)
1337 {
1338 if (prefix_offset < len_seg)
1339 {
1340 /* We have just drawn an underscore; we ought to
1341 * figure out where the next one is. I am going
1342 * to leave it for now until I have a better model
1343 * for the line, which will make reprefixing easier.
1344 * This is where ellip would be used.
1345 */
1346 prefix_offset = -1;
1347 }
1348 else
1349 prefix_offset -= len_seg;
1350 }
1351 }
1352 }
1353 }
1354 else if (size.cx > max_width)
1355 max_width = size.cx;
1356
1357 y += invert_y ? -lh : lh;
1358 if (dtp)
1359 dtp->uiLengthDrawn += len;
1360 }
1361 while (strPtr && !last_line);
1362
1363#ifndef _WIN32K_
1364 if (!(flags & DT_NOCLIP) )
1365 {
1366 SelectClipRgn(hdc, hrgn); // This should be NtGdiExtSelectClipRgn, but due to ReactOS build rules this option is next:
1367 GdiFlush(); // Flush the batch and level up! See CORE-16498.
1368 if (hrgn)
1369 {
1371 }
1372 }
1373#else
1374 if (!(flags & DT_NOCLIP) )
1375 {
1377 if (hrgn)
1378 {
1380 }
1381 }
1382#endif
1383
1384 if (flags & DT_CALCRECT)
1385 {
1386 rect->right = rect->left + max_width;
1387 rect->bottom = y;
1388 if (dtp)
1389 rect->right += lmargin + rmargin;
1390 }
1391 if (retstr)
1392 {
1393 memcpy (str, retstr, size_retstr);
1394#ifdef _WIN32K_
1396#else
1397 HeapFree (GetProcessHeap(), 0, retstr);
1398#endif
1399 }
1400 return y - rect->top;
1401}
static HRGN hrgn
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
int FASTCALL GreGetGraphicsMode(HDC)
Definition: dcutil.c:306
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
#define PagedPool
Definition: env_spec_w32.h:308
pKey DeleteObject()
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLint GLint GLsizei width
Definition: gl.h:1546
GLsizeiptr size
Definition: glext.h:5919
GLbitfield flags
Definition: glext.h:7161
GLfloat GLfloat p
Definition: glext.h:8902
GLenum GLsizei len
Definition: glext.h:6722
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define debugstr_wn
Definition: kernel32.h:33
if(dx< 0)
Definition: linetemp.h:194
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1109
#define CLIPRGN
Definition: precomp.h:18
BOOL WINAPI GreGetViewportExtEx(_In_ HDC hdc, _Out_ LPSIZE lpSize)
Definition: coord.c:1416
BOOL WINAPI GreGetWindowExtEx(_In_ HDC hdc, _Out_ LPSIZE lpSize)
Definition: coord.c:1407
__kernel_entry W32KAPI HRGN APIENTRY NtGdiCreateRectRgn(_In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
__kernel_entry W32KAPI INT APIENTRY NtGdiExtSelectClipRgn(_In_ HDC hdc, _In_opt_ HRGN hrgn, _In_ INT iMode)
__kernel_entry W32KAPI INT APIENTRY NtGdiIntersectClipRect(_In_ HDC hdc, _In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
Definition: cliprgn.c:488
__kernel_entry W32KAPI INT APIENTRY NtGdiGetRandomRgn(_In_ HDC hdc, _In_ HRGN hrgn, _In_ INT iRgn)
#define strlenW(s)
Definition: unicode.h:34
const WCHAR * str
#define TRACE(s)
Definition: solgame.cpp:4
int iRightMargin
Definition: winuser.h:3202
UINT uiLengthDrawn
Definition: winuser.h:3203
LONG cy
Definition: kdterminal.h:28
Definition: parser.c:49
Definition: time.h:68
BOOL UserExtTextOutW(HDC hdc, INT x, INT y, UINT flags, PRECTL lprc, LPCWSTR lpString, UINT count)
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1158
BOOL WINAPI GreGetTextMetricsW(_In_ HDC hdc, _Out_ LPTEXTMETRICW lptm)
Definition: text.c:191
BOOL FASTCALL GreGetTextExtentW(_In_ HDC hDC, _In_reads_(cwc) PCWCH lpwsz, _In_ INT cwc, _Out_ PSIZE psize, _In_ UINT flOpts)
Definition: text.c:77
#define USERTAG_RTL
Definition: tags.h:270
#define MAX_BUFFER
Definition: text.c:1065
static void TEXT_DrawUnderscore(HDC hdc, int x, int y, const WCHAR *str, int offset, const RECT *rect)
Definition: text.c:894
static const WCHAR * TEXT_NextLineW(HDC hdc, const WCHAR *str, int *count, WCHAR *dest, int *len, int width, DWORD format, SIZE *retsize, int last_line, WCHAR **p_retstr, int tabwidth, int *pprefix_offset, ellipsis_data *pellip)
Definition: text.c:666
#define TAB
Definition: text.c:109
#define assert(e)
Definition: text.c:47
#define GM_COMPATIBLE
Definition: wingdi.h:864
BOOL WINAPI GetTextMetricsW(_In_ HDC, _Out_ LPTEXTMETRICW)
Definition: text.c:221
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
int WINAPI GetGraphicsMode(_In_ HDC)
int WINAPI IntersectClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI GetTextExtentPointW(_In_ HDC hdc, _In_reads_(c) LPCWSTR lpString, _In_ int c, _Out_ LPSIZE lpsz)
BOOL WINAPI GdiFlush(void)
Definition: misc.c:44
int WINAPI GetClipRgn(_In_ HDC, _In_ HRGN)
#define RGN_COPY
Definition: wingdi.h:357
#define ETO_CLIPPED
Definition: wingdi.h:648
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ int x, _In_ int y, _In_ UINT options, _In_opt_ const RECT *lprect, _In_reads_opt_(c) LPCWSTR lpString, _In_ UINT c, _In_reads_opt_(c) const INT *lpDx)
BOOL WINAPI GetWindowExtEx(_In_ HDC, _Out_ LPSIZE)
Definition: coord.c:411
BOOL WINAPI GetViewportExtEx(_In_ HDC, _Out_ LPSIZE)
Definition: coord.c:351
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
#define DT_EXTERNALLEADING
Definition: winuser.h:533
#define DT_CENTER
Definition: winuser.h:527
#define DT_SINGLELINE
Definition: winuser.h:540
#define DT_TABSTOP
Definition: winuser.h:541
#define DT_NOCLIP
Definition: winuser.h:536
#define DT_RTLREADING
Definition: winuser.h:539
#define DT_MODIFYSTRING
Definition: winuser.h:535
#define DT_VCENTER
Definition: winuser.h:543
#define DT_BOTTOM
Definition: winuser.h:525
#define DT_RIGHT
Definition: winuser.h:538
#define DT_EXPANDTABS
Definition: winuser.h:532
#define DT_CALCRECT
Definition: winuser.h:526
#define DT_EDITCONTROL
Definition: winuser.h:528

Referenced by DrawTextW().

◆ DrawTextW()

INT WINAPI DrawTextW ( HDC  hdc,
LPCWSTR  str,
INT  count,
LPRECT  rect,
UINT  flags 
)

Definition at line 16 of file defwnd.c.

17{
19
20 memset (&dtp, 0, sizeof(dtp));
21 dtp.cbSize = sizeof(dtp);
22 if (flags & DT_TABSTOP)
23 {
24 dtp.iTabLength = (flags >> 8) & 0xff;
25 flags &= 0xffff00ff;
26 }
27 return DrawTextExWorker(hdc, (LPWSTR)str, count, rect, flags, &dtp);
28}
INT WINAPI DrawTextExWorker(HDC hdc, LPWSTR str, INT i_count, LPRECT rect, UINT flags, LPDRAWTEXTPARAMS dtp)
Definition: text.c:1071
#define memset(x, y, z)
Definition: compat.h:39
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by _check_txgetnaturalsize(), BUTTON_CalcLabelRect(), BUTTON_DrawTextCallback(), C1_SetData(), ProgressDlg::CalcTextRect(), CB_ThemedPaint(), CFn_WMPaint(), ConfirmMsgBox_Init(), ConfirmMsgBox_Paint(), SEALED_::ControlWindowProc(), CreateLayoutIcon(), DATETIME_Refresh(), DECLARE_INTERFACE_(), default_page_paint_hook(), DlgProc(), DoTestEntry(), DrawContent(), DrawProc(), DrawShadowText(), DrawStatusTextW(), DrawTextFromResource(), CUIFBalloonButton::DrawTextProc(), DrawThemeTextEx(), EditTypeDlg_OnDrawItem(), FillGrid(), CTextEditWindow::FixEditPos(), GetThemeTextExtent(), CUIFToolTip::GetTipWindowSize(), Graph_DrawCpuUsageGraph(), Graph_DrawMemUsageGraph(), HDropFromClipboard(), HEADER_DrawItem(), ICONTITLE_Paint(), ICONTITLE_SetTitlePos(), InatCreateIconBySize(), IPADDRESS_Draw(), LISTVIEW_DrawItemPart(), LISTVIEW_GetItemMetrics(), LrgCellWndProc(), MainWnd_OnDrawItem(), MENU_CalcItemSize(), MENU_DrawMenuItem(), MONTHCAL_PaintCalendar(), MONTHCAL_PaintTitle(), MONTHCAL_PaintTodayTitle(), MonthCalPaint(), MyDrawCaptionTemp(), MyDrawMenuBarTemp(), NT5_DrawLogoffCaptionText(), CFontsDialog::OnDrawItem(), CAutoComplete::OnDrawItem(), CCell::OnPaint(), OnPaint(), OSK_Paint(), PAINTING_DrawStateJam(), CUIFBalloonWindow::PaintMessageProc(), PaintText(), ProgressDlg::ProcessWindowMessage(), PROPSHEET_Paint(), REBAR_DrawBand(), ScrollProc(), SoftModalMessageBox(), STATIC_DrawTextCallback(), TAB_DrawItemInterior(), taskdialog_draw_expando_control(), taskdialog_get_expando_size(), taskdialog_get_label_size(), test_DrawTextCalcRect(), Text(), TOOLBAR_CustomizeDialogProc(), TOOLBAR_DrawString(), TOOLBAR_MeasureString(), TOOLTIPS_CalcTipSize(), TOOLTIPS_Refresh(), TREEVIEW_CreateDragImage(), UserDrawCaptionText(), WndProc(), and ZoomWnd_OnDraw().

◆ DWP_GetEnabledPopup()

PWND FASTCALL DWP_GetEnabledPopup ( PWND  pWnd)

Definition at line 499 of file defwnd.c.

500{
501 PWND pwndNode1;
502 PTHREADINFO pti = pWnd->head.pti, ptiNode;
503 BOOL bFoundNullNode = FALSE;
504
505 for (pwndNode1 = pWnd->spwndNext; pwndNode1 != pWnd; )
506 {
507 if (!pwndNode1) /* NULL detected? */
508 {
509 if (bFoundNullNode)
510 return NULL;
511 bFoundNullNode = TRUE;
512 /* Retry with parent's first child (once only) */
513 pwndNode1 = pWnd->spwndParent->spwndChild;
514 continue;
515 }
516
517 /*
518 * 1. We want to detect the window that owns the same input target of pWnd.
519 * 2. For non-16-bit apps, we need to check the two threads' input queues to
520 * see whether they are the same, while for 16-bit apps it's sufficient to
521 * only check the thread info pointers themselves (ptiNode and pti).
522 * See also:
523 * https://devblogs.microsoft.com/oldnewthing/20060221-09/?p=32203
524 * https://github.com/reactos/reactos/pull/7700#discussion_r1939435931
525 */
526 ptiNode = pwndNode1->head.pti;
527 if ((!(pti->TIF_flags & TIF_16BIT) && ptiNode->MessageQueue == pti->MessageQueue) ||
528 ((pti->TIF_flags & TIF_16BIT) && ptiNode == pti))
529 {
530 DWORD style = pwndNode1->style;
531 if ((style & WS_VISIBLE) && !(style & WS_DISABLED)) /* Visible and enabled? */
532 {
533 /* Does pwndNode1 have a pWnd as an ancestor? */
534 PWND pwndNode2;
535 for (pwndNode2 = pwndNode1->spwndOwner; pwndNode2;
536 pwndNode2 = pwndNode2->spwndOwner)
537 {
538 if (pwndNode2 == pWnd)
539 return pwndNode1;
540 }
541 }
542 }
543
544 pwndNode1 = pwndNode1->spwndNext;
545 }
546
547 return NULL;
548}
unsigned long DWORD
Definition: ntddk_ex.h:95
#define TIF_16BIT
Definition: ntuser.h:264
FLONG TIF_flags
Definition: win32.h:95
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:89
struct _WND * spwndNext
Definition: ntuser.h:711
struct _WND * spwndParent
Definition: ntuser.h:713

Referenced by NtUserCallHwnd().

◆ IntDefWindowProc()

LRESULT FASTCALL IntDefWindowProc ( PWND  Wnd,
UINT  Msg,
WPARAM  wParam,
LPARAM  lParam,
BOOL  Ansi 
)

Definition at line 638 of file defwnd.c.

644{
646 LRESULT lResult = 0;
648
649 if (Msg > WM_USER) return 0;
650
651 switch (Msg)
652 {
653 case WM_DEVICECHANGE:
654 return TRUE;
655
656 case WM_GETTEXTLENGTH:
657 {
658 PWSTR buf;
659 ULONG len;
660
661 if (Wnd != NULL && Wnd->strName.Length != 0)
662 {
663 buf = Wnd->strName.Buffer;
664 if (buf != NULL &&
666 buf,
667 Wnd->strName.Length)))
668 {
669 lResult = (LRESULT) (Wnd->strName.Length / sizeof(WCHAR));
670 }
671 }
672
673 break;
674 }
675
676 case WM_GETTEXT: // FIXME: Handle Ansi
677 {
678 PWSTR buf = NULL;
679 PWSTR outbuf = (PWSTR)lParam;
680
681 if (Wnd != NULL && wParam != 0)
682 {
683 if (Wnd->strName.Buffer != NULL)
684 buf = Wnd->strName.Buffer;
685 else
686 outbuf[0] = L'\0';
687
688 if (buf != NULL)
689 {
690 if (Wnd->strName.Length != 0)
691 {
692 lResult = min(Wnd->strName.Length / sizeof(WCHAR), wParam - 1);
693 RtlCopyMemory(outbuf,
694 buf,
695 lResult * sizeof(WCHAR));
696 outbuf[lResult] = L'\0';
697 }
698 else
699 outbuf[0] = L'\0';
700 }
701 }
702 break;
703 }
704
705 case WM_SETTEXT: // FIXME: Handle Ansi
706 {
707 DefSetText(Wnd, (PCWSTR)lParam);
708
709 if ((Wnd->style & WS_CAPTION) == WS_CAPTION)
711 IntNotifyWinEvent(EVENT_OBJECT_NAMECHANGE, Wnd, OBJID_WINDOW, CHILDID_SELF, 0);
712 lResult = 1;
713 break;
714 }
715
716 case WM_SYSCOMMAND:
717 {
718 TRACE("hwnd %p WM_SYSCOMMAND %lx %lx\n", UserHMGetHandle(Wnd), wParam, lParam );
719 lResult = DefWndHandleSysCommand(Wnd, wParam, lParam);
720 break;
721 }
722
723 case WM_SHOWWINDOW:
724 {
725 if ((Wnd->style & WS_VISIBLE) && wParam) break;
726 if (!(Wnd->style & WS_VISIBLE) && !wParam) break;
727 if (!Wnd->spwndOwner) break;
728 if (LOWORD(lParam))
729 {
731 }
732 break;
733 }
734
736 return IntClientShutdown(Wnd, wParam, lParam);
737
738 case WM_APPCOMMAND:
739 if ( (Wnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD &&
740 Wnd != co_GetDesktopWindow(Wnd) )
741 {
742 if (!co_HOOK_CallHooks(WH_SHELL, HSHELL_APPCOMMAND, wParam, lParam))
743 co_IntShellHookNotify(HSHELL_APPCOMMAND, wParam, lParam);
744 break;
745 }
746 UserRefObjectCo(Wnd->spwndParent, &Ref);
749 break;
750
752 /* This is an undocumented message used by the windows taskbar to
753 display the system menu of windows that belong to other processes. */
755 break;
756
757 case WM_KEYF1:
758 {
759 HELPINFO hi;
760 HMENU hMenu = UlongToHandle(Wnd->IDMenu);
761 PWND pwndActive = MENU_IsMenuActive();
762 hi.cbSize = sizeof(HELPINFO);
763 hi.MousePos = gpsi->ptCursor;
765 hi.hItemHandle = pwndActive ? UserHMGetHandle(pwndActive) : UserHMGetHandle(Wnd);
766 hi.iCtrlId = (Wnd->style & (WS_POPUP|WS_CHILD)) == WS_CHILD ? IntMenuItemFromPoint(Wnd, hMenu, hi.MousePos) : 0;
768
769 co_IntSendMessage( UserHMGetHandle(Wnd), WM_HELP, 0, (LPARAM)&hi );
770 break;
771 }
772
773 case WM_SETICON:
774 {
775 return DefWndSetIcon(Wnd, wParam, lParam);
776 }
777
778 case WM_GETICON:
779 {
780 return DefWndGetIcon(Wnd, wParam, lParam);
781 }
782
783 case WM_HELP:
784 {
785 PWND Parent = IntGetParent(Wnd);
787 break;
788 }
789
790 case WM_LBUTTONDOWN:
791 case WM_RBUTTONDOWN:
792 case WM_MBUTTONDOWN:
794 break;
795
796 case WM_NCLBUTTONDOWN:
798
799 case WM_NCRBUTTONDOWN:
801
802 case WM_LBUTTONDBLCLK:
804
807
808 case WM_RBUTTONUP:
809 {
810 POINT Pt;
811
812 Pt.x = GET_X_LPARAM(lParam);
813 Pt.y = GET_Y_LPARAM(lParam);
814 IntClientToScreen(Wnd, &Pt);
815 lParam = MAKELPARAM(Pt.x, Pt.y);
817 break;
818 }
819
820 case WM_NCRBUTTONUP:
821 /*
822 * FIXME : we must NOT send WM_CONTEXTMENU on a WM_NCRBUTTONUP (checked
823 * in Windows), but what _should_ we do? According to MSDN :
824 * "If it is appropriate to do so, the system sends the WM_SYSCOMMAND
825 * message to the window". When is it appropriate?
826 */
827 ERR("WM_NCRBUTTONUP\n");
828 break;
829
830 case WM_XBUTTONUP:
831 case WM_NCXBUTTONUP:
832 if (HIWORD(wParam) == XBUTTON1 || HIWORD(wParam) == XBUTTON2)
833 {
835 MAKELPARAM(LOWORD(wParam), FAPPCOMMAND_MOUSE | HIWORD(wParam)));
836 }
837 break;
838
839
840 case WM_CONTEXTMENU:
841 {
842 if (Wnd->style & WS_CHILD)
843 {
845 }
846 else
847 {
848 POINT Pt;
850 LONG HitCode;
851
852 Style = Wnd->style;
853
854 Pt.x = GET_X_LPARAM(lParam);
855 Pt.y = GET_Y_LPARAM(lParam);
856 if (Style & WS_CHILD)
857 {
859 }
860
861 HitCode = GetNCHitEx(Wnd, Pt);
862
863 if (HitCode == HTCAPTION || HitCode == HTSYSMENU)
864 {
865 PMENU SystemMenu;
866 UINT Flags;
867
868 if((SystemMenu = IntGetSystemMenu(Wnd, FALSE)))
869 {
870 MENU_InitSysMenuPopup(SystemMenu, Wnd->style, Wnd->pcls->style, HitCode);
871
872 if(HitCode == HTCAPTION)
874 else
876
877 IntTrackPopupMenuEx(SystemMenu, Flags|TPM_SYSTEM_MENU, Pt.x, Pt.y, Wnd, NULL);
878 }
879 }
880 if (HitCode == HTHSCROLL || HitCode == HTVSCROLL)
881 {
882 WARN("Scroll Menu Not Supported\n");
883 }
884 }
885 break;
886 }
887
888 case WM_KEYDOWN:
889 if (wParam == VK_F10)
890 {
891 pti->MessageQueue->QF_flags |= QF_FF10STATUS;
892
893 if (UserGetKeyState(VK_SHIFT) & 0x8000)
894 {
896 }
897 }
899 {
900 HWND hwndTop = UserGetForegroundWindow();
901 PWND topWnd = UserGetWindowObject(hwndTop);
902 BOOL allowSnap;
903
904 // MS Doc: foreground window can be NULL, e.g. when window is losing activation
905 if (!topWnd)
906 return 0;
907
908 allowSnap = IntIsSnapAllowedForWindow(topWnd);
909 /* Allow the minimize action if it has a minimize button, even if the window cannot be snapped (e.g. Calc.exe) */
910 if (!allowSnap && (topWnd->style & (WS_MINIMIZEBOX|WS_THICKFRAME)) == WS_MINIMIZEBOX)
911 allowSnap = wParam == VK_DOWN;
912
913 if (allowSnap)
914 {
915 UINT snapped = IntGetWindowSnapEdge(topWnd);
916
917 if (wParam == VK_DOWN)
918 {
919 if (topWnd->style & WS_MAXIMIZE)
921 else if (snapped)
922 co_IntUnsnapWindow(topWnd);
923 else
925 }
926 else if (wParam == VK_UP)
927 {
928 if (topWnd->style & WS_MINIMIZE)
930 else
932 }
933 else if (wParam == VK_LEFT || wParam == VK_RIGHT)
934 {
935 UINT edge = wParam == VK_LEFT ? HTLEFT : HTRIGHT;
936 UINT otherEdge = edge == HTLEFT ? HTRIGHT : HTLEFT;
937
938 if (topWnd->style & WS_MAXIMIZE)
939 {
940 /* SC_RESTORE + Snap causes the window to visually move twice, place it manually in the snap position */
941 RECT normalRect = topWnd->InternalPos.NormalRect;
942 co_IntCalculateSnapPosition(topWnd, edge, &topWnd->InternalPos.NormalRect); /* Calculate edge position */
943 IntSetSnapEdge(topWnd, edge); /* Tell everyone the edge we are snapped to */
945 IntSetSnapInfo(topWnd, edge, &normalRect); /* Reset the real place to unsnap to */
946 snapped = HTNOWHERE; /* Force snap */
947 }
948#if 0 /* Windows 8 does this but is it a good feature? */
949 else if (snapped == edge)
950 {
951 /* Already snapped to this edge, snap to the opposite side */
952 edge = otherEdge;
953 }
954#endif
955
956 if (snapped == otherEdge)
957 co_IntUnsnapWindow(topWnd);
958 else
959 co_IntSnapWindow(topWnd, edge);
960 }
961 }
962 }
963 break;
964
965 case WM_SYSKEYDOWN:
966 {
967 if (HIWORD(lParam) & KF_ALTDOWN)
968 { /* Previous state, if the key was down before this message,
969 this is a cheap way to ignore autorepeat keys. */
970 if ( !(HIWORD(lParam) & KF_REPEAT) )
971 {
972 if ( ( wParam == VK_MENU ||
973 wParam == VK_LMENU ||
974 wParam == VK_RMENU ) && !(pti->MessageQueue->QF_flags & QF_FMENUSTATUS)) //iMenuSysKey )
975 pti->MessageQueue->QF_flags |= QF_FMENUSTATUS; //iMenuSysKey = 1;
976 else
977 pti->MessageQueue->QF_flags &= ~QF_FMENUSTATUS; //iMenuSysKey = 0;
978 }
979
980 pti->MessageQueue->QF_flags &= ~QF_FF10STATUS; //iF10Key = 0;
981
982 if (wParam == VK_F4) /* Try to close the window */
983 {
985 if (!(top->pcls->style & CS_NOCLOSE))
987 }
988 else if (wParam == VK_SNAPSHOT) // Alt-VK_SNAPSHOT?
989 {
990 PWND pwnd = Wnd;
991 while (IntGetParent(pwnd) != NULL)
992 {
993 pwnd = IntGetParent(pwnd);
994 }
995 ERR("DefWndScreenshot\n");
996 DefWndScreenshot(pwnd);
997 }
998 else if ( wParam == VK_ESCAPE || wParam == VK_TAB ) // Alt-Tab/ESC Alt-Shift-Tab/ESC
999 {
1000 WPARAM wParamTmp;
1001 HWND Active = UserGetActiveWindow(); // Noticed MDI problem.
1002 if (!Active)
1003 {
1004 FIXME("WM_SYSKEYDOWN VK_ESCAPE no active\n");
1005 break;
1006 }
1007 wParamTmp = UserGetKeyState(VK_SHIFT) & 0x8000 ? SC_PREVWINDOW : SC_NEXTWINDOW;
1009 }
1010 }
1011 else if( wParam == VK_F10 )
1012 {
1013 if (UserGetKeyState(VK_SHIFT) & 0x8000)
1015 pti->MessageQueue->QF_flags |= QF_FF10STATUS; //iF10Key = 1;
1016 }
1017 else if( wParam == VK_ESCAPE && (UserGetKeyState(VK_SHIFT) & 0x8000))
1019 break;
1020 }
1021
1022 case WM_KEYUP:
1023 case WM_SYSKEYUP:
1024 {
1025 /* Press and release F10 or ALT */
1026 if (((wParam == VK_MENU || wParam == VK_LMENU || wParam == VK_RMENU)
1027 && (pti->MessageQueue->QF_flags & (QF_FMENUSTATUS|QF_FMENUSTATUSBREAK)) == QF_FMENUSTATUS /*iMenuSysKey*/) ||
1028 ((wParam == VK_F10) && pti->MessageQueue->QF_flags & QF_FF10STATUS /*iF10Key*/))
1030 pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK|QF_FF10STATUS); //iMenuSysKey = iF10Key = 0;
1031 break;
1032 }
1033
1034 case WM_SYSCHAR:
1035 {
1036 pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK); //iMenuSysKey = 0;
1037 if (wParam == VK_RETURN && (Wnd->style & WS_MINIMIZE) != 0)
1038 {
1040 break;
1041 }
1042 if ((HIWORD(lParam) & KF_ALTDOWN) && wParam)
1043 {
1044 if (wParam == VK_TAB || wParam == VK_ESCAPE) break;
1045 if (wParam == VK_SPACE && Wnd->style & WS_CHILD)
1047 else
1049 }
1050 else /* check for Ctrl-Esc */
1051 if (wParam != VK_ESCAPE) UserPostMessage(hwndSAS, WM_LOGONNOTIFY, LN_MESSAGE_BEEP, 0); //MessageBeep(0);
1052 break;
1053 }
1054
1055 case WM_CANCELMODE:
1056 {
1057 pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK);
1058
1059 MENU_EndMenu( Wnd );
1061 {
1063 }
1064 break;
1065 }
1066
1067 case WM_CLOSE:
1069 break;
1070
1071 case WM_CTLCOLORMSGBOX:
1072 case WM_CTLCOLOREDIT:
1073 case WM_CTLCOLORLISTBOX:
1074 case WM_CTLCOLORBTN:
1075 case WM_CTLCOLORDLG:
1076 case WM_CTLCOLORSTATIC:
1079
1080 case WM_CTLCOLOR:
1082
1083 case WM_SETCURSOR:
1084 {
1085 if (Wnd->style & WS_CHILD)
1086 {
1087 /* with the exception of the border around a resizable wnd,
1088 * give the parent first chance to set the cursor */
1090 {
1091 PWND parent = Wnd->spwndParent;//IntGetParent( Wnd );
1092 if (parent != UserGetDesktopWindow() &&
1094 return TRUE;
1095 }
1096 }
1097 return DefWndHandleSetCursor(Wnd, wParam, lParam);
1098 }
1099
1100 case WM_MOUSEACTIVATE:
1101 if (Wnd->style & WS_CHILD)
1102 {
1104 PWND pwndParent = IntGetParent(Wnd);
1105 hwndParent = pwndParent ? UserHMGetHandle(pwndParent) : NULL;
1106 if (hwndParent)
1107 {
1109 if (lResult)
1110 break;
1111 }
1112 }
1114
1115 case WM_ACTIVATE:
1116 /* The default action in Windows is to set the keyboard focus to
1117 * the window, if it's being activated and not minimized */
1118 if (LOWORD(wParam) != WA_INACTIVE &&
1119 !(Wnd->style & WS_MINIMIZE))
1120 {
1121 //ERR("WM_ACTIVATE %p\n",hWnd);
1122 co_UserSetFocus(Wnd);
1123 }
1124 break;
1125
1126 case WM_MOUSEWHEEL:
1127 if (Wnd->style & WS_CHILD)
1128 {
1130 PWND pwndParent = IntGetParent(Wnd);
1131 hwndParent = pwndParent ? UserHMGetHandle(pwndParent) : NULL;
1133 }
1134 break;
1135
1136 case WM_ERASEBKGND:
1137 case WM_ICONERASEBKGND:
1138 {
1139 RECT Rect;
1140 HBRUSH hBrush = Wnd->pcls->hbrBackground;
1141 if (!hBrush) return 0;
1142 if (hBrush <= (HBRUSH)COLOR_MENUBAR)
1143 {
1144 hBrush = IntGetSysColorBrush(HandleToUlong(hBrush));
1145 }
1146 if (Wnd->pcls->style & CS_PARENTDC)
1147 {
1148 /* can't use GetClipBox with a parent DC or we fill the whole parent */
1149 IntGetClientRect(Wnd, &Rect);
1151 }
1152 else
1153 {
1154 GdiGetClipBox((HDC)wParam, &Rect);
1155 }
1156 FillRect((HDC)wParam, &Rect, hBrush);
1157 return (1);
1158 }
1159
1160 case WM_GETHOTKEY:
1161 //ERR("WM_GETHOTKEY\n");
1162 return DefWndGetHotKey(Wnd);
1163 case WM_SETHOTKEY:
1164 //ERR("WM_SETHOTKEY\n");
1165 return DefWndSetHotKey(Wnd, wParam);
1166
1167 case WM_NCHITTEST:
1168 {
1169 POINT Point;
1172 return GetNCHitEx(Wnd, Point);
1173 }
1174
1175 case WM_PRINT:
1176 {
1177 DefWndPrint(Wnd, (HDC)wParam, lParam);
1178 return (0);
1179 }
1180
1181 case WM_SYSCOLORCHANGE:
1182 {
1183 /* force to redraw non-client area */
1184 UserPaintCaption(Wnd, DC_NC);
1185 /* Use InvalidateRect to redraw client area, enable
1186 * erase to redraw all subcontrols otherwise send the
1187 * WM_SYSCOLORCHANGE to child windows/controls is required
1188 */
1190 return (0);
1191 }
1192
1193 case WM_PAINTICON:
1194 case WM_PAINT:
1195 {
1196 PAINTSTRUCT Ps;
1197 HDC hDC;
1198
1199 /* If already in Paint and Client area is not empty just return. */
1200 if (Wnd->state2 & WNDS2_STARTPAINT && !RECTL_bIsEmptyRect(&Wnd->rcClient))
1201 {
1202 ERR("In Paint and Client area is not empty!\n");
1203 return 0;
1204 }
1205
1206 hDC = IntBeginPaint(Wnd, &Ps);
1207 if (hDC)
1208 {
1209 if (((Wnd->style & WS_MINIMIZE) != 0) && (Wnd->pcls->spicn))
1210 {
1211 RECT ClientRect;
1212 INT x, y;
1213
1214 ERR("Doing Paint and Client area is empty!\n");
1215 IntGetClientRect(Wnd, &ClientRect);
1216 x = (ClientRect.right - ClientRect.left - UserGetSystemMetrics(SM_CXICON)) / 2;
1217 y = (ClientRect.bottom - ClientRect.top - UserGetSystemMetrics(SM_CYICON)) / 2;
1219 UserDrawIconEx(hDC, x, y, Wnd->pcls->spicn, 0, 0, 0, 0, DI_NORMAL | DI_COMPAT | DI_DEFAULTSIZE);
1221 }
1222
1223 IntEndPaint(Wnd, &Ps);
1224 }
1225 return (0);
1226 }
1227
1228 case WM_SYNCPAINT:
1229 {
1230 HRGN hRgn;
1231 Wnd->state &= ~WNDS_SYNCPAINTPENDING;
1232 TRACE("WM_SYNCPAINT\n");
1233 hRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
1234 if (hRgn)
1235 {
1237 {
1238 PREGION pRgn = REGION_LockRgn(hRgn);
1239 if (pRgn) REGION_UnlockRgn(pRgn);
1240 if (!wParam)
1242 co_UserRedrawWindow(Wnd, NULL, pRgn, wParam);
1243 }
1245 }
1246 return 0;
1247 }
1248
1249 case WM_SETREDRAW:
1250 if (wParam)
1251 {
1252 if (!(Wnd->style & WS_VISIBLE))
1253 {
1254 IntSetStyle( Wnd, WS_VISIBLE, 0 );
1255 Wnd->state |= WNDS_SENDNCPAINT;
1256 }
1257 }
1258 else
1259 {
1260 if (Wnd->style & WS_VISIBLE)
1261 {
1263 IntSetStyle( Wnd, 0, WS_VISIBLE );
1264 }
1265 }
1266 return 0;
1267
1269 {
1271 }
1272
1274 {
1276 }
1277
1278 case WM_NCCALCSIZE:
1279 {
1280 return NC_HandleNCCalcSize( Wnd, wParam, (RECTL *)lParam, FALSE );
1281 }
1282
1283 case WM_NCACTIVATE:
1284 {
1285 return NC_HandleNCActivate( Wnd, wParam, lParam );
1286 }
1287
1288 //
1289 // NC Paint mode.
1290 //
1291 case WM_NCPAINT:
1292 {
1294 Wnd->state |= WNDS_FORCEMENUDRAW;
1295 NC_DoNCPaint(Wnd, hDC, -1);
1296 Wnd->state &= ~WNDS_FORCEMENUDRAW;
1297 UserReleaseDC(Wnd, hDC, FALSE);
1298 return 0;
1299 }
1300 //
1301 // Draw Caption mode.
1302 //
1303 // wParam are DC_* flags.
1304 //
1306 {
1308 TRACE("WM_NCUAHDRAWCAPTION: wParam DC_ flags %08x\n",wParam);
1309 UserDrawCaptionBar(Wnd, hDC, wParam | DC_FRAME); // Include DC_FRAME to comp for drawing glitch.
1310 UserReleaseDC(Wnd, hDC, FALSE);
1311 return 0;
1312 }
1313 //
1314 // Draw Frame mode.
1315 //
1316 // wParam is HDC, lParam are DC_ACTIVE and or DC_REDRAWHUNGWND.
1317 //
1318 case WM_NCUAHDRAWFRAME:
1319 {
1320 TRACE("WM_NCUAHDRAWFRAME: wParam hDC %p lParam DC_ flags %08x\n",wParam,lParam);
1322 return 0;
1323 }
1324
1325 /* ReactOS only. */
1326 case WM_CBT:
1327 {
1328 switch (wParam)
1329 {
1330 case HCBT_MOVESIZE:
1331 {
1332 RECTL rt;
1333
1334 if (lParam)
1335 {
1336 _SEH2_TRY
1337 {
1339 sizeof(RECT),
1340 1);
1341
1342 RtlCopyMemory(&rt,
1343 (PVOID)lParam,
1344 sizeof(RECT));
1345 }
1347 {
1348 lResult = 1;
1349 }
1350 _SEH2_END;
1351 }
1352 if (!lResult)
1354
1355 break;
1356 }
1357 }
1358 break;
1359 }
1360 }
1361 return lResult;
1362}
#define DCX_USESTYLE
Definition: GetDCEx.c:10
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER void *Data ACPI_OBJECT_HANDLER void **Data ACPI_STRING ACPI_OBJECT_LIST ACPI_BUFFER *ReturnObjectBuffer ACPI_DEVICE_INFO **ReturnBuffer ACPI_HANDLE Parent
Definition: acpixf.h:732
const DWORD Style
Definition: appswitch.c:72
#define WARN(fmt,...)
Definition: precomp.h:61
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define HandleToUlong(h)
Definition: basetsd.h:79
BOOL FASTCALL GreDPtoLP(HDC, LPPOINT, INT)
Definition: dcutil.c:7
static HWND hwndParent
Definition: cryptui.c:300
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define L(x)
Definition: resources.c:13
r parent
Definition: btrfs.c:3010
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
HWND FASTCALL co_UserSetFocus(PWND Window)
Definition: focus.c:1317
HWND FASTCALL IntGetCaptureWindow(VOID)
Definition: focus.c:34
BOOL FASTCALL IntReleaseCapture(VOID)
Definition: focus.c:1532
HWND FASTCALL UserGetForegroundWindow(VOID)
Definition: focus.c:1424
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define WNDS_SENDNCPAINT
Definition: ntuser.h:616
#define WNDS_FORCEMENUDRAW
Definition: ntuser.h:620
#define WNDS2_STARTPAINT
Definition: ntuser.h:643
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:90
static HRGN hRgn
Definition: mapping.c:33
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:63
#define WM_KEYF1
Definition: msg.c:47
DWORD FASTCALL UserGetKeyState(DWORD dwKey)
Definition: msgqueue.c:221
#define QF_FMENUSTATUSBREAK
Definition: msgqueue.h:96
#define QF_FMENUSTATUS
Definition: msgqueue.h:97
#define QF_FF10STATUS
Definition: msgqueue.h:98
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
_Use_decl_annotations_ NTSTATUS NTAPI RtlUnicodeToMultiByteSize(_Out_ PULONG MbSize, _In_ PCWCH UnicodeString, _In_ ULONG UnicodeSize)
Definition: nlsboot.c:145
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
LRESULT FASTCALL DefWndHandleWindowPosChanged(PWND pWnd, WINDOWPOS *Pos)
Definition: defwnd.c:95
LRESULT DefWndHandleSetCursor(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:243
LRESULT FASTCALL DefWndGetIcon(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:476
VOID FASTCALL DefWndScreenshot(PWND pWnd)
Definition: defwnd.c:551
LRESULT FASTCALL DefWndHandleWindowPosChanging(PWND pWnd, WINDOWPOS *Pos)
Definition: defwnd.c:68
VOID FASTCALL DefWndPrint(PWND pwnd, HDC hdc, ULONG uFlags)
Definition: defwnd.c:365
LRESULT FASTCALL DefWndHandleSysCommand(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:125
LRESULT FASTCALL DefWndSetIcon(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:437
static BOOL co_UserTrackSystemMenu(_In_ PWND pWnd, _In_ LONG nClickPos, _In_opt_ PUINT puCmdType)
Definition: defwnd.c:585
HBRUSH FASTCALL DefWndControlColor(HDC hDC, UINT ctlType)
Definition: defwnd.c:32
BOOL FASTCALL IntClientToScreen(PWND Wnd, LPPOINT lpPoint)
Definition: winpos.c:199
VOID FASTCALL IntSetSnapInfo(PWND Wnd, UINT Edge, IN const RECT *Pos OPTIONAL)
Definition: winpos.c:4044
VOID FASTCALL co_IntSnapWindow(PWND Wnd, UINT Edge)
Definition: winpos.c:3972
VOID FASTCALL co_IntCalculateSnapPosition(PWND Wnd, UINT Edge, OUT RECT *Pos)
Definition: winpos.c:3942
BOOL FASTCALL IntScreenToClient(PWND Wnd, LPPOINT lpPoint)
Definition: winpos.c:213
UINT FASTCALL IntGetWindowSnapEdge(PWND Wnd)
Definition: winpos.c:3934
VOID FASTCALL IntSetSnapEdge(PWND Wnd, UINT Edge)
Definition: winpos.c:4019
#define LRESULT
Definition: ole.h:14
#define WS_MINIMIZEBOX
Definition: pedump.c:631
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:82
#define _SEH2_END
Definition: pseh2_64.h:171
#define _SEH2_TRY
Definition: pseh2_64.h:71
#define WM_CONTEXTMENU
Definition: richedit.h:64
struct _CURICON_OBJECT * spicn
Definition: ntuser.h:585
HBRUSH hbrBackground
Definition: ntuser.h:587
UINT style
Definition: ntuser.h:580
Definition: region.h:8
struct _WND::@5394 InternalPos
DWORD state2
Definition: ntuser.h:702
RECT rcClient
Definition: ntuser.h:717
LARGE_UNICODE_STRING strName
Definition: ntuser.h:736
DWORD state
Definition: ntuser.h:701
UINT_PTR IDMenu
Definition: ntuser.h:731
POINT MousePos
Definition: winuser.h:3419
int iCtrlId
Definition: winuser.h:3416
DWORD_PTR dwContextId
Definition: winuser.h:3418
HANDLE hItemHandle
Definition: winuser.h:3417
int iContextType
Definition: winuser.h:3415
UINT cbSize
Definition: winuser.h:3414
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
#define WM_MOUSEWHEEL
Definition: treelist.c:96
uint16_t * PWSTR
Definition: typedefs.h:56
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
uint32_t ULONG
Definition: typedefs.h:59
#define DCX_KEEPCLIPRGN
Definition: undocuser.h:69
#define WM_NCUAHDRAWCAPTION
Definition: undocuser.h:48
#define DC_FRAME
Definition: undocuser.h:150
#define WM_CLIENTSHUTDOWN
Definition: undocuser.h:37
#define WM_POPUPSYSTEMMENU
Definition: undocuser.h:62
#define WM_CBT
Definition: undocuser.h:64
#define WM_NCUAHDRAWFRAME
Definition: undocuser.h:49
HDC FASTCALL IntBeginPaint(PWND Window, PPAINTSTRUCT Ps)
Definition: painting.c:1442
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:895
BOOL FASTCALL IntEndPaint(PWND Wnd, PPAINTSTRUCT Ps)
Definition: painting.c:1539
INT FASTCALL co_UserGetUpdateRgn(PWND Window, HRGN hRgn, BOOL bErase)
Definition: painting.c:1791
DWORD FASTCALL IntGetWindowContextHelpId(PWND pWnd)
Definition: window.c:440
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:124
PWND FASTCALL UserGetAncestor(PWND Wnd, UINT Type)
BOOLEAN co_UserDestroyWindow(PVOID Object)
Definition: window.c:2870
BOOL APIENTRY DefSetText(PWND Wnd, PCWSTR WindowText)
Definition: window.c:4390
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
FORCEINLINE BOOL RECTL_bIsEmptyRect(_In_ const RECTL *prcl)
Definition: rect.h:44
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2358
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2373
BOOL UserDrawIconEx(HDC hDc, INT xLeft, INT yTop, PCURICON_OBJECT pIcon, INT cxWidth, INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
Definition: cursoricon.c:1689
VOID co_IntShellHookNotify(WPARAM Message, WPARAM wParam, LPARAM lParam)
Definition: desktop.c:1709
PWND FASTCALL co_GetDesktopWindow(PWND pWnd)
Definition: desktop.c:1383
VOID FASTCALL IntNotifyWinEvent(DWORD Event, PWND pWnd, LONG idObject, LONG idChild, DWORD flags)
Definition: event.c:178
UINT FASTCALL DefWndGetHotKey(PWND pWnd)
Definition: hotkey.c:338
INT FASTCALL DefWndSetHotKey(PWND pWnd, WPARAM wParam)
Definition: hotkey.c:365
BYTE gafAsyncKeyState[256 *2/8]
Definition: keyboard.c:13
#define IS_KEY_DOWN(ks, vk)
Definition: input.h:103
INT FASTCALL IntMenuItemFromPoint(PWND pWnd, HMENU hMenu, POINT ptScreen)
Definition: menu.c:1518
PWND MENU_IsMenuActive(VOID)
Definition: menu.c:2650
void MENU_EndMenu(PWND pwnd)
Definition: menu.c:2662
void FASTCALL MENU_InitSysMenuPopup(PMENU menu, DWORD style, DWORD clsStyle, LONG HitTest)
Definition: menu.c:1362
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:210
LRESULT NC_HandleNCLButtonDown(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1575
VOID UserDrawCaptionBar(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:955
DWORD FASTCALL GetNCHitEx(PWND pWnd, POINT pt)
Definition: nonclient.c:1985
LRESULT NC_HandleNCActivate(PWND Wnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1438
LRESULT NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:1097
LRESULT NC_HandleNCCalcSize(PWND Wnd, WPARAM wparam, RECTL *Rect, BOOL Suspended)
Definition: nonclient.c:1304
LRESULT NC_HandleNCRButtonDown(PWND pwnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1725
LRESULT NC_HandleNCLButtonDblClk(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1667
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:644
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:731
LRESULT IntClientShutdown(IN PWND pWindow, IN WPARAM wParam, IN LPARAM lParam)
Definition: shutdown.c:22
BOOL g_bWindowSnapEnabled
Definition: sysparams.c:20
ULONG FASTCALL IntSetStyle(PWND pwnd, ULONG set_bits, ULONG clear_bits)
Definition: window.c:145
#define OBJID_WINDOW
Definition: winable.h:15
#define CHILDID_SELF
Definition: winable.h:14
LONG_PTR LPARAM
Definition: windef.h:208
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define WM_CTLCOLOR
Definition: windowsx.h:29
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299
#define DI_COMPAT
Definition: wingdi.h:68
#define NULLREGION
Definition: wingdi.h:361
#define DI_NORMAL
Definition: wingdi.h:72
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define DI_DEFAULTSIZE
Definition: wingdi.h:69
FORCEINLINE VOID co_IntUnsnapWindow(PWND Wnd)
Definition: winpos.h:89
FORCEINLINE BOOLEAN IntIsSnapAllowedForWindow(PWND Wnd)
Definition: winpos.h:101
#define WM_PAINT
Definition: winuser.h:1648
#define WM_GETHOTKEY
Definition: winuser.h:1681
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1800
#define WM_GETTEXTLENGTH
Definition: winuser.h:1647
#define SW_HIDE
Definition: winuser.h:779
#define VK_SNAPSHOT
Definition: winuser.h:2267
#define VK_TAB
Definition: winuser.h:2235
#define GA_ROOT
Definition: winuser.h:2891
#define MAKELPARAM(l, h)
Definition: winuser.h:4110
#define WM_KEYUP
Definition: winuser.h:1744
#define HTCAPTION
Definition: winuser.h:2512
#define DCX_WINDOW
Definition: winuser.h:2149
#define HELPINFO_MENUITEM
Definition: winuser.h:1182
#define VK_F10
Definition: winuser.h:2300
#define WM_SETHOTKEY
Definition: winuser.h:1680
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1689
#define WM_SYNCPAINT
Definition: winuser.h:1718
#define SC_PREVWINDOW
Definition: winuser.h:2627
#define VK_SPACE
Definition: winuser.h:2255
#define WM_CANCELMODE
Definition: winuser.h:1663
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1806
#define KF_ALTDOWN
Definition: winuser.h:2485
#define HTVSCROLL
Definition: winuser.h:2518
#define MA_ACTIVATE
Definition: winuser.h:2537
#define HTHSCROLL
Definition: winuser.h:2517
#define WM_APPCOMMAND
Definition: winuser.h:1910
#define WM_NCHITTEST
Definition: winuser.h:1714
#define WM_RBUTTONUP
Definition: winuser.h:1808
#define VK_UP
Definition: winuser.h:2261
#define SW_SHOWNOACTIVATE
Definition: winuser.h:785
#define WH_SHELL
Definition: winuser.h:40
#define WM_GETTEXT
Definition: winuser.h:1646
#define RDW_ERASE
Definition: winuser.h:1222
#define WM_CTLCOLORSCROLLBAR
Definition: winuser.h:1799
#define WA_INACTIVE
Definition: winuser.h:2664
#define MA_NOACTIVATE
Definition: winuser.h:2539
#define WM_DEVICECHANGE
Definition: winuser.h:1839
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1654
#define WM_CTLCOLORMSGBOX
Definition: winuser.h:1794
#define WM_NCLBUTTONDBLCLK
Definition: winuser.h:1722
#define WM_ACTIVATE
Definition: winuser.h:1640
#define WM_SHOWWINDOW
Definition: winuser.h:1656
#define WM_CTLCOLORBTN
Definition: winuser.h:1797
#define WM_SETTEXT
Definition: winuser.h:1645
#define SC_NEXTWINDOW
Definition: winuser.h:2626
#define DC_NC
Definition: winuser.h:440
#define DCX_INTERSECTRGN
Definition: winuser.h:2158
#define WM_NCACTIVATE
Definition: winuser.h:1716
#define WM_SYSCHAR
Definition: winuser.h:1749
#define VK_RETURN
Definition: winuser.h:2237
#define SM_CYICON
Definition: winuser.h:984
#define VK_RMENU
Definition: winuser.h:2323
#define RDW_ALLCHILDREN
Definition: winuser.h:1232
#define RDW_ERASENOW
Definition: winuser.h:1230
#define RDW_FRAME
Definition: winuser.h:1223
#define WM_SYSKEYUP
Definition: winuser.h:1748
#define HCBT_MOVESIZE
Definition: winuser.h:55
#define HTNOWHERE
Definition: winuser.h:2510
#define DC_TEXT
Definition: winuser.h:430
#define VK_LWIN
Definition: winuser.h:2271
struct tagHELPINFO HELPINFO
#define WM_MOUSEACTIVATE
Definition: winuser.h:1665
#define VK_F4
Definition: winuser.h:2294
#define VK_LEFT
Definition: winuser.h:2260
#define VK_RIGHT
Definition: winuser.h:2262
#define VK_DOWN
Definition: winuser.h:2263
#define WM_SETCURSOR
Definition: winuser.h:1664
#define KF_REPEAT
Definition: winuser.h:2486
#define WM_USER
Definition: winuser.h:1923
#define WM_CTLCOLORLISTBOX
Definition: winuser.h:1796
#define VK_SHIFT
Definition: winuser.h:2238
#define WM_NCRBUTTONUP
Definition: winuser.h:1724
#define WM_KEYDOWN
Definition: winuser.h:1743
#define WM_ICONERASEBKGND
Definition: winuser.h:1670
#define HTSYSMENU
Definition: winuser.h:2513
#define WM_PRINT
Definition: winuser.h:1908
#define WM_NCCALCSIZE
Definition: winuser.h:1713
#define CS_PARENTDC
Definition: winuser.h:664
#define SM_CXICON
Definition: winuser.h:983
#define RDW_VALIDATE
Definition: winuser.h:1229
#define WM_CTLCOLOREDIT
Definition: winuser.h:1795
#define VK_ESCAPE
Definition: winuser.h:2250
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1690
#define WM_CTLCOLORDLG
Definition: winuser.h:1798
#define CS_NOCLOSE
Definition: winuser.h:662
#define WM_SYSKEYDOWN
Definition: winuser.h:1747
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1720
#define RDW_INVALIDATE
Definition: winuser.h:1225
#define WM_PAINTICON
Definition: winuser.h:1669
#define VK_RWIN
Definition: winuser.h:2272
#define VK_LMENU
Definition: winuser.h:2322
#define VK_MENU
Definition: winuser.h:2240
#define WM_NCPAINT
Definition: winuser.h:1715
#define WM_NCRBUTTONDOWN
Definition: winuser.h:1723
#define WM_SETREDRAW
Definition: winuser.h:1644
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
_In_ ULONG _In_ BOOLEAN Active
Definition: potypes.h:564

Referenced by GetControlColor(), NtUserMessageCall(), PopupMenuWndProc(), and UserMessageWindowProc().

◆ UserPaintCaption()

BOOL UserPaintCaption ( PWND  pWnd,
INT  Flags 
)

Definition at line 398 of file defwnd.c.

399{
400 BOOL Ret = FALSE;
401
402 if ( (pWnd->style & WS_VISIBLE) && ((pWnd->style & WS_CAPTION) == WS_CAPTION) )
403 {
404 if (pWnd->state & WNDS_HASCAPTION && pWnd->head.pti->MessageQueue == gpqForeground)
405 Flags |= DC_ACTIVE;
406 /*
407 * When themes are not enabled we can go on and paint the non client area.
408 * However if we do that with themes enabled we will draw a classic frame.
409 * This is solved by sending a themes specific message to notify the themes
410 * engine that the caption needs to be redrawn.
411 */
413 {
414 /*
415 * This will cause uxtheme to either paint the themed caption or call
416 * RealUserDrawCaption in order to draw the classic caption when themes
417 * are disabled but the themes service is enabled.
418 */
419 TRACE("UDCB Flags %08x\n", Flags);
421 }
422 else
423 {
425 UserDrawCaptionBar(pWnd, hDC, Flags | DC_FRAME); // DCFRAME added as fix for CORE-10855.
426 UserReleaseDC(pWnd, hDC, FALSE);
427 }
428 Ret = TRUE;
429 }
430 // Support window tray
431 return Ret;
432}
#define DC_ACTIVE
Definition: dc21x4.h:120
#define SRVINFO_APIHOOK
Definition: ntuser.h:950
#define WNDS_HASCAPTION
Definition: ntuser.h:608
DWORD dwSRVIFlags
Definition: ntuser.h:1051

Referenced by DefWndSetIcon(), IntDefWindowProc(), IntEnableMenuItem(), IntNtUserSetClassLongPtr(), NtUserCallTwoParam(), RealDefWindowProcA(), and RealDefWindowProcW().