6fdefa96c45e7a32362abe75d44ebac74dd22997
[reactos.git] / reactos / subsys / win32k / ntuser / winpos.c
1 /* $Id: winpos.c,v 1.4 2002/08/31 23:18:47 dwelch Exp $
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * PURPOSE: Windows
6 * FILE: subsys/win32k/ntuser/window.c
7 * PROGRAMER: Casper S. Hornstrup (chorns@users.sourceforge.net)
8 * REVISION HISTORY:
9 * 06-06-2001 CSH Created
10 */
11 /* INCLUDES ******************************************************************/
12
13 #include <ddk/ntddk.h>
14 #include <win32k/win32k.h>
15 #include <include/object.h>
16 #include <include/guicheck.h>
17 #include <include/window.h>
18 #include <include/class.h>
19 #include <include/error.h>
20 #include <include/winsta.h>
21 #include <windows.h>
22 #include <include/winpos.h>
23 #include <include/rect.h>
24 #include <include/callback.h>
25 #include <include/painting.h>
26
27 #define NDEBUG
28 #include <debug.h>
29
30 /* GLOBALS *******************************************************************/
31
32 #define MINMAX_NOSWP (0x00010000)
33
34 #define SWP_EX_PAINTSELF 0x0002
35
36 /* FUNCTIONS *****************************************************************/
37
38 #define HAS_DLGFRAME(Style, ExStyle) \
39 (((ExStyle) & WS_EX_DLGMODALFRAME) || \
40 (((Style) & WS_DLGFRAME) && !((Style) & WS_BORDER)))
41
42 #define HAS_THICKFRAME(Style, ExStyle) \
43 (((Style) & WS_THICKFRAME) && \
44 !((Style) & (WS_DLGFRAME | WS_BORDER)) == WS_DLGFRAME)
45
46 BOOL
47 WinPosActivateOtherWindow(PWINDOW_OBJECT Window)
48 {
49 }
50
51 POINT STATIC
52 WinPosFindIconPos(HWND hWnd, POINT Pos)
53 {
54 }
55
56 HWND STATIC
57 WinPosCreateIconTitle(PWINDOW_OBJECT WindowObject)
58 {
59 return(NULL);
60 }
61
62 BOOL STATIC
63 WinPosShowIconTitle(PWINDOW_OBJECT WindowObject, BOOL Show)
64 {
65 PINTERNALPOS InternalPos = WindowObject->InternalPos;
66 PWINDOW_OBJECT IconWindow;
67 NTSTATUS Status;
68
69 if (InternalPos)
70 {
71 HWND hWnd = InternalPos->IconTitle;
72
73 if (hWnd == NULL)
74 {
75 hWnd = WinPosCreateIconTitle(WindowObject);
76 }
77 if (Show)
78 {
79 Status =
80 ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->
81 HandleTable,
82 hWnd,
83 otWindow,
84 (PVOID*)&IconWindow);
85 if (NT_SUCCESS(Status))
86 {
87 if (!(IconWindow->Style & WS_VISIBLE))
88 {
89 NtUserSendMessage(hWnd, WM_SHOWWINDOW, TRUE, 0);
90 WinPosSetWindowPos(hWnd, 0, 0, 0, 0, 0, SWP_NOSIZE |
91 SWP_NOMOVE | SWP_NOACTIVATE |
92 SWP_NOZORDER | SWP_SHOWWINDOW);
93 }
94 ObmDereferenceObject(IconWindow);
95 }
96 }
97 else
98 {
99 WinPosShowWindow(hWnd, SW_HIDE);
100 }
101 }
102 return(FALSE);
103 }
104
105 PINTERNALPOS STATIC
106 WinPosInitInternalPos(PWINDOW_OBJECT WindowObject, POINT pt, PRECT RestoreRect)
107 {
108 if (WindowObject->InternalPos == NULL)
109 {
110 WindowObject->InternalPos =
111 ExAllocatePool(NonPagedPool, sizeof(INTERNALPOS));
112 WindowObject->InternalPos->IconTitle = 0;
113 WindowObject->InternalPos->NormalRect = WindowObject->WindowRect;
114 WindowObject->InternalPos->IconPos.x =
115 WindowObject->InternalPos->MaxPos.x = 0xFFFFFFFF;
116 WindowObject->InternalPos->IconPos.y =
117 WindowObject->InternalPos->MaxPos.y = 0xFFFFFFFF;
118 }
119 if (WindowObject->Style & WS_MINIMIZE)
120 {
121 WindowObject->InternalPos->IconPos = pt;
122 }
123 else if (WindowObject->Style & WS_MAXIMIZE)
124 {
125 WindowObject->InternalPos->MaxPos = pt;
126 }
127 else if (RestoreRect != NULL)
128 {
129 WindowObject->InternalPos->NormalRect = *RestoreRect;
130 }
131 return(WindowObject->InternalPos);
132 }
133
134 UINT
135 WinPosMinMaximize(PWINDOW_OBJECT WindowObject, UINT ShowFlag, RECT* NewPos)
136 {
137 POINT Size;
138 PINTERNALPOS InternalPos;
139 UINT SwpFlags = 0;
140
141 Size.x = WindowObject->WindowRect.left;
142 Size.y = WindowObject->WindowRect.top;
143 InternalPos = WinPosInitInternalPos(WindowObject, Size,
144 &WindowObject->WindowRect);
145
146 if (InternalPos)
147 {
148 if (WindowObject->Style & WS_MINIMIZE)
149 {
150 if (!NtUserSendMessage(WindowObject->Self, WM_QUERYOPEN, 0, 0))
151 {
152 return(SWP_NOSIZE | SWP_NOMOVE);
153 }
154 SwpFlags |= SWP_NOCOPYBITS;
155 }
156 switch (ShowFlag)
157 {
158 case SW_MINIMIZE:
159 {
160 if (WindowObject->Style & WS_MAXIMIZE)
161 {
162 WindowObject->Flags |= WINDOWOBJECT_RESTOREMAX;
163 WindowObject->Style &= ~WS_MAXIMIZE;
164 }
165 else
166 {
167 WindowObject->Style &= ~WINDOWOBJECT_RESTOREMAX;
168 }
169 WindowObject->Style |= WS_MINIMIZE;
170 InternalPos->IconPos = WinPosFindIconPos(WindowObject,
171 InternalPos->IconPos);
172 W32kSetRect(NewPos, InternalPos->IconPos.x, InternalPos->IconPos.y,
173 NtUserGetSystemMetrics(SM_CXICON),
174 NtUserGetSystemMetrics(SM_CYICON));
175 SwpFlags |= SWP_NOCOPYBITS;
176 break;
177 }
178
179 case SW_MAXIMIZE:
180 {
181 WinPosGetMinMaxInfo(WindowObject, &Size, &InternalPos->MaxPos,
182 NULL, NULL);
183 if (WindowObject->Style & WS_MINIMIZE)
184 {
185 WinPosShowIconTitle(WindowObject, FALSE);
186 WindowObject->Style &= ~WS_MINIMIZE;
187 }
188 WindowObject->Style |= WS_MINIMIZE;
189 W32kSetRect(NewPos, InternalPos->MaxPos.x, InternalPos->MaxPos.y,
190 Size.x, Size.y);
191 break;
192 }
193
194 case SW_RESTORE:
195 {
196 if (WindowObject->Style & WS_MINIMIZE)
197 {
198 WindowObject->Style &= ~WS_MINIMIZE;
199 WinPosShowIconTitle(WindowObject, FALSE);
200 if (WindowObject->Flags & WINDOWOBJECT_RESTOREMAX)
201 {
202 WinPosGetMinMaxInfo(WindowObject, &Size,
203 &InternalPos->MaxPos, NULL, NULL);
204 WindowObject->Style |= WS_MAXIMIZE;
205 W32kSetRect(NewPos, InternalPos->MaxPos.x,
206 InternalPos->MaxPos.y, Size.x, Size.y);
207 break;
208 }
209 }
210 else
211 {
212 if (!(WindowObject->Style & WS_MAXIMIZE))
213 {
214 return(-1);
215 }
216 else
217 {
218 WindowObject->Style &= ~WS_MAXIMIZE;
219 }
220 *NewPos = InternalPos->NormalRect;
221 NewPos->right -= NewPos->left;
222 NewPos->bottom -= NewPos->top;
223 break;
224 }
225 }
226 }
227 }
228 else
229 {
230 SwpFlags |= SWP_NOSIZE | SWP_NOMOVE;
231 }
232 return(SwpFlags);
233 }
234
235 UINT
236 WinPosGetMinMaxInfo(PWINDOW_OBJECT Window, POINT* MaxSize, POINT* MaxPos,
237 POINT* MinTrack, POINT* MaxTrack)
238 {
239 MINMAXINFO MinMax;
240 INT XInc, YInc;
241 INTERNALPOS* Pos;
242
243 /* Get default values. */
244 MinMax.ptMaxSize.x = NtUserGetSystemMetrics(SM_CXSCREEN);
245 MinMax.ptMaxSize.y = NtUserGetSystemMetrics(SM_CYSCREEN);
246 MinMax.ptMinTrackSize.x = NtUserGetSystemMetrics(SM_CXMINTRACK);
247 MinMax.ptMinTrackSize.y = NtUserGetSystemMetrics(SM_CYMINTRACK);
248 MinMax.ptMaxTrackSize.x = NtUserGetSystemMetrics(SM_CXSCREEN);
249 MinMax.ptMaxTrackSize.y = NtUserGetSystemMetrics(SM_CYSCREEN);
250
251 if (HAS_DLGFRAME(Window->Style, Window->ExStyle))
252 {
253 XInc = NtUserGetSystemMetrics(SM_CXDLGFRAME);
254 YInc = NtUserGetSystemMetrics(SM_CYDLGFRAME);
255 }
256 else
257 {
258 XInc = YInc = 0;
259 if (HAS_THICKFRAME(Window->Style, Window->ExStyle))
260 {
261 XInc += NtUserGetSystemMetrics(SM_CXFRAME);
262 YInc += NtUserGetSystemMetrics(SM_CYFRAME);
263 }
264 if (Window->Style & WS_BORDER)
265 {
266 XInc += NtUserGetSystemMetrics(SM_CXBORDER);
267 YInc += NtUserGetSystemMetrics(SM_CYBORDER);
268 }
269 }
270 MinMax.ptMaxSize.x += 2 * XInc;
271 MinMax.ptMaxSize.y += 2 * YInc;
272
273 Pos = Window->InternalPos;
274 if (Pos != NULL)
275 {
276 MinMax.ptMaxPosition = Pos->MaxPos;
277 }
278 else
279 {
280 MinMax.ptMaxPosition.x -= XInc;
281 MinMax.ptMaxPosition.y -= YInc;
282 }
283
284 W32kSendMessage(Window->Self, WM_GETMINMAXINFO, 0, (LPARAM)&MinMax, TRUE);
285
286 MinMax.ptMaxTrackSize.x = max(MinMax.ptMaxTrackSize.x,
287 MinMax.ptMinTrackSize.x);
288 MinMax.ptMaxTrackSize.y = max(MinMax.ptMaxTrackSize.y,
289 MinMax.ptMinTrackSize.y);
290
291 if (MaxSize) *MaxSize = MinMax.ptMaxSize;
292 if (MaxPos) *MaxPos = MinMax.ptMaxPosition;
293 if (MinTrack) *MinTrack = MinMax.ptMinTrackSize;
294 if (MaxTrack) *MaxTrack = MinMax.ptMaxTrackSize;
295 }
296
297 BOOL STATIC
298 WinPosChangeActiveWindow(HWND Wnd, BOOL MouseMsg)
299 {
300 }
301
302 LONG STATIC
303 WinPosDoNCCALCSize(PWINDOW_OBJECT Window, PWINDOWPOS WinPos,
304 RECT* WindowRect, RECT* ClientRect)
305 {
306 }
307
308 BOOL
309 WinPosDoWinPosChanging(PWINDOW_OBJECT WindowObject,
310 PWINDOWPOS WinPos,
311 PRECT WindowRect,
312 PRECT ClientRect)
313 {
314 if (!(WinPos->flags & SWP_NOSENDCHANGING))
315 {
316 NtUserSendMessage(WindowObject->Self, WM_WINDOWPOSCHANGING, 0,
317 (LPARAM)WinPos);
318 }
319
320 *WindowRect = WindowObject->WindowRect;
321 *ClientRect =
322 (WindowObject->Style & WS_MINIMIZE) ? WindowObject->WindowRect :
323 WindowObject->ClientRect;
324
325 if (!(WinPos->flags & SWP_NOSIZE))
326 {
327 WindowRect->right = WindowRect->left + WinPos->cx;
328 WindowRect->bottom = WindowRect->top + WinPos->cy;
329 }
330
331 if (!(WinPos->flags & SWP_NOMOVE))
332 {
333 WindowRect->left = WinPos->x;
334 WindowRect->top = WinPos->y;
335 WindowRect->right += WinPos->x - WindowObject->WindowRect.left;
336 WindowRect->bottom += WinPos->y - WindowObject->WindowRect.top;
337
338 W32kOffsetRect(ClientRect, WinPos->x - WindowObject->WindowRect.left,
339 WinPos->y - WindowObject->WindowRect.top);
340 }
341
342 WinPos->flags |= SWP_NOCLIENTMOVE | SWP_NOCLIENTSIZE;
343 return(TRUE);
344 }
345
346 BOOLEAN
347 WinPosSetWindowPos(HWND Wnd, HWND WndInsertAfter, INT x, INT y, INT cx,
348 INT cy, UINT flags)
349 {
350 PWINDOW_OBJECT Window;
351 NTSTATUS Status;
352 WINDOWPOS WinPos;
353 RECT NewWindowRect;
354 RECT NewClientRect;
355 HRGN VisRgn = NULL;
356 ULONG WvrFlags = 0;
357
358 /* FIXME: Get current active window from active queue. */
359
360 /* Check if the window is for a desktop. */
361 if (Wnd == PsGetWin32Thread()->Desktop->DesktopWindow)
362 {
363 return(FALSE);
364 }
365
366 Status =
367 ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->HandleTable,
368 Wnd,
369 otWindow,
370 (PVOID*)&Window);
371 if (!NT_SUCCESS(Status))
372 {
373 return(FALSE);
374 }
375
376 /* Fix up the flags. */
377 if (Window->Style & WS_VISIBLE)
378 {
379 flags &= ~SWP_SHOWWINDOW;
380 }
381 else
382 {
383 if (!(flags & SWP_SHOWWINDOW))
384 {
385 flags |= SWP_NOREDRAW;
386 }
387 flags &= ~SWP_HIDEWINDOW;
388 }
389
390 cx = max(cx, 0);
391 cy = max(cy, 0);
392
393 if ((Window->WindowRect.right - Window->WindowRect.left) == cx &&
394 (Window->WindowRect.bottom - Window->WindowRect.top) == cy)
395 {
396 flags |= SWP_NOSIZE;
397 }
398 if (Window->WindowRect.left == x && Window->WindowRect.top == y)
399 {
400 flags |= SWP_NOMOVE;
401 }
402 if (FALSE /* FIXME: Check if the window if already active. */)
403 {
404 flags |= SWP_NOACTIVATE;
405 }
406 else if ((Window->Style & (WS_POPUP | WS_CHILD)) != WS_CHILD)
407 {
408 if (!(flags & SWP_NOACTIVATE))
409 {
410 flags &= ~SWP_NOZORDER;
411 WndInsertAfter = HWND_TOP;
412 }
413 }
414
415 if (WndInsertAfter == HWND_TOPMOST || WndInsertAfter == HWND_NOTOPMOST)
416 {
417 WndInsertAfter = HWND_TOP;
418 }
419
420 if (WndInsertAfter != HWND_TOP && WndInsertAfter != HWND_BOTTOM)
421 {
422 /* FIXME: Find the window to insert after. */
423 }
424
425 WinPos.hwnd = Wnd;
426 WinPos.hwndInsertAfter = WndInsertAfter;
427 WinPos.x = x;
428 WinPos.y = y;
429 WinPos.cx = cx;
430 WinPos.cy = cy;
431 WinPos.flags = flags;
432
433 WinPosDoWinPosChanging(Window, &WinPos, &NewWindowRect, &NewClientRect);
434
435 if ((WinPos.flags & (SWP_NOZORDER | SWP_HIDEWINDOW | SWP_SHOWWINDOW)) !=
436 SWP_NOZORDER)
437 {
438 /* FIXME: SWP_DoOwnedPopups. */
439 }
440
441 /* FIXME: Adjust flags based on WndInsertAfter */
442
443 if ((!(WinPos.flags & (SWP_NOREDRAW | SWP_SHOWWINDOW)) &&
444 WinPos.flags & (SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
445 SWP_HIDEWINDOW | SWP_FRAMECHANGED)) !=
446 (SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER))
447 {
448 if (Window->Style & WS_CLIPCHILDREN)
449 {
450 VisRgn = DceGetVisRgn(Wnd, DCX_WINDOW | DCX_CLIPSIBLINGS, 0, 0);
451 }
452 else
453 {
454 VisRgn = DceGetVisRgn(Wnd, DCX_WINDOW, 0, 0);
455 }
456 }
457
458 WvrFlags = WinPosDoNCCALCSize(Window, &WinPos, &NewWindowRect,
459 &NewClientRect);
460
461 /* FIXME: Relink windows. */
462
463 /* FIXME: Reset active DCEs */
464
465 /* FIXME: Check for redrawing the whole client rect. */
466
467 if (WinPos.flags & SWP_SHOWWINDOW)
468 {
469 Window->Style |= WS_VISIBLE;
470 flags |= SWP_EX_PAINTSELF;
471 VisRgn = 1;
472 }
473 else
474 {
475 /* FIXME: Move the window bits */
476 }
477
478 if (WinPos.flags & SWP_HIDEWINDOW)
479 {
480 Window->Style &= ~WS_VISIBLE;
481 }
482
483 /* FIXME: Hide or show the claret */
484
485 if (VisRgn)
486 {
487 if (!(WinPos.flags & SWP_NOREDRAW))
488 {
489 if (flags & SWP_EX_PAINTSELF)
490 {
491 PaintRedrawWindow(Window->Self, NULL,
492 (VisRgn == 1) ? 0 : VisRgn,
493 RDW_ERASE | RDW_FRAME | RDW_INVALIDATE |
494 RDW_ALLCHILDREN,
495 RDW_EX_XYWINDOW | RDW_EX_USEHRGN);
496 }
497 else
498 {
499 PaintRedrawWindow(Window->Self, NULL,
500 (VisRgn == 1) ? 0 : VisRgn,
501 RDW_ERASE | RDW_INVALIDATE | RDW_ALLCHILDREN,
502 RDW_EX_USEHRGN);
503 }
504 /* FIXME: Redraw the window parent. */
505 }
506 /* FIXME: Delete VisRgn */
507 }
508
509 if (!(flags & SWP_NOACTIVATE))
510 {
511 WinPosChangeActiveWindow(WinPos.hwnd, FALSE);
512 }
513
514 /* FIXME: Check some conditions before doing this. */
515 NtUserSendMessage(WinPos.hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM)&WinPos);
516
517 ObmDereferenceObject(Window);
518 return(TRUE);
519 }
520
521 LRESULT
522 WinPosGetNonClientSize(HWND Wnd, RECT* WindowRect, RECT* ClientRect)
523 {
524 *ClientRect = *WindowRect;
525 return(W32kSendNCCALCSIZEMessage(Wnd, FALSE, ClientRect, NULL));
526 }
527
528 BOOLEAN
529 WinPosShowWindow(HWND Wnd, INT Cmd)
530 {
531 BOOLEAN WasVisible;
532 PWINDOW_OBJECT Window;
533 NTSTATUS Status;
534 UINT Swp = 0;
535 RECT NewPos;
536 BOOLEAN ShowFlag;
537
538 Status =
539 ObmReferenceObjectByHandle(PsGetWin32Process()->WindowStation->HandleTable,
540 Wnd,
541 otWindow,
542 (PVOID*)&Window);
543 if (!NT_SUCCESS(Status))
544 {
545 return(FALSE);
546 }
547
548 WasVisible = (Window->Style & WS_VISIBLE) != 0;
549
550 switch (Cmd)
551 {
552 case SW_HIDE:
553 {
554 if (!WasVisible)
555 {
556 ObmDereferenceObject(Window);
557 return(FALSE);
558 }
559 Swp |= SWP_HIDEWINDOW | SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE |
560 SWP_NOZORDER;
561 break;
562 }
563
564 case SW_SHOWMINNOACTIVE:
565 Swp |= SWP_NOACTIVATE | SWP_NOZORDER;
566 /* Fall through. */
567 case SW_SHOWMINIMIZED:
568 Swp |= SWP_SHOWWINDOW;
569 /* Fall through. */
570 case SW_MINIMIZE:
571 {
572 Swp |= SWP_FRAMECHANGED;
573 if (!(Window->Style & WS_MINIMIZE))
574 {
575 Swp |= WinPosMinMaximize(Window, SW_MINIMIZE, &NewPos);
576 }
577 else
578 {
579 Swp |= SWP_NOSIZE | SWP_NOMOVE;
580 }
581 break;
582 }
583
584 case SW_SHOWMAXIMIZED:
585 {
586 Swp |= SWP_SHOWWINDOW | SWP_FRAMECHANGED;
587 if (!(Window->Style & WS_MAXIMIZE))
588 {
589 Swp |= WinPosMinMaximize(Window, SW_MAXIMIZE, &NewPos);
590 }
591 else
592 {
593 Swp |= SWP_NOSIZE | SWP_NOMOVE;
594 }
595 break;
596 }
597
598 case SW_SHOWNA:
599 Swp |= SWP_NOACTIVATE | SWP_NOZORDER;
600 /* Fall through. */
601 case SW_SHOW:
602 Swp |= SWP_SHOWWINDOW | SWP_NOSIZE | SWP_NOMOVE;
603 /* Don't activate the topmost window. */
604 break;
605
606 case SW_SHOWNOACTIVATE:
607 Swp |= SWP_NOZORDER;
608 /* Fall through. */
609 case SW_SHOWNORMAL:
610 case SW_SHOWDEFAULT:
611 case SW_RESTORE:
612 Swp |= SWP_SHOWWINDOW | SWP_FRAMECHANGED;
613 if (Window->Style & (WS_MINIMIZE | WS_MAXIMIZE))
614 {
615 Swp |= WinPosMinMaximize(Window, SW_RESTORE, &NewPos);
616 }
617 else
618 {
619 Swp |= SWP_NOSIZE | SWP_NOMOVE;
620 }
621 break;
622 }
623
624 ShowFlag = (Cmd != SW_HIDE);
625 if (ShowFlag != WasVisible)
626 {
627 NtUserSendMessage(Wnd, WM_SHOWWINDOW, ShowFlag, 0);
628 /*
629 * FIXME: Need to check the window wasn't destroyed during the
630 * window procedure.
631 */
632 }
633
634 if (Window->Style & WS_CHILD &&
635 !W32kIsWindowVisible(Window->Parent->Self) &&
636 (Swp & (SWP_NOSIZE | SWP_NOMOVE)) == (SWP_NOSIZE | SWP_NOMOVE))
637 {
638 if (Cmd == SW_HIDE)
639 {
640 Window->Style &= ~WS_VISIBLE;
641 }
642 else
643 {
644 Window->Style |= WS_VISIBLE;
645 }
646 }
647 else
648 {
649 if (Window->Style & WS_CHILD &&
650 !(Window->ExStyle & WS_EX_MDICHILD))
651 {
652 Swp |= SWP_NOACTIVATE | SWP_NOZORDER;
653 }
654 if (!(Swp & MINMAX_NOSWP))
655 {
656 WinPosSetWindowPos(Wnd, HWND_TOP, NewPos.left, NewPos.top,
657 NewPos.right, NewPos.bottom, LOWORD(Swp));
658 if (Cmd == SW_HIDE)
659 {
660 /* Hide the window. */
661 if (Wnd == W32kGetActiveWindow())
662 {
663 WinPosActivateOtherWindow(Window);
664 }
665 /* Revert focus to parent. */
666 if (Wnd == W32kGetFocusWindow() ||
667 W32kIsChildWindow(Wnd, W32kGetFocusWindow()))
668 {
669 W32kSetFocusWindow(Window->Parent->Self);
670 }
671 }
672 }
673 /* FIXME: Check for window destruction. */
674 /* Show title for minimized windows. */
675 if (Window->Style & WS_MINIMIZE)
676 {
677 WinPosShowIconTitle(Window, TRUE);
678 }
679 }
680
681 if (Window->Flags & WINDOWOBJECT_NEED_SIZE)
682 {
683 WPARAM wParam = SIZE_RESTORED;
684
685 Window->Flags &= ~WINDOWOBJECT_NEED_SIZE;
686 if (Window->Style & WS_MAXIMIZE)
687 {
688 wParam = SIZE_MAXIMIZED;
689 }
690 else if (Window->Style & WS_MINIMIZE)
691 {
692 wParam = SIZE_MINIMIZED;
693 }
694
695 NtUserSendMessage(Wnd, WM_SIZE, wParam,
696 MAKELONG(Window->ClientRect.right -
697 Window->ClientRect.left,
698 Window->ClientRect.bottom -
699 Window->ClientRect.top));
700 NtUserSendMessage(Wnd, WM_MOVE, 0,
701 MAKELONG(Window->ClientRect.left,
702 Window->ClientRect.top));
703 }
704 ObmDereferenceObject(Window);
705 return(WasVisible);
706 }