[ros-diffs] [jimtabor] 34289: - Moved WM_ACTIVATEAPP calles before WM_NC/ACTIVATE calls. - Implemented GetLastActivePopup, based on wine. - Fixed DCE, pass all tests, except six clipping and one ROP check, which might be due to DCX_NORESETATTRS flag not being reset during the next GetDCEx call. <Researching>

jimtabor at svn.reactos.org jimtabor at svn.reactos.org
Fri Jul 4 06:55:18 CEST 2008


Author: jimtabor
Date: Thu Jul  3 23:55:18 2008
New Revision: 34289

URL: http://svn.reactos.org/svn/reactos?rev=34289&view=rev
Log:
- Moved WM_ACTIVATEAPP calles before WM_NC/ACTIVATE calls.
- Implemented GetLastActivePopup, based on wine.
- Fixed DCE, pass all tests, except six clipping and one ROP check, which might be due to DCX_NORESETATTRS flag not being reset during the next GetDCEx call. <Researching>


Modified:
    trunk/reactos/dll/win32/user32/windows/window.c
    trunk/reactos/include/reactos/win32k/ntuser.h
    trunk/reactos/subsystems/win32/win32k/ntuser/focus.c
    trunk/reactos/subsystems/win32/win32k/ntuser/windc.c
    trunk/reactos/subsystems/win32/win32k/ntuser/window.c

Modified: trunk/reactos/dll/win32/user32/windows/window.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/window.c?rev=34289&r1=34288&r2=34289&view=diff
==============================================================================
--- trunk/reactos/dll/win32/user32/windows/window.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/user32/windows/window.c [iso-8859-1] Thu Jul  3 23:55:18 2008
@@ -1,5 +1,4 @@
-/* $Id$
- *
+/*
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS user32.dll
  * FILE:            lib/user32/windows/window.c
@@ -916,21 +915,21 @@
 
 
 /*
- * @unimplemented
+ * @implemented
  */
 HWND STDCALL
 GetLastActivePopup(HWND hWnd)
 {
-    PWINDOW Wnd, WndParent;
-    HWND Ret = NULL;
-    WARN("Not fully implemented!");
+    PWINDOW Wnd;
+    HWND Ret = hWnd;
+
     Wnd = ValidateHwnd(hWnd);
     if (Wnd != NULL)
     {
         _SEH_TRY
         {
-            WndParent = NULL;
-            Ret = hWnd;
+            if (Wnd->hWndLastActive)
+               Ret = Wnd->hWndLastActive;
         }
         _SEH_HANDLE
         {

Modified: trunk/reactos/include/reactos/win32k/ntuser.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/win32k/ntuser.h?rev=34289&r1=34288&r2=34289&view=diff
==============================================================================
--- trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/win32k/ntuser.h [iso-8859-1] Thu Jul  3 23:55:18 2008
@@ -153,6 +153,8 @@
     UNICODE_STRING WindowName;
     /* Context help id */
     DWORD ContextHelpId;
+
+    HWND hWndLastActive;
 
     struct
     {

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/focus.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/focus.c?rev=34289&r1=34288&r2=34289&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/focus.c [iso-8859-1] Thu Jul  3 23:55:18 2008
@@ -16,7 +16,6 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id$
  */
 
 #include <w32k.h>
@@ -85,17 +84,12 @@
          co_IntShellHookNotify(HSHELL_WINDOWACTIVATED, (LPARAM) hWnd);
       }
 
-      UserDerefObjectCo(Window);
-
-      /* FIXME: IntIsWindow */
-
-      CHECKPOINT;
-      co_IntPostOrSendMessage(hWnd, WM_NCACTIVATE, (WPARAM)(hWnd == UserGetForegroundWindow()), 0);
-      /* FIXME: WA_CLICKACTIVE */
-      co_IntPostOrSendMessage(hWnd, WM_ACTIVATE,
-                              MAKEWPARAM(MouseActivate ? WA_CLICKACTIVE : WA_ACTIVE,
-                                         UserGetWindowLong(hWnd, GWL_STYLE, FALSE) & WS_MINIMIZE),
-                              (LPARAM)hWndPrev);
+      if (Window->Wnd)
+      {  // Set last active for window and it's owner.
+         Window->Wnd->hWndLastActive = hWnd;
+         if (Window->Wnd->Owner)
+            Window->Wnd->Owner->hWndLastActive = hWnd;
+      }
 
       if (Window && hWndPrev)
       {
@@ -133,6 +127,18 @@
             }
          }
       }
+
+      UserDerefObjectCo(Window);
+
+      /* FIXME: IntIsWindow */
+
+      CHECKPOINT;
+      co_IntPostOrSendMessage(hWnd, WM_NCACTIVATE, (WPARAM)(hWnd == UserGetForegroundWindow()), 0);
+      /* FIXME: WA_CLICKACTIVE */
+      co_IntPostOrSendMessage(hWnd, WM_ACTIVATE,
+                              MAKEWPARAM(MouseActivate ? WA_CLICKACTIVE : WA_ACTIVE,
+                                         UserGetWindowLong(hWnd, GWL_STYLE, FALSE) & WS_MINIMIZE),
+                              (LPARAM)hWndPrev);
    }
 }
 

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/windc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/windc.c?rev=34289&r1=34288&r2=34289&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/windc.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/windc.c [iso-8859-1] Thu Jul  3 23:55:18 2008
@@ -220,16 +220,6 @@
          dce->DCXFlags |= DCX_DCEEMPTY;
        }
      }
-     else
-     { // Save Users Dc_Attr.
-       PDC dc = DC_LockDc(dce->hDC);
-       if(dc)
-       {
-         PDC_ATTR Dc_Attr = dc->pDc_Attr;
-         if(Dc_Attr) MmCopyFromCaller(&dc->Dc_Attr, Dc_Attr, sizeof(DC_ATTR));
-         DC_UnlockDc(dc);
-       }
-     }
      dce->DCXFlags &= ~DCX_DCEBUSY;
      DPRINT("Exit!!!!! DCX_CACHE!!!!!!   hDC-> %x \n", dce->hDC);
      if (!IntGdiSetDCOwnerEx( dce->hDC, GDI_OBJ_HMGR_NONE, FALSE))
@@ -427,17 +417,8 @@
    // Window nz, check to see if we still own this or it is just cheap wine tonight.
    if (!(Flags & DCX_CACHE))
    {
-      if ( Wnd->ti != GetW32ThreadInfo()) Flags |= DCX_CACHE; // Ah~ Not Powned! Forced to be cheap~
-      // Can only have one POWNED or CLASS.
-      if ( !Window->Dce && (Wnd->Class->Style & CS_OWNDC))
-         Window->Dce = DceAllocDCE(NULL, DCE_WINDOW_DC);
-      else
-         Flags |= DCX_CACHE;
-
-      if ( !Wnd->Class->Dce && (Wnd->Class->Style & CS_CLASSDC))
-         Wnd->Class->Dce = DceAllocDCE(NULL, DCE_CLASS_DC);
-      else
-         Flags |= DCX_CACHE;
+      if ( Wnd->ti != GetW32ThreadInfo())
+         Flags |= DCX_CACHE; // Ah~ Not Powned! Forced to be cheap~
    }
 
    DcxFlags = Flags & DCX_CACHECOMPAREMASK;
@@ -455,7 +436,10 @@
 // Need to test for null here. Not sure if this is a bug or a feature.
 // First time use hax, need to use DceAllocDCE during window display init.
          if (!Dce) break;
-
+//
+// The way I understand this, you can have more than one DC per window.
+// Only one Owned if one was requested and saved and one Cached. 
+//
          if ((Dce->DCXFlags & (DCX_CACHE | DCX_DCEBUSY)) == DCX_CACHE)
          {
             DceUnused = Dce;
@@ -469,7 +453,6 @@
 #if 0 /* FIXME */
                UpdateVisRgn = FALSE;
 #endif
-
                UpdateClipOrigin = TRUE;
                break;
             }
@@ -531,8 +514,6 @@
       /* FIXME: Handle error */
    }
 
-   Dce->DCXFlags = Flags | DCX_DCEBUSY;
-   
    if (!(Flags & (DCX_EXCLUDERGN | DCX_INTERSECTRGN)) && ClipRegion)
    {
       if (!(Flags & DCX_KEEPCLIPRGN))
@@ -546,6 +527,8 @@
       DceDeleteClipRgn(Dce);
    }
 #endif
+
+   Dce->DCXFlags = Flags | DCX_DCEBUSY;
 
    if (0 != (Flags & DCX_INTERSECTUPDATE) && NULL == ClipRegion)
    {

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/window.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/window.c?rev=34289&r1=34288&r2=34289&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/window.c [iso-8859-1] Thu Jul  3 23:55:18 2008
@@ -1627,6 +1627,7 @@
 
        Wnd->ti = ti;
        Wnd->pi = ti->kpi;
+       Wnd->hWndLastActive = hWnd;
    }
 
    DPRINT("Created object with handle %X\n", hWnd);



More information about the Ros-diffs mailing list