ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

vis.c
Go to the documentation of this file.
00001 /*
00002  * COPYRIGHT:        See COPYING in the top level directory
00003  * PROJECT:          ReactOS kernel
00004  * PURPOSE:          Visibility computations
00005  * FILE:             subsys/win32k/ntuser/vis.c
00006  * PROGRAMMER:       Ge van Geldorp (ge@gse.nl)
00007  */
00008 
00009 #include <win32k.h>
00010 DBG_DEFAULT_CHANNEL(UserWinpos);
00011 
00012 HRGN FASTCALL
00013 VIS_ComputeVisibleRegion(
00014    PWND Wnd,
00015    BOOLEAN ClientArea,
00016    BOOLEAN ClipChildren,
00017    BOOLEAN ClipSiblings)
00018 {
00019    HRGN VisRgn, ClipRgn;
00020    PWND PreviousWindow, CurrentWindow, CurrentSibling;
00021 
00022    if (!Wnd || !(Wnd->style & WS_VISIBLE))
00023    {
00024       return NULL;
00025    }
00026 
00027    VisRgn = NULL;
00028 
00029    if (ClientArea)
00030    {
00031       VisRgn = IntSysCreateRectRgnIndirect(&Wnd->rcClient);
00032    }
00033    else
00034    {
00035       VisRgn = IntSysCreateRectRgnIndirect(&Wnd->rcWindow);
00036    }
00037 
00038    /*
00039     * Walk through all parent windows and for each clip the visble region
00040     * to the parent's client area and exclude all siblings that are over
00041     * our window.
00042     */
00043 
00044    PreviousWindow = Wnd;
00045    CurrentWindow = Wnd->spwndParent;
00046    while (CurrentWindow)
00047    {
00048       if ( CurrentWindow->state2 & WNDS2_INDESTROY ||
00049            CurrentWindow->state & WNDS_DESTROYED )
00050       {
00051          ERR("ATM the Current Window or Parent is dead!\n");
00052          if (VisRgn) GreDeleteObject(VisRgn);
00053          return NULL;
00054       }
00055 
00056       if (!(CurrentWindow->style & WS_VISIBLE))
00057       {
00058          if (VisRgn) GreDeleteObject(VisRgn);
00059          return NULL;
00060       }
00061 
00062       ClipRgn = IntSysCreateRectRgnIndirect(&CurrentWindow->rcClient);
00063       NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_AND);
00064       GreDeleteObject(ClipRgn);
00065 
00066       if ((PreviousWindow->style & WS_CLIPSIBLINGS) ||
00067           (PreviousWindow == Wnd && ClipSiblings))
00068       {
00069          CurrentSibling = CurrentWindow->spwndChild;
00070          while ( CurrentSibling != NULL &&
00071                  CurrentSibling != PreviousWindow )
00072          {
00073             if ((CurrentSibling->style & WS_VISIBLE) &&
00074                 !(CurrentSibling->ExStyle & WS_EX_TRANSPARENT))
00075             {
00076                ClipRgn = IntSysCreateRectRgnIndirect(&CurrentSibling->rcWindow);
00077                /* Combine it with the window region if available */
00078                if (CurrentSibling->hrgnClip && !(CurrentSibling->style & WS_MINIMIZE))
00079                {
00080                   NtGdiOffsetRgn(ClipRgn, -CurrentSibling->rcWindow.left, -CurrentSibling->rcWindow.top);
00081                   NtGdiCombineRgn(ClipRgn, ClipRgn, CurrentSibling->hrgnClip, RGN_AND);
00082                   NtGdiOffsetRgn(ClipRgn, CurrentSibling->rcWindow.left, CurrentSibling->rcWindow.top);
00083                }
00084                NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_DIFF);
00085                GreDeleteObject(ClipRgn);
00086             }
00087             CurrentSibling = CurrentSibling->spwndNext;
00088          }
00089       }
00090 
00091       PreviousWindow = CurrentWindow;
00092       CurrentWindow = CurrentWindow->spwndParent;
00093    }
00094 
00095    if (ClipChildren)
00096    {
00097       CurrentWindow = Wnd->spwndChild;
00098       while (CurrentWindow)
00099       {
00100          if ((CurrentWindow->style & WS_VISIBLE) &&
00101              !(CurrentWindow->ExStyle & WS_EX_TRANSPARENT))
00102          {
00103             ClipRgn = IntSysCreateRectRgnIndirect(&CurrentWindow->rcWindow);
00104             /* Combine it with the window region if available */
00105             if (CurrentWindow->hrgnClip && !(CurrentWindow->style & WS_MINIMIZE))
00106             {
00107                NtGdiOffsetRgn(ClipRgn, -CurrentWindow->rcWindow.left, -CurrentWindow->rcWindow.top);
00108                NtGdiCombineRgn(ClipRgn, ClipRgn, CurrentWindow->hrgnClip, RGN_AND);
00109                NtGdiOffsetRgn(ClipRgn, CurrentWindow->rcWindow.left, CurrentWindow->rcWindow.top);
00110             }
00111             NtGdiCombineRgn(VisRgn, VisRgn, ClipRgn, RGN_DIFF);
00112             GreDeleteObject(ClipRgn);
00113          }
00114          CurrentWindow = CurrentWindow->spwndNext;
00115       }
00116    }
00117 
00118    if (Wnd->hrgnClip && !(Wnd->style & WS_MINIMIZE))
00119    {
00120       NtGdiOffsetRgn(VisRgn, -Wnd->rcWindow.left, -Wnd->rcWindow.top);
00121       NtGdiCombineRgn(VisRgn, VisRgn, Wnd->hrgnClip, RGN_AND);
00122       NtGdiOffsetRgn(VisRgn, Wnd->rcWindow.left, Wnd->rcWindow.top);
00123    }
00124 
00125    return VisRgn;
00126 }
00127 
00128 VOID FASTCALL
00129 co_VIS_WindowLayoutChanged(
00130    PWND Wnd,
00131    HRGN NewlyExposed)
00132 {
00133    HRGN Temp;
00134    PWND Parent;
00135    USER_REFERENCE_ENTRY Ref;
00136 
00137    ASSERT_REFS_CO(Wnd);
00138 
00139    Parent = Wnd->spwndParent;
00140    if(Parent)
00141    {
00142       Temp = IntSysCreateRectRgn(0, 0, 0, 0);
00143 
00144       NtGdiCombineRgn(Temp, NewlyExposed, NULL, RGN_COPY);
00145       NtGdiOffsetRgn(Temp,
00146                      Wnd->rcWindow.left - Parent->rcClient.left,
00147                      Wnd->rcWindow.top - Parent->rcClient.top);
00148 
00149       UserRefObjectCo(Parent, &Ref);
00150       co_UserRedrawWindow(Parent, NULL, Temp,
00151                           RDW_FRAME | RDW_ERASE | RDW_INVALIDATE |
00152                           RDW_ALLCHILDREN);
00153       UserDerefObjectCo(Parent);
00154 
00155       GreDeleteObject(Temp);
00156    }
00157 }
00158 
00159 /* EOF */

Generated on Fri May 25 2012 04:36:53 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.