Moved ScrollWindowEx implementation to the graphics driver.
[wine] / dlls / ttydrv / wnd.c
1 /*
2  * TTY window driver
3  *
4  * Copyright 1998,1999 Patrik Stridvall
5  */
6
7 #include "config.h"
8
9 #include "gdi.h"
10 #include "ttydrv.h"
11 #include "region.h"
12 #include "win.h"
13 #include "winpos.h"
14 #include "debugtools.h"
15
16 DEFAULT_DEBUG_CHANNEL(ttydrv);
17
18 WND_DRIVER TTYDRV_WND_Driver =
19 {
20   TTYDRV_WND_ForceWindowRaise,
21   TTYDRV_WND_SetHostAttr
22 };
23
24 #define SWP_AGG_NOGEOMETRYCHANGE \
25     (SWP_NOSIZE | SWP_NOMOVE | SWP_NOCLIENTSIZE | SWP_NOCLIENTMOVE)
26 #define SWP_AGG_NOPOSCHANGE \
27     (SWP_AGG_NOGEOMETRYCHANGE | SWP_NOZORDER)
28 #define SWP_AGG_STATUSFLAGS \
29     (SWP_AGG_NOPOSCHANGE | SWP_FRAMECHANGED | SWP_HIDEWINDOW | SWP_SHOWWINDOW)
30
31 /**********************************************************************
32  *              CreateWindow   (TTYDRV.@)
33  */
34 BOOL TTYDRV_CreateWindow( HWND hwnd )
35 {
36 #ifdef WINE_CURSES
37     WND *wndPtr = WIN_FindWndPtr( hwnd );
38     WINDOW *window;
39     INT cellWidth=8, cellHeight=8; /* FIXME: Hardcoded */
40
41     TRACE("(%x)\n", hwnd);
42
43     /* Only create top-level windows */
44     if (wndPtr->dwStyle & WS_CHILD)
45     {
46         WIN_ReleaseWndPtr( wndPtr );
47         return TRUE;
48     }
49
50     if (!wndPtr->parent)  /* desktop */
51         window = root_window;
52     else
53     {
54         int x = wndPtr->rectWindow.left;
55         int y = wndPtr->rectWindow.top;
56         int cx = wndPtr->rectWindow.right - wndPtr->rectWindow.left;
57         int cy = wndPtr->rectWindow.bottom - wndPtr->rectWindow.top;
58
59         window = subwin( root_window, cy/cellHeight, cx/cellWidth,
60                          y/cellHeight, x/cellWidth);
61         werase(window);
62         wrefresh(window);
63     }
64     wndPtr->pDriverData = window;
65     WIN_ReleaseWndPtr( wndPtr );
66 #else /* defined(WINE_CURSES) */
67     FIXME("(%x): stub\n", hwnd);
68 #endif /* defined(WINE_CURSES) */
69     return TRUE;
70 }
71
72 /***********************************************************************
73  *              DestroyWindow   (TTYDRV.@)
74  */
75 BOOL TTYDRV_DestroyWindow( HWND hwnd )
76 {
77 #ifdef WINE_CURSES
78     WND *wndPtr = WIN_FindWndPtr( hwnd );
79     WINDOW *window = wndPtr->pDriverData;
80
81     TRACE("(%x)\n", hwnd);
82
83     if (window && window != root_window) delwin(window);
84     wndPtr->pDriverData = NULL;
85     WIN_ReleaseWndPtr( wndPtr );
86 #else /* defined(WINE_CURSES) */
87     FIXME("(%x): stub\n", hwnd);
88 #endif /* defined(WINE_CURSES) */
89     return TRUE;
90 }
91
92 /***********************************************************************
93  *              TTYDRV_WND_ForceWindowRaise
94  */
95 void TTYDRV_WND_ForceWindowRaise(WND *wndPtr)
96 {
97   FIXME("(%p): stub\n", wndPtr);
98 }
99
100 /***********************************************************************
101  *              TTYDRV_WND_SetHostAttr
102  */
103 BOOL TTYDRV_WND_SetHostAttr(WND *wndPtr, INT attr, INT value)
104 {
105   FIXME("(%p): stub\n", wndPtr);
106
107   return TRUE;
108 }
109
110
111 /***********************************************************************
112  *           DCE_OffsetVisRgn
113  *
114  * Change region from DC-origin relative coordinates to screen coords.
115  */
116
117 static void DCE_OffsetVisRgn( HDC hDC, HRGN hVisRgn )
118 {
119     DC *dc;
120     if (!(dc = DC_GetDCPtr( hDC ))) return;
121
122     OffsetRgn( hVisRgn, dc->DCOrgX, dc->DCOrgY );
123
124     GDI_ReleaseObj( hDC );
125 }
126
127
128 /***********************************************************************
129  *           DCE_GetVisRect
130  *
131  * Calculate the visible rectangle of a window (i.e. the client or
132  * window area clipped by the client area of all ancestors) in the
133  * corresponding coordinates. Return FALSE if the visible region is empty.
134  */
135 static BOOL DCE_GetVisRect( WND *wndPtr, BOOL clientArea, RECT *lprect )
136 {
137     *lprect = clientArea ? wndPtr->rectClient : wndPtr->rectWindow;
138
139     if (wndPtr->dwStyle & WS_VISIBLE)
140     {
141         INT xoffset = lprect->left;
142         INT yoffset = lprect->top;
143
144         while ((wndPtr = WIN_LockWndPtr(wndPtr->parent)))
145         {
146             if ( (wndPtr->dwStyle & (WS_ICONIC | WS_VISIBLE)) != WS_VISIBLE )
147             {
148                 WIN_ReleaseWndPtr(wndPtr);
149                 goto fail;
150             }
151
152             xoffset += wndPtr->rectClient.left;
153             yoffset += wndPtr->rectClient.top;
154             OffsetRect( lprect, wndPtr->rectClient.left,
155                         wndPtr->rectClient.top );
156
157             if( (wndPtr->rectClient.left >= wndPtr->rectClient.right) ||
158                 (wndPtr->rectClient.top >= wndPtr->rectClient.bottom) ||
159                 (lprect->left >= wndPtr->rectClient.right) ||
160                 (lprect->right <= wndPtr->rectClient.left) ||
161                 (lprect->top >= wndPtr->rectClient.bottom) ||
162                 (lprect->bottom <= wndPtr->rectClient.top) )
163             {
164                 WIN_ReleaseWndPtr(wndPtr);
165                 goto fail;
166             }
167
168             lprect->left = max( lprect->left, wndPtr->rectClient.left );
169             lprect->right = min( lprect->right, wndPtr->rectClient.right );
170             lprect->top = max( lprect->top, wndPtr->rectClient.top );
171             lprect->bottom = min( lprect->bottom, wndPtr->rectClient.bottom );
172
173             WIN_ReleaseWndPtr(wndPtr);
174         }
175         OffsetRect( lprect, -xoffset, -yoffset );
176         return TRUE;
177     }
178
179 fail:
180     SetRectEmpty( lprect );
181     return FALSE;
182 }
183
184
185 /***********************************************************************
186  *           DCE_AddClipRects
187  *
188  * Go through the linked list of windows from pWndStart to pWndEnd,
189  * adding to the clip region the intersection of the target rectangle
190  * with an offset window rectangle.
191  */
192 static BOOL DCE_AddClipRects( WND *pWndStart, WND *pWndEnd,
193                               HRGN hrgnClip, LPRECT lpRect, int x, int y )
194 {
195     RECT rect;
196
197     for (WIN_LockWndPtr(pWndStart); (pWndStart && (pWndStart != pWndEnd)); WIN_UpdateWndPtr(&pWndStart,pWndStart->next))
198     {
199         if( !(pWndStart->dwStyle & WS_VISIBLE) ) continue;
200
201         rect.left = pWndStart->rectWindow.left + x;
202         rect.top = pWndStart->rectWindow.top + y;
203         rect.right = pWndStart->rectWindow.right + x;
204         rect.bottom = pWndStart->rectWindow.bottom + y;
205
206         if( IntersectRect( &rect, &rect, lpRect ))
207         {
208             if(!REGION_UnionRectWithRgn( hrgnClip, &rect )) break;
209         }
210     }
211     WIN_ReleaseWndPtr(pWndStart);
212     return (pWndStart == pWndEnd);
213 }
214
215
216 /***********************************************************************
217  *           DCE_GetVisRgn
218  *
219  * Return the visible region of a window, i.e. the client or window area
220  * clipped by the client area of all ancestors, and then optionally
221  * by siblings and children.
222  */
223 static HRGN DCE_GetVisRgn( HWND hwnd, WORD flags, HWND hwndChild, WORD cflags )
224 {
225     HRGN hrgnVis = 0;
226     RECT rect;
227     WND *wndPtr = WIN_FindWndPtr( hwnd );
228     WND *childWnd = WIN_FindWndPtr( hwndChild );
229
230     /* Get visible rectangle and create a region with it. */
231
232     if (wndPtr && DCE_GetVisRect(wndPtr, !(flags & DCX_WINDOW), &rect))
233     {
234         if((hrgnVis = CreateRectRgnIndirect( &rect )))
235         {
236             HRGN hrgnClip = CreateRectRgn( 0, 0, 0, 0 );
237             INT xoffset, yoffset;
238
239             if( hrgnClip )
240             {
241                 /* Compute obscured region for the visible rectangle by 
242                  * clipping children, siblings, and ancestors. Note that
243                  * DCE_GetVisRect() returns a rectangle either in client
244                  * or in window coordinates (for DCX_WINDOW request). */
245
246                 if( (flags & DCX_CLIPCHILDREN) && wndPtr->child )
247                 {
248                     if( flags & DCX_WINDOW )
249                     {
250                         /* adjust offsets since child window rectangles are 
251                          * in client coordinates */
252
253                         xoffset = wndPtr->rectClient.left - wndPtr->rectWindow.left;
254                         yoffset = wndPtr->rectClient.top - wndPtr->rectWindow.top;
255                     }
256                     else
257                         xoffset = yoffset = 0;
258
259                     DCE_AddClipRects( wndPtr->child, NULL, hrgnClip, &rect, xoffset, yoffset );
260                 }
261
262                 /* We may need to clip children of child window, if a window with PARENTDC
263                  * class style and CLIPCHILDREN window style (like in Free Agent 16
264                  * preference dialogs) gets here, we take the region for the parent window
265                  * but apparently still need to clip the children of the child window... */
266
267                 if( (cflags & DCX_CLIPCHILDREN) && childWnd && childWnd->child )
268                 {
269                     if( flags & DCX_WINDOW )
270                     {
271                         /* adjust offsets since child window rectangles are 
272                          * in client coordinates */
273
274                         xoffset = wndPtr->rectClient.left - wndPtr->rectWindow.left;
275                         yoffset = wndPtr->rectClient.top - wndPtr->rectWindow.top;
276                     }
277                     else
278                         xoffset = yoffset = 0;
279
280                     /* client coordinates of child window */
281                     xoffset += childWnd->rectClient.left;
282                     yoffset += childWnd->rectClient.top;
283
284                     DCE_AddClipRects( childWnd->child, NULL, hrgnClip,
285                                       &rect, xoffset, yoffset );
286                 }
287
288                 /* sibling window rectangles are in client 
289                  * coordinates of the parent window */
290
291                 if (flags & DCX_WINDOW)
292                 {
293                     xoffset = -wndPtr->rectWindow.left;
294                     yoffset = -wndPtr->rectWindow.top;
295                 }
296                 else
297                 {
298                     xoffset = -wndPtr->rectClient.left;
299                     yoffset = -wndPtr->rectClient.top;
300                 }
301
302                 if (flags & DCX_CLIPSIBLINGS && wndPtr->parent )
303                     DCE_AddClipRects( wndPtr->parent->child,
304                                       wndPtr, hrgnClip, &rect, xoffset, yoffset );
305
306                 /* Clip siblings of all ancestors that have the
307                  * WS_CLIPSIBLINGS style
308                  */
309
310                 while (wndPtr->parent)
311                 {
312                     WIN_UpdateWndPtr(&wndPtr,wndPtr->parent);
313                     xoffset -= wndPtr->rectClient.left;
314                     yoffset -= wndPtr->rectClient.top;
315                     if(wndPtr->dwStyle & WS_CLIPSIBLINGS && wndPtr->parent)
316                     {
317                         DCE_AddClipRects( wndPtr->parent->child, wndPtr,
318                                           hrgnClip, &rect, xoffset, yoffset );
319                     }
320                 }
321
322                 /* Now once we've got a jumbo clip region we have
323                  * to substract it from the visible rectangle.
324                  */
325                 CombineRgn( hrgnVis, hrgnVis, hrgnClip, RGN_DIFF );
326                 DeleteObject( hrgnClip );
327             }
328             else
329             {
330                 DeleteObject( hrgnVis );
331                 hrgnVis = 0;
332             }
333         }
334     }
335     else
336         hrgnVis = CreateRectRgn(0, 0, 0, 0); /* empty */
337     WIN_ReleaseWndPtr(wndPtr);
338     WIN_ReleaseWndPtr(childWnd);
339     return hrgnVis;
340 }
341
342
343 /***********************************************************************
344  *              GetDC   (TTYDRV.@)
345  *
346  * Set the drawable, origin and dimensions for the DC associated to
347  * a given window.
348  */
349 BOOL TTYDRV_GetDC( HWND hwnd, HDC hdc, HRGN hrgn, DWORD flags )
350 {
351     WND *wndPtr = WIN_FindWndPtr(hwnd);
352     DC *dc;
353     BOOL updateVisRgn;
354     HRGN hrgnVisible = 0;
355
356     if (!wndPtr) return FALSE;
357
358     if (!(dc = DC_GetDCPtr( hdc )))
359     {
360         WIN_ReleaseWndPtr( wndPtr );
361         return FALSE;
362     }
363
364     if(flags & DCX_WINDOW)
365     {
366         dc->DCOrgX = wndPtr->rectWindow.left;
367         dc->DCOrgY = wndPtr->rectWindow.top;
368     }
369     else
370     {
371         dc->DCOrgX = wndPtr->rectClient.left;
372         dc->DCOrgY = wndPtr->rectClient.top;
373     }
374     updateVisRgn = (dc->flags & DC_DIRTY) != 0;
375     GDI_ReleaseObj( hdc );
376
377     if (updateVisRgn)
378     {
379         if (flags & DCX_PARENTCLIP)
380         {
381             WND *parentPtr = WIN_LockWndPtr(wndPtr->parent);
382
383             if( wndPtr->dwStyle & WS_VISIBLE && !(parentPtr->dwStyle & WS_MINIMIZE) )
384             {
385                 DWORD dcxFlags;
386
387                 if( parentPtr->dwStyle & WS_CLIPSIBLINGS )
388                     dcxFlags = DCX_CLIPSIBLINGS | (flags & ~(DCX_CLIPCHILDREN | DCX_WINDOW));
389                 else
390                     dcxFlags = flags & ~(DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN | DCX_WINDOW);
391
392                 hrgnVisible = DCE_GetVisRgn( parentPtr->hwndSelf, dcxFlags,
393                                              wndPtr->hwndSelf, flags );
394                 if( flags & DCX_WINDOW )
395                     OffsetRgn( hrgnVisible, -wndPtr->rectWindow.left,
396                                -wndPtr->rectWindow.top );
397                 else
398                     OffsetRgn( hrgnVisible, -wndPtr->rectClient.left,
399                                -wndPtr->rectClient.top );
400                 DCE_OffsetVisRgn( hdc, hrgnVisible );
401             }
402             else
403                 hrgnVisible = CreateRectRgn( 0, 0, 0, 0 );
404             WIN_ReleaseWndPtr(parentPtr);
405         }
406         else
407         {
408             hrgnVisible = DCE_GetVisRgn( hwnd, flags, 0, 0 );
409             DCE_OffsetVisRgn( hdc, hrgnVisible );
410         }
411         SelectVisRgn16( hdc, hrgnVisible );
412     }
413
414     /* apply additional region operation (if any) */
415
416     if( flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN) )
417     {
418         if( !hrgnVisible ) hrgnVisible = CreateRectRgn( 0, 0, 0, 0 );
419
420         TRACE("\tsaved VisRgn, clipRgn = %04x\n", hrgn);
421
422         SaveVisRgn16( hdc );
423         CombineRgn( hrgnVisible, hrgn, 0, RGN_COPY );
424         DCE_OffsetVisRgn( hdc, hrgnVisible );
425         CombineRgn( hrgnVisible, InquireVisRgn16( hdc ), hrgnVisible,
426                       (flags & DCX_INTERSECTRGN) ? RGN_AND : RGN_DIFF );
427         SelectVisRgn16( hdc, hrgnVisible );
428     }
429
430     if (hrgnVisible) DeleteObject( hrgnVisible );
431
432     WIN_ReleaseWndPtr( wndPtr );
433     return TRUE;
434 }
435
436
437 /***********************************************************************
438  *              SetWindowPos   (TTYDRV.@)
439  */
440 BOOL TTYDRV_SetWindowPos( WINDOWPOS *winpos )
441 {
442     WND *wndPtr;
443     RECT newWindowRect, newClientRect;
444     BOOL retvalue;
445     HWND hwndActive = GetForegroundWindow();
446
447     TRACE( "hwnd %04x, swp (%i,%i)-(%i,%i) flags %08x\n",
448            winpos->hwnd, winpos->x, winpos->y,
449            winpos->x + winpos->cx, winpos->y + winpos->cy, winpos->flags);
450
451     /* ------------------------------------------------------------------------ CHECKS */
452
453       /* Check window handle */
454
455     if (winpos->hwnd == GetDesktopWindow()) return FALSE;
456     if (!(wndPtr = WIN_FindWndPtr( winpos->hwnd ))) return FALSE;
457
458     TRACE("\tcurrent (%i,%i)-(%i,%i), style %08x\n",
459           wndPtr->rectWindow.left, wndPtr->rectWindow.top,
460           wndPtr->rectWindow.right, wndPtr->rectWindow.bottom, (unsigned)wndPtr->dwStyle );
461
462     /* Fix redundant flags */
463
464     if(wndPtr->dwStyle & WS_VISIBLE)
465         winpos->flags &= ~SWP_SHOWWINDOW;
466     else
467     {
468         if (!(winpos->flags & SWP_SHOWWINDOW)) winpos->flags |= SWP_NOREDRAW;
469         winpos->flags &= ~SWP_HIDEWINDOW;
470     }
471
472     if ( winpos->cx < 0 ) winpos->cx = 0;
473     if ( winpos->cy < 0 ) winpos->cy = 0;
474
475     if ((wndPtr->rectWindow.right - wndPtr->rectWindow.left == winpos->cx) &&
476         (wndPtr->rectWindow.bottom - wndPtr->rectWindow.top == winpos->cy))
477         winpos->flags |= SWP_NOSIZE;    /* Already the right size */
478
479     if ((wndPtr->rectWindow.left == winpos->x) && (wndPtr->rectWindow.top == winpos->y))
480         winpos->flags |= SWP_NOMOVE;    /* Already the right position */
481
482     if (winpos->hwnd == hwndActive)
483         winpos->flags |= SWP_NOACTIVATE;   /* Already active */
484     else if ( (wndPtr->dwStyle & (WS_POPUP | WS_CHILD)) != WS_CHILD )
485     {
486         if(!(winpos->flags & SWP_NOACTIVATE)) /* Bring to the top when activating */
487         {
488             winpos->flags &= ~SWP_NOZORDER;
489             winpos->hwndInsertAfter = HWND_TOP;
490             goto Pos;
491         }
492     }
493
494     /* Check hwndInsertAfter */
495
496       /* FIXME: TOPMOST not supported yet */
497     if ((winpos->hwndInsertAfter == HWND_TOPMOST) ||
498         (winpos->hwndInsertAfter == HWND_NOTOPMOST)) winpos->hwndInsertAfter = HWND_TOP;
499
500     /* hwndInsertAfter must be a sibling of the window */
501     if ((winpos->hwndInsertAfter != HWND_TOP) && (winpos->hwndInsertAfter != HWND_BOTTOM))
502     {
503         WND* wnd = WIN_FindWndPtr(winpos->hwndInsertAfter);
504
505         if( wnd ) {
506             if( wnd->parent != wndPtr->parent )
507             {
508                 retvalue = FALSE;
509                 WIN_ReleaseWndPtr(wnd);
510                 goto END;
511             }
512             /* don't need to change the Zorder of hwnd if it's already inserted
513              * after hwndInsertAfter or when inserting hwnd after itself.
514              */
515             if(( wnd->next == wndPtr ) || (winpos->hwnd == winpos->hwndInsertAfter))
516                 winpos->flags |= SWP_NOZORDER;
517         }
518         WIN_ReleaseWndPtr(wnd);
519     }
520
521  Pos:  /* ------------------------------------------------------------------------ MAIN part */
522
523       /* Send WM_WINDOWPOSCHANGING message */
524
525     if (!(winpos->flags & SWP_NOSENDCHANGING))
526         SendMessageA( wndPtr->hwndSelf, WM_WINDOWPOSCHANGING, 0, (LPARAM)winpos );
527
528       /* Calculate new position and size */
529
530     newWindowRect = wndPtr->rectWindow;
531     newClientRect = (wndPtr->dwStyle & WS_MINIMIZE) ? wndPtr->rectWindow
532                                                     : wndPtr->rectClient;
533
534     if (!(winpos->flags & SWP_NOSIZE))
535     {
536         newWindowRect.right  = newWindowRect.left + winpos->cx;
537         newWindowRect.bottom = newWindowRect.top + winpos->cy;
538     }
539     if (!(winpos->flags & SWP_NOMOVE))
540     {
541         newWindowRect.left    = winpos->x;
542         newWindowRect.top     = winpos->y;
543         newWindowRect.right  += winpos->x - wndPtr->rectWindow.left;
544         newWindowRect.bottom += winpos->y - wndPtr->rectWindow.top;
545
546         OffsetRect( &newClientRect, winpos->x - wndPtr->rectWindow.left,
547                     winpos->y - wndPtr->rectWindow.top );
548     }
549
550     if( winpos->hwndInsertAfter == HWND_TOP )
551         winpos->flags |= ( wndPtr->parent->child == wndPtr)? SWP_NOZORDER: 0;
552     else
553         if( winpos->hwndInsertAfter == HWND_BOTTOM )
554             winpos->flags |= ( wndPtr->next )? 0: SWP_NOZORDER;
555         else
556             if( !(winpos->flags & SWP_NOZORDER) )
557                 if( GetWindow(winpos->hwndInsertAfter, GW_HWNDNEXT) == wndPtr->hwndSelf )
558                     winpos->flags |= SWP_NOZORDER;
559
560     /* Common operations */
561
562       /* Send WM_NCCALCSIZE message to get new client area */
563     if( (winpos->flags & (SWP_FRAMECHANGED | SWP_NOSIZE)) != SWP_NOSIZE )
564     {
565          WINPOS_SendNCCalcSize( winpos->hwnd, TRUE, &newWindowRect,
566                                 &wndPtr->rectWindow, &wndPtr->rectClient,
567                                 winpos, &newClientRect );
568     }
569
570     if(!(winpos->flags & SWP_NOZORDER) && winpos->hwnd != winpos->hwndInsertAfter)
571     {
572         if ( WIN_UnlinkWindow( winpos->hwnd ) )
573             WIN_LinkWindow( winpos->hwnd, winpos->hwndInsertAfter );
574     }
575
576     /* FIXME: actually do something with WVR_VALIDRECTS */
577
578     wndPtr->rectWindow = newWindowRect;
579     wndPtr->rectClient = newClientRect;
580
581     if( winpos->flags & SWP_SHOWWINDOW )
582     {
583         wndPtr->dwStyle |= WS_VISIBLE;
584     }
585     else if( winpos->flags & SWP_HIDEWINDOW )
586     {
587         wndPtr->dwStyle &= ~WS_VISIBLE;
588     }
589
590     /* ------------------------------------------------------------------------ FINAL */
591
592     /* repaint invalidated region (if any)
593      *
594      * FIXME: if SWP_NOACTIVATE is not set then set invalid regions here without any painting
595      *        and force update after ChangeActiveWindow() to avoid painting frames twice.
596      */
597
598     if( !(winpos->flags & SWP_NOREDRAW) )
599     {
600         RedrawWindow( wndPtr->parent->hwndSelf, NULL, 0,
601                       RDW_ERASE | RDW_INVALIDATE | RDW_ALLCHILDREN );
602         if (wndPtr->parent->hwndSelf == GetDesktopWindow() ||
603             wndPtr->parent->parent->hwndSelf == GetDesktopWindow())
604         {
605             RedrawWindow( wndPtr->parent->hwndSelf, NULL, 0,
606                           RDW_ERASENOW | RDW_NOCHILDREN );
607         }
608     }
609
610     if (!(winpos->flags & SWP_NOACTIVATE))
611         WINPOS_ChangeActiveWindow( winpos->hwnd, FALSE );
612
613       /* And last, send the WM_WINDOWPOSCHANGED message */
614
615     TRACE("\tstatus flags = %04x\n", winpos->flags & SWP_AGG_STATUSFLAGS);
616
617     if ((((winpos->flags & SWP_AGG_STATUSFLAGS) != SWP_AGG_NOPOSCHANGE) &&
618           !(winpos->flags & SWP_NOSENDCHANGING)) )
619         SendMessageA( winpos->hwnd, WM_WINDOWPOSCHANGED, 0, (LPARAM)winpos );
620
621     retvalue = TRUE;
622  END:
623     WIN_ReleaseWndPtr(wndPtr);
624     return retvalue;
625 }