ReactOS  0.4.14-dev-41-g31d7680
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)
 
VOID FASTCALL DefWndScreenshot (PWND pWnd)
 
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 215 of file defwnd.c.

216 {
217  PWND Ret;
218  PWND Child, OwnerWnd;
219 
220  for(Child = Root->spwndChild; Child; Child = Child->spwndNext)
221  {
222  OwnerWnd = Child->spwndOwner;
223  if(!OwnerWnd)
224  continue;
225 
226  if (!(Child->style & WS_POPUP) ||
227  !(Child->style & WS_VISIBLE) ||
228  /* Fixes CMD pop up properties window from having foreground. */
229  Owner->head.pti->MessageQueue != Child->head.pti->MessageQueue)
230  continue;
231 
232  if(OwnerWnd == Owner)
233  {
234  Ret = Child;
235  return Ret;
236  }
237  }
238  return NULL;
239 }
smooth NULL
Definition: ftsmooth.c:416
root entry for file system trees
Definition: entries.h:148
Definition: ntuser.h:657
#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:1557
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical 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 ACPI_HANDLE Child
Definition: acpixf.h:722
#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:927
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
COLORREF FASTCALL IntGdiSetBkColor(_In_ HDC hDC, _In_ COLORREF Color)
#define CTLCOLOR_SCROLLBAR
Definition: winuser.h:946
#define COLOR_WINDOW
Definition: winuser.h:908
PSERVERINFO gpsi
Definition: main.c:27
#define COLOR_3DFACE
Definition: winuser.h:919
#define COLOR_SCROLLBAR
Definition: winuser.h:902
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:285
#define COLOR_WINDOWTEXT
Definition: winuser.h:911
#define CTLCOLOR_EDIT
Definition: winuser.h:942
DWORD FASTCALL IntGetSysColor(INT nIndex)
Definition: stockobj.c:323
#define CTLCOLOR_LISTBOX
Definition: winuser.h:943
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 472 of file defwnd.c.

473 {
474  HICON hIconRet;
475  if ( wParam > ICON_SMALL2 )
476  {
478  return 0;
479  }
480  switch(wParam)
481  {
482  case ICON_BIG:
483  hIconRet = UserGetProp(pWnd, gpsi->atomIconProp, TRUE);
484  break;
485  case ICON_SMALL:
486  case ICON_SMALL2:
487  hIconRet = UserGetProp(pWnd, gpsi->atomIconSmProp, TRUE);
488  break;
489  default:
490  break;
491  }
492  return (LRESULT)hIconRet;
493 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
static HICON
Definition: imagelist.c:84
#define TRUE
Definition: types.h:120
PSERVERINFO gpsi
Definition: main.c:27
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:1019
ATOM atomIconSmProp
Definition: ntuser.h:1018
LONG_PTR LRESULT
Definition: windef.h:209
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
#define ICON_BIG
Definition: tnclass.cpp:51

Referenced by IntDefWindowProc(), and User32DefWindowProc().

◆ DefWndHandleSetCursor()

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

Definition at line 242 of file defwnd.c.

243 {
244  PWND pwndPopUP = NULL;
245  WORD Msg = HIWORD(lParam);
246 
247  /* Not for child windows. */
248  if (UserHMGetHandle(pWnd) != (HWND)wParam)
249  {
250  return FALSE;
251  }
252 
253  switch((short)LOWORD(lParam))
254  {
255  case HTERROR:
256  {
259 
260  if (Msg == WM_LBUTTONDOWN)
261  {
262  // Find a pop up window to bring active.
264  if (pwndPopUP)
265  {
266  // Not a child pop up from desktop.
267  if ( pwndPopUP != UserGetDesktopWindow()->spwndChild )
268  {
269  // Get original active window.
270  PWND pwndOrigActive = gpqForeground->spwndActive;
271 
273 
274  UserRefObjectCo(pwndPopUP, &Ref);
275  //UserSetActiveWindow(pwndPopUP);
276  co_IntSetForegroundWindow(pwndPopUP); // HACK
277  UserDerefObjectCo(pwndPopUP);
278 
279  // If the change was made, break out.
280  if (pwndOrigActive != gpqForeground->spwndActive)
281  break;
282  }
283  }
284  }
286  if (Msg == WM_LBUTTONDOWN || Msg == WM_MBUTTONDOWN ||
287  Msg == WM_RBUTTONDOWN || Msg == WM_XBUTTONDOWN)
288  {
289  if (pwndPopUP)
290  {
291  FLASHWINFO fwi =
292  {sizeof(FLASHWINFO),
293  UserHMGetHandle(pwndPopUP),
294  FLASHW_ALL,
296  (gpsi->dtCaretBlink >> 3)};
297 
298  // Now shake that window!
299  IntFlashWindowEx(pwndPopUP, &fwi);
300  }
302  }
303  break;
304  }
305 
306  case HTCLIENT:
307  {
308  if (pWnd->pcls->spcur)
309  {
310  IntSystemSetCursor(pWnd->pcls->spcur);
311  }
312  return FALSE;
313  }
314 
315  case HTLEFT:
316  case HTRIGHT:
317  {
318  if (pWnd->style & WS_MAXIMIZE)
319  {
320  break;
321  }
322  IntSystemSetCursor(SYSTEMCUR(SIZEWE));
323  return TRUE;
324  }
325 
326  case HTTOP:
327  case HTBOTTOM:
328  {
329  if (pWnd->style & WS_MAXIMIZE)
330  {
331  break;
332  }
333  IntSystemSetCursor(SYSTEMCUR(SIZENS));
334  return TRUE;
335  }
336 
337  case HTTOPLEFT:
338  case HTBOTTOMRIGHT:
339  {
340  if (pWnd->style & WS_MAXIMIZE)
341  {
342  break;
343  }
344  IntSystemSetCursor(SYSTEMCUR(SIZENWSE));
345  return TRUE;
346  }
347 
348  case HTBOTTOMLEFT:
349  case HTTOPRIGHT:
350  {
351  if (pWnd->style & WS_MAXIMIZE)
352  {
353  break;
354  }
355  IntSystemSetCursor(SYSTEMCUR(SIZENESW));
356  return TRUE;
357  }
358  }
360  return FALSE;
361 }
PUSER_MESSAGE_QUEUE gpqForeground
Definition: focus.c:12
BOOL FASTCALL IntFlashWindowEx(PWND pWnd, PFLASHWINFO pfwi)
Definition: painting.c:1292
#define HTTOP
Definition: winuser.h:2465
#define HTLEFT
Definition: winuser.h:2462
BOOL FASTCALL UserPostMessage(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1181
PCURICON_OBJECT IntSystemSetCursor(PCURICON_OBJECT pcurNew)
Definition: cursoricon.c:230
#define TRUE
Definition: types.h:120
#define WM_LBUTTONDOWN
Definition: winuser.h:1758
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:1720
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
#define HTBOTTOMLEFT
Definition: winuser.h:2469
struct _CURICON_OBJECT * spcur
Definition: ntuser.h:554
#define HTRIGHT
Definition: winuser.h:2464
PSERVERINFO gpsi
Definition: main.c:27
WPARAM wParam
Definition: combotst.c:138
#define HTTOPLEFT
Definition: winuser.h:2466
struct @1576 Msg[]
PWND FASTCALL co_IntFindChildWindowToOwner(PWND Root, PWND Owner)
Definition: defwnd.c:215
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
Definition: object.h:3
smooth NULL
Definition: ftsmooth.c:416
#define HTERROR
Definition: winuser.h:2447
#define WM_RBUTTONDOWN
Definition: winuser.h:1761
HWND hwndSAS
Definition: winsta.c:24
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define HTTOPRIGHT
Definition: winuser.h:2467
#define SWP_NOACTIVATE
Definition: winuser.h:1227
unsigned short WORD
Definition: ntddk_ex.h:93
SPIVALUES gspv
Definition: sysparams.c:17
#define HTBOTTOM
Definition: winuser.h:2468
PWND FASTCALL UserGetDesktopWindow(VOID)
Definition: desktop.c:1349
#define WM_LOGONNOTIFY
Definition: undocuser.h:37
#define HTBOTTOMRIGHT
Definition: winuser.h:2470
#define SWP_NOSIZE
Definition: winuser.h:1230
Definition: ntuser.h:657
#define WM_MBUTTONDOWN
Definition: winuser.h:1764
#define HIWORD(l)
Definition: typedefs.h:246
#define SYSTEMCUR(func)
Definition: cursoricon.h:129
#define SWP_NOMOVE
Definition: winuser.h:1229
#define LN_MESSAGE_BEEP
Definition: undocuser.h:118
#define HTCLIENT
Definition: winuser.h:2450
BOOL FASTCALL co_IntSetForegroundWindow(PWND Window)
Definition: focus.c:1432
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
PCLS pcls
Definition: ntuser.h:684
#define WS_MAXIMIZE
Definition: pedump.c:623
DWORD style
Definition: ntuser.h:670

Referenced by IntDefWindowProc().

◆ DefWndHandleSysCommand()

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

Definition at line 124 of file defwnd.c.

125 {
126  LRESULT lResult = 0;
127  BOOL Hook = FALSE;
128 
129  if (ISITHOOKED(WH_CBT) || (pWnd->head.rpdesk->pDeskInfo->fsHooks & HOOKID_TO_FLAG(WH_CBT)))
130  {
131  Hook = TRUE;
133 
134  if (lResult) return lResult;
135  }
136 
137  switch (wParam & 0xfff0)
138  {
139  case SC_MOVE:
140  case SC_SIZE:
141  DefWndDoSizeMove(pWnd, wParam);
142  break;
143 
144  case SC_MINIMIZE:
145  if (UserHMGetHandle(pWnd) == UserGetActiveWindow())
146  IntShowOwnedPopups(pWnd,FALSE); // This is done in ShowWindow! Need to retest!
148  break;
149 
150  case SC_MAXIMIZE:
151  if (((pWnd->style & WS_MINIMIZE) != 0) && UserHMGetHandle(pWnd) == UserGetActiveWindow())
152  IntShowOwnedPopups(pWnd,TRUE);
154  break;
155 
156  case SC_RESTORE:
157  if (((pWnd->style & WS_MINIMIZE) != 0) && UserHMGetHandle(pWnd) == UserGetActiveWindow())
158  IntShowOwnedPopups(pWnd,TRUE);
160  break;
161 
162  case SC_CLOSE:
163  return co_IntSendMessage(UserHMGetHandle(pWnd), WM_CLOSE, 0, 0);
164 
165  case SC_SCREENSAVE:
166  ERR("Screensaver Called!\n");
167  UserPostMessage(hwndSAS, WM_LOGONNOTIFY, LN_START_SCREENSAVE, 0); // always lParam 0 == not Secure
168  break;
169 
170  case SC_HOTKEY:
171  {
173 
174  pWnd = ValidateHwndNoErr((HWND)lParam);
175  if (pWnd)
176  {
177  if (pWnd->spwndLastActive)
178  {
179  pWnd = pWnd->spwndLastActive;
180  }
181  UserRefObjectCo(pWnd, &Ref);
183  UserDerefObjectCo(pWnd);
184  if (pWnd->style & WS_MINIMIZE)
185  {
187  }
188  }
189  }
190  break;
191 // case SC_DEFAULT:
192  case SC_MOUSEMENU:
193  {
194  POINT Pt;
195  Pt.x = (short)LOWORD(lParam);
196  Pt.y = (short)HIWORD(lParam);
197  MENU_TrackMouseMenuBar(pWnd, wParam & 0x000f, Pt);
198  }
199  break;
200 
201  case SC_KEYMENU:
203  break;
204 
205 
206  default:
207  // We do not support anything else here so we should return normal even when sending a hook.
208  return 0;
209  }
210 
211  return(Hook ? 1 : 0); // Don't call us again from user space.
212 }
#define HCBT_SYSCOMMAND
Definition: winuser.h:63
BOOL FASTCALL UserPostMessage(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1181
#define HOOKID_TO_FLAG(HookId)
Definition: hook.h:5
#define TRUE
Definition: types.h:120
PWND FASTCALL ValidateHwndNoErr(HWND hWnd)
Definition: window.c:96
#define SC_KEYMENU
Definition: winuser.h:2571
struct _DESKTOP * rpdesk
Definition: ntuser.h:189
#define SC_RESTORE
Definition: winuser.h:2573
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
HWND FASTCALL UserGetActiveWindow(VOID)
Definition: focus.c:1311
#define SC_SCREENSAVE
Definition: mmsystem.h:933
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
BOOL FASTCALL IntShowOwnedPopups(PWND OwnerWnd, BOOL fShow)
Definition: window.c:4442
#define SC_HOTKEY
Definition: winuser.h:2576
#define SC_MOUSEMENU
Definition: winuser.h:2570
#define SW_RESTORE
Definition: winuser.h:773
WPARAM wParam
Definition: combotst.c:138
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:93
#define WS_MINIMIZE
Definition: pedump.c:622
unsigned int BOOL
Definition: ntddk_ex.h:94
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
#define SC_MAXIMIZE
Definition: winuser.h:2563
THRDESKHEAD head
Definition: ntuser.h:659
#define LN_START_SCREENSAVE
Definition: undocuser.h:119
Definition: object.h:3
#define WH_CBT
Definition: winuser.h:35
BOOLEAN FASTCALL co_WinPosShowWindow(PWND Wnd, INT Cmd)
Definition: winpos.c:2464
HWND hwndSAS
Definition: winsta.c:24
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WM_CLOSE
Definition: winuser.h:1603
#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:1281
#define WM_LOGONNOTIFY
Definition: undocuser.h:37
#define SC_MINIMIZE
Definition: winuser.h:2561
#define ERR(fmt,...)
Definition: debug.h:109
VOID MENU_TrackKbdMenuBar(PWND pwnd, UINT wParam, WCHAR wChar)
Definition: menu.c:4497
struct _WND * spwndLastActive
Definition: ntuser.h:703
VOID FASTCALL DefWndDoSizeMove(PWND pwnd, WORD wParam)
Definition: nonclient.c:239
#define SC_SIZE
Definition: winuser.h:2559
#define SC_MOVE
Definition: winuser.h:2560
#define SC_CLOSE
Definition: winuser.h:2567
#define HIWORD(l)
Definition: typedefs.h:246
VOID MENU_TrackMouseMenuBar(PWND pWnd, ULONG ht, POINT pt)
Definition: menu.c:4467
LONG_PTR LRESULT
Definition: windef.h:209
BOOL FASTCALL co_IntSetForegroundWindow(PWND Window)
Definition: focus.c:1432
#define SW_MAXIMIZE
Definition: winuser.h:766
#define WM_SYSCOMMAND
Definition: winuser.h:1723
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
DWORD style
Definition: ntuser.h:670

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 }
#define SIZE_MAXIMIZED
Definition: winuser.h:2482
#define SIZE_RESTORED
Definition: winuser.h:2480
ush Pos
Definition: deflate.h:92
#define WM_MOVE
Definition: winuser.h:1592
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:248
smooth NULL
Definition: ftsmooth.c:416
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define WM_SIZE
Definition: winuser.h:1593
#define SWP_STATECHANGED
Definition: msg.c:47
#define SIZE_MINIMIZED
Definition: winuser.h:2481
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:185
INT FASTCALL IntMapWindowPoints(PWND FromWnd, PWND ToWnd, LPPOINT lpPoints, UINT cPoints)
Definition: winpos.c:143
#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:670

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
smooth NULL
Definition: ftsmooth.c:416
UINT FASTCALL co_WinPosGetMinMaxInfo(PWND Window, POINT *MaxSize, POINT *MaxPos, POINT *MinTrack, POINT *MaxTrack)
Definition: winpos.c:931
#define SWP_NOSIZE
Definition: winuser.h:1230
#define min(a, b)
Definition: monoChain.cc:55
#define WS_POPUP
Definition: pedump.c:616
Arabic default style
Definition: afstyles.h:93
DWORD style
Definition: ntuser.h:670

Referenced by IntDefWindowProc().

◆ DefWndPrint()

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

Definition at line 363 of file defwnd.c.

364 {
365  /*
366  * Visibility flag.
367  */
368  if ( (uFlags & PRF_CHECKVISIBLE) &&
369  !IntIsWindowVisible(pwnd) )
370  return;
371 
372  /*
373  * Unimplemented flags.
374  */
375  if ( (uFlags & PRF_CHILDREN) ||
376  (uFlags & PRF_OWNED) ||
377  (uFlags & PRF_NONCLIENT) )
378  {
379  FIXME("WM_PRINT message with unsupported flags\n");
380  }
381 
382  /*
383  * Background
384  */
385  if ( uFlags & PRF_ERASEBKGND)
387 
388  /*
389  * Client area
390  */
391  if ( uFlags & PRF_CLIENT)
393 }
UINT_PTR WPARAM
Definition: windef.h:207
UINT uFlags
Definition: api.c:60
#define WM_PRINTCLIENT
Definition: richedit.h:70
#define FIXME(fmt,...)
Definition: debug.h:110
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define PRF_ERASEBKGND
Definition: winuser.h:2501
#define PRF_NONCLIENT
Definition: winuser.h:2499
#define PRF_CHECKVISIBLE
Definition: winuser.h:2498
BOOL FASTCALL IntIsWindowVisible(PWND Wnd)
Definition: window.c:170
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
HDC hdc
Definition: main.c:9
#define PRF_OWNED
Definition: winuser.h:2503
#define WM_ERASEBKGND
Definition: winuser.h:1607
#define PRF_CLIENT
Definition: winuser.h:2500
#define PRF_CHILDREN
Definition: winuser.h:2502

Referenced by IntDefWindowProc().

◆ DefWndScreenshot()

VOID FASTCALL DefWndScreenshot ( PWND  pWnd)

Definition at line 496 of file defwnd.c.

497 {
498  RECT rect;
499  HDC hdc;
500  INT w;
501  INT h;
503  HDC hdc2;
504  SETCLIPBDATA scd = {FALSE, FALSE};
505 
508 
509  hdc = UserGetWindowDC(pWnd);
510  IntGetWindowRect(pWnd, &rect);
511  w = rect.right - rect.left;
512  h = rect.bottom - rect.top;
513 
517 
518  NtGdiBitBlt(hdc2, 0, 0, w, h, hdc, 0, 0, SRCCOPY, 0, 0);
519 
521 
522  UserReleaseDC(pWnd, hdc, FALSE);
523  UserReleaseDC(pWnd, hdc2, FALSE);
524 
526 }
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:946
BOOL NTAPI UserOpenClipboard(HWND hWnd)
Definition: clipboard.c:485
int32_t INT
Definition: typedefs.h:56
& rect
Definition: startmenu.cpp:1413
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
HDC hdc2
Definition: SelectObject.c:10
BOOL NTAPI UserCloseClipboard(VOID)
Definition: clipboard.c:542
#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:208
HDC hdc
Definition: main.c:9
__kernel_entry W32KAPI HDC APIENTRY NtGdiCreateCompatibleDC(_In_opt_ HDC hdc)
BOOL NTAPI UserEmptyClipboard(VOID)
Definition: clipboard.c:677
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:917
static HBITMAP hbitmap
static HBITMAP
Definition: button.c:44
#define SRCCOPY
Definition: wingdi.h:332
HANDLE NTAPI UserSetClipboardData(UINT fmt, HANDLE hData, PSETCLIPBDATA scd)
Definition: clipboard.c:1020
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 434 of file defwnd.c.

435 {
436  HICON hIcon, hIconSmall, hIconOld;
437 
438  if ( wParam > ICON_SMALL2 )
439  {
441  return 0;
442  }
443  hIconSmall = UserGetProp(pWnd, gpsi->atomIconSmProp, TRUE);
445 
446  hIconOld = wParam == ICON_BIG ? hIcon : hIconSmall;
447 
448  switch(wParam)
449  {
450  case ICON_BIG:
451  hIcon = (HICON)lParam;
452  break;
453  case ICON_SMALL:
454  hIconSmall = (HICON)lParam;
455  break;
456  case ICON_SMALL2:
457  ERR("FIXME: Set ICON_SMALL2 support!\n");
458  default:
459  break;
460  }
461 
462  UserSetProp(pWnd, gpsi->atomIconProp, hIcon, TRUE);
463  UserSetProp(pWnd, gpsi->atomIconSmProp, hIconSmall, TRUE);
464 
465  if ((pWnd->style & WS_CAPTION ) == WS_CAPTION)
466  UserPaintCaption(pWnd, DC_ICON);
467 
468  return (LRESULT)hIconOld;
469 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
static HICON
Definition: imagelist.c:84
#define TRUE
Definition: types.h:120
PSERVERINFO gpsi
Definition: main.c:27
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:1019
#define ERR(fmt,...)
Definition: debug.h:109
HICON hIcon
Definition: msconfig.c:44
ATOM atomIconSmProp
Definition: ntuser.h:1018
BOOL UserPaintCaption(PWND pWnd, INT Flags)
Definition: defwnd.c:396
LONG_PTR LRESULT
Definition: windef.h:209
LPARAM lParam
Definition: combotst.c:139
ENGAPI VOID APIENTRY EngSetLastError(_In_ ULONG iError)
Definition: error.c:27
#define ICON_BIG
Definition: tnclass.cpp:51
DWORD style
Definition: ntuser.h:670

Referenced by IntDefWindowProc().

◆ DrawTextExWorker()

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

Definition at line 1072 of file text.c.

1078 {
1079  SIZE size;
1080  const WCHAR *strPtr;
1081  WCHAR *retstr, *p_retstr;
1082  size_t size_retstr;
1084  int len, lh, count=i_count;
1085  TEXTMETRICW tm;
1086  int lmargin = 0, rmargin = 0;
1087  int x = rect->left, y = rect->top;
1088  int width = rect->right - rect->left;
1089  int max_width = 0;
1090  int last_line;
1091  int tabwidth /* to keep gcc happy */ = 0;
1092  int prefix_offset;
1093  ellipsis_data ellip;
1094  BOOL invert_y=FALSE;
1095 
1096  HRGN hrgn = 0;
1097 
1098 #ifdef _WIN32K_
1099  TRACE("%S, %d, %08x\n", str, count, flags);
1100 #else
1101  TRACE("%s, %d, [%s] %08x\n", debugstr_wn (str, count), count,
1103 #endif
1104  if (dtp) TRACE("Params: iTabLength=%d, iLeftMargin=%d, iRightMargin=%d\n",
1105  dtp->iTabLength, dtp->iLeftMargin, dtp->iRightMargin);
1106 
1107  if (!str) return 0;
1108 
1109  strPtr = str;
1110 
1111  if (flags & DT_SINGLELINE)
1112  flags &= ~DT_WORDBREAK;
1113 #ifdef _WIN32K_
1115 #else
1116  GetTextMetricsW(hdc, &tm);
1117 #endif
1118  if (flags & DT_EXTERNALLEADING)
1119  lh = tm.tmHeight + tm.tmExternalLeading;
1120  else
1121  lh = tm.tmHeight;
1122 
1123  if (str[0] && count == 0)
1124  return lh;
1125 
1126  if (dtp && dtp->cbSize != sizeof(DRAWTEXTPARAMS))
1127  return 0;
1128 #ifdef _WIN32K_
1130  {
1131  SIZE window_ext, viewport_ext;
1132  GreGetWindowExtEx(hdc, &window_ext);
1133  GreGetViewportExtEx(hdc, &viewport_ext);
1134  if ((window_ext.cy > 0) != (viewport_ext.cy > 0))
1135  invert_y = TRUE;
1136  }
1137 #else
1139  {
1140  SIZE window_ext, viewport_ext;
1141  GetWindowExtEx(hdc, &window_ext);
1142  GetViewportExtEx(hdc, &viewport_ext);
1143  if ((window_ext.cy > 0) != (viewport_ext.cy > 0))
1144  invert_y = TRUE;
1145  }
1146 #endif
1147  if (count == -1)
1148  {
1149 #ifdef _WIN32K_
1150  count = wcslen(str);
1151 #else
1152  count = strlenW(str);
1153 #endif
1154  if (count == 0)
1155  {
1156  if( flags & DT_CALCRECT)
1157  {
1158  rect->right = rect->left;
1159  if( flags & DT_SINGLELINE)
1160  rect->bottom = rect->top + (invert_y ? -lh : lh);
1161  else
1162  rect->bottom = rect->top;
1163  }
1164  return lh;
1165  }
1166  }
1167 
1168  if (dtp)
1169  {
1170  lmargin = dtp->iLeftMargin;
1171  rmargin = dtp->iRightMargin;
1172  if (!(flags & (DT_CENTER | DT_RIGHT)))
1173  x += lmargin;
1174  dtp->uiLengthDrawn = 0; /* This param RECEIVES number of chars processed */
1175  }
1176 
1177  if (flags & DT_EXPANDTABS)
1178  {
1179  int tabstop = ((flags & DT_TABSTOP) && dtp && dtp->iTabLength) ? dtp->iTabLength : 8;
1180  tabwidth = tm.tmAveCharWidth * tabstop;
1181  }
1182 
1183  if (flags & DT_CALCRECT) flags |= DT_NOCLIP;
1184 #ifndef _WIN32K_
1185  if (!(flags & DT_NOCLIP) )
1186  {
1187  int hasClip;
1188  hrgn = CreateRectRgn(0,0,0,0);
1189  if (hrgn)
1190  {
1191  hasClip = GetClipRgn(hdc, hrgn);
1192  // If the region to be retrieved is NULL, the return value is 0.
1193  if (hasClip != 1)
1194  {
1195  DeleteObject(hrgn);
1196  hrgn = NULL;
1197  }
1198  IntersectClipRect(hdc, rect->left, rect->top, rect->right, rect->bottom);
1199  }
1200  }
1201 #else
1202  if (!(flags & DT_NOCLIP) )
1203  {
1204  int hasClip;
1205  hrgn = NtGdiCreateRectRgn(0,0,0,0);
1206  if (hrgn)
1207  {
1208  hasClip = NtGdiGetRandomRgn(hdc, hrgn, CLIPRGN);
1209  if (hasClip != 1)
1210  {
1212  hrgn = NULL;
1213  }
1214  NtGdiIntersectClipRect(hdc, rect->left, rect->top, rect->right, rect->bottom);
1215  }
1216  }
1217 #endif
1218  if (flags & DT_MODIFYSTRING)
1219  {
1220  size_retstr = (count + 4) * sizeof (WCHAR);
1221 #ifdef _WIN32K_
1222  retstr = ExAllocatePoolWithTag(PagedPool, size_retstr, USERTAG_RTL);
1223 #else
1224  retstr = HeapAlloc(GetProcessHeap(), 0, size_retstr);
1225 #endif
1226  if (!retstr) return 0;
1227  memcpy (retstr, str, size_retstr);
1228  }
1229  else
1230  {
1231  size_retstr = 0;
1232  retstr = NULL;
1233  }
1234  p_retstr = retstr;
1235 
1236  do
1237  {
1238  len = sizeof(line)/sizeof(line[0]);
1239  if (invert_y)
1240  last_line = !(flags & DT_NOCLIP) && y - ((flags & DT_EDITCONTROL) ? 2*lh-1 : lh) < rect->bottom;
1241  else
1242  last_line = !(flags & DT_NOCLIP) && y + ((flags & DT_EDITCONTROL) ? 2*lh-1 : lh) > rect->bottom;
1243  strPtr = TEXT_NextLineW(hdc, strPtr, &count, line, &len, width, flags, &size, last_line, &p_retstr, tabwidth, &prefix_offset, &ellip);
1244 
1245 #ifdef __REACTOS__
1246  if (flags & DT_CENTER)
1247  {
1248  if (((rect->right - rect->left) < size.cx) && (flags & DT_CALCRECT))
1249  {
1250  x = rect->left + size.cx;
1251  }
1252  else
1253  {
1254  x = (rect->left + rect->right - size.cx) / 2;
1255  }
1256  }
1257 #else
1258  if (flags & DT_CENTER) x = (rect->left + rect->right -
1259  size.cx) / 2;
1260 #endif
1261  else if (flags & DT_RIGHT) x = rect->right - size.cx;
1262 
1263  if (flags & DT_SINGLELINE)
1264  {
1265 #ifdef __REACTOS__
1266  if (flags & DT_VCENTER)
1267  {
1268  if (flags & DT_CALCRECT)
1269  {
1270  if (rect->bottom - rect->top < size.cy / 2)
1271  y = rect->top + (invert_y ? size.cy : -size.cy) / 2;
1272  }
1273  else
1274  {
1275  y = rect->top + (rect->bottom - rect->top + (invert_y ? size.cy : -size.cy)) / 2;
1276  }
1277  }
1278  else if (flags & DT_BOTTOM)
1279  y = rect->bottom + (invert_y ? 0 : -size.cy);
1280 #else
1281  if (flags & DT_VCENTER) y = rect->top +
1282  (rect->bottom - rect->top) / 2 - size.cy / 2;
1283  else if (flags & DT_BOTTOM) y = rect->bottom - size.cy;
1284 #endif
1285  }
1286 
1287  if (!(flags & DT_CALCRECT))
1288  {
1289  const WCHAR *str = line;
1290  int xseg = x;
1291  while (len)
1292  {
1293  int len_seg;
1294  SIZE size;
1295  if ((flags & DT_EXPANDTABS))
1296  {
1297  const WCHAR *p;
1298  p = str; while (p < str+len && *p != TAB) p++;
1299  len_seg = p - str;
1300  if (len_seg != len &&
1301 #ifdef _WIN32K_
1302  !GreGetTextExtentW(hdc, str, len_seg, &size, 0))
1303 #else
1304  !GetTextExtentPointW(hdc, str, len_seg, &size))
1305 #endif
1306  {
1307 #ifdef _WIN32K_
1308  ExFreePoolWithTag(retstr, USERTAG_RTL);
1309 #else
1310  HeapFree (GetProcessHeap(), 0, retstr);
1311 #endif
1312  return 0;
1313  }
1314  }
1315  else
1316  len_seg = len;
1317 #ifdef _WIN32K_
1318  if (!UserExtTextOutW( hdc, xseg, y,
1319  ((flags & DT_NOCLIP) ? 0 : ETO_CLIPPED) |
1320  ((flags & DT_RTLREADING) ? ETO_RTLREADING : 0),
1321  rect, str, len_seg))
1322 #else
1323  if (!ExtTextOutW( hdc, xseg, y,
1324  ((flags & DT_NOCLIP) ? 0 : ETO_CLIPPED) |
1325  ((flags & DT_RTLREADING) ? ETO_RTLREADING : 0),
1326  rect, str, len_seg, NULL ))
1327 #endif
1328  {
1329 #ifdef _WIN32K_
1330  ExFreePoolWithTag(retstr, USERTAG_RTL);
1331 #else
1332  HeapFree (GetProcessHeap(), 0, retstr);
1333 #endif
1334  return 0;
1335  }
1336  if (prefix_offset != -1 && prefix_offset < len_seg)
1337  {
1338  TEXT_DrawUnderscore (hdc, xseg, y + tm.tmAscent + 1, str, prefix_offset, (flags & DT_NOCLIP) ? NULL : rect);
1339  }
1340  len -= len_seg;
1341  str += len_seg;
1342  if (len)
1343  {
1344  assert ((flags & DT_EXPANDTABS) && *str == TAB);
1345  len--; str++;
1346  xseg += ((size.cx/tabwidth)+1)*tabwidth;
1347  if (prefix_offset != -1)
1348  {
1349  if (prefix_offset < len_seg)
1350  {
1351  /* We have just drawn an underscore; we ought to
1352  * figure out where the next one is. I am going
1353  * to leave it for now until I have a better model
1354  * for the line, which will make reprefixing easier.
1355  * This is where ellip would be used.
1356  */
1357  prefix_offset = -1;
1358  }
1359  else
1360  prefix_offset -= len_seg;
1361  }
1362  }
1363  }
1364  }
1365  else if (size.cx > max_width)
1366  max_width = size.cx;
1367 
1368  y += invert_y ? -lh : lh;
1369  if (dtp)
1370  dtp->uiLengthDrawn += len;
1371  }
1372  while (strPtr && !last_line);
1373 
1374 #ifndef _WIN32K_
1375  if (!(flags & DT_NOCLIP) )
1376  {
1378  if (hrgn)
1379  {
1380  DeleteObject(hrgn);
1381  }
1382  }
1383 #else
1384  if (!(flags & DT_NOCLIP) )
1385  {
1387  if (hrgn)
1388  {
1390  }
1391  }
1392 #endif
1393 
1394  if (flags & DT_CALCRECT)
1395  {
1396  rect->right = rect->left + max_width;
1397  rect->bottom = y;
1398  if (dtp)
1399  rect->right += lmargin + rmargin;
1400  }
1401  if (retstr)
1402  {
1403  memcpy (str, retstr, size_retstr);
1404 #ifdef _WIN32K_
1405  ExFreePoolWithTag(retstr, USERTAG_RTL);
1406 #else
1407  HeapFree (GetProcessHeap(), 0, retstr);
1408 #endif
1409  }
1410  return y - rect->top;
1411 }
__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:1155
#define TRUE
Definition: types.h:120
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:503
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
__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:36
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:1413
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define DT_RIGHT
Definition: winuser.h:538
& rect
Definition: startmenu.cpp:1413
#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:484
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
#define assert(e)
Definition: text.c:47
#define ETO_CLIPPED
Definition: wingdi.h:647
#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:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
if(!(yy_init))
Definition: macro.lex.yy.c:714
BOOL WINAPI GetViewportExtEx(_In_ HDC, _Out_ LPSIZE)
Definition: coord.c:351
BOOL WINAPI GreGetTextMetricsW(_In_ HDC hdc, _Out_ LPTEXTMETRICW lptm)
Definition: text.c:151
__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:3074
GLbitfield flags
Definition: glext.h:7161
#define GM_COMPATIBLE
Definition: wingdi.h:863
#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)
char line[200]
Definition: main.c:97
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:76
#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:356
#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:1404
__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
#define USERTAG_RTL
Definition: tags.h:269
UINT uiLengthDrawn
Definition: winuser.h:3075
#define DT_CENTER
Definition: winuser.h:527
int WINAPI GetClipRgn(_In_ HDC, _In_ HRGN)
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
GLfloat GLfloat p
Definition: glext.h:8902
#define DT_BOTTOM
Definition: winuser.h:525
LONG cy
Definition: windef.h:320
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:394
#define MAX_BUFFER
Definition: text.c:1066
#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:1072
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 BUTTON_CalcLabelRect(), BUTTON_DrawTextCallback(), calc_tabbed_width(), calc_width(), CB_ThemedPaint(), CFn_WMPaint(), ConfirmMsgBox_Init(), ConfirmMsgBox_Paint(), CreateLayoutIcon(), DATETIME_Refresh(), DECLARE_INTERFACE_(), default_page_paint_hook(), DlgProc(), DrawProc(), DrawShadowText(), DrawStatusTextW(), DrawTextFromResource(), DrawThemeText(), EditTypeDlg_OnDrawItem(), FillGrid(), GetThemeTextExtent(), Graph_DrawCpuUsageGraph(), Graph_DrawMemUsageGraph(), HEADER_DrawItem(), ICONTITLE_Paint(), ICONTITLE_SetTitlePos(), 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(), CCell::OnPaint(), OnPaint(), output_number(), output_tabbed_text(), output_text(), PAINTING_DrawStateJam(), PaintText(), 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 532 of file defwnd.c.

538 {
540  LRESULT lResult = 0;
542  BOOL IsTaskBar;
543  DWORD Style;
544  DWORD ExStyle;
545 
546  if (Msg > WM_USER) return 0;
547 
548  switch (Msg)
549  {
550  case WM_GETTEXTLENGTH:
551  {
552  PWSTR buf;
553  ULONG len;
554 
555  if (Wnd != NULL && Wnd->strName.Length != 0)
556  {
557  buf = Wnd->strName.Buffer;
558  if (buf != NULL &&
560  buf,
561  Wnd->strName.Length)))
562  {
563  lResult = (LRESULT) (Wnd->strName.Length / sizeof(WCHAR));
564  }
565  }
566  else lResult = 0L;
567 
568  break;
569  }
570 
571  case WM_GETTEXT: // FIXME: Handle Ansi
572  {
573  PWSTR buf = NULL;
575 
576  if (Wnd != NULL && wParam != 0)
577  {
578  if (Wnd->strName.Buffer != NULL)
579  buf = Wnd->strName.Buffer;
580  else
581  outbuf[0] = L'\0';
582 
583  if (buf != NULL)
584  {
585  if (Wnd->strName.Length != 0)
586  {
587  lResult = min(Wnd->strName.Length / sizeof(WCHAR), wParam - 1);
589  buf,
590  lResult * sizeof(WCHAR));
591  outbuf[lResult] = L'\0';
592  }
593  else
594  outbuf[0] = L'\0';
595  }
596  }
597  break;
598  }
599 
600  case WM_SETTEXT: // FIXME: Handle Ansi
601  {
602  DefSetText(Wnd, (PCWSTR)lParam);
603 
604  if ((Wnd->style & WS_CAPTION) == WS_CAPTION)
606  IntNotifyWinEvent(EVENT_OBJECT_NAMECHANGE, Wnd, OBJID_WINDOW, CHILDID_SELF, 0);
607  lResult = 1;
608  break;
609  }
610 
611  case WM_SYSCOMMAND:
612  {
613  TRACE("hwnd %p WM_SYSCOMMAND %lx %lx\n", Wnd->head.h, wParam, lParam );
614  lResult = DefWndHandleSysCommand(Wnd, wParam, lParam);
615  break;
616  }
617 
618  case WM_SHOWWINDOW:
619  {
620  if ((Wnd->style & WS_VISIBLE) && wParam) break;
621  if (!(Wnd->style & WS_VISIBLE) && !wParam) break;
622  if (!Wnd->spwndOwner) break;
623  if (LOWORD(lParam))
624  {
626  }
627  break;
628  }
629 
630  case WM_CLIENTSHUTDOWN:
631  return IntClientShutdown(Wnd, wParam, lParam);
632 
633  case WM_APPCOMMAND:
634  if ( (Wnd->style & (WS_POPUP|WS_CHILD)) != WS_CHILD &&
635  Wnd != co_GetDesktopWindow(Wnd) )
636  {
637  if (!co_HOOK_CallHooks(WH_SHELL, HSHELL_APPCOMMAND, wParam, lParam))
638  co_IntShellHookNotify(HSHELL_APPCOMMAND, wParam, lParam);
639  break;
640  }
641  UserRefObjectCo(Wnd->spwndParent, &Ref);
644  break;
645 
646  case WM_KEYF1:
647  {
648  HELPINFO hi;
649  HMENU hMenu = UlongToHandle(Wnd->IDMenu);
650  PWND pwndActive = MENU_IsMenuActive();
651  hi.cbSize = sizeof(HELPINFO);
652  hi.MousePos = gpsi->ptCursor;
654  hi.hItemHandle = pwndActive ? UserHMGetHandle(pwndActive) : UserHMGetHandle(Wnd);
655  hi.iCtrlId = (Wnd->style & (WS_POPUP|WS_CHILD)) == WS_CHILD ? IntMenuItemFromPoint(Wnd, hMenu, hi.MousePos) : 0;
657 
658  co_IntSendMessage( UserHMGetHandle(Wnd), WM_HELP, 0, (LPARAM)&hi );
659  break;
660  }
661 
662  case WM_SETICON:
663  {
664  return DefWndSetIcon(Wnd, wParam, lParam);
665  }
666 
667  case WM_GETICON:
668  {
669  return DefWndGetIcon(Wnd, wParam, lParam);
670  }
671 
672  case WM_HELP:
673  {
674  PWND Parent = IntGetParent(Wnd);
676  break;
677  }
678 
679  case WM_LBUTTONDOWN:
680  case WM_RBUTTONDOWN:
681  case WM_MBUTTONDOWN:
682  pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK);
683  break;
684 
685  case WM_NCLBUTTONDOWN:
686  return NC_HandleNCLButtonDown(Wnd, wParam, lParam);
687 
688  case WM_NCRBUTTONDOWN:
689  return NC_HandleNCRButtonDown(Wnd, wParam, lParam);
690 
691  case WM_LBUTTONDBLCLK:
693 
694  case WM_NCLBUTTONDBLCLK:
695  return NC_HandleNCLButtonDblClk(Wnd, wParam, lParam);
696 
697  case WM_RBUTTONUP:
698  {
699  POINT Pt;
700 
701  Pt.x = GET_X_LPARAM(lParam);
702  Pt.y = GET_Y_LPARAM(lParam);
703  IntClientToScreen(Wnd, &Pt);
704  lParam = MAKELPARAM(Pt.x, Pt.y);
706  break;
707  }
708 
709  case WM_NCRBUTTONUP:
710  /*
711  * FIXME : we must NOT send WM_CONTEXTMENU on a WM_NCRBUTTONUP (checked
712  * in Windows), but what _should_ we do? According to MSDN :
713  * "If it is appropriate to do so, the system sends the WM_SYSCOMMAND
714  * message to the window". When is it appropriate?
715  */
716  ERR("WM_NCRBUTTONUP\n");
717  break;
718 
719  case WM_XBUTTONUP:
720  case WM_NCXBUTTONUP:
721  if (HIWORD(wParam) == XBUTTON1 || HIWORD(wParam) == XBUTTON2)
722  {
724  MAKELPARAM(LOWORD(wParam), FAPPCOMMAND_MOUSE | HIWORD(wParam)));
725  }
726  break;
727 
728 
729  case WM_CONTEXTMENU:
730  {
731  if (Wnd->style & WS_CHILD)
732  {
734  }
735  else
736  {
737  POINT Pt;
738  LONG_PTR Style;
739  LONG HitCode;
740 
741  Style = Wnd->style;
742 
743  Pt.x = GET_X_LPARAM(lParam);
744  Pt.y = GET_Y_LPARAM(lParam);
745  if (Style & WS_CHILD)
746  {
747  IntScreenToClient(IntGetParent(Wnd), &Pt);
748  }
749 
750  HitCode = GetNCHitEx(Wnd, Pt);
751 
752  if (HitCode == HTCAPTION || HitCode == HTSYSMENU)
753  {
754  PMENU SystemMenu;
755  UINT Flags;
756 
757  if((SystemMenu = IntGetSystemMenu(Wnd, FALSE)))
758  {
759  MENU_InitSysMenuPopup(SystemMenu, Wnd->style, Wnd->pcls->style, HitCode);
760 
761  if(HitCode == HTCAPTION)
763  else
765 
766  IntTrackPopupMenuEx(SystemMenu, Flags|TPM_SYSTEM_MENU, Pt.x, Pt.y, Wnd, NULL);
767  }
768  }
769  if (HitCode == HTHSCROLL || HitCode == HTVSCROLL)
770  {
771  WARN("Scroll Menu Not Supported\n");
772  }
773  }
774  break;
775  }
776 
777  case WM_KEYDOWN:
778  if (wParam == VK_F10)
779  {
780  pti->MessageQueue->QF_flags |= QF_FF10STATUS;
781 
782  if (UserGetKeyState(VK_SHIFT) & 0x8000)
783  {
785  }
786  }
788  {
789  HWND hwndTop = UserGetForegroundWindow();
790  PWND topWnd = UserGetWindowObject(hwndTop);
791 
792  /* Test for typical TaskBar ExStyle Values */
793  ExStyle = (topWnd->ExStyle & WS_EX_TOOLWINDOW);
794  TRACE("ExStyle is '%x'.\n", ExStyle);
795 
796  /* Test for typical TaskBar Style Values */
797  Style = (topWnd->style & (WS_POPUP | WS_VISIBLE |
799  TRACE("Style is '%x'.\n", Style);
800 
801  /* Test for masked typical TaskBar Style and ExStyles to detect TaskBar */
802  IsTaskBar = (Style == (WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN))
803  && (ExStyle == WS_EX_TOOLWINDOW);
804  TRACE("This %s the TaskBar.\n", IsTaskBar ? "is" : "is not");
805 
806  if (topWnd && !IsTaskBar) /* Second test is so we are not touching the Taskbar */
807  {
808  if ((topWnd->style & WS_THICKFRAME) == 0)
809  {
810  return 0;
811  }
812 
813  if (wParam == VK_DOWN)
814  {
815  if (topWnd->style & WS_MAXIMIZE)
817  else
819  }
820  else if (wParam == VK_UP)
821  {
822  RECT currentRect;
823  if ((topWnd->InternalPos.NormalRect.right == topWnd->InternalPos.NormalRect.left) ||
824  (topWnd->InternalPos.NormalRect.top == topWnd->InternalPos.NormalRect.bottom))
825  {
826  currentRect = topWnd->rcWindow;
827  }
828  else
829  {
830  currentRect = topWnd->InternalPos.NormalRect;
831  }
833 
834  // save normal rect if maximazing snapped window
835  topWnd->InternalPos.NormalRect = currentRect;
836  }
837  else if (wParam == VK_LEFT || wParam == VK_RIGHT)
838  {
839  RECT snapRect, normalRect, windowRect;
840  BOOL snapped;
841  normalRect = topWnd->InternalPos.NormalRect;
842  snapped = (normalRect.left != 0 && normalRect.right != 0 &&
843  normalRect.top != 0 && normalRect.bottom != 0);
844 
845  if (topWnd->style & WS_MAXIMIZE)
846  {
848  snapped = FALSE;
849  }
850  windowRect = topWnd->rcWindow;
851 
852  UserSystemParametersInfo(SPI_GETWORKAREA, 0, &snapRect, 0);
853  if (wParam == VK_LEFT)
854  {
855  snapRect.right = (snapRect.left + snapRect.right) / 2;
856  }
857  else // VK_RIGHT
858  {
859  snapRect.left = (snapRect.left + snapRect.right) / 2;
860  }
861 
862  if (snapped)
863  {
864  // if window was snapped but moved to other location - restore normal size
865  if (!IntEqualRect(&snapRect, &windowRect))
866  {
867  RECT empty = {0, 0, 0, 0};
868  co_WinPosSetWindowPos(topWnd,
869  0,
870  normalRect.left,
871  normalRect.top,
872  normalRect.right - normalRect.left,
873  normalRect.bottom - normalRect.top,
874  0);
875  topWnd->InternalPos.NormalRect = empty;
876  }
877  }
878  else
879  {
880  co_WinPosSetWindowPos(topWnd,
881  0,
882  snapRect.left,
883  snapRect.top,
884  snapRect.right - snapRect.left,
885  snapRect.bottom - snapRect.top,
886  0);
887  topWnd->InternalPos.NormalRect = windowRect;
888  }
889  }
890  }
891  }
892  break;
893 
894  case WM_SYSKEYDOWN:
895  {
896  if (HIWORD(lParam) & KF_ALTDOWN)
897  { /* Previous state, if the key was down before this message,
898  this is a cheap way to ignore autorepeat keys. */
899  if ( !(HIWORD(lParam) & KF_REPEAT) )
900  {
901  if ( ( wParam == VK_MENU ||
902  wParam == VK_LMENU ||
903  wParam == VK_RMENU ) && !(pti->MessageQueue->QF_flags & QF_FMENUSTATUS)) //iMenuSysKey )
904  pti->MessageQueue->QF_flags |= QF_FMENUSTATUS; //iMenuSysKey = 1;
905  else
906  pti->MessageQueue->QF_flags &= ~QF_FMENUSTATUS; //iMenuSysKey = 0;
907  }
908 
909  pti->MessageQueue->QF_flags &= ~QF_FF10STATUS; //iF10Key = 0;
910 
911  if (wParam == VK_F4) /* Try to close the window */
912  {
914  if (!(top->style & CS_NOCLOSE))
916  }
917  else if (wParam == VK_SNAPSHOT) // Alt-VK_SNAPSHOT?
918  {
919  PWND pwnd = Wnd;
920  while (IntGetParent(pwnd) != NULL)
921  {
922  pwnd = IntGetParent(pwnd);
923  }
924  ERR("DefWndScreenshot\n");
925  DefWndScreenshot(pwnd);
926  }
927  else if ( wParam == VK_ESCAPE || wParam == VK_TAB ) // Alt-Tab/ESC Alt-Shift-Tab/ESC
928  {
929  WPARAM wParamTmp;
930  HWND Active = UserGetActiveWindow(); // Noticed MDI problem.
931  if (!Active)
932  {
933  FIXME("WM_SYSKEYDOWN VK_ESCAPE no active\n");
934  break;
935  }
936  wParamTmp = UserGetKeyState(VK_SHIFT) & 0x8000 ? SC_PREVWINDOW : SC_NEXTWINDOW;
938  }
939  }
940  else if( wParam == VK_F10 )
941  {
942  if (UserGetKeyState(VK_SHIFT) & 0x8000)
944  pti->MessageQueue->QF_flags |= QF_FF10STATUS; //iF10Key = 1;
945  }
946  else if( wParam == VK_ESCAPE && (UserGetKeyState(VK_SHIFT) & 0x8000))
948  break;
949  }
950 
951  case WM_KEYUP:
952  case WM_SYSKEYUP:
953  {
954  /* Press and release F10 or ALT */
955  if (((wParam == VK_MENU || wParam == VK_LMENU || wParam == VK_RMENU)
956  && (pti->MessageQueue->QF_flags & (QF_FMENUSTATUS|QF_FMENUSTATUSBREAK)) == QF_FMENUSTATUS /*iMenuSysKey*/) ||
957  ((wParam == VK_F10) && pti->MessageQueue->QF_flags & QF_FF10STATUS /*iF10Key*/))
959  pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK|QF_FF10STATUS); //iMenuSysKey = iF10Key = 0;
960  break;
961  }
962 
963  case WM_SYSCHAR:
964  {
965  pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK); //iMenuSysKey = 0;
966  if (wParam == VK_RETURN && (Wnd->style & WS_MINIMIZE) != 0)
967  {
969  break;
970  }
971  if ((HIWORD(lParam) & KF_ALTDOWN) && wParam)
972  {
973  if (wParam == VK_TAB || wParam == VK_ESCAPE) break;
974  if (wParam == VK_SPACE && Wnd->style & WS_CHILD)
976  else
978  }
979  else /* check for Ctrl-Esc */
980  if (wParam != VK_ESCAPE) UserPostMessage(hwndSAS, WM_LOGONNOTIFY, LN_MESSAGE_BEEP, 0); //MessageBeep(0);
981  break;
982  }
983 
984  case WM_CANCELMODE:
985  {
986  pti->MessageQueue->QF_flags &= ~(QF_FMENUSTATUS|QF_FMENUSTATUSBREAK);
987 
988  MENU_EndMenu( Wnd );
989  if (IntGetCaptureWindow() == UserHMGetHandle(Wnd))
990  {
992  }
993  break;
994  }
995 
996  case WM_CLOSE:
998  break;
999 
1000  case WM_CTLCOLORMSGBOX:
1001  case WM_CTLCOLOREDIT:
1002  case WM_CTLCOLORLISTBOX:
1003  case WM_CTLCOLORBTN:
1004  case WM_CTLCOLORDLG:
1005  case WM_CTLCOLORSTATIC:
1006  case WM_CTLCOLORSCROLLBAR:
1008 
1009  case WM_CTLCOLOR:
1011 
1012  case WM_SETCURSOR:
1013  {
1014  if (Wnd->style & WS_CHILD)
1015  {
1016  /* with the exception of the border around a resizable wnd,
1017  * give the parent first chance to set the cursor */
1019  {
1020  PWND parent = Wnd->spwndParent;//IntGetParent( Wnd );
1021  if (parent != UserGetDesktopWindow() &&
1023  return TRUE;
1024  }
1025  }
1026  return DefWndHandleSetCursor(Wnd, wParam, lParam);
1027  }
1028 
1029  case WM_MOUSEACTIVATE:
1030  if (Wnd->style & WS_CHILD)
1031  {
1032  LONG Ret;
1033  HWND hwndParent;
1034  PWND pwndParent = IntGetParent(Wnd);
1035  hwndParent = pwndParent ? UserHMGetHandle(pwndParent) : NULL;
1037  if (Ret) return (Ret);
1038  }
1040 
1041  case WM_ACTIVATE:
1042  /* The default action in Windows is to set the keyboard focus to
1043  * the window, if it's being activated and not minimized */
1044  if (LOWORD(wParam) != WA_INACTIVE &&
1045  !(Wnd->style & WS_MINIMIZE))
1046  {
1047  //ERR("WM_ACTIVATE %p\n",hWnd);
1048  co_UserSetFocus(Wnd);
1049  }
1050  break;
1051 
1052  case WM_MOUSEWHEEL:
1053  if (Wnd->style & WS_CHILD)
1054  {
1055  HWND hwndParent;
1056  PWND pwndParent = IntGetParent(Wnd);
1057  hwndParent = pwndParent ? UserHMGetHandle(pwndParent) : NULL;
1059  }
1060  break;
1061 
1062  case WM_ERASEBKGND:
1063  case WM_ICONERASEBKGND:
1064  {
1065  RECT Rect;
1066  HBRUSH hBrush = Wnd->pcls->hbrBackground;
1067  if (!hBrush) return 0;
1068  if (hBrush <= (HBRUSH)COLOR_MENUBAR)
1069  {
1070  hBrush = IntGetSysColorBrush(HandleToUlong(hBrush));
1071  }
1072  if (Wnd->pcls->style & CS_PARENTDC)
1073  {
1074  /* can't use GetClipBox with a parent DC or we fill the whole parent */
1075  IntGetClientRect(Wnd, &Rect);
1076  GreDPtoLP((HDC)wParam, (LPPOINT)&Rect, 2);
1077  }
1078  else
1079  {
1080  GdiGetClipBox((HDC)wParam, &Rect);
1081  }
1082  FillRect((HDC)wParam, &Rect, hBrush);
1083  return (1);
1084  }
1085 
1086  case WM_GETHOTKEY:
1087  //ERR("WM_GETHOTKEY\n");
1088  return DefWndGetHotKey(Wnd);
1089  case WM_SETHOTKEY:
1090  //ERR("WM_SETHOTKEY\n");
1091  return DefWndSetHotKey(Wnd, wParam);
1092 
1093  case WM_NCHITTEST:
1094  {
1095  POINT Point;
1098  return GetNCHitEx(Wnd, Point);
1099  }
1100 
1101  case WM_PRINT:
1102  {
1103  DefWndPrint(Wnd, (HDC)wParam, lParam);
1104  return (0);
1105  }
1106 
1107  case WM_SYSCOLORCHANGE:
1108  {
1109  /* force to redraw non-client area */
1110  UserPaintCaption(Wnd, DC_NC);
1111  /* Use InvalidateRect to redraw client area, enable
1112  * erase to redraw all subcontrols otherwise send the
1113  * WM_SYSCOLORCHANGE to child windows/controls is required
1114  */
1116  return (0);
1117  }
1118 
1119  case WM_PAINTICON:
1120  case WM_PAINT:
1121  {
1122  PAINTSTRUCT Ps;
1123  HDC hDC;
1124 
1125  /* If already in Paint and Client area is not empty just return. */
1126  if (Wnd->state2 & WNDS2_STARTPAINT && !RECTL_bIsEmptyRect(&Wnd->rcClient))
1127  {
1128  ERR("In Paint and Client area is not empty!\n");
1129  return 0;
1130  }
1131 
1132  hDC = IntBeginPaint(Wnd, &Ps);
1133  if (hDC)
1134  {
1135  if (((Wnd->style & WS_MINIMIZE) != 0) && (Wnd->pcls->spicn))
1136  {
1137  RECT ClientRect;
1138  INT x, y;
1139 
1140  ERR("Doing Paint and Client area is empty!\n");
1141  IntGetClientRect(Wnd, &ClientRect);
1142  x = (ClientRect.right - ClientRect.left - UserGetSystemMetrics(SM_CXICON)) / 2;
1143  y = (ClientRect.bottom - ClientRect.top - UserGetSystemMetrics(SM_CYICON)) / 2;
1145  UserDrawIconEx(hDC, x, y, Wnd->pcls->spicn, 0, 0, 0, 0, DI_NORMAL | DI_COMPAT | DI_DEFAULTSIZE);
1147  }
1148 
1149  IntEndPaint(Wnd, &Ps);
1150  }
1151  return (0);
1152  }
1153 
1154  case WM_SYNCPAINT:
1155  {
1156  HRGN hRgn;
1157  Wnd->state &= ~WNDS_SYNCPAINTPENDING;
1158  TRACE("WM_SYNCPAINT\n");
1159  hRgn = NtGdiCreateRectRgn(0, 0, 0, 0);
1160  if (hRgn)
1161  {
1162  if (co_UserGetUpdateRgn(Wnd, hRgn, FALSE) != NULLREGION)
1163  {
1164  PREGION pRgn = REGION_LockRgn(hRgn);
1165  if (pRgn) REGION_UnlockRgn(pRgn);
1166  if (!wParam)
1168  co_UserRedrawWindow(Wnd, NULL, pRgn, wParam);
1169  }
1171  }
1172  return 0;
1173  }
1174 
1175  case WM_SETREDRAW:
1176  if (wParam)
1177  {
1178  if (!(Wnd->style & WS_VISIBLE))
1179  {
1180  IntSetStyle( Wnd, WS_VISIBLE, 0 );
1181  Wnd->state |= WNDS_SENDNCPAINT;
1182  }
1183  }
1184  else
1185  {
1186  if (Wnd->style & WS_VISIBLE)
1187  {
1189  IntSetStyle( Wnd, 0, WS_VISIBLE );
1190  }
1191  }
1192  return 0;
1193 
1194  case WM_WINDOWPOSCHANGING:
1195  {
1197  }
1198 
1199  case WM_WINDOWPOSCHANGED:
1200  {
1202  }
1203 
1204  case WM_NCCALCSIZE:
1205  {
1206  return NC_HandleNCCalcSize( Wnd, wParam, (RECTL *)lParam, FALSE );
1207  }
1208 
1209  case WM_NCACTIVATE:
1210  {
1211  return NC_HandleNCActivate( Wnd, wParam, lParam );
1212  }
1213 
1214  //
1215  // NC Paint mode.
1216  //
1217  case WM_NCPAINT:
1218  {
1220  Wnd->state |= WNDS_FORCEMENUDRAW;
1221  NC_DoNCPaint(Wnd, hDC, -1);
1222  Wnd->state &= ~WNDS_FORCEMENUDRAW;
1223  UserReleaseDC(Wnd, hDC, FALSE);
1224  return 0;
1225  }
1226  //
1227  // Draw Caption mode.
1228  //
1229  // wParam are DC_* flags.
1230  //
1231  case WM_NCUAHDRAWCAPTION:
1232  {
1234  TRACE("WM_NCUAHDRAWCAPTION: wParam DC_ flags %08x\n",wParam);
1235  UserDrawCaptionBar(Wnd, hDC, wParam|DC_FRAME); // Include DC_FRAME to comp for drawing glich.
1236  UserReleaseDC(Wnd, hDC, FALSE);
1237  return 0;
1238  }
1239  //
1240  // Draw Frame mode.
1241  //
1242  // wParam is HDC, lParam are DC_ACTIVE and or DC_REDRAWHUNGWND.
1243  //
1244  case WM_NCUAHDRAWFRAME:
1245  {
1246  TRACE("WM_NCUAHDRAWFRAME: wParam hDC %p lParam DC_ flags %08x\n",wParam,lParam);
1248  return 0;
1249  }
1250 
1251  /* ReactOS only. */
1252  case WM_CBT:
1253  {
1254  switch (wParam)
1255  {
1256  case HCBT_MOVESIZE:
1257  {
1258  RECTL rt;
1259 
1260  if (lParam)
1261  {
1262  _SEH2_TRY
1263  {
1265  sizeof(RECT),
1266  1);
1267 
1268  RtlCopyMemory(&rt,
1269  (PVOID)lParam,
1270  sizeof(RECT));
1271  }
1273  {
1274  lResult = 1;
1275  }
1276  _SEH2_END;
1277  }
1278  if (!lResult)
1279  lResult = co_HOOK_CallHooks(WH_CBT, HCBT_MOVESIZE, (WPARAM)Wnd->head.h, lParam ? (LPARAM)&rt : 0);
1280  }
1281  break;
1282  }
1283  break;
1284  }
1285  break;
1286  }
1287  return lResult;
1288 }
BYTE gafAsyncKeyState[256 *2/8]
Definition: keyboard.c:13
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1674
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
#define WM_SYNCPAINT
Definition: winuser.h:1672
#define WM_GETTEXTLENGTH
Definition: winuser.h:1601
#define GA_ROOT
Definition: winuser.h:2764
__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:1634
#define HTLEFT
Definition: winuser.h:2462
const uint16_t * PCWSTR
Definition: typedefs.h:55
#define WM_PAINTICON
Definition: winuser.h:1623
BOOL FASTCALL UserPostMessage(HWND Wnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1181
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1608
void FASTCALL MENU_InitSysMenuPopup(PMENU menu, DWORD style, DWORD clsStyle, LONG HitTest)
Definition: menu.c:1362
DWORD ExStyle
Definition: ntuser.h:668
#define HTHSCROLL
Definition: winuser.h:2456
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
BOOL NTAPI GreDeleteObject(HGDIOBJ hobj)
Definition: gdiobj.c:1155
#define TRUE
Definition: types.h:120
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define SC_KEYMENU
Definition: winuser.h:2571
#define SC_RESTORE
Definition: winuser.h:2573
#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:1758
HWND FASTCALL co_UserSetFocus(PWND Window)
Definition: focus.c:1196
HGDIOBJ FASTCALL IntGetSysColorBrush(INT Object)
Definition: stockobj.c:317
long x
Definition: polytest.cpp:48
#define TPM_SYSTEM_MENU
Definition: undocuser.h:71
BOOL FASTCALL IntReleaseCapture(VOID)
Definition: focus.c:1412
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define WM_CTLCOLORDLG
Definition: winuser.h:1752
#define WM_GETHOTKEY
Definition: winuser.h:1635
#define SW_HIDE
Definition: winuser.h:762
HWND FASTCALL UserGetActiveWindow(VOID)
Definition: focus.c:1311
#define VK_RMENU
Definition: winuser.h:2262
uint16_t * PWSTR
Definition: typedefs.h:54
#define WM_CLIENTSHUTDOWN
Definition: undocuser.h:35
#define WM_MOUSEWHEEL
Definition: treelist.c:96
static const WCHAR empty[]
Definition: main.c:49
#define WM_NCCALCSIZE
Definition: winuser.h:1667
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1754
#define WNDS_SENDNCPAINT
Definition: ntuser.h:584
#define WM_GETTEXT
Definition: winuser.h:1600
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:124
#define WARN(fmt,...)
Definition: debug.h:111
#define MAKELPARAM(l, h)
Definition: winuser.h:3947
DWORD_PTR dwContextId
Definition: winuser.h:3290
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:1720
NTSYSAPI NTSTATUS NTAPI RtlUnicodeToMultiByteSize(PULONG MbSize, PCWCH UnicodeString, ULONG UnicodeSize)
#define HandleToUlong(h)
Definition: basetsd.h:79
static HDC
Definition: imagelist.c:92
HANDLE hItemHandle
Definition: winuser.h:3289
#define WM_SETREDRAW
Definition: winuser.h:1598
#define OBJID_WINDOW
Definition: winable.h:15
#define NULLREGION
Definition: wingdi.h:360
#define WH_SHELL
Definition: winuser.h:40
LONG top
Definition: windef.h:292
static __inline VOID UserRefObjectCo(PVOID obj, PUSER_REFERENCE_ENTRY UserReferenceEntry)
Definition: object.h:25
#define DI_COMPAT
Definition: wingdi.h:68
#define GET_X_LPARAM(lp)
Definition: windowsx.h:274
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:2476
#define VK_LEFT
Definition: winuser.h:2199
#define WM_SHOWWINDOW
Definition: winuser.h:1610
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
#define WM_NCRBUTTONDOWN
Definition: winuser.h:1677
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
struct _WND::@4115 InternalPos
#define WM_CTLCOLOR
Definition: windowsx.h:4
BOOL WINAPI IntTrackPopupMenuEx(PMENU menu, UINT wFlags, int x, int y, PWND pWnd, LPTPMPARAMS lpTpm)
Definition: menu.c:4558
BOOL FASTCALL UserDereferenceObject(PVOID Object)
Definition: object.c:610
#define WM_NCHITTEST
Definition: winuser.h:1668
UINT_PTR WPARAM
Definition: windef.h:207
#define VK_LWIN
Definition: winuser.h:2210
#define VK_TAB
Definition: winuser.h:2174
#define VK_DOWN
Definition: winuser.h:2202
#define WS_CHILD
Definition: pedump.c:617
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn BOOLEAN Physical 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:722
RECT rcClient
Definition: ntuser.h:681
#define VK_MENU
Definition: winuser.h:2179
#define RDW_FRAME
Definition: winuser.h:1198
LONG left
Definition: windef.h:291
VOID FASTCALL IntGetClientRect(PWND WindowObject, RECTL *Rect)
Definition: winpos.c:91
HWND FASTCALL IntGetCaptureWindow(VOID)
Definition: focus.c:32
#define WNDS2_STARTPAINT
Definition: ntuser.h:611
#define VK_ESCAPE
Definition: winuser.h:2189
#define WS_CLIPCHILDREN
Definition: pedump.c:619
LONG right
Definition: windef.h:293
#define WM_CTLCOLORLISTBOX
Definition: winuser.h:1750
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:472
int32_t INT
Definition: typedefs.h:56
PSERVERINFO gpsi
Definition: main.c:27
#define VK_RETURN
Definition: winuser.h:2176
struct _CURICON_OBJECT * spicn
Definition: ntuser.h:553
WPARAM wParam
Definition: combotst.c:138
#define DCX_INTERSECTRGN
Definition: winuser.h:2104
#define DCX_WINDOW
Definition: winuser.h:2095
LRESULT DefWndHandleSetCursor(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:242
#define QF_FF10STATUS
Definition: msgqueue.h:98
DWORD FASTCALL UserGetKeyState(DWORD dwKey)
Definition: msgqueue.c:221
#define QF_FMENUSTATUS
Definition: msgqueue.h:97
_SEH2_TRY
Definition: create.c:4250
#define VK_F10
Definition: winuser.h:2239
#define WM_NCPAINT
Definition: winuser.h:1669
#define TPM_RIGHTBUTTON
Definition: winuser.h:2355
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
struct @1576 Msg[]
#define WM_CTLCOLORBTN
Definition: winuser.h:1751
#define HTSYSMENU
Definition: winuser.h:2452
UINT style
Definition: ntuser.h:548
#define VK_UP
Definition: winuser.h:2200
#define DC_NC
Definition: winuser.h:440
#define WM_NCACTIVATE
Definition: winuser.h:1670
#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:2644
static __inline VOID UserDerefObjectCo(PVOID obj)
Definition: object.h:38
#define WM_NCRBUTTONUP
Definition: winuser.h:1678
#define WM_SETCURSOR
Definition: winuser.h:1618
BOOL FASTCALL GreDPtoLP(HDC, LPPOINT, INT)
Definition: dcutil.c:7
#define FIXME(fmt,...)
Definition: debug.h:110
#define WM_CTLCOLORSCROLLBAR
Definition: winuser.h:1753
#define WM_SYSCHAR
Definition: winuser.h:1703
#define SM_CXICON
Definition: winuser.h:962
#define VK_F4
Definition: winuser.h:2233
#define CHILDID_SELF
Definition: winable.h:14
#define SC_MAXIMIZE
Definition: winuser.h:2563
struct _WND * spwndOwner
Definition: ntuser.h:679
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
LRESULT NC_DoNCPaint(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:1042
#define VK_SHIFT
Definition: winuser.h:2177
THRDESKHEAD head
Definition: ntuser.h:659
Definition: object.h:3
#define DCX_KEEPCLIPRGN
Definition: undocuser.h:66
smooth NULL
Definition: ftsmooth.c:416
#define WM_ICONERASEBKGND
Definition: winuser.h:1624
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:95
#define WM_KEYDOWN
Definition: winuser.h:1697
#define WM_CTLCOLORMSGBOX
Definition: winuser.h:1748
LONG_PTR LPARAM
Definition: windef.h:208
INT FASTCALL co_UserGetUpdateRgn(PWND Window, HRGN hRgn, BOOL bErase)
Definition: painting.c:1770
PWND FASTCALL co_GetDesktopWindow(PWND pWnd)
Definition: desktop.c:1330
#define WH_CBT
Definition: winuser.h:35
#define DI_DEFAULTSIZE
Definition: wingdi.h:69
POINT MousePos
Definition: winuser.h:3291
Definition: region.h:7
#define WM_MOUSEACTIVATE
Definition: winuser.h:1619
Definition: sacdrv.h:287
#define WM_SETTEXT
Definition: winuser.h:1599
LARGE_UNICODE_STRING strName
Definition: ntuser.h:700
VOID FASTCALL DefWndScreenshot(PWND pWnd)
Definition: defwnd.c:496
PWND FASTCALL UserGetWindowObject(HWND hWnd)
Definition: window.c:103
HWND FASTCALL UserGetForegroundWindow(VOID)
Definition: focus.c:1303
#define WM_RBUTTONDOWN
Definition: winuser.h:1761
int iContextType
Definition: winuser.h:3287
void MENU_EndMenu(PWND pwnd)
Definition: menu.c:2662
DWORD FASTCALL IntGetWindowContextHelpId(PWND pWnd)
Definition: window.c:410
LONG NTAPI UserGetSystemMetrics(ULONG Index)
Definition: metric.c:180
#define WM_APPCOMMAND
Definition: winuser.h:1864
BOOLEAN FASTCALL co_WinPosShowWindow(PWND Wnd, INT Cmd)
Definition: winpos.c:2464
HWND hwndSAS
Definition: winsta.c:24
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define KF_REPEAT
Definition: winuser.h:2425
#define WS_CAPTION
Definition: pedump.c:624
struct tagHELPINFO HELPINFO
BOOL FASTCALL DefSetText(HWND hWnd, PCWSTR String, BOOL Ansi)
Definition: defwnd.c:64
UINT_PTR IDMenu
Definition: ntuser.h:695
VOID FASTCALL DefWndPrint(PWND pwnd, HDC hdc, ULONG uFlags)
Definition: defwnd.c:363
#define TRACE(s)
Definition: solgame.cpp:4
const DWORD Style
Definition: appswitch.c:71
r parent
Definition: btrfs.c:2897
HBRUSH hbrBackground
Definition: ntuser.h:555
PMENU FASTCALL IntGetSystemMenu(PWND Window, BOOL bRevert)
Definition: menu.c:5380
__wchar_t WCHAR
Definition: xmlstorage.h:180
PWND MENU_IsMenuActive(VOID)
Definition: menu.c:2650
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define RDW_ERASE
Definition: winuser.h:1197
#define UlongToHandle(ul)
Definition: basetsd.h:97
#define WM_NCUAHDRAWCAPTION
Definition: undocuser.h:45
#define DC_FRAME
Definition: undocuser.h:147
#define WM_WINDOWPOSCHANGING
Definition: winuser.h:1643
#define WM_CLOSE
Definition: winuser.h:1603
#define WM_KEYUP
Definition: winuser.h:1698
unsigned long DWORD
Definition: ntddk_ex.h:95
HDC FASTCALL IntBeginPaint(PWND Window, PPAINTSTRUCT Ps)
Definition: painting.c:1422
#define HELPINFO_MENUITEM
Definition: winuser.h:1157
#define WM_RBUTTONUP
Definition: winuser.h:1762
#define WM_PRINT
Definition: winuser.h:1862
#define SC_PREVWINDOW
Definition: winuser.h:2566
#define WM_PAINT
Definition: winuser.h:1602
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:1349
#define RDW_VALIDATE
Definition: winuser.h:1204
LRESULT NC_HandleNCCalcSize(PWND Wnd, WPARAM wparam, RECTL *Rect, BOOL Suspended)
Definition: nonclient.c:1248
struct Point Point
#define SM_CYICON
Definition: winuser.h:963
#define WNDS_SYNCPAINTPENDING
Definition: ntuser.h:596
VOID NTAPI ProbeForRead(IN CONST VOID *Address, IN SIZE_T Length, IN ULONG Alignment)
Definition: exintrin.c:102
static const WCHAR L[]
Definition: oid.c:1250
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
#define VK_LMENU
Definition: winuser.h:2261
#define WM_CANCELMODE
Definition: winuser.h:1617
#define DI_NORMAL
Definition: wingdi.h:72
GLenum GLsizei len
Definition: glext.h:6722
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1760
#define LRESULT
Definition: ole.h:14
BOOL FASTCALL IntScreenToClient(PWND Wnd, LPPOINT lpPoint)
Definition: winpos.c:212
RECT rcWindow
Definition: ntuser.h:680
UINT cbSize
Definition: winuser.h:3286
#define WM_LOGONNOTIFY
Definition: undocuser.h:37
#define MA_NOACTIVATE
Definition: winuser.h:2478
#define HTBOTTOMRIGHT
Definition: winuser.h:2470
#define VK_RWIN
Definition: winuser.h:2211
#define WM_USER
Definition: winuser.h:1877
PWND FASTCALL UserGetAncestor(PWND Wnd, UINT Type)
Definition: window.c:3144
#define VK_RIGHT
Definition: winuser.h:2201
#define SC_MINIMIZE
Definition: winuser.h:2561
#define ERR(fmt,...)
Definition: debug.h:109
#define HTCAPTION
Definition: winuser.h:2451
Definition: ntuser.h:657
struct _USER_MESSAGE_QUEUE * MessageQueue
Definition: win32.h:88
LRESULT NC_HandleNCLButtonDblClk(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1610
static HDC hDC
Definition: 3dtext.c:33
VOID UserDrawCaptionBar(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:900
_SEH2_END
Definition: create.c:4424
INT FASTCALL DefWndSetHotKey(PWND pWnd, WPARAM wParam)
Definition: hotkey.c:340
#define WM_ACTIVATE
Definition: winuser.h:1594
BOOL FASTCALL co_UserRedrawWindow(PWND Window, const RECTL *UpdateRect, PREGION UpdateRgn, ULONG Flags)
Definition: painting.c:876
#define RDW_ALLCHILDREN
Definition: winuser.h:1207
#define WM_SYSKEYUP
Definition: winuser.h:1702
LRESULT FASTCALL DefWndSetIcon(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: defwnd.c:434
#define WM_CTLCOLOREDIT
Definition: winuser.h:1749
FORCEINLINE BOOL IntEqualRect(RECTL *lprc1, RECTL *lprc2)
Definition: winpos.h:48
#define WM_MBUTTONDOWN
Definition: winuser.h:1764
PWND FASTCALL IntGetParent(PWND Wnd)
Definition: window.c:185
DWORD state
Definition: ntuser.h:665
int iCtrlId
Definition: winuser.h:3288
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
LRESULT NC_HandleNCRButtonDown(PWND pwnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1668
#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:1518
unsigned int UINT
Definition: ndis.h:50
BOOL UserPaintCaption(PWND pWnd, INT Flags)
Definition: defwnd.c:396
#define VK_SPACE
Definition: winuser.h:2194
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:917
VOID co_IntShellHookNotify(WPARAM Message, WPARAM wParam, LPARAM lParam)
Definition: desktop.c:1656
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
#define KF_ALTDOWN
Definition: winuser.h:2424
#define GET_Y_LPARAM(lp)
Definition: windowsx.h:275
#define HTVSCROLL
Definition: winuser.h:2457
#define WM_WINDOWPOSCHANGED
Definition: winuser.h:1644
INT FASTCALL IntMenuItemFromPoint(PWND pWnd, HMENU hMenu, POINT ptScreen)
Definition: menu.c:1518
VOID FASTCALL REGION_UnlockRgn(_In_ PREGION prgn)
Definition: region.c:2392
#define RDW_ERASENOW
Definition: winuser.h:1205
#define SC_CLOSE
Definition: winuser.h:2567
#define WM_NCUAHDRAWFRAME
Definition: undocuser.h:46
#define HCBT_MOVESIZE
Definition: winuser.h:55
#define WM_SYSKEYDOWN
Definition: winuser.h:1701
#define TPM_LEFTBUTTON
Definition: winuser.h:2354
struct _WND * spwndParent
Definition: ntuser.h:677
ULONG FASTCALL IntSetStyle(PWND pwnd, ULONG set_bits, ULONG clear_bits)
Definition: window.c:124
#define HIWORD(l)
Definition: typedefs.h:246
FORCEINLINE BOOL RECTL_bIsEmptyRect(_In_ const RECTL *prcl)
Definition: rect.h:44
unsigned int ULONG
Definition: retypes.h:1
DWORD state2
Definition: ntuser.h:666
LONG bottom
Definition: windef.h:294
#define IS_KEY_DOWN(ks, vk)
Definition: input.h:98
#define WNDS_FORCEMENUDRAW
Definition: ntuser.h:588
#define WA_INACTIVE
Definition: winuser.h:2597
BOOL FASTCALL UserSystemParametersInfo(UINT uiAction, UINT uiParam, PVOID pvParam, UINT fWinIni)
Definition: sysparams.c:2066
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define SC_NEXTWINDOW
Definition: winuser.h:2565
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
#define WM_ERASEBKGND
Definition: winuser.h:1607
#define LN_MESSAGE_BEEP
Definition: undocuser.h:118
LRESULT NC_HandleNCLButtonDown(PWND pWnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1519
#define HTCLIENT
Definition: winuser.h:2450
DWORD FASTCALL GetNCHitEx(PWND pWnd, POINT pt)
Definition: nonclient.c:1927
LONG_PTR LRESULT
Definition: windef.h:209
LRESULT NC_HandleNCActivate(PWND Wnd, WPARAM wParam, LPARAM lParam)
Definition: nonclient.c:1382
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:1723
#define QF_FMENUSTATUSBREAK
Definition: msgqueue.h:96
LPARAM lParam
Definition: combotst.c:139
#define VK_SNAPSHOT
Definition: winuser.h:2206
#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:52
#define WM_CBT
Definition: undocuser.h:61
LRESULT IntClientShutdown(IN PWND pWindow, IN WPARAM wParam, IN LPARAM lParam)
Definition: shutdown.c:22
struct Rect Rect
#define RDW_INVALIDATE
Definition: winuser.h:1200
const DWORD ExStyle
Definition: appswitch.c:72
#define WM_NCLBUTTONDBLCLK
Definition: winuser.h:1676
VOID FASTCALL UserReferenceObject(PVOID obj)
Definition: object.c:697
uchar outbuf[M_BLOCK_OUT]
Definition: unzcrash.c:41
PCLS pcls
Definition: ntuser.h:684
#define WS_MAXIMIZE
Definition: pedump.c:623
DWORD style
Definition: ntuser.h:670

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

◆ UserPaintCaption()

BOOL UserPaintCaption ( PWND  pWnd,
INT  Flags 
)

Definition at line 396 of file defwnd.c.

397 {
398  BOOL Ret = FALSE;
399 
400  if ( (pWnd->style & WS_VISIBLE) && ((pWnd->style & WS_CAPTION) == WS_CAPTION) )
401  {
402  if (pWnd->state & WNDS_HASCAPTION && pWnd->head.pti->MessageQueue == gpqForeground)
403  Flags |= DC_ACTIVE;
404  /*
405  * When themes are not enabled we can go on and paint the non client area.
406  * However if we do that with themes enabled we will draw a classic frame.
407  * This is solved by sending a themes specific message to notify the themes
408  * engine that the caption needs to be redrawn
409  */
411  {
412  /*
413  * This will cause uxtheme to either paint the themed caption or call
414  * RealUserDrawCaption in order to draw the classic caption when themes
415  * are disabled but the themes service is enabled
416  */
417  TRACE("UDCB Flags %08x\n");
419  }
420  else
421  {
423  UserDrawCaptionBar(pWnd, hDC, Flags);
424  UserReleaseDC(pWnd, hDC, FALSE);
425  }
426  Ret = TRUE;
427  }
428  // Support window tray
429  return Ret;
430 }
PUSER_MESSAGE_QUEUE gpqForeground
Definition: focus.c:12
#define TRUE
Definition: types.h:120
static HDC
Definition: imagelist.c:92
#define DCX_USESTYLE
Definition: GetDCEx.c:10
HDC FASTCALL UserGetDCEx(PWND Window OPTIONAL, HANDLE ClipRegion, ULONG Flags)
PSERVERINFO gpsi
Definition: main.c:27
#define DCX_WINDOW
Definition: winuser.h:2095
_Must_inspect_result_ _In_ ULONG Flags
Definition: wsk.h:170
DWORD dwSRVIFlags
Definition: ntuser.h:1004
unsigned int BOOL
Definition: ntddk_ex.h:94
THRDESKHEAD head
Definition: ntuser.h:659
smooth NULL
Definition: ftsmooth.c:416
#define DC_ACTIVE
Definition: winuser.h:427
#define UserHMGetHandle(obj)
Definition: ntuser.h:208
#define WS_CAPTION
Definition: pedump.c:624
#define TRACE(s)
Definition: solgame.cpp:4
#define WM_NCUAHDRAWCAPTION
Definition: undocuser.h:45
LRESULT FASTCALL co_IntSendMessage(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
Definition: message.c:1281
#define SRVINFO_APIHOOK
Definition: ntuser.h:911
static HDC hDC
Definition: 3dtext.c:33
VOID UserDrawCaptionBar(PWND pWnd, HDC hDC, INT Flags)
Definition: nonclient.c:900
DWORD state
Definition: ntuser.h:665
INT FASTCALL UserReleaseDC(PWND Window, HDC hDc, BOOL EndPaint)
Definition: windc.c:917
#define WS_VISIBLE
Definition: pedump.c:620
#define WNDS_HASCAPTION
Definition: ntuser.h:576
DWORD style
Definition: ntuser.h:670

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