Alexandre Julliard : user32: Add a driver entry point for UpdateLayeredWindow.

Alexandre Julliard julliard at winehq.org
Mon Oct 1 13:35:06 CDT 2012


Module: wine
Branch: master
Commit: 24eee97d21e0e8034dd9b567d8feec131526a220
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=24eee97d21e0e8034dd9b567d8feec131526a220

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Sep 27 18:13:01 2012 +0200

user32: Add a driver entry point for UpdateLayeredWindow.

---

 dlls/user32/driver.c              |   16 +++++++++++++
 dlls/user32/exticon.c             |    1 +
 dlls/user32/focus.c               |    1 +
 dlls/user32/hook.c                |    1 +
 dlls/user32/user_private.h        |    1 +
 dlls/user32/win.c                 |   34 +---------------------------
 dlls/user32/winproc.c             |    1 +
 dlls/winex11.drv/window.c         |   43 +++++++++++++++++++++++++++++++++++++
 dlls/winex11.drv/winex11.drv.spec |    1 +
 9 files changed, 67 insertions(+), 32 deletions(-)

diff --git a/dlls/user32/driver.c b/dlls/user32/driver.c
index 1d3d96a..20837d0 100644
--- a/dlls/user32/driver.c
+++ b/dlls/user32/driver.c
@@ -22,6 +22,7 @@
 #include <stdio.h>
 #include "windef.h"
 #include "winbase.h"
+#include "wingdi.h"
 #include "winuser.h"
 #include "wine/debug.h"
 
@@ -122,6 +123,7 @@ static const USER_DRIVER *load_driver(void)
         GET_USER_FUNC(SetWindowText);
         GET_USER_FUNC(ShowWindow);
         GET_USER_FUNC(SysCommand);
+        GET_USER_FUNC(UpdateLayeredWindow);
         GET_USER_FUNC(WindowMessage);
         GET_USER_FUNC(WindowPosChanging);
         GET_USER_FUNC(WindowPosChanged);
@@ -413,6 +415,12 @@ static LRESULT CDECL nulldrv_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam
     return -1;
 }
 
+static BOOL CDECL nulldrv_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info,
+                                               const RECT *window_rect )
+{
+    return TRUE;
+}
+
 static LRESULT CDECL nulldrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
 {
     return 0;
@@ -489,6 +497,7 @@ static USER_DRIVER null_driver =
     nulldrv_SetWindowText,
     nulldrv_ShowWindow,
     nulldrv_SysCommand,
+    nulldrv_UpdateLayeredWindow,
     nulldrv_WindowMessage,
     nulldrv_WindowPosChanging,
     nulldrv_WindowPosChanged
@@ -757,6 +766,12 @@ static LRESULT CDECL loaderdrv_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lpar
     return load_driver()->pSysCommand( hwnd, wparam, lparam );
 }
 
+static BOOL CDECL loaderdrv_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info,
+                                                 const RECT *window_rect )
+{
+    return load_driver()->pUpdateLayeredWindow( hwnd, info, window_rect );
+}
+
 static LRESULT CDECL loaderdrv_WindowMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
 {
     return load_driver()->pWindowMessage( hwnd, msg, wparam, lparam );
@@ -837,6 +852,7 @@ static USER_DRIVER lazy_load_driver =
     loaderdrv_SetWindowText,
     loaderdrv_ShowWindow,
     loaderdrv_SysCommand,
+    loaderdrv_UpdateLayeredWindow,
     loaderdrv_WindowMessage,
     loaderdrv_WindowPosChanging,
     loaderdrv_WindowPosChanged
diff --git a/dlls/user32/exticon.c b/dlls/user32/exticon.c
index fb9ff03..840483c 100644
--- a/dlls/user32/exticon.c
+++ b/dlls/user32/exticon.c
@@ -36,6 +36,7 @@
 #define NONAMELESSSTRUCT
 #include "windef.h"
 #include "winbase.h"
+#include "wingdi.h"
 #include "winuser.h"
 #include "winnls.h"
 #include "user_private.h"
diff --git a/dlls/user32/focus.c b/dlls/user32/focus.c
index 6b5312f..bd2e572 100644
--- a/dlls/user32/focus.c
+++ b/dlls/user32/focus.c
@@ -27,6 +27,7 @@
 
 #include "windef.h"
 #include "winbase.h"
+#include "wingdi.h"
 #include "winuser.h"
 #include "win.h"
 #include "user_private.h"
diff --git a/dlls/user32/hook.c b/dlls/user32/hook.c
index 1ba5dda..c9e9e20 100644
--- a/dlls/user32/hook.c
+++ b/dlls/user32/hook.c
@@ -70,6 +70,7 @@
 
 #include "windef.h"
 #include "winbase.h"
+#include "wingdi.h"
 #include "winuser.h"
 #include "winerror.h"
 #include "win.h"
diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h
index 505b2bf..6e337ca 100644
--- a/dlls/user32/user_private.h
+++ b/dlls/user32/user_private.h
@@ -111,6 +111,7 @@ typedef struct tagUSER_DRIVER {
     void   (CDECL *pSetWindowText)(HWND,LPCWSTR);
     UINT   (CDECL *pShowWindow)(HWND,INT,RECT*,UINT);
     LRESULT (CDECL *pSysCommand)(HWND,WPARAM,LPARAM);
+    BOOL    (CDECL *pUpdateLayeredWindow)(HWND,const UPDATELAYEREDWINDOWINFO *,const RECT *);
     LRESULT (CDECL *pWindowMessage)(HWND,UINT,WPARAM,LPARAM);
     void   (CDECL *pWindowPosChanging)(HWND,HWND,UINT,const RECT *,const RECT *,RECT *,struct window_surface**);
     void   (CDECL *pWindowPosChanged)(HWND,HWND,UINT,const RECT *,const RECT *,const RECT *,const RECT *,struct window_surface*);
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index 6845369..023af02 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -3648,7 +3648,6 @@ BOOL WINAPI UpdateLayeredWindowIndirect( HWND hwnd, const UPDATELAYEREDWINDOWINF
     DWORD flags = SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOREDRAW;
     RECT window_rect, client_rect;
     SIZE offset;
-    BYTE alpha = 0xff;
 
     if (!info ||
         info->cbSize != sizeof(*info) ||
@@ -3693,39 +3692,10 @@ BOOL WINAPI UpdateLayeredWindowIndirect( HWND hwnd, const UPDATELAYEREDWINDOWINF
 
     TRACE( "window %p win %s client %s\n", hwnd,
            wine_dbgstr_rect(&window_rect), wine_dbgstr_rect(&client_rect) );
-    set_window_pos( hwnd, 0, flags, &window_rect, &client_rect, NULL );
-
-    if (info->hdcSrc)
-    {
-        HDC hdc = GetWindowDC( hwnd );
 
-        if (hdc)
-        {
-            int x = 0, y = 0;
-            RECT rect;
-
-            GetWindowRect( hwnd, &rect );
-            OffsetRect( &rect, -rect.left, -rect.top);
-            if (info->pptSrc)
-            {
-                x = info->pptSrc->x;
-                y = info->pptSrc->y;
-            }
+    if (!USER_Driver->pUpdateLayeredWindow( hwnd, info, &window_rect )) return FALSE;
 
-            if (!info->prcDirty || (info->prcDirty && IntersectRect(&rect, &rect, info->prcDirty)))
-            {
-                TRACE( "copying window %p pos %d,%d\n", hwnd, x, y );
-                BitBlt( hdc, rect.left, rect.top, rect.right, rect.bottom,
-                        info->hdcSrc, rect.left + x, rect.top + y, SRCCOPY );
-            }
-            ReleaseDC( hwnd, hdc );
-        }
-    }
-
-    if (info->pblend && !(info->dwFlags & ULW_OPAQUE)) alpha = info->pblend->SourceConstantAlpha;
-    TRACE( "setting window %p alpha %u\n", hwnd, alpha );
-    USER_Driver->pSetLayeredWindowAttributes( hwnd, info->crKey, alpha,
-                                              info->dwFlags & (LWA_ALPHA | LWA_COLORKEY) );
+    set_window_pos( hwnd, 0, flags, &window_rect, &client_rect, NULL );
     return TRUE;
 }
 
diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c
index de7de6f..33afbdd 100644
--- a/dlls/user32/winproc.c
+++ b/dlls/user32/winproc.c
@@ -28,6 +28,7 @@
 
 #include "windef.h"
 #include "winbase.h"
+#include "wingdi.h"
 #include "controls.h"
 #include "win.h"
 #include "user_private.h"
diff --git a/dlls/winex11.drv/window.c b/dlls/winex11.drv/window.c
index dff4384..45c3a36 100644
--- a/dlls/winex11.drv/window.c
+++ b/dlls/winex11.drv/window.c
@@ -2324,6 +2324,49 @@ void CDECL X11DRV_SetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alph
 }
 
 
+/*****************************************************************************
+ *              UpdateLayeredWindow  (X11DRV.@)
+ */
+BOOL CDECL X11DRV_UpdateLayeredWindow( HWND hwnd, const UPDATELAYEREDWINDOWINFO *info,
+                                       const RECT *window_rect )
+{
+    BYTE alpha = 0xff;
+
+    if (info->hdcSrc)
+    {
+        HDC hdc = GetWindowDC( hwnd );
+
+        if (hdc)
+        {
+            int x = 0, y = 0;
+            RECT rect;
+
+            GetWindowRect( hwnd, &rect );
+            OffsetRect( &rect, -rect.left, -rect.top);
+            if (info->pptSrc)
+            {
+                x = info->pptSrc->x;
+                y = info->pptSrc->y;
+            }
+
+            if (!info->prcDirty || (info->prcDirty && IntersectRect(&rect, &rect, info->prcDirty)))
+            {
+                TRACE( "copying window %p pos %d,%d\n", hwnd, x, y );
+                BitBlt( hdc, rect.left, rect.top, rect.right, rect.bottom,
+                        info->hdcSrc, rect.left + x, rect.top + y, SRCCOPY );
+            }
+            ReleaseDC( hwnd, hdc );
+        }
+    }
+
+    if (info->pblend && !(info->dwFlags & ULW_OPAQUE)) alpha = info->pblend->SourceConstantAlpha;
+    TRACE( "setting window %p alpha %u\n", hwnd, alpha );
+    X11DRV_SetLayeredWindowAttributes( hwnd, info->crKey, alpha,
+                                       info->dwFlags & (LWA_ALPHA | LWA_COLORKEY) );
+    return TRUE;
+}
+
+
 /**********************************************************************
  *           X11DRV_WindowMessage   (X11DRV.@)
  */
diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec
index 1e8d4d9..8f68a47 100644
--- a/dlls/winex11.drv/winex11.drv.spec
+++ b/dlls/winex11.drv/winex11.drv.spec
@@ -51,6 +51,7 @@
 @ cdecl SetWindowText(long wstr) X11DRV_SetWindowText
 @ cdecl ShowWindow(long long ptr long) X11DRV_ShowWindow
 @ cdecl SysCommand(long long long) X11DRV_SysCommand
+@ cdecl UpdateLayeredWindow(long ptr ptr) X11DRV_UpdateLayeredWindow
 @ cdecl WindowMessage(long long long long) X11DRV_WindowMessage
 @ cdecl WindowPosChanging(long long long ptr ptr ptr ptr) X11DRV_WindowPosChanging
 @ cdecl WindowPosChanged(long long long ptr ptr ptr ptr ptr) X11DRV_WindowPosChanged




More information about the wine-cvs mailing list