[ros-diffs] [fireball] 43149: - Drop in Wine 1.1.30 user32, gdi32, winex11.drv, server. Part 1/2.

fireball at svn.reactos.org fireball at svn.reactos.org
Fri Sep 25 20:32:41 CEST 2009


Author: fireball
Date: Fri Sep 25 20:32:41 2009
New Revision: 43149

URL: http://svn.reactos.org/svn/reactos?rev=43149&view=rev
Log:
- Drop in Wine 1.1.30 user32, gdi32, winex11.drv, server. Part 1/2.

Modified:
    vendor/wine/dlls/gdi32/current/bitblt.c
    vendor/wine/dlls/gdi32/current/opengl.c
    vendor/wine/dlls/gdi32/current/tests/bitmap.c
    vendor/wine/dlls/gdi32/current/tests/metafile.c
    vendor/wine/dlls/user32/current/clipboard.c
    vendor/wine/dlls/user32/current/cursoricon.c
    vendor/wine/dlls/user32/current/edit.c
    vendor/wine/dlls/user32/current/hook.c
    vendor/wine/dlls/user32/current/nonclient.c
    vendor/wine/dlls/user32/current/painting.c
    vendor/wine/dlls/user32/current/resources/user32_Ja.rc
    vendor/wine/dlls/user32/current/tests/cursoricon.c
    vendor/wine/dlls/user32/current/tests/input.c
    vendor/wine/dlls/user32/current/tests/msg.c
    vendor/wine/dlls/user32/current/tests/win.c
    vendor/wine/dlls/winex11.drv/current/bitmap.c
    vendor/wine/dlls/winex11.drv/current/brush.c
    vendor/wine/dlls/winex11.drv/current/dib.c
    vendor/wine/dlls/winex11.drv/current/event.c
    vendor/wine/dlls/winex11.drv/current/palette.c
    vendor/wine/dlls/winex11.drv/current/window.c
    vendor/wine/dlls/winex11.drv/current/x11drv.h
    vendor/wine/dlls/winex11.drv/current/xrender.c
    vendor/wine/dlls/winex11.drv/current/xvidmode.c

Modified: vendor/wine/dlls/gdi32/current/bitblt.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/gdi32/current/bitblt.c?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/gdi32/current/bitblt.c [iso-8859-1] (original)
+++ vendor/wine/dlls/gdi32/current/bitblt.c [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -518,9 +518,11 @@
     DC *dcDst, *dcSrc;
 
     dcSrc = get_dc_ptr( hdcSrc );
+    if (!dcSrc) return FALSE;
+
     if ((dcDst = get_dc_ptr( hdcDst )))
     {
-        if (dcSrc) update_dc( dcSrc );
+        update_dc( dcSrc );
         update_dc( dcDst );
         TRACE("%p %d,%d %dx%d -> %p %d,%d %dx%d op=%02x flags=%02x srcconstalpha=%02x alphafmt=%02x\n",
               hdcSrc, xSrc, ySrc, widthSrc, heightSrc,
@@ -529,11 +531,11 @@
               blendFunction.SourceConstantAlpha, blendFunction.AlphaFormat);
         if (dcDst->funcs->pAlphaBlend)
             ret = dcDst->funcs->pAlphaBlend( dcDst->physDev, xDst, yDst, widthDst, heightDst,
-                                             dcSrc ? dcSrc->physDev : NULL,
-                                             xSrc, ySrc, widthSrc, heightSrc, blendFunction );
+                                             dcSrc->physDev, xSrc, ySrc, widthSrc, heightSrc,
+                                             blendFunction );
         release_dc_ptr( dcDst );
     }
-    if (dcSrc) release_dc_ptr( dcSrc );
+    release_dc_ptr( dcSrc );
     return ret;
 }
 

Modified: vendor/wine/dlls/gdi32/current/opengl.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/gdi32/current/opengl.c?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/gdi32/current/opengl.c [iso-8859-1] (original)
+++ vendor/wine/dlls/gdi32/current/opengl.c [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -193,7 +193,15 @@
     /* When the context hglrc is NULL, the HDC is ignored and can be NULL.
      * In that case use the global hDC to get access to the driver.  */
     if(hglrc == NULL)
+    {
+        if( hdc == NULL && !wglGetCurrentContext() )
+        {
+            WARN( "Current context is NULL\n");
+            SetLastError( ERROR_INVALID_HANDLE );
+            return FALSE;
+        }
         dc = OPENGL_GetDefaultDC();
+    }
     else
         dc = get_dc_ptr( hdc );
 

Modified: vendor/wine/dlls/gdi32/current/tests/bitmap.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/gdi32/current/tests/bitmap.c?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/gdi32/current/tests/bitmap.c [iso-8859-1] (original)
+++ vendor/wine/dlls/gdi32/current/tests/bitmap.c [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -2393,6 +2393,10 @@
     expect_eq(pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, -1, 0, 30, 30, blend), TRUE, BOOL, "%d");
     expect_eq(pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, hdcSrc, 0, -1, 30, 30, blend), TRUE, BOOL, "%d");
 
+    SetLastError(0xdeadbeef);
+    expect_eq(pGdiAlphaBlend(hdcDst, 0, 0, 20, 20, NULL, 0, 0, 20, 20, blend), FALSE, BOOL, "%d");
+    expect_eq(GetLastError(), 0xdeadbeef, int, "%d");
+
     SelectObject(hdcDst, oldDst);
     SelectObject(hdcSrc, oldSrc);
     DeleteObject(bmpSrc);

Modified: vendor/wine/dlls/gdi32/current/tests/metafile.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/gdi32/current/tests/metafile.c?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/gdi32/current/tests/metafile.c [iso-8859-1] (original)
+++ vendor/wine/dlls/gdi32/current/tests/metafile.c [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -1908,6 +1908,7 @@
     HENHMETAFILE hemf;
     HRGN hrgn;
     INT ret;
+    RECT rc_res, rc_sclip;
 
     SetLastError(0xdeadbeef);
     hdc = CreateEnhMetaFileA(0, NULL, NULL, NULL);
@@ -1946,6 +1947,22 @@
     DeleteEnhMetaFile(hemf);
     ReleaseDC(hwnd, hdc);
     DestroyWindow(hwnd);
+
+    hdc = CreateEnhMetaFileA(0, NULL, NULL, NULL);
+
+    SetRect(&rc_sclip, 100, 100, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
+    hrgn = CreateRectRgn(rc_sclip.left, rc_sclip.top, rc_sclip.right, rc_sclip.bottom);
+    SelectClipRgn(hdc, hrgn);
+    GetClipBox(hdc, &rc_res);
+    todo_wine ok(EqualRect(&rc_res, &rc_sclip),
+                 "expected rc_res (%d, %d) - (%d, %d), got (%d, %d) - (%d, %d)\n",
+                 rc_sclip.left, rc_sclip.top, rc_sclip.right, rc_sclip.bottom,
+                 rc_res.left, rc_res.top, rc_res.right, rc_res.bottom);
+
+    hemf = CloseEnhMetaFile(hdc);
+    DeleteEnhMetaFile(hemf);
+    DeleteObject(hrgn);
+    DeleteDC(hdc);
 }
 
 static INT CALLBACK EmfEnumProc(HDC hdc, HANDLETABLE *lpHTable, const ENHMETARECORD *lpEMFR, INT nObj, LPARAM lpData)

Modified: vendor/wine/dlls/user32/current/clipboard.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/clipboard.c?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/clipboard.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/clipboard.c [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -188,6 +188,21 @@
     return bRet;
 }
 
+static HWND CLIPBOARD_SetClipboardViewer( HWND hWnd )
+{
+    HWND hwndPrev = 0;
+
+    SERVER_START_REQ( set_clipboard_info )
+    {
+        req->flags = SET_CB_VIEWER;
+        req->viewer = wine_server_user_handle( hWnd );
+        if (!wine_server_call_err( req ))
+            hwndPrev = wine_server_ptr_handle( reply->old_viewer );
+    }
+    SERVER_END_REQ;
+
+    return hwndPrev;
+}
 
 /**************************************************************************
  *                WIN32 Clipboard implementation
@@ -285,7 +300,7 @@
             USER_Driver->pEndClipboardUpdate();
 
             if (hWndViewer)
-                SendMessageW(hWndViewer, WM_DRAWCLIPBOARD, 0, 0);
+                SendMessageW(hWndViewer, WM_DRAWCLIPBOARD, (WPARAM) GetClipboardOwner(), 0);
 
             bCBHasChanged = FALSE;
         }
@@ -390,17 +405,10 @@
  */
 HWND WINAPI SetClipboardViewer( HWND hWnd )
 {
-    HWND hwndPrev = 0;
-
-    SERVER_START_REQ( set_clipboard_info )
-    {
-        req->flags = SET_CB_VIEWER;
-        req->viewer = wine_server_user_handle( hWnd );
-        if (!wine_server_call_err( req ))
-            hwndPrev = wine_server_ptr_handle( reply->old_viewer );
-    }
-    SERVER_END_REQ;
-
+    HWND hwndPrev = CLIPBOARD_SetClipboardViewer(hWnd);
+
+    if (hWnd)
+        SendMessageW(hWnd, WM_DRAWCLIPBOARD, (WPARAM) GetClipboardOwner(), 0);
     TRACE("(%p): returning %p\n", hWnd, hwndPrev);
 
     return hwndPrev;
@@ -438,7 +446,7 @@
     if (hWndViewer)
     {
         if (WIN_GetFullHandle(hWnd) == hWndViewer)
-            SetClipboardViewer(WIN_GetFullHandle(hWndNext));
+            CLIPBOARD_SetClipboardViewer(WIN_GetFullHandle(hWndNext));
         else
             bRet = !SendMessageW(hWndViewer, WM_CHANGECBCHAIN, (WPARAM)hWnd, (LPARAM)hWndNext);
     }

Modified: vendor/wine/dlls/user32/current/cursoricon.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/cursoricon.c?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/cursoricon.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/cursoricon.c [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -1715,7 +1715,9 @@
             /* Do the alpha blending render */
             premultiply_alpha_channel(dibBits, xorBitmapBits, dibLength);
             hBitTemp = SelectObject( hMemDC, hXorBits );
-            GdiAlphaBlend(hdc, x, y, ptr->nWidth, ptr->nHeight, hMemDC,
+	    /* Destination width/height has to be "System Large" size */
+            GdiAlphaBlend(hdc, x, y, GetSystemMetrics(SM_CXICON),
+	                    GetSystemMetrics(SM_CYICON), hMemDC,
                             0, 0, ptr->nWidth, ptr->nHeight, pixelblend);
             SelectObject( hMemDC, hBitTemp );
         }
@@ -1729,9 +1731,13 @@
         if (hXorBits && hAndBits)
         {
             hBitTemp = SelectObject( hMemDC, hAndBits );
-            BitBlt( hdc, x, y, ptr->nWidth, ptr->nHeight, hMemDC, 0, 0, SRCAND );
+            StretchBlt( hdc, x, y, GetSystemMetrics(SM_CXICON),
+	                    GetSystemMetrics(SM_CYICON), hMemDC, 0, 0,
+			    ptr->nWidth, ptr->nHeight, SRCAND );
             SelectObject( hMemDC, hXorBits );
-            BitBlt(hdc, x, y, ptr->nWidth, ptr->nHeight, hMemDC, 0, 0,SRCINVERT);
+            StretchBlt( hdc, x, y, GetSystemMetrics(SM_CXICON),
+	                    GetSystemMetrics(SM_CYICON), hMemDC, 0, 0,
+			    ptr->nWidth, ptr->nHeight, SRCINVERT );
             SelectObject( hMemDC, hBitTemp );
         }
     }

Modified: vendor/wine/dlls/user32/current/edit.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/edit.c?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/edit.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/edit.c [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -5011,6 +5011,9 @@
 
 	case EM_SETREADONLY16:
 	case EM_SETREADONLY:
+	{
+		DWORD old_style = es->style;
+
 		if (wParam) {
                     SetWindowLongW( hwnd, GWL_STYLE,
                                     GetWindowLongW( hwnd, GWL_STYLE ) | ES_READONLY );
@@ -5020,8 +5023,13 @@
                                     GetWindowLongW( hwnd, GWL_STYLE ) & ~ES_READONLY );
                     es->style &= ~ES_READONLY;
 		}
-                result = 1;
-		break;
+
+		if (old_style ^ es->style)
+		    InvalidateRect(es->hwndSelf, NULL, TRUE);
+
+		result = 1;
+		break;
+	}
 
 	case EM_SETWORDBREAKPROC16:
 		EDIT_EM_SetWordBreakProc16(es, (EDITWORDBREAKPROC16)lParam);

Modified: vendor/wine/dlls/user32/current/hook.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/hook.c?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/hook.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/hook.c [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -85,7 +85,7 @@
 struct hook_info
 {
     INT id;
-    FARPROC proc;
+    void *proc;
     void *handle;
     DWORD pid, tid;
     BOOL prev_unicode, next_unicode;
@@ -844,24 +844,25 @@
 
     do
     {
-        if (info.proc)
+        WINEVENTPROC proc = info.proc;
+        if (proc)
         {
             TRACE( "calling WH_WINEVENT hook %p event %x hwnd %p %x %x module %s\n",
-                   info.proc, event, hwnd, object_id, child_id, debugstr_w(info.module) );
-
-            if (!info.module[0] || (info.proc = get_hook_proc( info.proc, info.module )) != NULL)
+                   proc, event, hwnd, object_id, child_id, debugstr_w(info.module) );
+
+            if (!info.module[0] || (proc = get_hook_proc( proc, info.module )) != NULL)
             {
                 if (TRACE_ON(relay))
                     DPRINTF( "%04x:Call winevent hook proc %p (hhook=%p,event=%x,hwnd=%p,object_id=%x,child_id=%x,tid=%04x,time=%x)\n",
-                             GetCurrentThreadId(), info.proc, info.handle, event, hwnd, object_id,
+                             GetCurrentThreadId(), proc, info.handle, event, hwnd, object_id,
                              child_id, GetCurrentThreadId(), GetCurrentTime());
 
-                info.proc(info.handle, event, hwnd, object_id, child_id,
-                          GetCurrentThreadId(), GetCurrentTime());
+                proc( info.handle, event, hwnd, object_id, child_id,
+                      GetCurrentThreadId(), GetCurrentTime());
 
                 if (TRACE_ON(relay))
                     DPRINTF( "%04x:Ret  winevent hook proc %p (hhook=%p,event=%x,hwnd=%p,object_id=%x,child_id=%x,tid=%04x,time=%x)\n",
-                             GetCurrentThreadId(), info.proc, info.handle, event, hwnd, object_id,
+                             GetCurrentThreadId(), proc, info.handle, event, hwnd, object_id,
                              child_id, GetCurrentThreadId(), GetCurrentTime());
             }
         }

Modified: vendor/wine/dlls/user32/current/nonclient.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/nonclient.c?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/nonclient.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/nonclient.c [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -1316,7 +1316,7 @@
  *
  * Track a mouse button press on the Win95 close button.
  */
-static void NC_TrackCloseButton (HWND hwnd, WORD wParam)
+static void NC_TrackCloseButton (HWND hwnd, WPARAM wParam, LPARAM lParam)
 {
     MSG msg;
     HDC hdc;
@@ -1364,7 +1364,7 @@
     ReleaseDC( hwnd, hdc );
     if (!pressed) return;
 
-    SendMessageW( hwnd, WM_SYSCOMMAND, SC_CLOSE, MAKELONG(msg.pt.x,msg.pt.y) );
+    SendMessageW( hwnd, WM_SYSCOMMAND, SC_CLOSE, lParam );
 }
 
 
@@ -1442,7 +1442,7 @@
         break;
 
     case HTCLOSE:
-        NC_TrackCloseButton (hwnd, wParam);
+        NC_TrackCloseButton (hwnd, wParam, lParam);
         break;
 
     case HTLEFT:
@@ -1600,7 +1600,9 @@
             HMODULE hmodule = LoadLibraryA( "shell32.dll" );
             if (hmodule)
             {
-                FARPROC aboutproc = GetProcAddress( hmodule, "ShellAboutA" );
+                BOOL (WINAPI *aboutproc)(HWND, LPCSTR, LPCSTR, HICON);
+
+                aboutproc = (void *)GetProcAddress( hmodule, "ShellAboutA" );
                 if (aboutproc) aboutproc( hwnd, PACKAGE_STRING, NULL, 0 );
                 FreeLibrary( hmodule );
             }

Modified: vendor/wine/dlls/user32/current/painting.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/painting.c?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/painting.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/painting.c [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -1404,10 +1404,11 @@
     hwnd = WIN_GetFullHandle( hwnd );
 
     GetClientRect(hwnd, &rc);
-    if (rect) IntersectRect(&rc, &rc, rect);
 
     if (clipRect) IntersectRect(&cliprc,&rc,clipRect);
     else cliprc = rc;
+
+    if (rect) IntersectRect(&rc, &rc, rect);
 
     if( hrgnUpdate ) bOwnRgn = FALSE;
     else if( bUpdate ) hrgnUpdate = CreateRectRgn( 0, 0, 0, 0 );

Modified: vendor/wine/dlls/user32/current/resources/user32_Ja.rc
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/resources/user32_Ja.rc?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/resources/user32_Ja.rc [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/resources/user32_Ja.rc [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -53,7 +53,6 @@
 
 MSGBOX DIALOG 100, 80, 216, 168
 STYLE DS_MODALFRAME | DS_NOIDLEMSG | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-FONT 9, "MS Shell Dlg"
 BEGIN
         ICON "", 1088, 8, 20, 16, 16, WS_CHILD | WS_VISIBLE
         LTEXT "", 100, 32, 4, 176, 48, WS_CHILD | WS_VISIBLE | WS_GROUP | SS_NOPREFIX

Modified: vendor/wine/dlls/user32/current/tests/cursoricon.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/tests/cursoricon.c?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/tests/cursoricon.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/tests/cursoricon.c [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -1039,6 +1039,8 @@
     HICON hicon = create_test_icon(hdc, 1, 1, bpp, maskvalue, &color, sizeof(color));
     if (!hicon) return;
     SetPixelV(hdc, 0, 0, background);
+    SetPixelV(hdc, GetSystemMetrics(SM_CXICON)-1, GetSystemMetrics(SM_CYICON)-1, background);
+    SetPixelV(hdc, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON), background);
     DrawIcon(hdc, 0, 0, hicon);
     result = GetPixel(hdc, 0, 0);
 
@@ -1047,6 +1049,21 @@
         "Overlaying Mask %d on Color %06X with DrawIcon. "
         "Expected a close match to %06X (modern), or %06X (legacy). Got %06X from line %d\n",
         maskvalue, color, modern_expected, legacy_expected, result, line);
+
+    result = GetPixel(hdc, GetSystemMetrics(SM_CXICON)-1, GetSystemMetrics(SM_CYICON)-1);
+
+    ok (color_match(result, modern_expected) ||         /* Windows 2000 and up */
+        broken(color_match(result, legacy_expected)),   /* Windows NT 4.0, 9X and below */
+        "Overlaying Mask %d on Color %06X with DrawIcon. "
+        "Expected a close match to %06X (modern), or %06X (legacy). Got %06X from line %d\n",
+        maskvalue, color, modern_expected, legacy_expected, result, line);
+
+    result = GetPixel(hdc, GetSystemMetrics(SM_CXICON), GetSystemMetrics(SM_CYICON));
+
+    ok (color_match(result, background),
+        "Overlaying Mask %d on Color %06X with DrawIcon. "
+        "Expected unchanged background color %06X. Got %06X from line %d\n",
+        maskvalue, color, background, result, line);
 }
 
 static void test_DrawIcon(void)
@@ -1070,8 +1087,8 @@
 
     memset(&bitmapInfo, 0, sizeof(bitmapInfo));
     bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-    bitmapInfo.bmiHeader.biWidth = 1;
-    bitmapInfo.bmiHeader.biHeight = 1;
+    bitmapInfo.bmiHeader.biWidth = GetSystemMetrics(SM_CXICON)+1;
+    bitmapInfo.bmiHeader.biHeight = GetSystemMetrics(SM_CYICON)+1;
     bitmapInfo.bmiHeader.biBitCount = 32;
     bitmapInfo.bmiHeader.biPlanes = 1;
     bitmapInfo.bmiHeader.biCompression = BI_RGB;

Modified: vendor/wine/dlls/user32/current/tests/input.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/tests/input.c?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/tests/input.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/tests/input.c [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -892,6 +892,11 @@
     HWND window;
     HHOOK hook;
 
+    if (GetKeyboardLayout(0) != (HKL)(ULONG_PTR)0x04090409)
+    {
+        skip("Skipping Input_blackbox test on non-US keyboard\n");
+        return;
+    }
     window = CreateWindow("Static", NULL, WS_POPUP|WS_HSCROLL|WS_VSCROLL
         |WS_VISIBLE, 0, 0, 200, 60, NULL, NULL,
         NULL, NULL);

Modified: vendor/wine/dlls/user32/current/tests/msg.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/tests/msg.c?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/tests/msg.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/tests/msg.c [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -11724,6 +11724,171 @@
     DestroyWindow( hwnd);
 }
 
+#define clear_clipboard(hwnd)  clear_clipboard_(__LINE__, (hwnd))
+static void clear_clipboard_(int line, HWND hWnd)
+{
+    BOOL succ;
+    succ = OpenClipboard(hWnd);
+    ok_(__FILE__, line)(succ, "OpenClipboard failed, err=%u\n", GetLastError());
+    succ = EmptyClipboard();
+    ok_(__FILE__, line)(succ, "EmptyClipboard failed, err=%u\n", GetLastError());
+    succ = CloseClipboard();
+    ok_(__FILE__, line)(succ, "CloseClipboard failed, err=%u\n", GetLastError());
+}
+
+#define expect_HWND(expected, got) expect_HWND_(__LINE__, (expected), (got))
+static void expect_HWND_(int line, HWND expected, HWND got)
+{
+    ok_(__FILE__, line)(got==expected, "Expected %p, got %p\n", expected, got);
+}
+
+static WNDPROC pOldViewerProc;
+
+static LRESULT CALLBACK recursive_viewer_proc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
+    static BOOL recursion_guard;
+
+    if (message == WM_DRAWCLIPBOARD && !recursion_guard)
+    {
+        recursion_guard = TRUE;
+        clear_clipboard(hWnd);
+        recursion_guard = FALSE;
+    }
+    return CallWindowProcA(pOldViewerProc, hWnd, message, wParam, lParam);
+}
+
+static void test_clipboard_viewers(void)
+{
+    static struct message wm_change_cb_chain[] =
+    {
+        { WM_CHANGECBCHAIN, sent|wparam|lparam, 0, 0 },
+        { 0 }
+    };
+    static const struct message wm_clipboard_destroyed[] =
+    {
+        { WM_DESTROYCLIPBOARD, sent|wparam|lparam, 0, 0 },
+        { 0 }
+    };
+    static struct message wm_clipboard_changed[] =
+    {
+        { WM_DRAWCLIPBOARD, sent|wparam|lparam, 0, 0 },
+        { 0 }
+    };
+    static struct message wm_clipboard_changed_and_owned[] =
+    {
+        { WM_DESTROYCLIPBOARD, sent|wparam|lparam, 0, 0 },
+        { WM_DRAWCLIPBOARD, sent|wparam|lparam, 0, 0 },
+        { 0 }
+    };
+
+    HINSTANCE hInst = GetModuleHandleA(NULL);
+    HWND hWnd1, hWnd2, hWnd3;
+    HWND hOrigViewer;
+    HWND hRet;
+
+    hWnd1 = CreateWindowExA(0, "TestWindowClass", "Clipboard viewer test wnd 1",
+        WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX,
+        CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
+        GetDesktopWindow(), NULL, hInst, NULL);
+    hWnd2 = CreateWindowExA(0, "SimpleWindowClass", "Clipboard viewer test wnd 2",
+        WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX,
+        CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
+        GetDesktopWindow(), NULL, hInst, NULL);
+    hWnd3 = CreateWindowExA(0, "SimpleWindowClass", "Clipboard viewer test wnd 3",
+        WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX,
+        CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
+        GetDesktopWindow(), NULL, hInst, NULL);
+    trace("clipbd viewers: hWnd1=%p, hWnd2=%p, hWnd3=%p\n", hWnd1, hWnd2, hWnd3);
+    assert(hWnd1 && hWnd2 && hWnd3);
+
+    flush_sequence();
+
+    /* Test getting the clipboard viewer and setting the viewer to NULL. */
+    hOrigViewer = GetClipboardViewer();
+    hRet = SetClipboardViewer(NULL);
+    ok_sequence(WmEmptySeq, "set viewer to NULL", FALSE);
+    expect_HWND(hOrigViewer, hRet);
+    expect_HWND(NULL, GetClipboardViewer());
+
+    /* Test registering hWnd1 as a viewer. */
+    hRet = SetClipboardViewer(hWnd1);
+    wm_clipboard_changed[0].wParam = (WPARAM) GetClipboardOwner();
+    ok_sequence(wm_clipboard_changed, "set viewer NULL->1", FALSE);
+    expect_HWND(NULL, hRet);
+    expect_HWND(hWnd1, GetClipboardViewer());
+
+    /* Test that changing the clipboard actually refreshes the registered viewer. */
+    clear_clipboard(hWnd1);
+    wm_clipboard_changed[0].wParam = (WPARAM) GetClipboardOwner();
+    ok_sequence(wm_clipboard_changed, "clear clipbd (viewer=owner=1)", FALSE);
+
+    /* Again, but with different owner. */
+    clear_clipboard(hWnd2);
+    wm_clipboard_changed_and_owned[1].wParam = (WPARAM) GetClipboardOwner();
+    ok_sequence(wm_clipboard_changed_and_owned, "clear clipbd (viewer=1, owner=2)", FALSE);
+
+    /* Test re-registering same window. */
+    hRet = SetClipboardViewer(hWnd1);
+    wm_clipboard_changed[0].wParam = (WPARAM) GetClipboardOwner();
+    ok_sequence(wm_clipboard_changed, "set viewer 1->1", FALSE);
+    expect_HWND(hWnd1, hRet);
+    expect_HWND(hWnd1, GetClipboardViewer());
+
+    /* Test ChangeClipboardChain. */
+    ChangeClipboardChain(hWnd2, hWnd3);
+    wm_change_cb_chain[0].wParam = (WPARAM) hWnd2;
+    wm_change_cb_chain[0].lParam = (LPARAM) hWnd3;
+    ok_sequence(wm_change_cb_chain, "change chain (viewer=1, remove=2, next=3)", FALSE);
+    expect_HWND(hWnd1, GetClipboardViewer());
+
+    ChangeClipboardChain(hWnd2, NULL);
+    wm_change_cb_chain[0].wParam = (WPARAM) hWnd2;
+    wm_change_cb_chain[0].lParam = 0;
+    ok_sequence(wm_change_cb_chain, "change chain (viewer=1, remove=2, next=NULL)", FALSE);
+    expect_HWND(hWnd1, GetClipboardViewer());
+
+    ChangeClipboardChain(NULL, hWnd2);
+    ok_sequence(WmEmptySeq, "change chain (viewer=1, remove=NULL, next=2)", TRUE);
+    expect_HWND(hWnd1, GetClipboardViewer());
+
+    /* Actually change clipboard viewer with ChangeClipboardChain. */
+    ChangeClipboardChain(hWnd1, hWnd2);
+    ok_sequence(WmEmptySeq, "change chain (viewer=remove=1, next=2)", FALSE);
+    expect_HWND(hWnd2, GetClipboardViewer());
+
+    /* Test that no refresh messages are sent when viewer has unregistered. */
+    clear_clipboard(hWnd2);
+    ok_sequence(WmEmptySeq, "clear clipd (viewer=2, owner=1)", FALSE);
+
+    /* Register hWnd1 again. */
+    ChangeClipboardChain(hWnd2, hWnd1);
+    ok_sequence(WmEmptySeq, "change chain (viewer=remove=2, next=1)", FALSE);
+    expect_HWND(hWnd1, GetClipboardViewer());
+
+    /* Subclass hWnd1 so that when it receives a WM_DRAWCLIPBOARD message, it
+     * changes the clipboard. When this happens, the system shouldn't send
+     * another WM_DRAWCLIPBOARD (as this could cause an infinite loop).
+     */
+    pOldViewerProc = (WNDPROC) SetWindowLongPtrA(hWnd1, GWLP_WNDPROC, (LONG_PTR) recursive_viewer_proc);
+    clear_clipboard(hWnd2);
+    /* The clipboard owner is changed in recursive_viewer_proc: */
+    wm_clipboard_changed[0].wParam = (WPARAM) hWnd2;
+    ok_sequence(wm_clipboard_changed, "recursive clear clipbd (viewer=1, owner=2)", TRUE);
+
+    /* Test unregistering. */
+    ChangeClipboardChain(hWnd1, NULL);
+    ok_sequence(WmEmptySeq, "change chain (viewer=remove=1, next=NULL)", FALSE);
+    expect_HWND(NULL, GetClipboardViewer());
+
+    clear_clipboard(hWnd1);
+    ok_sequence(wm_clipboard_destroyed, "clear clipbd (no viewer, owner=1)", FALSE);
+
+    DestroyWindow(hWnd1);
+    DestroyWindow(hWnd2);
+    DestroyWindow(hWnd3);
+    SetClipboardViewer(hOrigViewer);
+}
+
 static void test_PostMessage(void)
 {
     static const struct
@@ -11787,7 +11952,7 @@
 START_TEST(msg)
 {
     BOOL ret;
-    FARPROC pIsWinEventHookInstalled = 0;/*GetProcAddress(user32, "IsWinEventHookInstalled");*/
+    BOOL (WINAPI *pIsWinEventHookInstalled)(DWORD)= 0;/*GetProcAddress(user32, "IsWinEventHookInstalled");*/
 
     init_procs();
 
@@ -11867,6 +12032,7 @@
     test_menu_messages();
     test_paintingloop();
     test_defwinproc();
+    test_clipboard_viewers();
     /* keep it the last test, under Windows it tends to break the tests
      * which rely on active/foreground windows being correct.
      */

Modified: vendor/wine/dlls/user32/current/tests/win.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/user32/current/tests/win.c?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/user32/current/tests/win.c [iso-8859-1] (original)
+++ vendor/wine/dlls/user32/current/tests/win.c [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -3216,6 +3216,57 @@
     check_window_style(WS_CHILD, WS_EX_DLGMODALFRAME|WS_EX_STATICEDGE, WS_CHILD, WS_EX_STATICEDGE|WS_EX_WINDOWEDGE|WS_EX_DLGMODALFRAME);
     check_window_style(WS_CAPTION, WS_EX_STATICEDGE, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_STATICEDGE|WS_EX_WINDOWEDGE);
     check_window_style(0, WS_EX_APPWINDOW, WS_CLIPSIBLINGS|WS_CAPTION, WS_EX_APPWINDOW|WS_EX_WINDOWEDGE);
+}
+
+static void test_scrollwindow( HWND hwnd)
+{
+    HDC hdc;
+    RECT rc, rc2, rc3;
+    COLORREF colr;
+
+    ShowWindow( hwnd, SW_SHOW);
+    UpdateWindow( hwnd);
+    flush_events( TRUE );
+    GetClientRect( hwnd, &rc);
+    hdc = GetDC( hwnd);
+    /* test ScrollWindow(Ex) with no clip rectangle */
+    /* paint the lower half of the window black */
+    rc2 = rc;
+    rc2.top = ( rc2.top + rc2.bottom) / 2;
+    FillRect( hdc, &rc2, GetStockObject(BLACK_BRUSH));
+    /* paint the upper half of the window white */
+    rc2.bottom = rc2.top;
+    rc2.top =0;
+    FillRect( hdc, &rc2, GetStockObject(WHITE_BRUSH));
+    /* scroll lower half up */
+    rc2 = rc;
+    rc2.top = ( rc2.top + rc2.bottom) / 2;
+    ScrollWindowEx( hwnd, 0, - rc2.top, &rc2, NULL, NULL, NULL, SW_ERASE);
+    /* expected: black should have scrolled to the upper half */
+    colr = GetPixel( hdc, (rc2.left+rc2.right)/ 2,  rc2.bottom / 4 );
+    ok ( colr == 0, "pixel should be black, color is %08x\n", colr);
+    /* Repeat that test of ScrollWindow(Ex) now with clip rectangle */
+    /* paint the lower half of the window black */
+    rc2 = rc;
+    rc2.top = ( rc2.top + rc2.bottom) / 2;
+    FillRect( hdc, &rc2, GetStockObject(BLACK_BRUSH));
+    /* paint the upper half of the window white */
+    rc2.bottom = rc2.top;
+    rc2.top =0;
+    FillRect( hdc, &rc2, GetStockObject(WHITE_BRUSH));
+    /* scroll lower half up */
+    rc2 = rc;
+    rc2.top = ( rc2.top + rc2.bottom) / 2;
+    rc3 = rc;
+    rc3.left = rc3.right / 4;
+    rc3.right -= rc3.right / 4;
+    ScrollWindowEx( hwnd, 0, - rc2.top, &rc2, &rc3, NULL, NULL, SW_ERASE);
+    /* expected: black should have scrolled to the upper half */
+    colr = GetPixel( hdc, (rc2.left+rc2.right)/ 2,  rc2.bottom / 4 );
+    ok ( colr == 0, "pixel should be black, color is %08x\n", colr);
+
+    /* clean up */
+    ReleaseDC( hwnd, hdc);
 }
 
 static void test_scrollvalidate( HWND parent)
@@ -5724,6 +5775,7 @@
     test_mouse_input(hwndMain);
     test_validatergn(hwndMain);
     test_nccalcscroll( hwndMain);
+    test_scrollwindow( hwndMain);
     test_scrollvalidate( hwndMain);
     test_scrolldc( hwndMain);
     test_scroll();

Modified: vendor/wine/dlls/winex11.drv/current/bitmap.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/winex11.drv/current/bitmap.c?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/winex11.drv/current/bitmap.c [iso-8859-1] (original)
+++ vendor/wine/dlls/winex11.drv/current/bitmap.c [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -102,6 +102,7 @@
 
     physDev->bitmap = physBitmap;
     physDev->drawable = physBitmap->pixmap;
+    physDev->color_shifts = physBitmap->trueColor ? &physBitmap->pixmap_color_shifts : NULL;
     SetRect( &physDev->drawable_rect, 0, 0, bitmap.bmWidth, bitmap.bmHeight );
     physDev->dc_rect = physDev->drawable_rect;
 
@@ -110,10 +111,6 @@
     if (physDev->depth != physBitmap->pixmap_depth)
     {
         physDev->depth = physBitmap->pixmap_depth;
-        if(physDev->depth == 1)
-            physDev->color_shifts = NULL;
-        else
-            physDev->color_shifts = &physBitmap->pixmap_color_shifts;
         wine_tsx11_lock();
         XFreeGC( gdi_display, physDev->gc );
         physDev->gc = XCreateGC( gdi_display, physDev->drawable, 0, NULL );
@@ -122,6 +119,7 @@
         XFlush( gdi_display );
         wine_tsx11_unlock();
     }
+
     return hbitmap;
 }
 
@@ -165,11 +163,13 @@
     if(bitmap.bmBitsPixel == 1)
     {
         physBitmap->pixmap_depth = 1;
+        physBitmap->trueColor = FALSE;
     }
     else
     {
         physBitmap->pixmap_depth = screen_depth;
         physBitmap->pixmap_color_shifts = X11DRV_PALETTE_default_shifts;
+        physBitmap->trueColor = (visual->class == TrueColor || visual->class == DirectColor);
     }
     physBitmap->pixmap = XCreatePixmap(gdi_display, root_window,
                                        bitmap.bmWidth, bitmap.bmHeight, physBitmap->pixmap_depth);

Modified: vendor/wine/dlls/winex11.drv/current/brush.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/winex11.drv/current/brush.c?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/winex11.drv/current/brush.c [iso-8859-1] (original)
+++ vendor/wine/dlls/winex11.drv/current/brush.c [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -215,25 +215,22 @@
 
     if (!physBitmap || !GetObjectW( hbitmap, sizeof(bitmap), &bitmap )) return FALSE;
 
-    wine_tsx11_lock();
     if ((physDev->depth == 1) && (physBitmap->pixmap_depth != 1))
     {
+        wine_tsx11_lock();
         /* Special case: a color pattern on a monochrome DC */
         physDev->brush.pixmap = XCreatePixmap( gdi_display, root_window,
                                                bitmap.bmWidth, bitmap.bmHeight, 1);
         /* FIXME: should probably convert to monochrome instead */
         XCopyPlane( gdi_display, physBitmap->pixmap, physDev->brush.pixmap,
                     get_bitmap_gc(1), 0, 0, bitmap.bmWidth, bitmap.bmHeight, 0, 0, 1 );
+        wine_tsx11_unlock();
     }
     else
     {
-        physDev->brush.pixmap = XCreatePixmap( gdi_display, root_window,
-                                               bitmap.bmWidth, bitmap.bmHeight,
-                                               physBitmap->pixmap_depth );
-        XCopyArea( gdi_display, physBitmap->pixmap, physDev->brush.pixmap,
-                   get_bitmap_gc(physBitmap->pixmap_depth), 0, 0, bitmap.bmWidth, bitmap.bmHeight, 0, 0 );
-    }
-    wine_tsx11_unlock();
+        /* XRender is needed because of possible depth conversion */
+        X11DRV_XRender_CopyBrush(physDev, physBitmap, bitmap.bmWidth, bitmap.bmHeight);
+    }
 
     if (physBitmap->pixmap_depth > 1)
     {

Modified: vendor/wine/dlls/winex11.drv/current/dib.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/winex11.drv/current/dib.c?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/winex11.drv/current/dib.c [iso-8859-1] (original)
+++ vendor/wine/dlls/winex11.drv/current/dib.c [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -4749,11 +4749,13 @@
     if(dib.dsBm.bmBitsPixel == 1)
     {
         physBitmap->pixmap_depth = 1;
+        physBitmap->trueColor = FALSE;
     }
     else
     {
         physBitmap->pixmap_depth = screen_depth;
         physBitmap->pixmap_color_shifts = X11DRV_PALETTE_default_shifts;
+        physBitmap->trueColor = (visual->class == TrueColor || visual->class == DirectColor);
     }
 #ifdef HAVE_LIBXXSHM
     physBitmap->shminfo.shmid = -1;

Modified: vendor/wine/dlls/winex11.drv/current/event.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/winex11.drv/current/event.c?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/winex11.drv/current/event.c [iso-8859-1] (original)
+++ vendor/wine/dlls/winex11.drv/current/event.c [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -511,6 +511,7 @@
         if (IsWindowEnabled(hwnd))
         {
             HMENU hSysMenu;
+            POINT pt;
 
             if (GetClassLongW(hwnd, GCL_STYLE) & CS_NOCLOSE) return;
             hSysMenu = GetSystemMenu(hwnd, FALSE);
@@ -524,7 +525,7 @@
             {
                 LRESULT ma = SendMessageW( hwnd, WM_MOUSEACTIVATE,
                                            (WPARAM)GetAncestor( hwnd, GA_ROOT ),
-                                           MAKELONG(HTCLOSE,WM_LBUTTONDOWN) );
+                                           MAKELPARAM( HTCLOSE, WM_NCLBUTTONDOWN ) );
                 switch(ma)
                 {
                     case MA_NOACTIVATEANDEAT:
@@ -541,7 +542,10 @@
                         break;
                 }
             }
-            PostMessageW( hwnd, WM_X11DRV_DELETE_WINDOW, 0, 0 );
+            /* Simulate clicking the caption Close button */
+            GetCursorPos( &pt );
+            PostMessageW( hwnd, WM_NCLBUTTONDOWN, HTCLOSE, MAKELPARAM( pt.x, pt.y ) );
+            PostMessageW( hwnd, WM_LBUTTONUP, HTCLOSE, MAKELPARAM( pt.x, pt.y ) );
         }
     }
     else if (protocol == x11drv_atom(WM_TAKE_FOCUS))

Modified: vendor/wine/dlls/winex11.drv/current/palette.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/winex11.drv/current/palette.c?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/winex11.drv/current/palette.c [iso-8859-1] (original)
+++ vendor/wine/dlls/winex11.drv/current/palette.c [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -101,7 +101,6 @@
 
 static BOOL X11DRV_PALETTE_BuildPrivateMap( const PALETTEENTRY *sys_pal_template );
 static BOOL X11DRV_PALETTE_BuildSharedMap( const PALETTEENTRY *sys_pal_template );
-static void X11DRV_PALETTE_ComputeShifts(unsigned long maskbits, ChannelShift *physical, ChannelShift *to_logical);
 static void X11DRV_PALETTE_FillDefaultColors( const PALETTEENTRY *sys_pal_template );
 static void X11DRV_PALETTE_FormatSystemPalette(void);
 static BOOL X11DRV_PALETTE_CheckSysColor( const PALETTEENTRY *sys_pal_template, COLORREF c);
@@ -223,9 +222,7 @@
             X11DRV_PALETTE_PaletteXColormap = XCreateColormap(gdi_display, root_window,
                                                               visual, AllocNone);
             X11DRV_PALETTE_PaletteFlags |= X11DRV_PALETTE_FIXED;
-            X11DRV_PALETTE_ComputeShifts(visual->red_mask, &X11DRV_PALETTE_default_shifts.physicalRed, &X11DRV_PALETTE_default_shifts.logicalRed);
-            X11DRV_PALETTE_ComputeShifts(visual->green_mask, &X11DRV_PALETTE_default_shifts.physicalGreen, &X11DRV_PALETTE_default_shifts.logicalGreen);
-            X11DRV_PALETTE_ComputeShifts(visual->blue_mask, &X11DRV_PALETTE_default_shifts.physicalBlue, &X11DRV_PALETTE_default_shifts.logicalBlue);
+            X11DRV_PALETTE_ComputeColorShifts(&X11DRV_PALETTE_default_shifts, visual->red_mask, visual->green_mask, visual->blue_mask);
         }
         XFree(depths);
         wine_tsx11_unlock();
@@ -281,11 +278,11 @@
 }
 
 /***********************************************************************
- *		X11DRV_PALETTE_ComputeShifts
+ *		X11DRV_PALETTE_ComputeChannelShift
  *
- * Calculate conversion parameters for direct mapped visuals
- */
-static void X11DRV_PALETTE_ComputeShifts(unsigned long maskbits, ChannelShift *physical, ChannelShift *to_logical)
+ * Calculate conversion parameters for a given color mask
+ */
+static void X11DRV_PALETTE_ComputeChannelShift(unsigned long maskbits, ChannelShift *physical, ChannelShift *to_logical)
 {
     int i;
 
@@ -324,6 +321,18 @@
         to_logical->scale=physical->scale;
         to_logical->max=physical->max;
     }
+}
+
+/***********************************************************************
+ *      X11DRV_PALETTE_ComputeColorShifts
+ *
+ * Calculate conversion parameters for a given color
+ */
+void X11DRV_PALETTE_ComputeColorShifts(ColorShifts *shifts, unsigned long redMask, unsigned long greenMask, unsigned long blueMask)
+{
+    X11DRV_PALETTE_ComputeChannelShift(redMask, &shifts->physicalRed, &shifts->logicalRed);
+    X11DRV_PALETTE_ComputeChannelShift(greenMask, &shifts->physicalGreen, &shifts->logicalGreen);
+    X11DRV_PALETTE_ComputeChannelShift(blueMask, &shifts->physicalBlue, &shifts->logicalBlue);
 }
 
 /***********************************************************************
@@ -782,10 +791,6 @@
 COLORREF X11DRV_PALETTE_ToLogical(X11DRV_PDEVICE *physDev, int pixel)
 {
     XColor color;
-    ColorShifts *shifts = &X11DRV_PALETTE_default_shifts;
-
-    if(physDev->color_shifts)
-        shifts = physDev->color_shifts;
 
 #if 0
     /* truecolor visual */
@@ -797,6 +802,11 @@
 
     if ( (X11DRV_PALETTE_PaletteFlags & X11DRV_PALETTE_FIXED) && !X11DRV_PALETTE_Graymax )
     {
+         ColorShifts *shifts = &X11DRV_PALETTE_default_shifts;
+
+         if(physDev->color_shifts)
+             shifts = physDev->color_shifts;
+
          color.red = (pixel >> shifts->logicalRed.shift) & shifts->logicalRed.max;
          if (shifts->logicalRed.scale<8)
              color.red=  color.red   << (8-shifts->logicalRed.scale) |

Modified: vendor/wine/dlls/winex11.drv/current/window.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/winex11.drv/current/window.c?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/winex11.drv/current/window.c [iso-8859-1] (original)
+++ vendor/wine/dlls/winex11.drv/current/window.c [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -2308,8 +2308,6 @@
     {
     case WM_X11DRV_ACQUIRE_SELECTION:
         return X11DRV_AcquireClipboard( hwnd );
-    case WM_X11DRV_DELETE_WINDOW:
-        return SendMessageW( hwnd, WM_SYSCOMMAND, SC_CLOSE, 0 );
     case WM_X11DRV_SET_WIN_FORMAT:
         return set_win_format( hwnd, (XID)wp );
     case WM_X11DRV_SET_WIN_REGION:

Modified: vendor/wine/dlls/winex11.drv/current/x11drv.h
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/winex11.drv/current/x11drv.h?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/winex11.drv/current/x11drv.h [iso-8859-1] (original)
+++ vendor/wine/dlls/winex11.drv/current/x11drv.h [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -124,6 +124,7 @@
     XImage      *image;             /* cached XImage */
     int         *colorMap;          /* color map info */
     int          nColorMap;
+    BOOL         trueColor;
     CRITICAL_SECTION lock;          /* GDI access lock */
     enum x11drv_shm_mode shm_mode;
 #ifdef HAVE_LIBXXSHM
@@ -286,6 +287,7 @@
 extern void X11DRV_XRender_Finalize(void);
 extern BOOL X11DRV_XRender_SelectFont(X11DRV_PDEVICE*, HFONT);
 extern void X11DRV_XRender_DeleteDC(X11DRV_PDEVICE*);
+extern void X11DRV_XRender_CopyBrush(X11DRV_PDEVICE *physDev, X_PHYSBITMAP *physBitmap, int width, int height);
 extern BOOL X11DRV_XRender_ExtTextOut(X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags,
 				      const RECT *lprect, LPCWSTR wstr,
 				      UINT count, const INT *lpDx);
@@ -493,6 +495,7 @@
 extern COLORREF X11DRV_PALETTE_ToLogical(X11DRV_PDEVICE *physDev, int pixel);
 extern int X11DRV_PALETTE_ToPhysical(X11DRV_PDEVICE *physDev, COLORREF color);
 extern int X11DRV_PALETTE_LookupPixel(COLORREF color);
+extern void X11DRV_PALETTE_ComputeColorShifts(ColorShifts *shifts, unsigned long redMask, unsigned long greenMask, unsigned long blueMask);
 
 extern unsigned int depth_to_bpp( unsigned int depth );
 
@@ -700,7 +703,6 @@
 enum x11drv_window_messages
 {
     WM_X11DRV_ACQUIRE_SELECTION = 0x80001000,
-    WM_X11DRV_DELETE_WINDOW,
     WM_X11DRV_SET_WIN_FORMAT,
     WM_X11DRV_SET_WIN_REGION,
     WM_X11DRV_RESIZE_DESKTOP

Modified: vendor/wine/dlls/winex11.drv/current/xrender.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/winex11.drv/current/xrender.c?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/winex11.drv/current/xrender.c [iso-8859-1] (original)
+++ vendor/wine/dlls/winex11.drv/current/xrender.c [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -427,23 +427,41 @@
     return NULL;
 }
 
-static WineXRenderFormat *get_xrender_format_from_pdevice(X11DRV_PDEVICE *physDev)
-{
-    WXRFormat format;
-
-    switch(physDev->depth)
-    {
-        case 1:
-            format = WXR_FORMAT_MONO;
-            break;
-        default:
-            /* For now fall back to the format of the default visual.
-               In the future we should check if we are using a DDB/DIB and what exact format we need.
-             */
-            return default_format;
-    }
-
-    return get_xrender_format(format);
+static WineXRenderFormat *get_xrender_format_from_color_shifts(int depth, ColorShifts *shifts)
+{
+    int redMask, greenMask, blueMask;
+    unsigned int i;
+
+    if(depth == 1)
+        return get_xrender_format(WXR_FORMAT_MONO);
+
+    /* physDevs of a depth <=8, don't have color_shifts set and XRender can't handle those except for 1-bit */
+    if(!shifts)
+        return default_format;
+
+    redMask   = shifts->physicalRed.max << shifts->physicalRed.shift;
+    greenMask = shifts->physicalGreen.max << shifts->physicalGreen.shift;
+    blueMask  = shifts->physicalBlue.max << shifts->physicalBlue.shift;
+
+    /* Try to locate a format which matches the specification of the dibsection. */
+    for(i = 0; i < (sizeof(wxr_formats_template) / sizeof(wxr_formats_template[0])); i++)
+    {
+        if( depth     == wxr_formats_template[i].depth &&
+            redMask   == (wxr_formats_template[i].redMask << wxr_formats_template[i].red) &&
+            greenMask == (wxr_formats_template[i].greenMask << wxr_formats_template[i].green) &&
+            blueMask  == (wxr_formats_template[i].blueMask << wxr_formats_template[i].blue) )
+
+        {
+            /* When we reach this stage the format was found in our template table but this doesn't mean that
+            * the Xserver also supports this format (e.g. its depth might be too low). The call below verifies that.
+            */
+            return get_xrender_format(wxr_formats_template[i].wxr_format);
+        }
+    }
+
+    /* This should not happen because when we reach 'shifts' must have been set and we only allows shifts which are backed by X */
+    ERR("No XRender format found!\n");
+    return NULL;
 }
 
 static BOOL fontcmp(LFANDSIZE *p1, LFANDSIZE *p2)
@@ -1381,7 +1399,7 @@
     unsigned int idx;
     double cosEsc, sinEsc;
     LOGFONTW lf;
-    WineXRenderFormat *dst_format = get_xrender_format_from_pdevice(physDev);
+    WineXRenderFormat *dst_format = get_xrender_format_from_color_shifts(physDev->depth, physDev->color_shifts);
     Picture tile_pict = 0;
 
     /* Do we need to disable antialiasing because of palette mode? */
@@ -1787,7 +1805,7 @@
     POINT pts[2];
     BOOL top_down = FALSE;
     RGNDATA *rgndata;
-    WineXRenderFormat *dst_format = get_xrender_format_from_pdevice(devDst);
+    WineXRenderFormat *dst_format = get_xrender_format_from_color_shifts(devDst->depth, devDst->color_shifts);
     WineXRenderFormat *src_format;
     int repeat_src;
 
@@ -1816,14 +1834,10 @@
     heightSrc = pts[1].y - pts[0].y;
     if (!widthDst || !heightDst || !widthSrc || !heightSrc) return TRUE;
 
-    /* If the source is a 1x1 bitmap, tiling is equivalent to stretching, but
-        tiling is much faster. Therefore, we do no stretching in this case. */
-    repeat_src = widthSrc == 1 && heightSrc == 1;
-
 #ifndef HAVE_XRENDERSETPICTURETRANSFORM
-    if((widthDst != widthSrc || heightDst != heightSrc) && !repeat_src)
+    if(widthDst != widthSrc || heightDst != heightSrc)
 #else
-    if(!pXRenderSetPictureTransform && !repeat_src)
+    if(!pXRenderSetPictureTransform)
 #endif
     {
         FIXME("Unable to Stretch, XRenderSetPictureTransform is currently required\n");
@@ -1840,6 +1854,10 @@
         }
         return FALSE;
     }
+
+    /* If the source is a 1x1 bitmap, tiling is equivalent to stretching, but
+        tiling is much faster. Therefore, we do no stretching in this case. */
+    repeat_src = dib.dsBmih.biWidth == 1 && abs(dib.dsBmih.biHeight) == 1;
 
     if (xSrc < 0 || ySrc < 0 || widthSrc < 0 || heightSrc < 0 || xSrc + widthSrc > dib.dsBmih.biWidth
         || ySrc + heightSrc > abs(dib.dsBmih.biHeight))
@@ -1948,7 +1966,10 @@
     /* Make sure we ALWAYS set the transformation matrix even if we don't need to scale. The reason is
      * that later on we want to reuse pictures (it can bring a lot of extra performance) and each time
      * a different transformation matrix might have been used. */
-    set_xrender_transformation(src_pict, widthSrc/(double)widthDst, heightSrc/(double)heightDst, 0, 0);
+    if (repeat_src)
+        set_xrender_transformation(src_pict, 1.0, 1.0, 0, 0);
+    else
+        set_xrender_transformation(src_pict, widthSrc/(double)widthDst, heightSrc/(double)heightDst, 0, 0);
     pXRenderComposite(gdi_display, PictOpOver, src_pict, 0, dst_pict,
                       0, 0, 0, 0,
                       xDst + devDst->dc_rect.left, yDst + devDst->dc_rect.top, widthDst, heightDst);
@@ -1966,6 +1987,40 @@
     return TRUE;
 }
 
+void X11DRV_XRender_CopyBrush(X11DRV_PDEVICE *physDev, X_PHYSBITMAP *physBitmap, int width, int height)
+{
+    /* At depths >1, the depth of physBitmap and physDev might not be the same e.g. the physbitmap might be a 16-bit DIB while the physdev uses 24-bit */
+    int depth = physBitmap->pixmap_depth == 1 ? 1 : physDev->depth;
+
+    wine_tsx11_lock();
+    physDev->brush.pixmap = XCreatePixmap(gdi_display, root_window, width, height, depth);
+
+    /* Use XCopyArea when the physBitmap and brush.pixmap have the same depth. */
+    if(physBitmap->pixmap_depth == 1 || physDev->depth == physBitmap->pixmap_depth)
+    {
+        XCopyArea( gdi_display, physBitmap->pixmap, physDev->brush.pixmap,
+                   get_bitmap_gc(physBitmap->pixmap_depth), 0, 0, width, height, 0, 0 );
+    }
+    else /* We meed depth conversion */
+    {
+        WineXRenderFormat *src_format = get_xrender_format_from_color_shifts(physBitmap->pixmap_depth, &physBitmap->pixmap_color_shifts);
+        WineXRenderFormat *dst_format = get_xrender_format_from_color_shifts(physDev->depth, physDev->color_shifts);
+
+        Picture src_pict, dst_pict;
+        XRenderPictureAttributes pa;
+        pa.subwindow_mode = IncludeInferiors;
+        pa.repeat = RepeatNone;
+
+        src_pict = pXRenderCreatePicture(gdi_display, physBitmap->pixmap, src_format->pict_format, CPSubwindowMode|CPRepeat, &pa);
+        dst_pict = pXRenderCreatePicture(gdi_display, physDev->brush.pixmap, dst_format->pict_format, CPSubwindowMode|CPRepeat, &pa);
+
+        xrender_blit(src_pict, 0, dst_pict, 0, 0, 1.0, 1.0, width, height);
+        pXRenderFreePicture(gdi_display, src_pict);
+        pXRenderFreePicture(gdi_display, dst_pict);
+    }
+    wine_tsx11_unlock();
+}
+
 BOOL X11DRV_XRender_GetSrcAreaStretch(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDevDst,
                                       Pixmap pixmap, GC gc,
                                       INT widthSrc, INT heightSrc,
@@ -1977,8 +2032,8 @@
     int height = visRectDst->bottom - visRectDst->top;
     int x_src = physDevSrc->dc_rect.left + visRectSrc->left;
     int y_src = physDevSrc->dc_rect.top + visRectSrc->top;
-    WineXRenderFormat *src_format = get_xrender_format_from_pdevice(physDevSrc);
-    WineXRenderFormat *dst_format = get_xrender_format_from_pdevice(physDevDst);
+    WineXRenderFormat *src_format = get_xrender_format_from_color_shifts(physDevSrc->depth, physDevSrc->color_shifts);
+    WineXRenderFormat *dst_format = get_xrender_format_from_color_shifts(physDevDst->depth, physDevDst->color_shifts);
     Picture src_pict=0, dst_pict=0, mask_pict=0;
 
     double xscale = widthSrc/(double)widthDst;
@@ -2107,6 +2162,16 @@
   return FALSE;
 }
 
+void X11DRV_XRender_CopyBrush(X11DRV_PDEVICE *physDev, X_PHYSBITMAP *physBitmap, int width, int height)
+{
+    wine_tsx11_lock();
+    physDev->brush.pixmap = XCreatePixmap(gdi_display, root_window, width, height, physBitmap->pixmap_depth);
+
+    XCopyArea( gdi_display, physBitmap->pixmap, physDev->brush.pixmap,
+               get_bitmap_gc(physBitmap->pixmap_depth), 0, 0, width, height, 0, 0 );
+    wine_tsx11_unlock();
+}
+
 BOOL X11DRV_XRender_GetSrcAreaStretch(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDevDst,
                                       Pixmap pixmap, GC gc,
                                       INT widthSrc, INT heightSrc,

Modified: vendor/wine/dlls/winex11.drv/current/xvidmode.c
URL: http://svn.reactos.org/svn/reactos/vendor/wine/dlls/winex11.drv/current/xvidmode.c?rev=43149&r1=43148&r2=43149&view=diff
==============================================================================
--- vendor/wine/dlls/winex11.drv/current/xvidmode.c [iso-8859-1] (original)
+++ vendor/wine/dlls/winex11.drv/current/xvidmode.c [iso-8859-1] Fri Sep 25 20:32:41 2009
@@ -29,6 +29,9 @@
 
 #ifdef HAVE_X11_EXTENSIONS_XF86VMODE_H
 #include <X11/extensions/xf86vmode.h>
+#endif
+#ifdef HAVE_X11_EXTENSIONS_XF86VMPROTO_H
+#include <X11/extensions/xf86vmproto.h>
 #endif
 
 #include "xvidmode.h"




More information about the Ros-diffs mailing list