ReactOS  0.4.15-dev-5492-g47f3a4e
defwnd.c File Reference
#include <win32k.h>
#include <windowsx.h>
Include dependency graph for defwnd.c:

Go to the source code of this file.

Macros

#define ID_NEXTLAYOUT   10003
 

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)
 
VOID FASTCALL DefWndScreenshot (PWND pWnd)
 
LRESULT FASTCALL IntDefWindowProc (PWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam, BOOL Ansi)
 

Macro Definition Documentation

◆ ID_NEXTLAYOUT

#define ID_NEXTLAYOUT   10003

Function Documentation

◆ co_IntFindChildWindowToOwner()

PWND FASTCALL co_IntFindChildWindowToOwner ( PWND  Root,
PWND  Owner 
)

Definition at line 217 of file defwnd.c.

218 {
219  PWND Ret;
220  PWND Child, OwnerWnd;
221 
222  for(Child = Root->spwndChild; Child; Child = Child->spwndNext)
223  {
224  OwnerWnd = Child->spwndOwner;
225  if(!OwnerWnd)
226  continue;
227 
228  if (!(Child->style & WS_POPUP) ||
229  !(Child->style & WS_VISIBLE) ||
230  /* Fixes CMD pop up properties window from having foreground. */
231  Owner->head.pti->MessageQueue != Child->head.pti->MessageQueue)
232  continue;
233 
234  if(OwnerWnd == Owner)
235  {
236  Ret = Child;
237  return Ret;
238  }
239  }
240  return NULL;
241 }
_Must_inspect_result_ _In_ WDFDEVICE _In_ WDFDEVICE Child
Definition: wdffdo.h:533
struct _WND * spwndOwner
Definition: ntuser.h:710
root entry for file system trees
Definition: entries.h:148
Definition: ntuser.h:688
#define WS_POPUP
Definition: pedump.c:616
_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:1597
#define NULL
Definition: types.h:112
#define WS_VISIBLE
Definition: pedump.c:620

Referenced by DefWndHandleSetCursor().

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( UserDefwnd  )

◆ DefWndControlColor()

HBRUSH FASTCALL DefWndControlColor ( HDC  hDC,
UINT  ctlType 
)

Definition at line 33 of file defwnd.c.

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

Referenced by IntDefWindowProc(), and User32DefWindowProc().

◆ DefWndGetIcon()

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

Definition at line 477 of file defwnd.c.

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

Referenced by IntDefWindowProc(), and User32DefWindowProc().

◆ DefWndHandleSetCursor()

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

Definition at line 244 of file defwnd.c.

245 {
246  PWND pwndPopUP = NULL;
247  WORD Msg = HIWORD(lParam);
248 
249  /* Not for child windows. */
250  if (UserHMGetHandle(pWnd) != (HWND)wParam)
251  {
252  return FALSE;
253  }
254 
255  switch((short)LOWORD(lParam))
256  {
257  case HTERROR:
258  {
261 
262  if (Msg == WM_LBUTTONDOWN)
263  {
264  // Find a pop up window to bring active.
266  if (pwndPopUP)
267  {
268  // Not a child pop up from desktop.
269  if ( pwndPopUP != UserGetDesktopWindow()->spwndChild )
270  {
271  // Get original active window.
272  PWND pwndOrigActive = gpqForeground->spwndActive;
273 
275 
276  UserRefObjectCo(pwndPopUP, &Ref);
277  //UserSetActiveWindow(pwndPopUP);
278  co_IntSetForegroundWindow(pwndPopUP); // HACK
279  UserDerefObjectCo(pwndPopUP);
280 
281  // If the change was made, break out.
282  if (pwndOrigActive != gpqForeground->spwndActive)
283  break;
284  }
285  }
286  }
288  if (Msg == WM_LBUTTONDOWN || Msg == WM_MBUTTONDOWN ||
289  Msg == WM_RBUTTONDOWN || Msg == WM_XBUTTONDOWN)
290  {
291  if (pwndPopUP)
292  {
293  FLASHWINFO fwi =
294  {sizeof(FLASHWINFO),
295  UserHMGetHandle(pwndPopUP),
296  FLASHW_ALL,
298  (gpsi->dtCaretBlink >> 3)};
299 
300  // Now shake that window!
301  IntFlashWindowEx(pwndPopUP, &fwi);
302  }
304  }
305  break;
306  }
307 
308  case HTCLIENT:
309  {
310  if (pWnd->pcls->spcur)
311  {
312  IntSystemSetCursor(pWnd->pcls->spcur);
313  }
314  return FALSE;
315  }
316 
317  case HTLEFT:
318  case HTRIGHT:
319  {
320  if (pWnd->style & WS_MAXIMIZE)
321  {
322  break;
323  }
324  IntSystemSetCursor(SYSTEMCUR(SIZEWE));
325  return TRUE;
326  }
327 
328  case HTTOP:
329  case HTBOTTOM:
330  {
331  if (pWnd->style & WS_MAXIMIZE)
332  {
333  break;
334  }
335  IntSystemSetCursor(SYSTEMCUR(SIZENS));
336  return TRUE;
337  }
338 
339  case HTTOPLEFT:
340  case HTBOTTOMRIGHT:
341  {
342  if (pWnd->style & WS_MAXIMIZE)
343  {
344  break;
345  }
346  IntSystemSetCursor(SYSTEMCUR(SIZENWSE));
347  return TRUE;
348  }
349 
350  case HTBOTTOMLEFT:
351  case HTTOPRIGHT:
352  {
353  if (pWnd->style & WS_MAXIMIZE)
354  {
355  break;
356  }
357  IntSystemSetCursor(SYSTEMCUR(SIZENESW));
358  return TRUE;
359  }
360  }
362  return FALSE;
363 }
PUSER_MESSAGE_QUEUE gpqForeground
Definition: focus.c:13
BOOL FASTCALL IntFlashWindowEx(PWND pWnd, PFLASHWINFO pfwi)
Definition: painting.c:1304
#define HTTOP
Definition: winuser.h:2480
#define HTLEFT
Definition: winuser.h:2477
BOOL FASTCALL UserPostMessage(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1346
PCURICON_OBJECT IntSystemSetCursor(PCURICON_OBJECT pcurNew)
Definition: cursoricon.c:230
#define WM_LBUTTONDOWN
Definition: winuser.h:1766
#define TRUE
Definition: types.h:120
DWORD dwForegroundFlashCount
Definition: sysparams.h:157
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1748
PSERVERINFO gpsi
Definition: imm.c:18
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:27
#define HTBOTTOMLEFT
Definition: winuser.h:2484
struct _CURICON_OBJECT * spcur
Definition: ntuser.h:581
#define HTRIGHT
Definition: winuser.h:2479
WPARAM wParam
Definition: combotst.c:138
#define HTTOPLEFT
Definition: winuser.h:2481
PWND FASTCALL co_IntFindChildWindowToOwner(PWND Root, PWND Owner)
Definition: defwnd.c:217
#define FALSE
Definition: types.h:117
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:40
Definition: object.h:3
#define HTERROR
Definition: winuser.h:2462
#define WM_RBUTTONDOWN
Definition: winuser.h:1769
HWND hwndSAS
Definition: winsta.c:24
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define HTTOPRIGHT
Definition: winuser.h:2482
#define SWP_NOACTIVATE
Definition: winuser.h:1232
unsigned short WORD
Definition: ntddk_ex.h:93
SPIVALUES gspv
Definition: sysparams.c:17
#define HTBOTTOM
Definition: winuser.h:2483
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1386
#define WM_LOGONNOTIFY
Definition: undocuser.h:37
#define HTBOTTOMRIGHT
Definition: winuser.h:2485
#define SWP_NOSIZE
Definition: winuser.h:1235
Definition: ntuser.h:688
#define WM_MBUTTONDOWN
Definition: winuser.h:1772
#define NULL
Definition: types.h:112
#define HIWORD(l)
Definition: typedefs.h:247
#define SYSTEMCUR(func)
Definition: cursoricon.h:129
#define SWP_NOMOVE
Definition: winuser.h:1234
#define LN_MESSAGE_BEEP
Definition: undocuser.h:120
#define HTCLIENT
Definition: winuser.h:2465
BOOL FASTCALL co_IntSetForegroundWindow(PWND Window)
Definition: focus.c:1550
struct @1595 Msg[]
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
PCLS pcls
Definition: ntuser.h:715
#define WS_MAXIMIZE
Definition: pedump.c:623
DWORD style
Definition: ntuser.h:701

Referenced by IntDefWindowProc().

◆ DefWndHandleSysCommand()

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

Definition at line 126 of file defwnd.c.

127 {
128  LRESULT lResult = 0;
129  BOOL Hook = FALSE;
130 
131  if (ISITHOOKED(WH_CBT) || (pWnd->head.rpdesk->pDeskInfo->fsHooks & HOOKID_TO_FLAG(WH_CBT)))
132  {
133  Hook = TRUE;
135 
136  if (lResult) return lResult;
137  }
138 
139  switch (wParam & 0xfff0)
140  {
141  case SC_MOVE:
142  case SC_SIZE:
143  DefWndDoSizeMove(pWnd, wParam);
144  break;
145 
146  case SC_MINIMIZE:
147  if (UserHMGetHandle(pWnd) == UserGetActiveWindow())
148  IntShowOwnedPopups(pWnd,FALSE); // This is done in ShowWindow! Need to retest!
150  break;
151 
152  case SC_MAXIMIZE:
153  if (((pWnd->style & WS_MINIMIZE) != 0) && UserHMGetHandle(pWnd) == UserGetActiveWindow())
154  IntShowOwnedPopups(pWnd,TRUE);
156  break;
157 
158  case SC_RESTORE:
159  if (((pWnd->style & WS_MINIMIZE) != 0) && UserHMGetHandle(pWnd) == UserGetActiveWindow())
160  IntShowOwnedPopups(pWnd,TRUE);
162  break;
163 
164  case SC_CLOSE:
165  return co_IntSendMessage(UserHMGetHandle(pWnd), WM_CLOSE, 0, 0);
166 
167  case SC_SCREENSAVE:
168  ERR("Screensaver Called!\n");
169  UserPostMessage(hwndSAS, WM_LOGONNOTIFY, LN_START_SCREENSAVE, 0); // always lParam 0 == not Secure
170  break;
171 
172  case SC_HOTKEY:
173  {
175 
176  pWnd = ValidateHwndNoErr((HWND)lParam);
177  if (pWnd)
178  {
179  if (pWnd->spwndLastActive)
180  {
181  pWnd = pWnd->spwndLastActive;
182  }
183  UserRefObjectCo(pWnd, &Ref);
185  UserDerefObjectCo(pWnd);
186  if (pWnd->style & WS_MINIMIZE)
187  {
189  }
190  }
191  }
192  break;
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 
208  default:
209  // We do not support anything else here so we should return normal even when sending a hook.
210  return 0;
211  }
212 
213  return(Hook ? 1 : 0); // Don't call us again from user space.
214 }
#define HCBT_SYSCOMMAND
Definition: winuser.h:63
BOOL FASTCALL UserPostMessage(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1346
#define HOOKID_TO_FLAG(HookId)
Definition: hook.h:5
#define SC_KEYMENU
Definition: winuser.h:2586
struct _DESKTOP * rpdesk
Definition: ntuser.h:194
#define SC_RESTORE
Definition: winuser.h:2588
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
#define TRUE
Definition: types.h:120
HWND FASTCALL UserGetActiveWindow(VOID)
Definition: focus.c:1429
#define SC_SCREENSAVE
Definition: mmsystem.h:933
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:27
BOOL FASTCALL IntShowOwnedPopups(PWND OwnerWnd, BOOL fShow)
Definition: window.c:4656
#define SC_HOTKEY
Definition: winuser.h:2591
#define SC_MOUSEMENU
Definition: winuser.h:2585
#define SW_RESTORE
Definition: winuser.h:773
WPARAM wParam
Definition: combotst.c:138
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
#define FALSE
Definition: types.h:117
#define WS_MINIMIZE
Definition: pedump.c:622
unsigned int BOOL
Definition: ntddk_ex.h:94
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:40
#define SC_MAXIMIZE
Definition: winuser.h:2578
THRDESKHEAD head
Definition: ntuser.h:690
#define LN_START_SCREENSAVE
Definition: undocuser.h:121
Definition: object.h:3
#define WH_CBT
Definition: winuser.h:35
BOOLEAN FASTCALL co_WinPosShowWindow(PWND Wnd, INT Cmd)
Definition: winpos.c:2518
HWND hwndSAS
Definition: winsta.c:24
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ValidateHwndNoErr(hwnd)
Definition: precomp.h:84
#define WM_CLOSE
Definition: winuser.h:1611
#define ISITHOOKED(HookId)
Definition: hook.h:6
#define SW_MINIMIZE
Definition: winuser.h:770
LRESULT APIENTRY co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
Definition: hook.c:1103
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
#define WM_LOGONNOTIFY
Definition: undocuser.h:37
#define SC_MINIMIZE
Definition: winuser.h:2576
#define ERR(fmt,...)
Definition: debug.h:110
VOID MENU_TrackKbdMenuBar(PWND pwnd, UINT wParam, WCHAR wChar)
Definition: menu.c:4500
struct _WND * spwndLastActive
Definition: ntuser.h:734
VOID FASTCALL DefWndDoSizeMove(PWND pwnd, WORD wParam)
Definition: nonclient.c:239
#define SC_SIZE
Definition: winuser.h:2574
#define SC_MOVE
Definition: winuser.h:2575
#define SC_CLOSE
Definition: winuser.h:2582
#define HIWORD(l)
Definition: typedefs.h:247
VOID MENU_TrackMouseMenuBar(PWND pWnd, ULONG ht, POINT pt)
Definition: menu.c:4470
LONG_PTR LRESULT
Definition: windef.h:209
BOOL FASTCALL co_IntSetForegroundWindow(PWND Window)
Definition: focus.c:1550
#define SW_MAXIMIZE
Definition: winuser.h:766
#define WM_SYSCOMMAND
Definition: winuser.h:1731
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
DWORD style
Definition: ntuser.h:701

Referenced by IntDefWindowProc(), and User32DefWindowProc().

◆ DefWndHandleWindowPosChanged()

LRESULT FASTCALL DefWndHandleWindowPosChanged ( PWND  pWnd,
WINDOWPOS Pos 
)

Definition at line 96 of file defwnd.c.

97 {
98  RECT Rect;
99  LONG style = pWnd->style;
100 
101  IntGetClientRect(pWnd, &Rect);
102  IntMapWindowPoints(pWnd, (style & WS_CHILD ? IntGetParent(pWnd) : NULL), (LPPOINT) &Rect, 2);
103 
104  if (!(Pos->flags & SWP_NOCLIENTMOVE))
105  {
107  }
108 
109  if (!(Pos->flags & SWP_NOCLIENTSIZE) || (Pos->flags & SWP_STATECHANGED))
110  {
112  else
113  {
115  co_IntSendMessage(UserHMGetHandle(pWnd), WM_SIZE, wp, MAKELONG(Rect.right - Rect.left, Rect.bottom - Rect.top));
116  }
117  }
118  return 0;
119 }
#define SIZE_MAXIMIZED
Definition: winuser.h:2497
#define SIZE_RESTORED
Definition: winuser.h:2495
ush Pos
Definition: deflate.h:92
#define WM_MOVE
Definition: winuser.h:1600
UINT_PTR WPARAM
Definition: windef.h:207
#define WS_CHILD
Definition: pedump.c:617
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:91
#define WS_MINIMIZE
Definition: pedump.c:622
long LONG
Definition: pedump.c:60
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define WM_SIZE
Definition: winuser.h:1601
#define SWP_STATECHANGED
Definition: msg.c:42
#define SIZE_MINIMIZED
Definition: winuser.h:2496
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:208
INT FASTCALL IntMapWindowPoints(PWND FromWnd, PWND ToWnd, LPPOINT lpPoints, UINT cPoints)
Definition: winpos.c:143
#define NULL
Definition: types.h:112
#define SWP_NOCLIENTMOVE
Definition: msg.h:30
Arabic default style
Definition: afstyles.h:93
#define SWP_NOCLIENTSIZE
Definition: msg.h:29
struct Rect Rect
#define WS_MAXIMIZE
Definition: pedump.c:623
DWORD style
Definition: ntuser.h:701

Referenced by IntDefWindowProc().

◆ DefWndHandleWindowPosChanging()

LRESULT FASTCALL DefWndHandleWindowPosChanging ( PWND  pWnd,
WINDOWPOS Pos 
)

Definition at line 69 of file defwnd.c.

70 {
71  POINT maxTrack, minTrack;
72  LONG style = pWnd->style;
73 
74  if (Pos->flags & SWP_NOSIZE) return 0;
75  if ((style & WS_THICKFRAME) || ((style & (WS_POPUP | WS_CHILD)) == 0))
76  {
77  co_WinPosGetMinMaxInfo(pWnd, NULL, NULL, &minTrack, &maxTrack);
78  Pos->cx = min(Pos->cx, maxTrack.x);
79  Pos->cy = min(Pos->cy, maxTrack.y);
80  if (!(style & WS_MINIMIZE))
81  {
82  if (Pos->cx < minTrack.x) Pos->cx = minTrack.x;
83  if (Pos->cy < minTrack.y) Pos->cy = minTrack.y;
84  }
85  }
86  else
87  {
88  Pos->cx = max(Pos->cx, 0);
89  Pos->cy = max(Pos->cy, 0);
90  }
91  return 0;
92 }
#define WS_THICKFRAME
Definition: pedump.c:630
#define max(a, b)
Definition: svc.c:63
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
ush Pos
Definition: deflate.h:92
#define WS_CHILD
Definition: pedump.c:617
#define WS_MINIMIZE
Definition: pedump.c:622
long LONG
Definition: pedump.c:60
UINT FASTCALL co_WinPosGetMinMaxInfo(PWND Window, POINT *MaxSize, POINT *MaxPos, POINT *MinTrack, POINT *MaxTrack)
Definition: winpos.c:933
#define SWP_NOSIZE
Definition: winuser.h:1235
#define min(a, b)
Definition: monoChain.cc:55
#define WS_POPUP
Definition: pedump.c:616
#define NULL
Definition: types.h:112
Arabic default style
Definition: afstyles.h:93
DWORD style
Definition: ntuser.h:701

Referenced by IntDefWindowProc().

◆ DefWndPrint()

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

Definition at line 366 of file defwnd.c.

367 {
368  /*
369  * Visibility flag.
370  */
371  if ( (uFlags & PRF_CHECKVISIBLE) &&
372  !IntIsWindowVisible(pwnd) )
373  return;
374 
375  /*
376  * Unimplemented flags.
377  */
378  if ( (uFlags & PRF_CHILDREN) ||
379  (uFlags & PRF_OWNED) ||
380  (uFlags & PRF_NONCLIENT) )
381  {
382  FIXME("WM_PRINT message with unsupported flags\n");
383  }
384 
385  /*
386  * Background
387  */
388  if ( uFlags & PRF_ERASEBKGND)
390 
391  /*
392  * Client area
393  */
394  if ( uFlags & PRF_CLIENT)
396 }
UINT_PTR WPARAM
Definition: windef.h:207
UINT uFlags
Definition: api.c:59
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define FIXME(fmt,...)
Definition: debug.h:111
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define PRF_ERASEBKGND
Definition: winuser.h:2516
#define PRF_NONCLIENT
Definition: winuser.h:2514
#define PRF_CHECKVISIBLE
Definition: winuser.h:2513
BOOL FASTCALL IntIsWindowVisible(PWND Wnd)
Definition: window.c:193
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
HDC hdc
Definition: main.c:9
#define PRF_OWNED
Definition: winuser.h:2518
#define WM_ERASEBKGND
Definition: winuser.h:1615
#define PRF_CLIENT
Definition: winuser.h:2515
#define PRF_CHILDREN
Definition: winuser.h:2517

Referenced by IntDefWindowProc().

◆ DefWndScreenshot()

VOID FASTCALL DefWndScreenshot ( PWND  pWnd)

Definition at line 500 of file defwnd.c.

501 {
502  RECT rect;
503  HDC hdc;
504  INT w;
505  INT h;
507  HDC hdc2;
508  SETCLIPBDATA scd = {FALSE, FALSE};
509 
512 
513  hdc = UserGetWindowDC(pWnd);
514  IntGetWindowRect(pWnd, &rect);
515  w = rect.right - rect.left;
516  h = rect.bottom - rect.top;
517 
521 
522  NtGdiBitBlt(hdc2, 0, 0, w, h, hdc, 0, 0, SRCCOPY, 0, 0);
523 
525 
526  UserReleaseDC(pWnd, hdc, FALSE);
527  UserReleaseDC(pWnd, hdc2, FALSE);
528 
530 }
GLubyte GLubyte GLubyte GLubyte w
Definition: glext.h:6102
__kernel_entry W32KAPI HBITMAP APIENTRY NtGdiCreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
static HDC
Definition: imagelist.c:92
__kernel_entry W32KAPI HBITMAP APIENTRY NtGdiSelectBitmap(_In_ HDC hdc, _In_ HBITMAP hbm)
HDC FASTCALL UserGetWindowDC(PWND Wnd)
Definition: windc.c:947
BOOL NTAPI UserOpenClipboard(HWND hWnd)
Definition: clipboard.c:488
int32_t INT
Definition: typedefs.h:58
& rect
Definition: startmenu.cpp:1413
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
HDC hdc2
Definition: SelectObject.c:10
#define FALSE
Definition: types.h:117
BOOL NTAPI UserCloseClipboard(VOID)
Definition: clipboard.c:545
#define CF_BITMAP
Definition: constants.h:397
__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)
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
HDC hdc
Definition: main.c:9
__kernel_entry W32KAPI HDC APIENTRY NtGdiCreateCompatibleDC(_In_opt_ HDC hdc)
BOOL NTAPI UserEmptyClipboard(VOID)
Definition: clipboard.c:680
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
static HBITMAP hbitmap
static HBITMAP
Definition: button.c:44
#define SRCCOPY
Definition: wingdi.h:333
HANDLE NTAPI UserSetClipboardData(UINT fmt, HANDLE hData, PSETCLIPBDATA scd)
Definition: clipboard.c:1023
BOOL FASTCALL IntGetWindowRect(PWND Wnd, RECTL *Rect)
Definition: winpos.c:120

Referenced by IntDefWindowProc().

◆ DefWndSetIcon()

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

Definition at line 438 of file defwnd.c.

439 {
440  HICON hIcon, hIconSmall, hIconOld;
441 
442  if ( wParam > ICON_SMALL2 )
443  {
445  return 0;
446  }
447  hIconSmall = UserGetProp(pWnd, gpsi->atomIconSmProp, TRUE);
449 
450  hIconOld = wParam == ICON_BIG ? hIcon : hIconSmall;
451 
452  switch(wParam)
453  {
454  case ICON_BIG:
455  hIcon = (HICON)lParam;
456  break;
457  case ICON_SMALL:
458  hIconSmall = (HICON)lParam;
459  break;
460  case ICON_SMALL2:
461  ERR("FIXME: Set ICON_SMALL2 support!\n");
462  default:
463  break;
464  }
465 
466  UserSetProp(pWnd, gpsi->atomIconProp, hIcon, TRUE);
467  UserSetProp(pWnd, gpsi->atomIconSmProp, hIconSmall, TRUE);
468 
469  if ((pWnd->style & WS_CAPTION ) == WS_CAPTION)
470  UserPaintCaption(pWnd, DC_ICON);
471 
472  return (LRESULT)hIconOld;
473 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
static HICON
Definition: imagelist.c:84
#define TRUE
Definition: types.h:120
PSERVERINFO gpsi
Definition: imm.c:18
WPARAM wParam
Definition: combotst.c:138
#define DC_ICON
Definition: winuser.h:429
#define ICON_SMALL
Definition: tnclass.cpp:48
#define WS_CAPTION
Definition: pedump.c:624
HANDLE FASTCALL UserGetProp(_In_ PWND Window, _In_ ATOM Atom, _In_ BOOLEAN SystemProp)
Definition: prop.c:46
ATOM atomIconProp
Definition: ntuser.h:1061
#define ERR(fmt,...)
Definition: debug.h:110
HICON hIcon
Definition: msconfig.c:44
ATOM atomIconSmProp
Definition: ntuser.h:1060
BOOL UserPaintCaption(PWND pWnd, INT Flags)
Definition: defwnd.c:399
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:28
#define ICON_BIG
Definition: tnclass.cpp:51
DWORD style
Definition: ntuser.h:701

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;
1084  TEXTMETRICW tm;
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
1115  GetTextMetricsW(hdc, &tm);
1116 #endif
1117  if (flags & DT_EXTERNALLEADING)
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  {
1194  DeleteObject(hrgn);
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_
1297  ExFreePoolWithTag(retstr, USERTAG_RTL);
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_
1319  ExFreePoolWithTag(retstr, USERTAG_RTL);
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  {
1370  DeleteObject(hrgn);
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_
1395  ExFreePoolWithTag(retstr, USERTAG_RTL);
1396 #else
1397  HeapFree (GetProcessHeap(), 0, retstr);
1398 #endif
1399  }
1400  return y - rect->top;
1401 }
__kernel_entry W32KAPI HRGN APIENTRY NtGdiCreateRectRgn(_In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
#define DT_EXPANDTABS
Definition: winuser.h:532
GLint GLint GLsizei width
Definition: gl.h:1546
#define DT_TABSTOP
Definition: winuser.h:541
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1158
static void TEXT_DrawUnderscore(HDC hdc, int x, int y, const WCHAR *str, int offset, const RECT *rect)
Definition: text.c:894
#define DT_RTLREADING
Definition: winuser.h:539
__kernel_entry W32KAPI INT APIENTRY NtGdiIntersectClipRect(_In_ HDC hdc, _In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
Definition: cliprgn.c:486
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
#define TRUE
Definition: types.h:120
__kernel_entry W32KAPI INT APIENTRY NtGdiExtSelectClipRgn(_In_ HDC hdc, _In_opt_ HRGN hrgn, _In_ INT iMode)
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define DT_WORDBREAK
Definition: winuser.h:544
BOOL FASTCALL GreGetTextExtentW(HDC hDC, LPCWSTR lpwsz, INT cwc, LPSIZE psize, UINT flOpts)
Definition: text.c:78
int WINAPI IntersectClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI GreGetViewportExtEx(_In_ HDC hdc, _Out_ LPSIZE lpSize)
Definition: coord.c:1416
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define DT_RIGHT
Definition: winuser.h:538
if(dx==0 &&dy==0)
Definition: linetemp.h:174
& rect
Definition: startmenu.cpp:1413
#define FALSE
Definition: types.h:117
#define DT_CALCRECT
Definition: winuser.h:526
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TAB
Definition: text.c:109
BOOL WINAPI ExtTextOutW(_In_ HDC hdc, _In_ INT x, _In_ INT y, _In_ UINT fuOptions, _In_opt_ const RECT *lprc, _In_reads_opt_(cwc) LPCWSTR lpString, _In_ UINT cwc, _In_reads_opt_(cwc) const INT *lpDx)
Definition: text.c:492
const WCHAR * str
Definition: parser.c:48
#define assert(e)
Definition: text.c:47
#define ETO_CLIPPED
Definition: wingdi.h:648
#define DT_VCENTER
Definition: winuser.h:543
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
BOOL WINAPI GetViewportExtEx(_In_ HDC, _Out_ LPSIZE)
Definition: coord.c:351
BOOL WINAPI GreGetTextMetricsW(_In_ HDC hdc, _Out_ LPTEXTMETRICW lptm)
Definition: text.c:193
__wchar_t WCHAR
Definition: xmlstorage.h:180
int WINAPI GetGraphicsMode(_In_ HDC)
BOOL WINAPI GetWindowExtEx(_In_ HDC, _Out_ LPSIZE)
Definition: coord.c:411
const char * wine_dbgstr_rect(const RECT *rect)
#define CLIPRGN
Definition: precomp.h:18
int iRightMargin
Definition: winuser.h:3090
GLbitfield flags
Definition: glext.h:7161
#define GM_COMPATIBLE
Definition: wingdi.h:864
#define ExAllocatePoolWithTag(hernya, size, tag)
Definition: env_spec_w32.h:350
BOOL UserExtTextOutW(HDC hdc, INT x, INT y, UINT flags, PRECTL lprc, LPCWSTR lpString, UINT count)
BOOL WINAPI GetTextMetricsW(_In_ HDC hdc, _Out_ LPTEXTMETRICW lptm)
Definition: text.c:221
HDC hdc
Definition: main.c:9
static HRGN hrgn
Definition: win.c:55
BOOL APIENTRY GetTextExtentPointW(_In_ HDC hdc, _In_reads_(cchString) LPCWSTR lpString, _In_ INT cchString, _Out_ LPSIZE lpsz)
Definition: text.c:268
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
Definition: time.h:68
IN PCTCH line
Definition: pager.h:36
#define debugstr_wn
Definition: kernel32.h:33
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 RGN_COPY
Definition: wingdi.h:357
BOOL WINAPI GdiFlush(void)
Definition: misc.c:44
#define DT_NOCLIP
Definition: winuser.h:536
#define DT_SINGLELINE
Definition: winuser.h:540
#define DT_EXTERNALLEADING
Definition: winuser.h:533
BOOL WINAPI GreGetWindowExtEx(_In_ HDC hdc, _Out_ LPSIZE lpSize)
Definition: coord.c:1407
#define NULL
Definition: types.h:112
__kernel_entry W32KAPI INT APIENTRY NtGdiGetRandomRgn(_In_ HDC hdc, _In_ HRGN hrgn, _In_ INT iRgn)
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define USERTAG_RTL
Definition: tags.h:270
UINT uiLengthDrawn
Definition: winuser.h:3091
#define DT_CENTER
Definition: winuser.h:527
int WINAPI GetClipRgn(_In_ HDC, _In_ HRGN)
GLfloat GLfloat p
Definition: glext.h:8902
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define DT_BOTTOM
Definition: winuser.h:525
LONG cy
Definition: windef.h:335
#define HeapFree(x, y, z)
Definition: compat.h:735
#define MAX_BUFFER
Definition: text.c:1065
#define DT_EDITCONTROL
Definition: winuser.h:528
int FASTCALL GreGetGraphicsMode(HDC)
Definition: dcutil.c:306

Referenced by DrawTextW().

◆ DrawTextW()

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

Definition at line 17 of file defwnd.c.

18 {
19  DRAWTEXTPARAMS dtp;
20 
21  memset (&dtp, 0, sizeof(dtp));
22  dtp.cbSize = sizeof(dtp);
23  if (flags & DT_TABSTOP)
24  {
25  dtp.iTabLength = (flags >> 8) & 0xff;
26  flags &= 0xffff00ff;
27  }
28  return DrawTextExWorker(hdc, (LPWSTR)str, count, rect, flags, &dtp);
29 }
#define DT_TABSTOP
Definition: winuser.h:541
GLuint GLuint GLsizei count
Definition: gl.h:1545
& rect
Definition: startmenu.cpp:1413
const WCHAR * str
INT WINAPI DrawTextExWorker(HDC hdc, LPWSTR str, INT i_count, LPRECT rect, UINT flags, LPDRAWTEXTPARAMS dtp)
Definition: text.c:1071
GLbitfield flags
Definition: glext.h:7161
HDC hdc
Definition: main.c:9
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define memset(x, y, z)
Definition: compat.h:39

Referenced by _check_txgetnaturalsize(), BUTTON_CalcLabelRect(), BUTTON_DrawTextCallback(), calc_tabbed_width(), calc_width(), ProgressDlg::CalcTextRect(), CB_ThemedPaint(), CFn_WMPaint(), ConfirmMsgBox_Init(), ConfirmMsgBox_Paint(), CreateLayoutIcon(), DATETIME_Refresh(), DECLARE_INTERFACE_(), default_page_paint_hook(), DlgProc(), DoTestEntry(), DrawProc(), DrawShadowText(), DrawStatusTextW(), DrawTextFromResource(), DrawThemeText(), EditTypeDlg_OnDrawItem(), FillGrid(), GetThemeTextExtent(), Graph_DrawCpuUsageGraph(), Graph_DrawMemUsageGraph(), HEADER_DrawItem(), ICONTITLE_Paint(), ICONTITLE_SetTitlePos(), ImageView_DrawImage(), IPADDRESS_Draw(), LISTVIEW_DrawItemPart(), LISTVIEW_GetItemMetrics(), LrgCellWndProc(), MainWnd_OnDrawItem(), MENU_CalcItemSize(), MENU_DrawMenuItem(), MONTHCAL_DrawDay(), MONTHCAL_PaintCalendar(), MONTHCAL_PaintTitle(), MONTHCAL_PaintTodayTitle(), MONTHCAL_PaintWeeknumbers(), MonthCalPaint(), MyDrawCaptionTemp(), MyDrawMenuBarTemp(), NT5_DrawLogoffCaptionText(), CAutoComplete::OnDrawItem(), CCell::OnPaint(), OnPaint(), OSK_Paint(), output_number(), output_tabbed_text(), output_text(), PAINTING_DrawStateJam(), PaintText(), ProgressDlg::ProcessWindowMessage(), PROPSHEET_Paint(), REBAR_DrawBand(), ScrollProc(), SoftModalMessageBox(), STATIC_PaintTextfn(), TAB_DrawItemInterior(), taskdialog_get_text_extent(), test_DrawTextCalcRect(), TOOLBAR_CustomizeDialogProc(), TOOLBAR_DrawString(), TOOLBAR_MeasureString(), TOOLTIPS_CalcTipSize(), TOOLTIPS_Refresh(), TREEVIEW_CreateDragImage(), UserDrawCaptionText(), and WndProc().

◆ IntDefWindowProc()

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

Definition at line 537 of file defwnd.c.

543 {
545  LRESULT lResult = 0;
547  BOOL IsTaskBar;
548  DWORD Style;
549  DWORD ExStyle;
550 
551  if (Msg > WM_USER) return 0;
552 
553  switch (Msg)
554  {
555  case WM_DEVICECHANGE:
556  return TRUE;
557 
558  case WM_GETTEXTLENGTH:
559  {
560  PWSTR buf;
561  ULONG len;
562 
563  if (Wnd != NULL && Wnd->strName.Length != 0)
564  {
565  buf = Wnd->strName.Buffer;
566  if (buf != NULL &&
568  buf,
569  Wnd->strName.Length)))
570  {
571  lResult = (LRESULT) (Wnd->strName.Length / sizeof(WCHAR));
572  }
573  }
574  else lResult = 0L;
575 
576  break;
577  }
578 
579  case WM_GETTEXT: // FIXME: Handle Ansi
580  {
581  PWSTR buf = NULL;
582  PWSTR outbuf = (PWSTR)lParam;
583 
584  if (Wnd != NULL && wParam != 0)
585  {
586  if (Wnd->strName.Buffer != NULL)
587  buf = Wnd->strName.Buffer;
588  else
589  outbuf[0] = L'\0';
590 
591  if (buf != NULL)
592  {
593  if (Wnd->strName.Length != 0)
594  {
595  lResult = min(Wnd->strName.Length / sizeof(WCHAR), wParam - 1);
596  RtlCopyMemory(outbuf,
597  buf,
598  lResult * sizeof(WCHAR));
599  outbuf[lResult] = L'\0';
600  }
601  else
602  outbuf[0] = L'\0';
603  }
604  }
605  break;
606  }
607 
608  case WM_SETTEXT: // FIXME: Handle Ansi
609  {
610  DefSetText(Wnd, (PCWSTR)lParam);
611 
612  if ((Wnd->style & WS_CAPTION) == WS_CAPTION)
614  IntNotifyWinEvent(EVENT_OBJECT_NAMECHANGE, Wnd, OBJID_WINDOW, CHILDID_SELF, 0);
615  lResult = 1;
616  break;
617  }
618 
619  case WM_SYSCOMMAND:
620  {
621  TRACE("hwnd %p WM_SYSCOMMAND %lx %lx\n", Wnd->head.h, wParam, lParam );
622  lResult = DefWndHandleSysCommand(Wnd, wParam, lParam);
623  break;
624  }
625 
626  case WM_SHOWWINDOW:
627  {
628  if ((Wnd->style & WS_VISIBLE) && wParam) break;
629  if (!(Wnd->style & WS_VISIBLE) && !wParam) break;
630  if (!Wnd->spwndOwner) break;
631  if (LOWORD(lParam))
632  {
634  }
635  break;
636  }
637 
638  case WM_CLIENTSHUTDOWN:
639  return IntClientShutdown(Wnd, wParam, lParam);
640 
641  case WM_APPCOMMAND:
642  if ( (Wnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD &&
643  Wnd != co_GetDesktopWindow(Wnd) )
644  {
645  if (!co_HOOK_CallHooks(WH_SHELL, HSHELL_APPCOMMAND, wParam, lParam))
646  co_IntShellHookNotify(HSHELL_APPCOMMAND, wParam, lParam);
647  break;
648  }
649  UserRefObjectCo(Wnd->spwndParent, &Ref);
652  break;
653 
654  case WM_KEYF1:
655  {
656  HELPINFO hi;
657  HMENU hMenu = UlongToHandle(Wnd->IDMenu);
658  PWND pwndActive = MENU_IsMenuActive();
659  hi.cbSize = sizeof(HELPINFO);
660  hi.MousePos = gpsi->ptCursor;
662  hi.hItemHandle = pwndActive ? UserHMGetHandle(pwndActive) : UserHMGetHandle(Wnd);
663  hi.iCtrlId = (Wnd->style & (WS_POPUP|WS_CHILD)) == WS_CHILD ? IntMenuItemFromPoint(Wnd, hMenu, hi.MousePos) : 0;
665 
666  co_IntSendMessage( UserHMGetHandle(Wnd), WM_HELP, 0, (LPARAM)&hi );
667  break;
668  }
669 
670  case WM_SETICON:
671  {
672  return DefWndSetIcon(Wnd, wParam, lParam);
673  }
674 
675  case WM_GETICON:
676  {
677  return DefWndGetIcon(Wnd, wParam, lParam);
678  }
679 
680  case WM_HELP:
681  {
682  PWND Parent = IntGetParent(Wnd);
684  break;
685  }
686 
687  case WM_LBUTTONDOWN:
688  case WM_RBUTTONDOWN:
689  case WM_MBUTTONDOWN:
690  pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK);
691  break;
692 
693  case WM_NCLBUTTONDOWN:
694  return NC_HandleNCLButtonDown(Wnd, wParam, lParam);
695 
696  case WM_NCRBUTTONDOWN:
697  return NC_HandleNCRButtonDown(Wnd, wParam, lParam);
698 
699  case WM_LBUTTONDBLCLK:
701 
702  case WM_NCLBUTTONDBLCLK:
703  return NC_HandleNCLButtonDblClk(Wnd, wParam, lParam);
704 
705  case WM_RBUTTONUP:
706  {
707  POINT Pt;
708 
709  Pt.x = GET_X_LPARAM(lParam);
710  Pt.y = GET_Y_LPARAM(lParam);
711  IntClientToScreen(Wnd, &Pt);
712  lParam = MAKELPARAM(Pt.x, Pt.y);
714  break;
715  }
716 
717  case WM_NCRBUTTONUP:
718  /*
719  * FIXME : we must NOT send WM_CONTEXTMENU on a WM_NCRBUTTONUP (checked
720  * in Windows), but what _should_ we do? According to MSDN :
721  * "If it is appropriate to do so, the system sends the WM_SYSCOMMAND
722  * message to the window". When is it appropriate?
723  */
724  ERR("WM_NCRBUTTONUP\n");
725  break;
726 
727  case WM_XBUTTONUP:
728  case WM_NCXBUTTONUP:
729  if (HIWORD(wParam) == XBUTTON1 || HIWORD(wParam) == XBUTTON2)
730  {
732  MAKELPARAM(LOWORD(wParam), FAPPCOMMAND_MOUSE | HIWORD(wParam)));
733  }
734  break;
735 
736 
737  case WM_CONTEXTMENU:
738  {
739  if (Wnd->style & WS_CHILD)
740  {
742  }
743  else
744  {
745  POINT Pt;
746  LONG_PTR Style;
747  LONG HitCode;
748 
749  Style = Wnd->style;
750 
751  Pt.x = GET_X_LPARAM(lParam);
752  Pt.y = GET_Y_LPARAM(lParam);
753  if (Style & WS_CHILD)
754  {
755  IntScreenToClient(IntGetParent(Wnd), &Pt);
756  }
757 
758  HitCode = GetNCHitEx(Wnd, Pt);
759 
760  if (HitCode == HTCAPTION || HitCode == HTSYSMENU)
761  {
762  PMENU SystemMenu;
763  UINT Flags;
764 
765  if((SystemMenu = IntGetSystemMenu(Wnd, FALSE)))
766  {
767  MENU_InitSysMenuPopup(SystemMenu, Wnd->style, Wnd->pcls->style, HitCode);
768 
769  if(HitCode == HTCAPTION)
771  else
773 
774  IntTrackPopupMenuEx(SystemMenu, Flags|TPM_SYSTEM_MENU, Pt.x, Pt.y, Wnd, NULL);
775  }
776  }
777  if (HitCode == HTHSCROLL || HitCode == HTVSCROLL)
778  {
779  WARN("Scroll Menu Not Supported\n");
780  }
781  }
782  break;
783  }
784 
785  case WM_KEYDOWN:
786  if (wParam == VK_F10)
787  {
788  pti->MessageQueue->QF_flags |= QF_FF10STATUS;
789 
790  if (UserGetKeyState(VK_SHIFT) & 0x8000)
791  {
793  }
794  }
796  {
797  HWND hwndTop = UserGetForegroundWindow();
798  PWND topWnd = UserGetWindowObject(hwndTop);
799 
800  /* Test for typical TaskBar ExStyle Values */
801  ExStyle = (topWnd->ExStyle & WS_EX_TOOLWINDOW);
802  TRACE("ExStyle is '%x'.\n", ExStyle);
803 
804  /* Test for typical TaskBar Style Values */
805  Style = (topWnd->style & (WS_POPUP | WS_VISIBLE |
807  TRACE("Style is '%x'.\n", Style);
808 
809  /* Test for masked typical TaskBar Style and ExStyles to detect TaskBar */
810  IsTaskBar = (Style == (WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN))
811  && (ExStyle == WS_EX_TOOLWINDOW);
812  TRACE("This %s the TaskBar.\n", IsTaskBar ? "is" : "is not");
813 
814  if (topWnd && !IsTaskBar) /* Second test is so we are not touching the Taskbar */
815  {
816  if ((topWnd->style & WS_THICKFRAME) == 0)
817  {
818  return 0;
819  }
820 
821  if (wParam == VK_DOWN)
822  {
823  if (topWnd->style & WS_MAXIMIZE)
824  {
826 
827  /* "Normal size" must be erased after restoring, otherwise it will block next side snap actions */
828  RECTL_vSetEmptyRect(&topWnd->InternalPos.NormalRect);
829  }
830  else
831  {
833  }
834  }
835  else if (wParam == VK_UP)
836  {
837  RECT currentRect;
838  if ((topWnd->InternalPos.NormalRect.right == topWnd->InternalPos.NormalRect.left) ||
839  (topWnd->InternalPos.NormalRect.top == topWnd->InternalPos.NormalRect.bottom))
840  {
841  currentRect = topWnd->rcWindow;
842  }
843  else
844  {
845  currentRect = topWnd->InternalPos.NormalRect;
846  }
848 
849  // save normal rect if maximazing snapped window
850  topWnd->InternalPos.NormalRect = currentRect;
851  }
852  else if (wParam == VK_LEFT || wParam == VK_RIGHT)
853  {
854  RECT snapRect, normalRect, windowRect;
855  BOOL snapped;
856  normalRect = topWnd->InternalPos.NormalRect;
857  snapped = (normalRect.left != 0 && normalRect.right != 0 &&
858  normalRect.top != 0 && normalRect.bottom != 0);
859 
860  if (topWnd->style & WS_MAXIMIZE)
861  {
863  snapped = FALSE;
864  }
865  windowRect = topWnd->rcWindow;
866 
867  UserSystemParametersInfo(SPI_GETWORKAREA, 0, &snapRect, 0);
868  if (wParam == VK_LEFT)
869  {
870  snapRect.right = (snapRect.left + snapRect.right) / 2;
871  }
872  else // VK_RIGHT
873  {
874  snapRect.left = (snapRect.left + snapRect.right) / 2;
875  }
876 
877  if (snapped)
878  {
879  // if window was snapped but moved to other location - restore normal size
880  if (!IntEqualRect(&snapRect, &windowRect))
881  {
882  RECT empty = {0, 0, 0, 0};
883  co_WinPosSetWindowPos(topWnd,
884  0,
885  normalRect.left,
886  normalRect.top,
887  normalRect.right - normalRect.left,
888  normalRect.bottom - normalRect.top,
889  0);
890  topWnd->InternalPos.NormalRect = empty;
891  }
892  }
893  else
894  {
895  co_WinPosSetWindowPos(topWnd,
896  0,
897  snapRect.left,
898  snapRect.top,
899  snapRect.right - snapRect.left,
900  snapRect.bottom - snapRect.top,
901  0);
902  topWnd->InternalPos.NormalRect = windowRect;
903  }
904  }
905  }
906  }
907  break;
908 
909  case WM_SYSKEYDOWN:
910  {
911  if (HIWORD(lParam) & KF_ALTDOWN)
912  { /* Previous state, if the key was down before this message,
913  this is a cheap way to ignore autorepeat keys. */
914  if ( !(HIWORD(lParam) & KF_REPEAT) )
915  {
916  if ( ( wParam == VK_MENU ||
917  wParam == VK_LMENU ||
918  wParam == VK_RMENU ) && !(pti->MessageQueue->QF_flags & QF_FMENUSTATUS)) //iMenuSysKey )
919  pti->MessageQueue->QF_flags |= QF_FMENUSTATUS; //iMenuSysKey = 1;
920  else
921  pti->MessageQueue->QF_flags &= ~QF_FMENUSTATUS; //iMenuSysKey = 0;
922  }
923 
924  pti->MessageQueue->QF_flags &= ~QF_FF10STATUS; //iF10Key = 0;
925 
926  if (wParam == VK_F4) /* Try to close the window */
927  {
929  if (!(top->style & CS_NOCLOSE))
931  }
932  else if (wParam == VK_SNAPSHOT) // Alt-VK_SNAPSHOT?
933  {
934  PWND pwnd = Wnd;
935  while (IntGetParent(pwnd) != NULL)
936  {
937  pwnd = IntGetParent(pwnd);
938  }
939  ERR("DefWndScreenshot\n");
940  DefWndScreenshot(pwnd);
941  }
942  else if ( wParam == VK_ESCAPE || wParam == VK_TAB ) // Alt-Tab/ESC Alt-Shift-Tab/ESC
943  {
944  WPARAM wParamTmp;
945  HWND Active = UserGetActiveWindow(); // Noticed MDI problem.
946  if (!Active)
947  {
948  FIXME("WM_SYSKEYDOWN VK_ESCAPE no active\n");
949  break;
950  }
951  wParamTmp = UserGetKeyState(VK_SHIFT) & 0x8000 ? SC_PREVWINDOW : SC_NEXTWINDOW;
953  }
954  else if (wParam == VK_SHIFT) // Alt+Shift
955  {
956  RTL_ATOM ClassAtom = 0;
957  UNICODE_STRING ustrClass, ustrWindow;
958  HWND hwndSwitch;
959 
960  RtlInitUnicodeString(&ustrClass, L"kbswitcher");
961  RtlInitUnicodeString(&ustrWindow, L"");
962 
963  IntGetAtomFromStringOrAtom(&ustrClass, &ClassAtom);
964 
965  hwndSwitch = IntFindWindow(UserGetDesktopWindow(), NULL, ClassAtom, &ustrWindow);
966  if (hwndSwitch)
967  {
968 #define ID_NEXTLAYOUT 10003
970  }
971  }
972  }
973  else if( wParam == VK_F10 )
974  {
975  if (UserGetKeyState(VK_SHIFT) & 0x8000)
977  pti->MessageQueue->QF_flags |= QF_FF10STATUS; //iF10Key = 1;
978  }
979  else if( wParam == VK_ESCAPE && (UserGetKeyState(VK_SHIFT) & 0x8000))
981  break;
982  }
983 
984  case WM_KEYUP:
985  case WM_SYSKEYUP:
986  {
987  /* Press and release F10 or ALT */
988  if (((wParam == VK_MENU || wParam == VK_LMENU || wParam == VK_RMENU)
989  && (pti->MessageQueue->QF_flags & (QF_FMENUSTATUS|QF_FMENUSTATUSBREAK)) == QF_FMENUSTATUS /*iMenuSysKey*/) ||
990  ((wParam == VK_F10) && pti->MessageQueue->QF_flags & QF_FF10STATUS /*iF10Key*/))
992  pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK|QF_FF10STATUS); //iMenuSysKey = iF10Key = 0;
993  break;
994  }
995 
996  case WM_SYSCHAR:
997  {
998  pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK); //iMenuSysKey = 0;
999  if (wParam == VK_RETURN && (Wnd->style & WS_MINIMIZE) != 0)
1000  {
1002  break;
1003  }
1004  if ((HIWORD(lParam) & KF_ALTDOWN) && wParam)
1005  {
1006  if (wParam == VK_TAB || wParam == VK_ESCAPE) break;
1007  if (wParam == VK_SPACE && Wnd->style & WS_CHILD)
1009  else
1011  }
1012  else /* check for Ctrl-Esc */
1013  if (wParam != VK_ESCAPE) UserPostMessage(hwndSAS, WM_LOGONNOTIFY, LN_MESSAGE_BEEP, 0); //MessageBeep(0);
1014  break;
1015  }
1016 
1017  case WM_CANCELMODE:
1018  {
1019  pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK);
1020 
1021  MENU_EndMenu( Wnd );
1022  if (IntGetCaptureWindow() == UserHMGetHandle(Wnd))
1023  {
1025  }
1026  break;
1027  }
1028 
1029  case WM_CLOSE:
1030  co_UserDestroyWindow(Wnd);
1031  break;
1032 
1033  case WM_CTLCOLORMSGBOX:
1034  case WM_CTLCOLOREDIT:
1035  case WM_CTLCOLORLISTBOX:
1036  case WM_CTLCOLORBTN:
1037  case WM_CTLCOLORDLG:
1038  case WM_CTLCOLORSTATIC:
1039  case WM_CTLCOLORSCROLLBAR:
1041 
1042  case WM_CTLCOLOR:
1044 
1045  case WM_SETCURSOR:
1046  {
1047  if (Wnd->style & WS_CHILD)
1048  {
1049  /* with the exception of the border around a resizable wnd,
1050  * give the parent first chance to set the cursor */
1052  {
1053  PWND parent = Wnd->spwndParent;//IntGetParent( Wnd );
1054  if (parent != UserGetDesktopWindow() &&
1056  return TRUE;
1057  }
1058  }
1059  return DefWndHandleSetCursor(Wnd, wParam, lParam);
1060  }
1061 
1062  case WM_MOUSEACTIVATE:
1063  if (Wnd->style & WS_CHILD)
1064  {
1065  LONG Ret;
1066  HWND hwndParent;
1067  PWND pwndParent = IntGetParent(Wnd);
1068  hwndParent = pwndParent ? UserHMGetHandle(pwndParent) : NULL;
1070  if (Ret) return (Ret);
1071  }
1073 
1074  case WM_ACTIVATE:
1075  /* The default action in Windows is to set the keyboard focus to
1076  * the window, if it's being activated and not minimized */
1077  if (LOWORD(wParam) != WA_INACTIVE &&
1078  !(Wnd->style & WS_MINIMIZE))
1079  {
1080  //ERR("WM_ACTIVATE %p\n",hWnd);
1081  co_UserSetFocus(Wnd);
1082  }
1083  break;
1084 
1085  case WM_MOUSEWHEEL:
1086  if (Wnd->style & WS_CHILD)
1087  {
1088  HWND hwndParent;
1089  PWND pwndParent = IntGetParent(Wnd);
1090  hwndParent = pwndParent ? UserHMGetHandle(pwndParent) : NULL;
1092  }
1093  break;
1094 
1095  case WM_ERASEBKGND:
1096  case WM_ICONERASEBKGND:
1097  {
1098  RECT Rect;
1099  HBRUSH hBrush = Wnd->pcls->hbrBackground;
1100  if (!hBrush) return 0;
1101  if (hBrush <= (HBRUSH)COLOR_MENUBAR)
1102  {
1103  hBrush = IntGetSysColorBrush(HandleToUlong(hBrush));
1104  }
1105  if (Wnd->pcls->style & CS_PARENTDC)
1106  {
1107  /* can't use GetClipBox with a parent DC or we fill the whole parent */
1108  IntGetClientRect(Wnd, &Rect);
1109  GreDPtoLP((HDC)wParam, (LPPOINT)&Rect, 2);
1110  }
1111  else
1112  {
1113  GdiGetClipBox((HDC)wParam, &Rect);
1114  }
1115  FillRect((HDC)wParam, &Rect, hBrush);
1116  return (1);
1117  }
1118 
1119  case WM_GETHOTKEY:
1120  //ERR("WM_GETHOTKEY\n");
1121  return DefWndGetHotKey(Wnd);
1122  case WM_SETHOTKEY:
1123  //ERR("WM_SETHOTKEY\n");
1124  return DefWndSetHotKey(Wnd, wParam);
1125 
1126  case WM_NCHITTEST:
1127  {
1128  POINT Point;
1131  return GetNCHitEx(Wnd, Point);
1132  }
1133 
1134  case WM_PRINT:
1135  {
1136  DefWndPrint(Wnd, (HDC)wParam, lParam);
1137  return (0);
1138  }
1139 
1140  case WM_SYSCOLORCHANGE:
1141  {
1142  /* force to redraw non-client area */
1143  UserPaintCaption(Wnd, DC_NC);
1144  /* Use InvalidateRect to redraw client area, enable
1145  * erase to redraw all subcontrols otherwise send the
1146  * WM_SYSCOLORCHANGE to child windows/controls is required
1147  */
1149  return (0);
1150  }
1151 
1152  case WM_PAINTICON:
1153  case WM_PAINT:
1154  {
1155  PAINTSTRUCT Ps;
1156  HDC hDC;
1157 
1158  /* If already in Paint and Client area is not empty just return. */
1159  if (Wnd->state2 & WNDS2_STARTPAINT && !RECTL_bIsEmptyRect(&Wnd->rcClient))
1160  {
1161  ERR("In Paint and Client area is not empty!\n");
1162  return 0;
1163  }
1164 
1165  hDC = IntBeginPaint(Wnd, &Ps);
1166  if (hDC)
1167  {
1168  if (((Wnd->style & WS_MINIMIZE) != 0) && (Wnd->pcls->spicn))
1169  {
1170  RECT ClientRect;
1171  INT x, y;
1172 
1173  ERR("Doing Paint and Client area is empty!\n");
1174  IntGetClientRect(Wnd, &ClientRect);
1175  x = (ClientRect.right - ClientRect.left - UserGetSystemMetrics(SM_CXICON)) / 2;
1176  y = (ClientRect.bottom - ClientRect.top - UserGetSystemMetrics(SM_CYICON)) / 2;
1178  UserDrawIconEx(hDC, x, y, Wnd->pcls->spicn, 0, 0, 0, 0, DI_NORMAL | DI_COMPAT | DI_DEFAULTSIZE);
1180  }
1181 
1182  IntEndPaint(Wnd, &Ps);
1183  }
1184  return (0);
1185  }
1186 
1187  case WM_SYNCPAINT:
1188  {
1189  HRGN hRgn;
1190  Wnd->state &= ~WNDS_SYNCPAINTPENDING;
1191  TRACE("WM_SYNCPAINT\n");
1192  hRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
1193  if (hRgn)
1194  {
1195  if (co_UserGetUpdateRgn(Wnd, hRgn, FALSE) != NULLREGION)
1196  {
1197  PREGION pRgn = REGION_LockRgn(hRgn);
1198  if (pRgn) REGION_UnlockRgn(pRgn);
1199  if (!wParam)
1201  co_UserRedrawWindow(Wnd, NULL, pRgn, wParam);
1202  }
1204  }
1205  return 0;
1206  }
1207 
1208  case WM_SETREDRAW:
1209  if (wParam)
1210  {
1211  if (!(Wnd->style & WS_VISIBLE))
1212  {
1213  IntSetStyle( Wnd, WS_VISIBLE, 0 );
1214  Wnd->state |= WNDS_SENDNCPAINT;
1215  }
1216  }
1217  else
1218  {
1219  if (Wnd->style & WS_VISIBLE)
1220  {
1222  IntSetStyle( Wnd, 0, WS_VISIBLE );
1223  }
1224  }
1225  return 0;
1226 
1227  case WM_WINDOWPOSCHANGING:
1228  {
1230  }
1231 
1232  case WM_WINDOWPOSCHANGED:
1233  {
1235  }
1236 
1237  case WM_NCCALCSIZE:
1238  {
1239  return NC_HandleNCCalcSize( Wnd, wParam, (RECTL *)lParam, FALSE );
1240  }
1241 
1242  case WM_NCACTIVATE:
1243  {
1244  return NC_HandleNCActivate( Wnd, wParam, lParam );
1245  }
1246 
1247  //
1248  // NC Paint mode.
1249  //
1250  case WM_NCPAINT:
1251  {
1253  Wnd->state |= WNDS_FORCEMENUDRAW;
1254  NC_DoNCPaint(Wnd, hDC, -1);
1255  Wnd->state &= ~WNDS_FORCEMENUDRAW;
1256  UserReleaseDC(Wnd, hDC, FALSE);
1257  return 0;
1258  }
1259  //
1260  // Draw Caption mode.
1261  //
1262  // wParam are DC_* flags.
1263  //
1264  case WM_NCUAHDRAWCAPTION:
1265  {
1267  TRACE("WM_NCUAHDRAWCAPTION: wParam DC_ flags %08x\n",wParam);
1268  UserDrawCaptionBar(Wnd, hDC, wParam | DC_FRAME); // Include DC_FRAME to comp for drawing glitch.
1269  UserReleaseDC(Wnd, hDC, FALSE);
1270  return 0;
1271  }
1272  //
1273  // Draw Frame mode.
1274  //
1275  // wParam is HDC, lParam are DC_ACTIVE and or DC_REDRAWHUNGWND.
1276  //
1277  case WM_NCUAHDRAWFRAME:
1278  {
1279  TRACE("WM_NCUAHDRAWFRAME: wParam hDC %p lParam DC_ flags %08x\n",wParam,lParam);
1281  return 0;
1282  }
1283 
1284  /* ReactOS only. */
1285  case WM_CBT:
1286  {
1287  switch (wParam)
1288  {
1289  case HCBT_MOVESIZE:
1290  {
1291  RECTL rt;
1292 
1293  if (lParam)
1294  {
1295  _SEH2_TRY
1296  {
1298  sizeof(RECT),
1299  1);
1300 
1301  RtlCopyMemory(&rt,
1302  (PVOID)lParam,
1303  sizeof(RECT));
1304  }
1306  {
1307  lResult = 1;
1308  }
1309  _SEH2_END;
1310  }
1311  if (!lResult)
1312  lResult = co_HOOK_CallHooks(WH_CBT, HCBT_MOVESIZE, (WPARAM)Wnd->head.h, lParam ? (LPARAM)&rt : 0);
1313  }
1314  break;
1315  }
1316  break;
1317  }
1318  break;
1319  }
1320  return lResult;
1321 }
_SEH2_TRY
Definition: create.c:4226
BYTE gafAsyncKeyState[256 *2/8]
Definition: keyboard.c:13
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1682
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WM_SYNCPAINT
Definition: winuser.h:1680
#define WM_GETTEXTLENGTH
Definition: winuser.h:1609
#define GA_ROOT
Definition: winuser.h:2779
__kernel_entry W32KAPI HRGN APIENTRY NtGdiCreateRectRgn(_In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom)
#define WS_THICKFRAME
Definition: pedump.c:630
#define WM_SETHOTKEY
Definition: winuser.h:1642
#define HTLEFT
Definition: winuser.h:2477
const uint16_t * PCWSTR
Definition: typedefs.h:57
#define WM_PAINTICON
Definition: winuser.h:1631
BOOL FASTCALL UserPostMessage(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1346
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1616
void FASTCALL MENU_InitSysMenuPopup(PMENU menu, DWORD style, DWORD clsStyle, LONG HitTest)
Definition: menu.c:1364
DWORD ExStyle
Definition: ntuser.h:699
#define HTHSCROLL
Definition: winuser.h:2471
BOOL UserDrawIconEx(HDC hDc, INT xLeft, INT yTop, PCURICON_OBJECT pIcon, INT cxWidth, INT cyHeight, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags)
Definition: cursoricon.c:1688
#define ID_NEXTLAYOUT
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1158
unsigned short RTL_ATOM
Definition: atom.c:42
#define SC_KEYMENU
Definition: winuser.h:2586
#define SC_RESTORE
Definition: winuser.h:2588
#define SW_SHOWNOACTIVATE
Definition: winuser.h:768
long y
Definition: polytest.cpp:48
BOOL FASTCALL IntClientToScreen(PWND Wnd, LPPOINT lpPoint)
Definition: winpos.c:198
#define WM_CONTEXTMENU
Definition: richedit.h:64
#define WM_LBUTTONDOWN
Definition: winuser.h:1766
FORCEINLINE VOID RECTL_vSetEmptyRect(_Out_ RECTL *prcl)
Definition: rect.h:20
HWND FASTCALL co_UserSetFocus(PWND Window)
Definition: focus.c:1314
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
long x
Definition: polytest.cpp:48
#define TPM_SYSTEM_MENU
Definition: undocuser.h:73
BOOL FASTCALL IntReleaseCapture(VOID)
Definition: focus.c:1530
#define TRUE
Definition: types.h:120
#define WM_CTLCOLORDLG
Definition: winuser.h:1760
#define WM_GETHOTKEY
Definition: winuser.h:1643
#define SW_HIDE
Definition: winuser.h:762
HWND FASTCALL UserGetActiveWindow(VOID)
Definition: focus.c:1429
#define VK_RMENU
Definition: winuser.h:2277
uint16_t * PWSTR
Definition: typedefs.h:56
#define WM_CLIENTSHUTDOWN
Definition: undocuser.h:35
#define WM_MOUSEWHEEL
Definition: treelist.c:96
#define WM_NCCALCSIZE
Definition: winuser.h:1675
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1762
#define WNDS_SENDNCPAINT
Definition: ntuser.h:611
#define WM_GETTEXT
Definition: winuser.h:1608
VOID FASTCALL IntNotifyWinEvent(DWORD Event, PWND pWnd, LONG idObject, LONG idChild, DWORD flags)
Definition: event.c:179
LRESULT FASTCALL DefWndHandleSysCommand(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:126
#define WARN(fmt,...)
Definition: debug.h:112
#define MAKELPARAM(l, h)
Definition: winuser.h:3998
DWORD_PTR dwContextId
Definition: winuser.h:3306
PVOID NTAPI PsGetCurrentThreadWin32Thread(VOID)
Definition: thread.c:805
BOOLEAN FASTCALL co_WinPosSetWindowPos(PWND Window, HWND WndInsertAfter, INT x, INT y, INT cx, INT cy, UINT flags)
Definition: winpos.c:1748
#define HandleToUlong(h)
Definition: basetsd.h:79
static HDC
Definition: imagelist.c:92
HANDLE hItemHandle
Definition: winuser.h:3305
#define WM_SETREDRAW
Definition: winuser.h:1606
PSERVERINFO gpsi
Definition: imm.c:18
#define OBJID_WINDOW
Definition: winable.h:15
#define NULLREGION
Definition: wingdi.h:361
#define WH_SHELL
Definition: winuser.h:40
LONG top
Definition: windef.h:307
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:27
#define DI_COMPAT
Definition: wingdi.h:68
#define GET_X_LPARAM(lp)
Definition: windowsx.h:299
static HRGN hRgn
Definition: mapping.c:33
#define CS_NOCLOSE
Definition: winuser.h:649
#define DCX_USESTYLE
Definition: GetDCEx.c:10
#define MA_ACTIVATE
Definition: winuser.h:2491
#define VK_LEFT
Definition: winuser.h:2214
#define WM_SHOWWINDOW
Definition: winuser.h:1618
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define WM_NCRBUTTONDOWN
Definition: winuser.h:1685
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
#define WM_CTLCOLOR
Definition: windowsx.h:29
BOOL WINAPI IntTrackPopupMenuEx(PMENU menu, UINT wFlags, int x, int y, PWND pWnd, LPTPMPARAMS lpTpm)
Definition: menu.c:4561
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:644
#define WM_NCHITTEST
Definition: winuser.h:1676
UINT_PTR WPARAM
Definition: windef.h:207
#define VK_LWIN
Definition: winuser.h:2225
#define VK_TAB
Definition: winuser.h:2189
#define VK_DOWN
Definition: winuser.h:2217
#define WS_CHILD
Definition: pedump.c:617
RECT rcClient
Definition: ntuser.h:712
#define VK_MENU
Definition: winuser.h:2194
#define RDW_FRAME
Definition: winuser.h:1202
LONG left
Definition: windef.h:306
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:91
_SEH2_END
Definition: create.c:4400
HWND FASTCALL IntGetCaptureWindow(VOID)
Definition: focus.c:34
#define WNDS2_STARTPAINT
Definition: ntuser.h:638
#define VK_ESCAPE
Definition: winuser.h:2204
#define WS_CLIPCHILDREN
Definition: pedump.c:619
LONG right
Definition: windef.h:308
#define WM_CTLCOLORLISTBOX
Definition: winuser.h:1758
PREGION FASTCALL REGION_LockRgn(_In_ HRGN hrgn)
Definition: region.c:2377
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
LRESULT FASTCALL DefWndHandleWindowPosChanging(PWND pWnd, WINDOWPOS *Pos)
Definition: defwnd.c:69
LRESULT FASTCALL DefWndGetIcon(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:477
int32_t INT
Definition: typedefs.h:58
#define VK_RETURN
Definition: winuser.h:2191
struct _CURICON_OBJECT * spicn
Definition: ntuser.h:580
WPARAM wParam
Definition: combotst.c:138
#define DCX_INTERSECTRGN
Definition: winuser.h:2112
#define DCX_WINDOW
Definition: winuser.h:2103
LRESULT DefWndHandleSetCursor(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:244
#define QF_FF10STATUS
Definition: msgqueue.h:98
DWORD FASTCALL UserGetKeyState(DWORD dwKey)
Definition: msgqueue.c:221
#define QF_FMENUSTATUS
Definition: msgqueue.h:97
#define VK_F10
Definition: winuser.h:2254
#define WM_NCPAINT
Definition: winuser.h:1677
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define TPM_RIGHTBUTTON
Definition: winuser.h:2370
#define L(x)
Definition: ntvdm.h:50
#define WM_CTLCOLORBTN
Definition: winuser.h:1759
#define HTSYSMENU
Definition: winuser.h:2467
UINT style
Definition: ntuser.h:575
#define VK_UP
Definition: winuser.h:2215
#define DC_NC
Definition: winuser.h:440
#define FALSE
Definition: types.h:117
#define WM_NCACTIVATE
Definition: winuser.h:1678
#define WS_MINIMIZE
Definition: pedump.c:622
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
BOOLEAN co_UserDestroyWindow(PVOID Object)
Definition: window.c:2845
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:40
#define WM_NCRBUTTONUP
Definition: winuser.h:1686
#define WM_SETCURSOR
Definition: winuser.h:1626
BOOL FASTCALL GreDPtoLP(HDC, LPPOINT, INT)
Definition: dcutil.c:7
#define FIXME(fmt,...)
Definition: debug.h:111
#define WM_CTLCOLORSCROLLBAR
Definition: winuser.h:1761
#define WM_SYSCHAR
Definition: winuser.h:1711
#define SM_CXICON
Definition: winuser.h:966
#define VK_F4
Definition: winuser.h:2248
#define CHILDID_SELF
Definition: winable.h:14
#define SC_MAXIMIZE
Definition: winuser.h:2578
struct _WND * spwndOwner
Definition: ntuser.h:710
LRESULT NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:1042
#define VK_SHIFT
Definition: winuser.h:2192
THRDESKHEAD head
Definition: ntuser.h:690
Definition: object.h:3
#define DCX_KEEPCLIPRGN
Definition: undocuser.h:68
#define WM_ICONERASEBKGND
Definition: winuser.h:1632
HBRUSH FASTCALL DefWndControlColor(HDC hDC, UINT ctlType)
Definition: defwnd.c:33
static HWND hwndParent
Definition: cryptui.c:300
LRESULT FASTCALL DefWndHandleWindowPosChanged(PWND pWnd, WINDOWPOS *Pos)
Definition: defwnd.c:96
#define WM_KEYDOWN
Definition: winuser.h:1705
#define WM_CTLCOLORMSGBOX
Definition: winuser.h:1756
LONG_PTR LPARAM
Definition: windef.h:208
INT FASTCALL co_UserGetUpdateRgn(PWND Window, HRGN hRgn, BOOL bErase)
Definition: painting.c:1785
PWND FASTCALL co_GetDesktopWindow(PWND pWnd)
Definition: desktop.c:1366
#define WH_CBT
Definition: winuser.h:35
#define DI_DEFAULTSIZE
Definition: wingdi.h:69
POINT MousePos
Definition: winuser.h:3307
Definition: region.h:7
#define WM_MOUSEACTIVATE
Definition: winuser.h:1627
#define WM_SETTEXT
Definition: winuser.h:1607
LARGE_UNICODE_STRING strName
Definition: ntuser.h:731
VOID FASTCALL DefWndScreenshot(PWND pWnd)
Definition: defwnd.c:500
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:126
HWND FASTCALL UserGetForegroundWindow(VOID)
Definition: focus.c:1421
#define WM_RBUTTONDOWN
Definition: winuser.h:1769
int iContextType
Definition: winuser.h:3303
void MENU_EndMenu(PWND pwnd)
Definition: menu.c:2664
DWORD FASTCALL IntGetWindowContextHelpId(PWND pWnd)
Definition: window.c:433
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:208
#define WM_APPCOMMAND
Definition: winuser.h:1872
BOOLEAN FASTCALL co_WinPosShowWindow(PWND Wnd, INT Cmd)
Definition: winpos.c:2518
HWND hwndSAS
Definition: winsta.c:24
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define KF_REPEAT
Definition: winuser.h:2440
#define WS_CAPTION
Definition: pedump.c:624
struct tagHELPINFO HELPINFO
BOOL FASTCALL DefSetText(HWND hWnd, PCWSTR String, BOOL Ansi)
Definition: defwnd.c:65
UINT_PTR IDMenu
Definition: ntuser.h:726
VOID FASTCALL DefWndPrint(PWND pwnd, HDC hdc, ULONG uFlags)
Definition: defwnd.c:366
#define TRACE(s)
Definition: solgame.cpp:4
HWND FASTCALL IntFindWindow(PWND Parent, PWND ChildAfter, RTL_ATOM ClassAtom, PUNICODE_STRING WindowName)
Definition: window.c:3048
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
const DWORD Style
Definition: appswitch.c:71
r parent
Definition: btrfs.c:3010
HBRUSH hbrBackground
Definition: ntuser.h:582
PMENU FASTCALL IntGetSystemMenu(PWND Window, BOOL bRevert)
Definition: menu.c:5383
__wchar_t WCHAR
Definition: xmlstorage.h:180
PWND MENU_IsMenuActive(VOID)
Definition: menu.c:2652
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
#define RDW_ERASE
Definition: winuser.h:1201
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define WM_NCUAHDRAWCAPTION
Definition: undocuser.h:46
#define DC_FRAME
Definition: undocuser.h:149
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1651
#define WM_CLOSE
Definition: winuser.h:1611
#define WM_KEYUP
Definition: winuser.h:1706
unsigned long DWORD
Definition: ntddk_ex.h:95
HDC FASTCALL IntBeginPaint(PWND Window, PPAINTSTRUCT Ps)
Definition: painting.c:1435
#define HELPINFO_MENUITEM
Definition: winuser.h:1161
#define WM_RBUTTONUP
Definition: winuser.h:1770
#define WM_PRINT
Definition: winuser.h:1870
#define SC_PREVWINDOW
Definition: winuser.h:2581
#define WM_PAINT
Definition: winuser.h:1610
UINT FASTCALL DefWndGetHotKey(PWND pWnd)
Definition: hotkey.c:313
LRESULT APIENTRY co_HOOK_CallHooks(INT HookId, INT Code, WPARAM wParam, LPARAM lParam)
Definition: hook.c:1103
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1386
#define RDW_VALIDATE
Definition: winuser.h:1208
LRESULT NC_HandleNCCalcSize(PWND Wnd, WPARAM wparam, RECTL *Rect, BOOL Suspended)
Definition: nonclient.c:1249
struct Point Point
#define SM_CYICON
Definition: winuser.h:967
#define WNDS_SYNCPAINTPENDING
Definition: ntuser.h:623
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
#define VK_LMENU
Definition: winuser.h:2276
#define WM_CANCELMODE
Definition: winuser.h:1625
#define DI_NORMAL
Definition: wingdi.h:72
GLenum GLsizei len
Definition: glext.h:6722
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1768
#define LRESULT
Definition: ole.h:14
BOOL FASTCALL IntScreenToClient(PWND Wnd, LPPOINT lpPoint)
Definition: winpos.c:212
RECT rcWindow
Definition: ntuser.h:711
UINT cbSize
Definition: winuser.h:3302
#define WM_LOGONNOTIFY
Definition: undocuser.h:37
#define WM_COMMAND
Definition: winuser.h:1730
#define MA_NOACTIVATE
Definition: winuser.h:2493
#define HTBOTTOMRIGHT
Definition: winuser.h:2485
#define VK_RWIN
Definition: winuser.h:2226
#define WM_USER
Definition: winuser.h:1885
PWND FASTCALL UserGetAncestor(PWND Wnd, UINT Type)
Definition: window.c:3331
#define VK_RIGHT
Definition: winuser.h:2216
#define SC_MINIMIZE
Definition: winuser.h:2576
#define ERR(fmt,...)
Definition: debug.h:110
#define HTCAPTION
Definition: winuser.h:2466
Definition: ntuser.h:688
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:89
LRESULT NC_HandleNCLButtonDblClk(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1612
static HDC hDC
Definition: 3dtext.c:33
VOID UserDrawCaptionBar(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:900
INT FASTCALL DefWndSetHotKey(PWND pWnd, WPARAM wParam)
Definition: hotkey.c:340
#define WM_ACTIVATE
Definition: winuser.h:1602
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:888
#define RDW_ALLCHILDREN
Definition: winuser.h:1211
_Use_decl_annotations_ NTSTATUS NTAPI RtlUnicodeToMultiByteSize(_Out_ PULONG MbSize, _In_ PCWCH UnicodeString, _In_ ULONG UnicodeSize)
Definition: nlsboot.c:145
#define WM_SYSKEYUP
Definition: winuser.h:1710
LRESULT FASTCALL DefWndSetIcon(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:438
#define WM_CTLCOLOREDIT
Definition: winuser.h:1757
FORCEINLINE BOOL IntEqualRect(RECTL *lprc1, RECTL *lprc2)
Definition: winpos.h:48
#define WM_MBUTTONDOWN
Definition: winuser.h:1772
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:208
DWORD state
Definition: ntuser.h:696
int iCtrlId
Definition: winuser.h:3304
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
LRESULT NC_HandleNCRButtonDown(PWND pwnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1670
#define min(a, b)
Definition: monoChain.cc:55
#define WS_POPUP
Definition: pedump.c:616
BOOL FASTCALL IntEndPaint(PWND Wnd, PPAINTSTRUCT Ps)
Definition: painting.c:1532
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
BOOL UserPaintCaption(PWND pWnd, INT Flags)
Definition: defwnd.c:399
#define VK_SPACE
Definition: winuser.h:2209
BOOL empty
Definition: button.c:170
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
VOID co_IntShellHookNotify(WPARAM Message, WPARAM wParam, LPARAM lParam)
Definition: desktop.c:1692
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define KF_ALTDOWN
Definition: winuser.h:2439
#define WM_DEVICECHANGE
Definition: winuser.h:1801
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
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:300
#define HTVSCROLL
Definition: winuser.h:2472
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1652
INT FASTCALL IntMenuItemFromPoint(PWND pWnd, HMENU hMenu, POINT ptScreen)
Definition: menu.c:1520
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2392
#define RDW_ERASENOW
Definition: winuser.h:1209
#define SC_CLOSE
Definition: winuser.h:2582
#define WM_NCUAHDRAWFRAME
Definition: undocuser.h:47
#define HCBT_MOVESIZE
Definition: winuser.h:55
#define WM_SYSKEYDOWN
Definition: winuser.h:1709
#define TPM_LEFTBUTTON
Definition: winuser.h:2369
struct _WND * spwndParent
Definition: ntuser.h:708
ULONG FASTCALL IntSetStyle(PWND pwnd, ULONG set_bits, ULONG clear_bits)
Definition: window.c:147
#define HIWORD(l)
Definition: typedefs.h:247
FORCEINLINE BOOL RECTL_bIsEmptyRect(_In_ const RECTL *prcl)
Definition: rect.h:44
unsigned int ULONG
Definition: retypes.h:1
DWORD state2
Definition: ntuser.h:697
NTSYSAPI VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING DestinationString, PCWSTR SourceString)
LONG bottom
Definition: windef.h:309
#define IS_KEY_DOWN(ks, vk)
Definition: input.h:99
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define WNDS_FORCEMENUDRAW
Definition: ntuser.h:615
_In_ ULONG _In_ BOOLEAN Active
Definition: potypes.h:560
struct _WND::@4898 InternalPos
#define WA_INACTIVE
Definition: winuser.h:2612
BOOL FASTCALL UserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: sysparams.c:2090
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:40
#define SC_NEXTWINDOW
Definition: winuser.h:2580
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
#define WM_ERASEBKGND
Definition: winuser.h:1615
#define LN_MESSAGE_BEEP
Definition: undocuser.h:120
LRESULT NC_HandleNCLButtonDown(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1520
#define HTCLIENT
Definition: winuser.h:2465
DWORD FASTCALL GetNCHitEx(PWND pWnd, POINT pt)
Definition: nonclient.c:1930
LONG_PTR LRESULT
Definition: windef.h:209
LRESULT NC_HandleNCActivate(PWND Wnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1383
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
#define WS_VISIBLE
Definition: pedump.c:620
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
Definition: ordinal.c:60
#define WM_SYSCOMMAND
Definition: winuser.h:1731
#define QF_FMENUSTATUSBREAK
Definition: msgqueue.h:96
struct @1595 Msg[]
LPARAM lParam
Definition: combotst.c:139
#define VK_SNAPSHOT
Definition: winuser.h:2221
#define LOWORD(l)
Definition: pedump.c:82
#define DC_TEXT
Definition: winuser.h:430
#define CS_PARENTDC
Definition: winuser.h:651
#define WM_KEYF1
Definition: msg.c:47
#define WM_CBT
Definition: undocuser.h:63
LRESULT IntClientShutdown(IN PWND pWindow, IN WPARAM wParam, IN LPARAM lParam)
Definition: shutdown.c:22
struct Rect Rect
#define RDW_INVALIDATE
Definition: winuser.h:1204
const DWORD ExStyle
Definition: appswitch.c:72
#define WM_NCLBUTTONDBLCLK
Definition: winuser.h:1684
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:731
PCLS pcls
Definition: ntuser.h:715
#define WS_MAXIMIZE
Definition: pedump.c:623
DWORD style
Definition: ntuser.h:701

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

◆ UserPaintCaption()

BOOL UserPaintCaption ( PWND  pWnd,
INT  Flags 
)

Definition at line 399 of file defwnd.c.

400 {
401  BOOL Ret = FALSE;
402 
403  if ( (pWnd->style & WS_VISIBLE) && ((pWnd->style & WS_CAPTION) == WS_CAPTION) )
404  {
405  if (pWnd->state & WNDS_HASCAPTION && pWnd->head.pti->MessageQueue == gpqForeground)
406  Flags |= DC_ACTIVE;
407  /*
408  * When themes are not enabled we can go on and paint the non client area.
409  * However if we do that with themes enabled we will draw a classic frame.
410  * This is solved by sending a themes specific message to notify the themes
411  * engine that the caption needs to be redrawn
412  */
414  {
415  /*
416  * This will cause uxtheme to either paint the themed caption or call
417  * RealUserDrawCaption in order to draw the classic caption when themes
418  * are disabled but the themes service is enabled
419  */
420  TRACE("UDCB Flags %08x\n", Flags);
422  }
423  else
424  {
426  UserDrawCaptionBar(pWnd, hDC, Flags | DC_FRAME); // DCFRAME added as fix for CORE-10855.
427  UserReleaseDC(pWnd, hDC, FALSE);
428  }
429  Ret = TRUE;
430  }
431  // Support window tray
432  return Ret;
433 }
PUSER_MESSAGE_QUEUE gpqForeground
Definition: focus.c:13
#define TRUE
Definition: types.h:120
static HDC
Definition: imagelist.c:92
PSERVERINFO gpsi
Definition: imm.c:18
#define DCX_USESTYLE
Definition: GetDCEx.c:10
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
#define DCX_WINDOW
Definition: winuser.h:2103
#define FALSE
Definition: types.h:117
DWORD dwSRVIFlags
Definition: ntuser.h:1046
unsigned int BOOL
Definition: ntddk_ex.h:94
THRDESKHEAD head
Definition: ntuser.h:690
#define DC_ACTIVE
Definition: winuser.h:427
#define UserHMGetHandle(obj)
Definition: ntuser.h:230
#define WS_CAPTION
Definition: pedump.c:624
#define TRACE(s)
Definition: solgame.cpp:4
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
#define WM_NCUAHDRAWCAPTION
Definition: undocuser.h:46
#define DC_FRAME
Definition: undocuser.h:149
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1446
#define SRVINFO_APIHOOK
Definition: ntuser.h:945
static HDC hDC
Definition: 3dtext.c:33
VOID UserDrawCaptionBar(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:900
DWORD state
Definition: ntuser.h:696
#define NULL
Definition: types.h:112
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:918
#define WS_VISIBLE
Definition: pedump.c:620
#define WNDS_HASCAPTION
Definition: ntuser.h:603
DWORD style
Definition: ntuser.h:701

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