[ros-diffs] [fireball] 49760: - Sync up to Wine-1.3.7.

fireball at svn.reactos.org fireball at svn.reactos.org
Tue Nov 23 22:12:41 UTC 2010


Author: fireball
Date: Tue Nov 23 22:12:41 2010
New Revision: 49760

URL: http://svn.reactos.org/svn/reactos?rev=49760&view=rev
Log:
- Sync up to Wine-1.3.7.

Added:
    branches/arwinss/reactos/dll/win32/user32/resources/user32_He.rc
      - copied unchanged from r49721, vendor/wine/dlls/user32/current/resources/user32_He.rc
Modified:
    branches/arwinss/reactos/dll/win32/gdi32/   (props changed)
    branches/arwinss/reactos/dll/win32/gdi32/dc.c
    branches/arwinss/reactos/dll/win32/gdi32/dib.c
    branches/arwinss/reactos/dll/win32/gdi32/driver.c
    branches/arwinss/reactos/dll/win32/gdi32/enhmfdrv/init.c
    branches/arwinss/reactos/dll/win32/gdi32/font.c
    branches/arwinss/reactos/dll/win32/gdi32/gdi_private.h
    branches/arwinss/reactos/dll/win32/gdi32/icm.c
    branches/arwinss/reactos/dll/win32/gdi32/mapping.c
    branches/arwinss/reactos/dll/win32/gdi32/mfdrv/init.c
    branches/arwinss/reactos/dll/win32/gdi32/mfdrv/objects.c
    branches/arwinss/reactos/dll/win32/gdi32/opengl.c
    branches/arwinss/reactos/dll/win32/user32/   (props changed)
    branches/arwinss/reactos/dll/win32/user32/button.c
    branches/arwinss/reactos/dll/win32/user32/resources/user32_Sr.rc
    branches/arwinss/reactos/dll/win32/user32/win.c
    branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c
    branches/arwinss/reactos/dll/win32/winent.drv/winent.drv.spec
    branches/arwinss/reactos/dll/win32/winex11.drv/   (props changed)
    branches/arwinss/reactos/dll/win32/winex11.drv/brush.c
    branches/arwinss/reactos/dll/win32/winex11.drv/event.c
    branches/arwinss/reactos/dll/win32/winex11.drv/graphics.c
    branches/arwinss/reactos/dll/win32/winex11.drv/mouse.c
    branches/arwinss/reactos/dll/win32/winex11.drv/opengl.c
    branches/arwinss/reactos/dll/win32/winex11.drv/palette.c
    branches/arwinss/reactos/dll/win32/winex11.drv/systray.c
    branches/arwinss/reactos/dll/win32/winex11.drv/window.c
    branches/arwinss/reactos/dll/win32/winex11.drv/winex11.drv.spec
    branches/arwinss/reactos/dll/win32/winex11.drv/x11drv.h
    branches/arwinss/reactos/dll/win32/winex11.drv/x11drv_main.c
    branches/arwinss/reactos/subsystems/win32/win32k/wine/   (props changed)
    branches/arwinss/reactos/subsystems/win32/win32k/wine/window.c   (contents, props changed)

Propchange: branches/arwinss/reactos/dll/win32/gdi32/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 23 22:12:41 2010
@@ -1,3 +1,3 @@
 /branches/ros-amd64-bringup/reactos/dll/win32/gdi32:35746,35789,36614,36930,38148,38151,38265,38268,39333,39345,40991,41000,41027-41028,41050,41052,41082-41086,41549,43080
 /trunk/reactos/dll/win32/gdi32:42000-44999,45011,45097-45099,45319,45418-45419,45535-45539,45687-45688,47605,48678
-/vendor/wine/dlls/gdi32/current:43136,43149,43398,43708,44151,44715,45044,45206,45455,45646,45910,46314,46696,46915,47274,47321,47585,47798,47861,48418,48677,49173
+/vendor/wine/dlls/gdi32/current:43136,43149,43398,43708,44151,44715,45044,45206,45455,45646,45910,46314,46696,46915,47274,47321,47585,47798,47861,48418,48677,49173,49721

Modified: branches/arwinss/reactos/dll/win32/gdi32/dc.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32/dc.c?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/gdi32/dc.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/gdi32/dc.c [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -30,7 +30,6 @@
 #include "winreg.h"
 #include "winternl.h"
 #include "winerror.h"
-#include "wownt32.h"
 #include "gdi_private.h"
 #include "wine/unicode.h"
 #include "wine/debug.h"

Modified: branches/arwinss/reactos/dll/win32/gdi32/dib.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32/dib.c?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/gdi32/dib.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/gdi32/dib.c [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -66,7 +66,6 @@
 
 #include "windef.h"
 #include "winbase.h"
-#include "wownt32.h"
 #include "gdi_private.h"
 #include "wine/debug.h"
 

Modified: branches/arwinss/reactos/dll/win32/gdi32/driver.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32/driver.c?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/gdi32/driver.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/gdi32/driver.c [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -96,6 +96,7 @@
         GET_FUNC(EndPage);
         GET_FUNC(EndPath);
         GET_FUNC(EnumDeviceFonts);
+        GET_FUNC(EnumICMProfiles);
         GET_FUNC(ExcludeClipRect);
         GET_FUNC(ExtDeviceMode);
         GET_FUNC(ExtEscape);

Modified: branches/arwinss/reactos/dll/win32/gdi32/enhmfdrv/init.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32/enhmfdrv/init.c?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/gdi32/enhmfdrv/init.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/gdi32/enhmfdrv/init.c [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -58,6 +58,7 @@
     NULL,                            /* pEndPage */
     EMFDRV_EndPath,                  /* pEndPath */
     NULL,                            /* pEnumDeviceFonts */
+    NULL,                            /* pEnumICMProfiles */
     EMFDRV_ExcludeClipRect,          /* pExcludeClipRect */
     NULL,                            /* pExtDeviceMode */
     NULL,                            /* pExtEscape */

Modified: branches/arwinss/reactos/dll/win32/gdi32/font.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32/font.c?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/gdi32/font.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/gdi32/font.c [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -31,7 +31,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "winnls.h"
-#include "wownt32.h"
 #include "gdi_private.h"
 #include "wine/exception.h"
 #include "wine/unicode.h"

Modified: branches/arwinss/reactos/dll/win32/gdi32/gdi_private.h
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32/gdi_private.h?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/gdi32/gdi_private.h [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/gdi32/gdi_private.h [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -99,6 +99,7 @@
     INT      (CDECL *pEndDoc)(PHYSDEV);
     INT      (CDECL *pEndPage)(PHYSDEV);
     BOOL     (CDECL *pEndPath)(PHYSDEV);
+    INT      (CDECL *pEnumICMProfiles)(PHYSDEV,ICMENUMPROCW,LPARAM);
     BOOL     (CDECL *pEnumDeviceFonts)(PHYSDEV,LPLOGFONTW,FONTENUMPROCW,LPARAM);
     INT      (CDECL *pExcludeClipRect)(PHYSDEV,INT,INT,INT,INT);
     INT      (CDECL *pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD);

Modified: branches/arwinss/reactos/dll/win32/gdi32/icm.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32/icm.c?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/gdi32/icm.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/gdi32/icm.c [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -38,13 +38,62 @@
 WINE_DEFAULT_DEBUG_CHANNEL(icm);
 
 
+struct enum_profiles
+{
+    BOOL unicode;
+    union
+    {
+        ICMENUMPROCA funcA;
+        ICMENUMPROCW funcW;
+    } callback;
+    LPARAM data;
+};
+
+INT CALLBACK enum_profiles_callback( LPWSTR filename, LPARAM lparam )
+{
+    int len, ret = -1;
+    struct enum_profiles *ep = (struct enum_profiles *)lparam;
+    char *filenameA;
+
+    if (ep->unicode)
+        return ep->callback.funcW( filename, ep->data );
+
+    len = WideCharToMultiByte( CP_ACP, 0, filename, -1, NULL, 0, NULL, NULL );
+    filenameA = HeapAlloc( GetProcessHeap(), 0, len );
+    if (filenameA)
+    {
+        WideCharToMultiByte( CP_ACP, 0, filename, -1, filenameA, len, NULL, NULL );
+        ret = ep->callback.funcA( filenameA, ep->data );
+        HeapFree( GetProcessHeap(), 0, filenameA );
+    }
+    return ret;
+}
+
 /***********************************************************************
  *           EnumICMProfilesA    (GDI32.@)
  */
 INT WINAPI EnumICMProfilesA(HDC hdc, ICMENUMPROCA func, LPARAM lparam)
 {
-	FIXME("%p, %p, 0x%08lx stub\n", hdc, func, lparam);
-	return -1;
+    DC *dc;
+    INT ret = -1;
+
+    TRACE("%p, %p, 0x%08lx\n", hdc, func, lparam);
+
+    if (!func) return -1;
+    if ((dc = get_dc_ptr(hdc)))
+    {
+        if (dc->funcs->pEnumICMProfiles)
+        {
+            struct enum_profiles ep;
+
+            ep.unicode        = FALSE;
+            ep.callback.funcA = func;
+            ep.data           = lparam;
+            ret = dc->funcs->pEnumICMProfiles(dc->physDev, enum_profiles_callback, (LPARAM)&ep);
+        }
+        release_dc_ptr(dc);
+    }
+    return ret;
 }
 
 /***********************************************************************
@@ -52,8 +101,26 @@
  */
 INT WINAPI EnumICMProfilesW(HDC hdc, ICMENUMPROCW func, LPARAM lparam)
 {
-	FIXME("%p, %p, 0x%08lx stub\n", hdc, func, lparam);
-	return -1;
+    DC *dc;
+    INT ret = -1;
+
+    TRACE("%p, %p, 0x%08lx\n", hdc, func, lparam);
+
+    if (!func) return -1;
+    if ((dc = get_dc_ptr(hdc)))
+    {
+        if (dc->funcs->pEnumICMProfiles)
+        {
+            struct enum_profiles ep;
+
+            ep.unicode        = TRUE;
+            ep.callback.funcW = func;
+            ep.data           = lparam;
+            ret = dc->funcs->pEnumICMProfiles(dc->physDev, enum_profiles_callback, (LPARAM)&ep);
+        }
+        release_dc_ptr(dc);
+    }
+    return ret;
 }
 
 /**********************************************************************
@@ -137,6 +204,17 @@
 BOOL WINAPI SetICMProfileA(HDC hdc, LPSTR filename)
 {
     FIXME("%p %s stub\n", hdc, debugstr_a(filename));
+
+    if (!filename)
+    {
+        SetLastError( ERROR_INVALID_PARAMETER );
+        return FALSE;
+    }
+    if (!hdc)
+    {
+        SetLastError( ERROR_INVALID_HANDLE );
+        return FALSE;
+    }
     return TRUE;
 }
 
@@ -146,6 +224,17 @@
 BOOL WINAPI SetICMProfileW(HDC hdc, LPWSTR filename)
 {
     FIXME("%p %s stub\n", hdc, debugstr_w(filename));
+
+    if (!filename)
+    {
+        SetLastError( ERROR_INVALID_PARAMETER );
+        return FALSE;
+    }
+    if (!hdc)
+    {
+        SetLastError( ERROR_INVALID_HANDLE );
+        return FALSE;
+    }
     return TRUE;
 }
 

Modified: branches/arwinss/reactos/dll/win32/gdi32/mapping.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32/mapping.c?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/gdi32/mapping.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/gdi32/mapping.c [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -23,7 +23,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "wingdi.h"
-#include "wownt32.h"
 #include "gdi_private.h"
 #include "wine/debug.h"
 

Modified: branches/arwinss/reactos/dll/win32/gdi32/mfdrv/init.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32/mfdrv/init.c?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/gdi32/mfdrv/init.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/gdi32/mfdrv/init.c [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -56,6 +56,7 @@
     NULL,                            /* pEndPage */
     MFDRV_EndPath,                   /* pEndPath */
     NULL,                            /* pEnumDeviceFonts */
+    NULL,                            /* pEnumICMProfiles */
     MFDRV_ExcludeClipRect,           /* pExcludeClipRect */
     NULL,                            /* pExtDeviceMode */
     MFDRV_ExtEscape,                 /* pExtEscape */

Modified: branches/arwinss/reactos/dll/win32/gdi32/mfdrv/objects.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32/mfdrv/objects.c?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/gdi32/mfdrv/objects.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/gdi32/mfdrv/objects.c [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -26,7 +26,6 @@
 #include "windef.h"
 #include "winbase.h"
 #include "wingdi.h"
-#include "wownt32.h"
 #include "wine/wingdi16.h"
 #include "mfdrv/metafiledrv.h"
 #include "gdi_private.h"

Modified: branches/arwinss/reactos/dll/win32/gdi32/opengl.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/gdi32/opengl.c?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/gdi32/opengl.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/gdi32/opengl.c [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -135,11 +135,18 @@
 
     TRACE("hglrc: (%p)\n", hglrc);
     if(ctx == NULL)
-        return FALSE;
+    {
+        SetLastError(ERROR_INVALID_HANDLE);
+        return FALSE;
+    }
 
     /* Retrieve the HDC associated with the context to access the display driver */
     dc = get_dc_ptr(ctx->hdc);
-    if (!dc) return FALSE;
+    if (!dc)
+    {
+        SetLastError(ERROR_INVALID_HANDLE);
+        return FALSE;
+    }
 
     if (!dc->funcs->pwglDeleteContext) FIXME(" :stub\n");
     else ret = dc->funcs->pwglDeleteContext(hglrc);

Propchange: branches/arwinss/reactos/dll/win32/user32/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 23 22:12:41 2010
@@ -1,3 +1,3 @@
 /branches/ros-amd64-bringup/reactos/dll/win32/user32:35746,35789,36614,36930,38148,38151,38265,38268,39333,39345,40991,41000,41027-41028,41050,41052,41082-41086,41549,43080
 /trunk/reactos/dll/win32/user32:42000-44999,45011,45097-45099,45319,45418-45419,45535-45539,45687-45688,47605,48678
-/vendor/wine/dlls/user32/current:43136,43149,43398,43708,44151,44715,45044,45206,45455,45646,45910,46314,46696,46915,47274,47321,47585,47798,47861,48147,48418,48677,49173
+/vendor/wine/dlls/user32/current:43136,43149,43398,43708,44151,44715,45044,45206,45455,45646,45910,46314,46696,46915,47274,47321,47585,47798,47861,48147,48418,48677,49173,49721

Modified: branches/arwinss/reactos/dll/win32/user32/button.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user32/button.c?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/user32/button.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/user32/button.c [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -113,7 +113,7 @@
 static void OB_Paint( HWND hwnd, HDC hDC, UINT action );
 static void BUTTON_CheckAutoRadioButton( HWND hwnd );
 
-#define MAX_BTN_TYPE  12
+#define MAX_BTN_TYPE  16
 
 static const WORD maxCheckState[MAX_BTN_TYPE] =
 {
@@ -127,7 +127,7 @@
     BUTTON_UNCHECKED,   /* BS_GROUPBOX */
     BUTTON_UNCHECKED,   /* BS_USERBUTTON */
     BUTTON_CHECKED,     /* BS_AUTORADIOBUTTON */
-    BUTTON_UNCHECKED,   /* Not defined */
+    BUTTON_UNCHECKED,   /* BS_PUSHBOX */
     BUTTON_UNCHECKED    /* BS_OWNERDRAW */
 };
 
@@ -145,7 +145,7 @@
     GB_Paint,    /* BS_GROUPBOX */
     UB_Paint,    /* BS_USERBUTTON */
     CB_Paint,    /* BS_AUTORADIOBUTTON */
-    NULL,        /* Not defined */
+    NULL,        /* BS_PUSHBOX */
     OB_Paint     /* BS_OWNERDRAW */
 };
 

Modified: branches/arwinss/reactos/dll/win32/user32/resources/user32_Sr.rc
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user32/resources/user32_Sr.rc?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/user32/resources/user32_Sr.rc [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/user32/resources/user32_Sr.rc [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -1,6 +1,7 @@
 /*
  * Copyright 2010 Nenad Vujic
  *                Paul Vriens
+ * Copyright 2010 Đorđe Vasiljević
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -25,29 +26,29 @@
 
 SYSMENU MENU
 {
-    MENUITEM "&Obnovi", 61728
-    MENUITEM "&Pomeri", 61456
+    MENUITEM "&Povrati", 61728
+    MENUITEM "Pr&emesti", 61456
     MENUITEM "&Veličina", 61440
-    MENUITEM "&Smanji", 61472
-    MENUITEM "&Ceo ekran", 61488
+    MENUITEM "&Umanji", 61472
+    MENUITEM "U&većaj", 61488
     MENUITEM SEPARATOR
     MENUITEM "&Zatvori\tAlt-F4", 61536
     MENUITEM SEPARATOR
-    MENUITEM "O &Wine...", 61761
+    MENUITEM "&O Wine-u...", 61761
 }
 
 EDITMENU MENU
 {
     POPUP ""
     BEGIN
-        MENUITEM "&Opozovi", EM_UNDO
+        MENUITEM "&Opozivi", EM_UNDO
         MENUITEM SEPARATOR
-        MENUITEM "Ise&ci", WM_CUT
-        MENUITEM "&Kopiraj", WM_COPY
+        MENUITEM "&Iseci", WM_CUT
+        MENUITEM "&Umnoži", WM_COPY
         MENUITEM "&Ubaci", WM_PASTE
-        MENUITEM "O&briši", WM_CLEAR
+        MENUITEM "Iz&briši", WM_CLEAR
         MENUITEM SEPARATOR
-        MENUITEM "Izaberi &Sve", EM_SETSEL
+        MENUITEM "Izaberi &sve", EM_SETSEL
     END
 }
 
@@ -56,62 +57,61 @@
 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
-    PUSHBUTTON "&OK", 1, 16, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
-    PUSHBUTTON "O&tkaži", 2, 64, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+    PUSHBUTTON "&U redu", 1, 16, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+    PUSHBUTTON "&Otkaži", 2, 64, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
     PUSHBUTTON "&Prekini", 3, 112, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
-    PUSHBUTTON "Po&kusaj ponovo", 4, 160, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
-    PUSHBUTTON "&Ignoriši", 5, 208, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+    PUSHBUTTON "Pokušaj &ponovo", 4, 160, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+    PUSHBUTTON "&Zanemari", 5, 208, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
     PUSHBUTTON "&Da", 6, 256, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
     PUSHBUTTON "&Ne", 7, 304, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
-    PUSHBUTTON "&Probaj ponovo", 10, 352, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+    PUSHBUTTON "Pok&ušaj ponovo", 10, 352, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
     PUSHBUTTON "&Nastavi", 11, 400, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
     PUSHBUTTON "Pomoć", 9, 448, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
 END
 
 MDI_MOREWINDOWS DIALOG 20, 20, 232, 122
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Izaberi prozor"
+CAPTION "Izbor"
 FONT 8, "MS Shell Dlg"
 BEGIN
     LISTBOX         MDI_IDC_LISTBOX, 5, 7, 222, 90, WS_VSCROLL | WS_HSCROLL /* defined in mdi.h */
-    DEFPUSHBUTTON   "OK", IDOK, 75, 100, 35, 14
+    DEFPUSHBUTTON   "U redu", IDOK, 75, 100, 35, 14
     PUSHBUTTON      "Otkaži", IDCANCEL, 120, 100, 35, 14
 END
-
 
 STRINGTABLE
 {
     IDS_ERROR "Greška"
-    IDS_MDI_MOREWINDOWS "&Vise Prozora..."
+    IDS_MDI_MOREWINDOWS "&Više prozora..."
 }
 
 LANGUAGE LANG_SERBIAN, SUBLANG_SERBIAN_CYRILLIC
 
 SYSMENU MENU
 {
-    MENUITEM "&Обнови", 61728
-    MENUITEM "&Помери", 61456
+    MENUITEM "&Поврати", 61728
+    MENUITEM "Пр&емести", 61456
     MENUITEM "&Величина", 61440
-    MENUITEM "С&мањи", 61472
-    MENUITEM "Цео &екран", 61488
+    MENUITEM "&Умањи", 61472
+    MENUITEM "У&већај", 61488
     MENUITEM SEPARATOR
     MENUITEM "&Затвори\tAlt-F4", 61536
     MENUITEM SEPARATOR
-    MENUITEM "&O Wine...", 61761
+    MENUITEM "&О Wine-у...", 61761
 }
 
 EDITMENU MENU
 {
     POPUP ""
     BEGIN
-        MENUITEM "&Опозови", EM_UNDO
+        MENUITEM "&Опозиви", EM_UNDO
         MENUITEM SEPARATOR
-        MENUITEM "Исе&ци", WM_CUT
-        MENUITEM "&Копирај", WM_COPY
+        MENUITEM "&Исеци", WM_CUT
+        MENUITEM "&Умножи", WM_COPY
         MENUITEM "&Убаци", WM_PASTE
-        MENUITEM "&Обриши", WM_CLEAR
+        MENUITEM "Из&бриши", WM_CLEAR
         MENUITEM SEPARATOR
-        MENUITEM "Изабери &Све", EM_SETSEL
+        MENUITEM "Изабери &све", EM_SETSEL
     END
 }
 
@@ -120,25 +120,25 @@
 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
-    PUSHBUTTON "&ОK", 1, 16, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+    PUSHBUTTON "&У реду", 1, 16, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
     PUSHBUTTON "&Откажи", 2, 64, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
     PUSHBUTTON "&Прекини", 3, 112, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
-    PUSHBUTTON "&Покушај поново", 4, 160, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
-    PUSHBUTTON "&Игнриши", 5, 208, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+    PUSHBUTTON "Покушај &поново", 4, 160, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+    PUSHBUTTON "&Занемари", 5, 208, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
     PUSHBUTTON "&Да", 6, 256, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
     PUSHBUTTON "&Не", 7, 304, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
-    PUSHBUTTON "&Пробај поново", 10, 352, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+    PUSHBUTTON "Пок&ушај поново", 10, 352, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
     PUSHBUTTON "&Настави", 11, 400, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
     PUSHBUTTON "Помоћ", 9, 448, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
 END
 
 MDI_MOREWINDOWS DIALOG 20, 20, 232, 122
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Изабери прозор"
+CAPTION "Избор"
 FONT 8, "MS Shell Dlg"
 BEGIN
     LISTBOX         MDI_IDC_LISTBOX, 5, 7, 222, 90, WS_VSCROLL | WS_HSCROLL /* defined in mdi.h */
-    DEFPUSHBUTTON   "ОK", IDOK, 75, 100, 35, 14
+    DEFPUSHBUTTON   "У реду", IDOK, 75, 100, 35, 14
     PUSHBUTTON      "Откажи", IDCANCEL, 120, 100, 35, 14
 END
 

Modified: branches/arwinss/reactos/dll/win32/user32/win.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/user32/win.c?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/user32/win.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/user32/win.c [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -1768,7 +1768,14 @@
     {
         while (list[i])
         {
-            if (GetWindowTextW( list[i], buffer, len + 1 ) && !strcmpiW( buffer, title )) break;
+            if (GetWindowTextW( list[i], buffer, len + 1 ))
+            {
+                if (!strcmpiW( buffer, title )) break;
+            }
+            else
+            {
+                if (!title[0]) break;
+            }
             i++;
         }
     }

Modified: branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winent.drv/gdidrv.c [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -420,6 +420,12 @@
 {
     UNIMPLEMENTED;
     return FALSE;
+}
+
+INT CDECL RosDrv_EnumICMProfiles( NTDRV_PDEVICE *physDev, ICMENUMPROCW proc, LPARAM lparam )
+{
+    UNIMPLEMENTED;
+    return 0;
 }
 
 COLORREF CDECL RosDrv_GetNearestColor( NTDRV_PDEVICE *physDev, COLORREF color )

Modified: branches/arwinss/reactos/dll/win32/winent.drv/winent.drv.spec
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winent.drv/winent.drv.spec?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/winent.drv/winent.drv.spec [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winent.drv/winent.drv.spec [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -12,6 +12,7 @@
 @ cdecl DeleteDC(ptr) RosDrv_DeleteDC
 @ cdecl DescribePixelFormat(ptr long long ptr) RosDrv_DescribePixelFormat
 @ cdecl Ellipse(ptr long long long long) RosDrv_Ellipse
+@ cdecl EnumICMProfiles(ptr ptr long) RosDrv_EnumICMProfiles
 @ cdecl EnumDeviceFonts(ptr ptr ptr long) RosDrv_EnumDeviceFonts
 @ cdecl ExtEscape(ptr long long ptr long ptr) RosDrv_ExtEscape
 @ cdecl ExtFloodFill(ptr long long long long) RosDrv_ExtFloodFill

Propchange: branches/arwinss/reactos/dll/win32/winex11.drv/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 23 22:12:41 2010
@@ -1,3 +1,3 @@
 /branches/ros-amd64-bringup/reactos/dll/win32/winex11.drv:35746,35789,36614,36930,38148,38151,38265,38268,39333,39345,40991,41000,41027-41028,41050,41052,41082-41086,41549,43080
 /trunk/reactos/dll/win32/winex11.drv:42000-44999,45011,45097-45099,45319,45418-45419,45535-45539,45687-45688,47605,48678
-/vendor/wine/dlls/winex11.drv/current:43149,43398,43708,44151,44715,45044,45206,45455,45646,45910,46314,46915,47274,47321,47798,47861,48147,48418,48677,49173
+/vendor/wine/dlls/winex11.drv/current:43149,43398,43708,44151,44715,45044,45206,45455,45646,45910,46314,46915,47274,47321,47798,47861,48147,48418,48677,49173,49721

Modified: branches/arwinss/reactos/dll/win32/winex11.drv/brush.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex11.drv/brush.c?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/winex11.drv/brush.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winex11.drv/brush.c [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -183,17 +183,18 @@
  */
 static void BRUSH_SelectSolidBrush( X11DRV_PDEVICE *physDev, COLORREF color )
 {
+    COLORREF colorRGB = X11DRV_PALETTE_GetColor( physDev, color );
     if ((physDev->depth > 1) && (screen_depth <= 8) && !X11DRV_IsSolidColor( color ))
     {
 	  /* Dithered brush */
-	physDev->brush.pixmap = BRUSH_DitherColor( color, physDev->depth );
+	physDev->brush.pixmap = BRUSH_DitherColor( colorRGB, physDev->depth );
 	physDev->brush.fillStyle = FillTiled;
 	physDev->brush.pixel = 0;
     }
-    else if (physDev->depth == 1 && color != WHITE && color != BLACK)
+    else if (physDev->depth == 1 && colorRGB != WHITE && colorRGB != BLACK)
     {
 	physDev->brush.pixel = 0;
-	physDev->brush.pixmap = BRUSH_DitherMono( color );
+	physDev->brush.pixmap = BRUSH_DitherMono( colorRGB );
 	physDev->brush.fillStyle = FillTiled;
     }
     else

Modified: branches/arwinss/reactos/dll/win32/winex11.drv/event.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex11.drv/event.c?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/winex11.drv/event.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winex11.drv/event.c [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -73,14 +73,30 @@
 
 #define DndURL          128   /* KDE drag&drop */
 
+#define XEMBED_EMBEDDED_NOTIFY        0
+#define XEMBED_WINDOW_ACTIVATE        1
+#define XEMBED_WINDOW_DEACTIVATE      2
+#define XEMBED_REQUEST_FOCUS          3
+#define XEMBED_FOCUS_IN               4
+#define XEMBED_FOCUS_OUT              5
+#define XEMBED_FOCUS_NEXT             6
+#define XEMBED_FOCUS_PREV             7
+#define XEMBED_MODALITY_ON            10
+#define XEMBED_MODALITY_OFF           11
+#define XEMBED_REGISTER_ACCELERATOR   12
+#define XEMBED_UNREGISTER_ACCELERATOR 13
+#define XEMBED_ACTIVATE_ACCELERATOR   14
+
   /* Event handlers */
 static void X11DRV_FocusIn( HWND hwnd, XEvent *event );
 static void X11DRV_FocusOut( HWND hwnd, XEvent *event );
 static void X11DRV_Expose( HWND hwnd, XEvent *event );
 static void X11DRV_MapNotify( HWND hwnd, XEvent *event );
+static void X11DRV_ReparentNotify( HWND hwnd, XEvent *event );
 static void X11DRV_ConfigureNotify( HWND hwnd, XEvent *event );
 static void X11DRV_PropertyNotify( HWND hwnd, XEvent *event );
 static void X11DRV_ClientMessage( HWND hwnd, XEvent *event );
+static void X11DRV_GravityNotify( HWND hwnd, XEvent *event );
 
 struct event_handler
 {
@@ -112,10 +128,10 @@
     /* UnmapNotify */
     { MapNotify,        X11DRV_MapNotify },
     /* MapRequest */
-    /* ReparentNotify */
+    { ReparentNotify,   X11DRV_ReparentNotify },
     { ConfigureNotify,  X11DRV_ConfigureNotify },
     /* ConfigureRequest */
-    /* GravityNotify */
+    { GravityNotify,    X11DRV_GravityNotify },
     /* ResizeRequest */
     /* CirculateNotify */
     /* CirculateRequest */
@@ -128,7 +144,7 @@
     { MappingNotify,    X11DRV_MappingNotify },
 };
 
-static int nb_event_handlers = 18;  /* change this if you add handlers above */
+static int nb_event_handlers = 20;  /* change this if you add handlers above */
 
 
 /* return the name of an X event */
@@ -495,6 +511,17 @@
         XSetInputFocus( display, win, RevertToParent, time );
         wine_tsx11_unlock();
     }
+}
+
+
+/**********************************************************************
+ *              handle_manager_message
+ */
+static void handle_manager_message( HWND hwnd, XClientMessageEvent *event )
+{
+    if (hwnd != GetDesktopWindow()) return;
+    if (systray_atom && event->data.l[1] == systray_atom)
+        change_systray_owner( event->display, event->data.l[2] );
 }
 
 
@@ -774,7 +801,7 @@
     struct x11drv_win_data *data;
 
     if (!(data = X11DRV_get_win_data( hwnd ))) return;
-    if (!data->mapped) return;
+    if (!data->mapped || data->embedded) return;
 
     if (!data->managed)
     {
@@ -792,6 +819,8 @@
     Atom type, *state;
     int format, ret = 0;
     unsigned long i, count, remaining;
+
+    if (!data->whole_window) return FALSE;
 
     wine_tsx11_lock();
     if (!XGetWindowProperty( display, data->whole_window, x11drv_atom(_NET_WM_STATE), 0,
@@ -815,6 +844,57 @@
 
 
 /***********************************************************************
+ *           X11DRV_ReparentNotify
+ */
+static void X11DRV_ReparentNotify( HWND hwnd, XEvent *xev )
+{
+    XReparentEvent *event = &xev->xreparent;
+    struct x11drv_win_data *data;
+    HWND parent, old_parent;
+    DWORD style;
+
+    if (!(data = X11DRV_get_win_data( hwnd ))) return;
+    if (!data->embedded) return;
+
+    if (data->whole_window)
+    {
+        if (event->parent == root_window)
+        {
+            TRACE( "%p/%lx reparented to root\n", hwnd, data->whole_window );
+            data->embedder = 0;
+            SendMessageW( hwnd, WM_CLOSE, 0, 0 );
+            return;
+        }
+        data->embedder = event->parent;
+    }
+
+    TRACE( "%p/%lx reparented to %lx\n", hwnd, data->whole_window, event->parent );
+
+    style = GetWindowLongW( hwnd, GWL_STYLE );
+    if (event->parent == root_window)
+    {
+        parent = GetDesktopWindow();
+        style = (style & ~WS_CHILD) | WS_POPUP;
+    }
+    else
+    {
+        if (!(parent = create_foreign_window( event->display, event->parent ))) return;
+        style = (style & ~WS_POPUP) | WS_CHILD;
+    }
+
+    ShowWindow( hwnd, SW_HIDE );
+    old_parent = SetParent( hwnd, parent );
+    SetWindowLongW( hwnd, GWL_STYLE, style );
+    SetWindowPos( hwnd, HWND_TOP, event->x, event->y, 0, 0,
+                  SWP_NOACTIVATE | SWP_NOSIZE | SWP_NOCOPYBITS |
+                  ((style & WS_VISIBLE) ? SWP_SHOWWINDOW : 0) );
+
+    /* make old parent destroy itself if it no longer has children */
+    if (old_parent != GetDesktopWindow()) PostMessageW( old_parent, WM_CLOSE, 0, 0 );
+}
+
+
+/***********************************************************************
  *		X11DRV_ConfigureNotify
  */
 void X11DRV_ConfigureNotify( HWND hwnd, XEvent *xev )
@@ -823,11 +903,16 @@
     struct x11drv_win_data *data;
     RECT rect;
     UINT flags;
+    HWND parent;
+    BOOL root_coords;
     int cx, cy, x = event->x, y = event->y;
 
     if (!hwnd) return;
     if (!(data = X11DRV_get_win_data( hwnd ))) return;
-    if (!data->mapped || data->iconic || !data->managed) return;
+    if (!data->mapped || data->iconic) return;
+    if (data->whole_window && !data->managed) return;
+    /* ignore synthetic events on foreign windows */
+    if (event->send_event && !data->whole_window) return;
     if (data->configure_serial && (long)(data->configure_serial - event->serial) > 0)
     {
         TRACE( "win %p/%lx event %d,%d,%dx%d ignoring old serial %lu/%lu\n",
@@ -838,23 +923,26 @@
 
     /* Get geometry */
 
-    if (!event->send_event)  /* normal event, need to map coordinates to the root */
+    parent = GetAncestor( hwnd, GA_PARENT );
+    root_coords = event->send_event;  /* synthetic events are always in root coords */
+
+    if (!root_coords && parent == GetDesktopWindow()) /* normal event, map coordinates to the root */
     {
         Window child;
         wine_tsx11_lock();
-        XTranslateCoordinates( event->display, data->whole_window, root_window,
+        XTranslateCoordinates( event->display, event->window, root_window,
                                0, 0, &x, &y, &child );
         wine_tsx11_unlock();
+        root_coords = TRUE;
     }
     rect.left   = x;
     rect.top    = y;
     rect.right  = x + event->width;
     rect.bottom = y + event->height;
-    OffsetRect( &rect, virtual_screen_rect.left, virtual_screen_rect.top );
+    if (root_coords) OffsetRect( &rect, virtual_screen_rect.left, virtual_screen_rect.top );
     TRACE( "win %p/%lx new X rect %d,%d,%dx%d (event %d,%d,%dx%d)\n",
            hwnd, data->whole_window, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top,
            event->x, event->y, event->width, event->height );
-    X11DRV_X_to_window_rect( data, &rect );
 
     if (is_net_wm_state_maximized( event->display, data ))
     {
@@ -874,6 +962,9 @@
             return;
         }
     }
+
+    X11DRV_X_to_window_rect( data, &rect );
+    if (root_coords) MapWindowPoints( 0, parent, (POINT *)&rect, 2 );
 
     /* Compare what has changed */
 
@@ -883,6 +974,8 @@
     cy    = rect.bottom - rect.top;
     flags = SWP_NOACTIVATE | SWP_NOZORDER;
 
+    if (!data->whole_window) flags |= SWP_NOCOPYBITS;  /* we can't copy bits of foreign windows */
+
     if (data->window_rect.left == x && data->window_rect.top == y) flags |= SWP_NOMOVE;
     else
         TRACE( "%p moving from (%d,%d) to (%d,%d)\n",
@@ -901,6 +994,34 @@
                data->window_rect.bottom - data->window_rect.top, cx, cy );
 
     SetWindowPos( hwnd, 0, x, y, cx, cy, flags );
+}
+
+
+/**********************************************************************
+ *           X11DRV_GravityNotify
+ */
+static void X11DRV_GravityNotify( HWND hwnd, XEvent *xev )
+{
+    XGravityEvent *event = &xev->xgravity;
+    struct x11drv_win_data *data = X11DRV_get_win_data( hwnd );
+    RECT rect;
+
+    if (!data || data->whole_window) return;  /* only handle this for foreign windows */
+
+    rect.left   = event->x;
+    rect.top    = event->y;
+    rect.right  = rect.left + data->whole_rect.right - data->whole_rect.left;
+    rect.bottom = rect.top + data->whole_rect.bottom - data->whole_rect.top;
+
+    TRACE( "win %p/%lx new X rect %d,%d,%dx%d (event %d,%d)\n",
+           hwnd, data->whole_window, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top,
+           event->x, event->y );
+
+    X11DRV_X_to_window_rect( data, &rect );
+
+    if (data->window_rect.left != rect.left || data ->window_rect.top != rect.top)
+        SetWindowPos( hwnd, 0, rect.left, rect.top, 0, 0,
+                      SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_NOCOPYBITS );
 }
 
 
@@ -1335,6 +1456,30 @@
   }
 }
 
+
+/**********************************************************************
+ *              handle_xembed_protocol
+ */
+static void handle_xembed_protocol( HWND hwnd, XClientMessageEvent *event )
+{
+    struct x11drv_win_data *data = X11DRV_get_win_data( hwnd );
+
+    if (!data) return;
+
+    switch (event->data.l[1])
+    {
+    case XEMBED_EMBEDDED_NOTIFY:
+        TRACE( "win %p/%lx XEMBED_EMBEDDED_NOTIFY owner %lx\n", hwnd, event->window, event->data.l[3] );
+        data->embedder = event->data.l[3];
+        break;
+    default:
+        TRACE( "win %p/%lx XEMBED message %lu(%lu)\n",
+               hwnd, event->window, event->data.l[1], event->data.l[2] );
+        break;
+    }
+}
+
+
 /**********************************************************************
  *              handle_dnd_protocol
  */
@@ -1366,7 +1511,9 @@
 
 static const struct client_message_handler client_messages[] =
 {
+    { XATOM_MANAGER,      handle_manager_message },
     { XATOM_WM_PROTOCOLS, handle_wm_protocols },
+    { XATOM__XEMBED,      handle_xembed_protocol },
     { XATOM_DndProtocol,  handle_dnd_protocol },
     { XATOM_XdndEnter,    X11DRV_XDND_EnterEvent },
     { XATOM_XdndPosition, X11DRV_XDND_PositionEvent },
@@ -1415,7 +1562,7 @@
         switch(inputs->type)
         {
         case INPUT_MOUSE:
-            X11DRV_send_mouse_input( 0, inputs->u.mi.dwFlags, inputs->u.mi.dx, inputs->u.mi.dy,
+            X11DRV_send_mouse_input( 0, 0, inputs->u.mi.dwFlags, inputs->u.mi.dx, inputs->u.mi.dy,
                                      inputs->u.mi.mouseData, inputs->u.mi.time,
                                      inputs->u.mi.dwExtraInfo, LLMHF_INJECTED );
             break;

Modified: branches/arwinss/reactos/dll/win32/winex11.drv/graphics.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex11.drv/graphics.c?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/winex11.drv/graphics.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winex11.drv/graphics.c [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -1508,35 +1508,35 @@
 extern void WINAPI A_SHAUpdate( sha_ctx *, const unsigned char *, unsigned int );
 extern void WINAPI A_SHAFinal( sha_ctx *, unsigned char * );
 
+static const WCHAR mntr_key[] =
+    {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
+     'W','i','n','d','o','w','s',' ','N','T','\\','C','u','r','r','e','n','t',
+     'V','e','r','s','i','o','n','\\','I','C','M','\\','m','n','t','r',0};
+
+static const WCHAR color_path[] =
+    {'\\','s','p','o','o','l','\\','d','r','i','v','e','r','s','\\','c','o','l','o','r','\\',0};
+
 /***********************************************************************
  *              GetICMProfile (X11DRV.@)
  */
 BOOL CDECL X11DRV_GetICMProfile( X11DRV_PDEVICE *physDev, LPDWORD size, LPWSTR filename )
 {
-    static const WCHAR path[] =
-        {'\\','s','p','o','o','l','\\','d','r','i','v','e','r','s',
-         '\\','c','o','l','o','r','\\',0};
     static const WCHAR srgb[] =
         {'s','R','G','B',' ','C','o','l','o','r',' ','S','p','a','c','e',' ',
          'P','r','o','f','i','l','e','.','i','c','m',0};
-    static const WCHAR mntr[] =
-        {'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
-         'W','i','n','d','o','w','s',' ','N','T','\\','C','u','r','r','e','n','t',
-         'V','e','r','s','i','o','n','\\','I','C','M','\\','m','n','t','r',0};
-
     HKEY hkey;
     DWORD required, len;
-    WCHAR profile[MAX_PATH], fullname[2*MAX_PATH + sizeof(path)/sizeof(WCHAR)];
+    WCHAR profile[MAX_PATH], fullname[2*MAX_PATH + sizeof(color_path)/sizeof(WCHAR)];
     unsigned char *buffer;
     unsigned long buflen;
 
     if (!size) return FALSE;
 
     GetSystemDirectoryW( fullname, MAX_PATH );
-    strcatW( fullname, path );
+    strcatW( fullname, color_path );
 
     len = sizeof(profile)/sizeof(WCHAR);
-    if (!RegCreateKeyExW( HKEY_LOCAL_MACHINE, mntr, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL ) &&
+    if (!RegCreateKeyExW( HKEY_LOCAL_MACHINE, mntr_key, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL ) &&
         !RegEnumValueW( hkey, 0, profile, &len, NULL, NULL, NULL, NULL )) /* FIXME handle multiple values */
     {
         strcatW( fullname, profile );
@@ -1589,3 +1589,57 @@
     *size = required;
     return TRUE;
 }
+
+/***********************************************************************
+ *              EnumICMProfiles (X11DRV.@)
+ */
+INT CDECL X11DRV_EnumICMProfiles( X11DRV_PDEVICE *physDev, ICMENUMPROCW proc, LPARAM lparam )
+{
+    HKEY hkey;
+    DWORD len_sysdir, len_path, len, index = 0;
+    WCHAR sysdir[MAX_PATH], *profile;
+    LONG res;
+    INT ret;
+
+    TRACE("%p, %p, %ld\n", physDev, proc, lparam);
+
+    if (RegOpenKeyExW( HKEY_LOCAL_MACHINE, mntr_key, 0, KEY_ALL_ACCESS, &hkey ))
+        return -1;
+
+    len_sysdir = GetSystemDirectoryW( sysdir, MAX_PATH );
+    len_path = len_sysdir + sizeof(color_path) / sizeof(color_path[0]) - 1;
+    len = 64;
+    for (;;)
+    {
+        if (!(profile = HeapAlloc( GetProcessHeap(), 0, (len_path + len) * sizeof(WCHAR) )))
+        {
+            RegCloseKey( hkey );
+            return -1;
+        }
+        res = RegEnumValueW( hkey, index, profile + len_path, &len, NULL, NULL, NULL, NULL );
+        while (res == ERROR_MORE_DATA)
+        {
+            len *= 2;
+            HeapFree( GetProcessHeap(), 0, profile );
+            if (!(profile = HeapAlloc( GetProcessHeap(), 0, (len_path + len) * sizeof(WCHAR) )))
+            {
+                RegCloseKey( hkey );
+                return -1;
+            }
+            res = RegEnumValueW( hkey, index, profile + len_path, &len, NULL, NULL, NULL, NULL );
+        }
+        if (res != ERROR_SUCCESS)
+        {
+            HeapFree( GetProcessHeap(), 0, profile );
+            break;
+        }
+        memcpy( profile, sysdir, len_sysdir * sizeof(WCHAR) );
+        memcpy( profile + len_sysdir, color_path, sizeof(color_path) - sizeof(WCHAR) );
+        ret = proc( profile, lparam );
+        HeapFree( GetProcessHeap(), 0, profile );
+        if (!ret) break;
+        index++;
+    }
+    RegCloseKey( hkey );
+    return -1;
+}

Modified: branches/arwinss/reactos/dll/win32/winex11.drv/mouse.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex11.drv/mouse.c?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/winex11.drv/mouse.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winex11.drv/mouse.c [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -23,6 +23,7 @@
 #include "wine/port.h"
 
 #include <X11/Xlib.h>
+#include <X11/cursorfont.h>
 #include <stdarg.h>
 
 #ifdef SONAME_LIBXCURSOR
@@ -35,18 +36,22 @@
 MAKE_FUNCPTR(XcursorImagesCreate);
 MAKE_FUNCPTR(XcursorImagesDestroy);
 MAKE_FUNCPTR(XcursorImagesLoadCursor);
+MAKE_FUNCPTR(XcursorLibraryLoadCursor);
 # undef MAKE_FUNCPTR
 #endif /* SONAME_LIBXCURSOR */
 
 #define NONAMELESSUNION
 #define NONAMELESSSTRUCT
+#define OEMRESOURCE
 #include "windef.h"
 #include "winbase.h"
+#include "winreg.h"
 
 #include "x11drv.h"
 #include "winternl.h"
 #include "wine/server.h"
 #include "wine/library.h"
+#include "wine/unicode.h"
 #include "wine/debug.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(cursor);
@@ -121,6 +126,7 @@
     LOAD_FUNCPTR(XcursorImagesCreate);
     LOAD_FUNCPTR(XcursorImagesDestroy);
     LOAD_FUNCPTR(XcursorImagesLoadCursor);
+    LOAD_FUNCPTR(XcursorLibraryLoadCursor);
 #undef LOAD_FUNCPTR
 #endif /* SONAME_LIBXCURSOR */
 }
@@ -223,21 +229,25 @@
  *
  * Update the various window states on a mouse event.
  */
-static void update_mouse_state( HWND hwnd, Window window, int x, int y, unsigned int state, POINT *pt )
+static HWND update_mouse_state( HWND hwnd, Window window, int x, int y, unsigned int state, POINT *pt )
 {
     struct x11drv_win_data *data = X11DRV_get_win_data( hwnd );
 
-    if (!data) return;
+    if (!data) return 0;
 
     if (window == data->whole_window)
     {
         x += data->whole_rect.left - data->client_rect.left;
         y += data->whole_rect.top - data->client_rect.top;
     }
-    pt->x = x + data->client_rect.left;
-    pt->y = y + data->client_rect.top;
+    pt->x = x;
+    pt->y = y;
+    if (GetWindowLongW( data->hwnd, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL)
+        pt->x = data->client_rect.right - data->client_rect.left - 1 - pt->x;
+    MapWindowPoints( hwnd, 0, pt, 1 );
 
     cursor_window = hwnd;
+    if (hwnd != GetDesktopWindow()) hwnd = GetAncestor( hwnd, GA_ROOT );
 
     /* update the wine server Z-order */
 
@@ -246,9 +256,8 @@
         !(state & (Button1Mask|Button2Mask|Button3Mask|Button4Mask|Button5Mask|Button6Mask|Button7Mask)))
     {
         RECT rect;
-        SetRect( &rect, x, y, x + 1, y + 1 );
-        if (GetWindowLongW( data->hwnd, GWL_EXSTYLE ) & WS_EX_LAYOUTRTL)
-            mirror_rect( &data->client_rect, &rect );
+        SetRect( &rect, pt->x, pt->y, pt->x + 1, pt->y + 1 );
+        MapWindowPoints( 0, hwnd, (POINT *)&rect, 2 );
 
         SERVER_START_REQ( update_window_zorder )
         {
@@ -261,6 +270,7 @@
         }
         SERVER_END_REQ;
     }
+    return hwnd;
 }
 
 
@@ -293,7 +303,7 @@
 /***********************************************************************
  *           queue_raw_mouse_message
  */
-static void queue_raw_mouse_message( UINT message, HWND hwnd, DWORD x, DWORD y,
+static void queue_raw_mouse_message( UINT message, HWND top_hwnd, HWND cursor_hwnd, DWORD x, DWORD y,
                                      DWORD data, DWORD time, DWORD extra_info, UINT injected_flags )
 {
     MSLLHOOKSTRUCT hook;
@@ -313,7 +323,7 @@
     SERVER_START_REQ( send_hardware_message )
     {
         req->id       = (injected_flags & LLMHF_INJECTED) ? 0 : GetCurrentThreadId();
-        req->win      = wine_server_user_handle( hwnd );
+        req->win      = wine_server_user_handle( top_hwnd );
         req->msg      = message;
         req->wparam   = MAKEWPARAM( get_key_state(), data );
         req->lparam   = 0;
@@ -326,10 +336,10 @@
     }
     SERVER_END_REQ;
 
-    if (hwnd)
-    {
-        struct x11drv_win_data *data = X11DRV_get_win_data( hwnd );
-        if (data && cursor != data->cursor) set_window_cursor( hwnd, cursor );
+    if (cursor_hwnd)
+    {
+        struct x11drv_win_data *data = X11DRV_get_win_data( cursor_hwnd );
+        if (data && cursor != data->cursor) set_window_cursor( cursor_hwnd, cursor );
     }
 }
 
@@ -337,7 +347,7 @@
 /***********************************************************************
  *		X11DRV_send_mouse_input
  */
-void X11DRV_send_mouse_input( HWND hwnd, DWORD flags, DWORD x, DWORD y,
+void X11DRV_send_mouse_input( HWND top_hwnd, HWND cursor_hwnd, DWORD flags, DWORD x, DWORD y,
                               DWORD data, DWORD time, DWORD extra_info, UINT injected_flags )
 {
     POINT pt;
@@ -394,7 +404,7 @@
 
     if (flags & MOUSEEVENTF_MOVE)
     {
-        queue_raw_mouse_message( WM_MOUSEMOVE, hwnd, pt.x, pt.y, data, time,
+        queue_raw_mouse_message( WM_MOUSEMOVE, top_hwnd, cursor_hwnd, pt.x, pt.y, data, time,
                                  extra_info, injected_flags );
         if ((injected_flags & LLMHF_INJECTED) &&
             ((flags & MOUSEEVENTF_ABSOLUTE) || x || y))  /* we have to actually move the cursor */
@@ -413,54 +423,58 @@
     {
         key_state_table[VK_LBUTTON] |= 0xc0;
         queue_raw_mouse_message( GetSystemMetrics(SM_SWAPBUTTON) ? WM_RBUTTONDOWN : WM_LBUTTONDOWN,
-                                 hwnd, pt.x, pt.y, data, time, extra_info, injected_flags );
+                                 top_hwnd, cursor_hwnd, pt.x, pt.y,
+                                 data, time, extra_info, injected_flags );
     }
     if (flags & MOUSEEVENTF_LEFTUP)
     {
         key_state_table[VK_LBUTTON] &= ~0x80;
         queue_raw_mouse_message( GetSystemMetrics(SM_SWAPBUTTON) ? WM_RBUTTONUP : WM_LBUTTONUP,
-                                 hwnd, pt.x, pt.y, data, time, extra_info, injected_flags );
+                                 top_hwnd, cursor_hwnd, pt.x, pt.y,
+                                 data, time, extra_info, injected_flags );
     }
     if (flags & MOUSEEVENTF_RIGHTDOWN)
     {
         key_state_table[VK_RBUTTON] |= 0xc0;
         queue_raw_mouse_message( GetSystemMetrics(SM_SWAPBUTTON) ? WM_LBUTTONDOWN : WM_RBUTTONDOWN,
-                                 hwnd, pt.x, pt.y, data, time, extra_info, injected_flags );
+                                 top_hwnd, cursor_hwnd, pt.x, pt.y,
+                                 data, time, extra_info, injected_flags );
     }
     if (flags & MOUSEEVENTF_RIGHTUP)
     {
         key_state_table[VK_RBUTTON] &= ~0x80;
         queue_raw_mouse_message( GetSystemMetrics(SM_SWAPBUTTON) ? WM_LBUTTONUP : WM_RBUTTONUP,
-                                 hwnd, pt.x, pt.y, data, time, extra_info, injected_flags );
+                                 top_hwnd, cursor_hwnd, pt.x, pt.y,
+                                 data, time, extra_info, injected_flags );
     }
     if (flags & MOUSEEVENTF_MIDDLEDOWN)
     {
         key_state_table[VK_MBUTTON] |= 0xc0;
-        queue_raw_mouse_message( WM_MBUTTONDOWN, hwnd, pt.x, pt.y, data, time,
-                                 extra_info, injected_flags );
+        queue_raw_mouse_message( WM_MBUTTONDOWN, top_hwnd, cursor_hwnd, pt.x, pt.y,
+                                 data, time, extra_info, injected_flags );
     }
     if (flags & MOUSEEVENTF_MIDDLEUP)
     {
         key_state_table[VK_MBUTTON] &= ~0x80;
-        queue_raw_mouse_message( WM_MBUTTONUP, hwnd, pt.x, pt.y, data, time,
-                                 extra_info, injected_flags );
+        queue_raw_mouse_message( WM_MBUTTONUP, top_hwnd, cursor_hwnd, pt.x, pt.y,
+                                 data, time, extra_info, injected_flags );
     }
     if (flags & MOUSEEVENTF_WHEEL)
     {
-        queue_raw_mouse_message( WM_MOUSEWHEEL, hwnd, pt.x, pt.y, data, time,
-                                 extra_info, injected_flags );
+        queue_raw_mouse_message( WM_MOUSEWHEEL, top_hwnd, cursor_hwnd, pt.x, pt.y,
+                                 data, time, extra_info, injected_flags );
     }
     if (flags & MOUSEEVENTF_XDOWN)
     {
         key_state_table[VK_XBUTTON1 + data - 1] |= 0xc0;
-        queue_raw_mouse_message( WM_XBUTTONDOWN, hwnd, pt.x, pt.y, data, time,
-                                 extra_info, injected_flags );
+        queue_raw_mouse_message( WM_XBUTTONDOWN, top_hwnd, cursor_hwnd, pt.x, pt.y,
+                                 data, time, extra_info, injected_flags );
     }
     if (flags & MOUSEEVENTF_XUP)
     {
         key_state_table[VK_XBUTTON1 + data - 1] &= ~0x80;
-        queue_raw_mouse_message( WM_XBUTTONUP, hwnd, pt.x, pt.y, data, time,
-                                 extra_info, injected_flags );
+        queue_raw_mouse_message( WM_XBUTTONUP, top_hwnd, cursor_hwnd, pt.x, pt.y,
+                                 data, time, extra_info, injected_flags );
     }
 }
 
@@ -471,7 +485,7 @@
  *
  * Use Xcursor to create a frame of an X cursor from a Windows one.
  */
-static XcursorImage *create_xcursor_frame( HDC hdc, ICONINFO *iinfo, HANDLE icon,
+static XcursorImage *create_xcursor_frame( HDC hdc, const ICONINFOEXW *iinfo, HANDLE icon,
                                            HBITMAP hbmColor, unsigned char *color_bits, int color_size,
                                            HBITMAP hbmMask, unsigned char *mask_bits, int mask_size,
                                            int width, int height, int istep )
@@ -538,7 +552,7 @@
  *
  * Use Xcursor to create an X cursor from a Windows one.
  */
-static Cursor create_xcursor_cursor( HDC hdc, ICONINFO *iinfo, HANDLE icon, int width, int height )
+static Cursor create_xcursor_cursor( HDC hdc, const ICONINFOEXW *iinfo, HANDLE icon, int width, int height )
 {
     unsigned char *color_bits, *mask_bits;
     HBITMAP hbmColor = 0, hbmMask = 0;
@@ -620,6 +634,148 @@
     if (hbmColor) DeleteObject( hbmColor );
     if (hbmMask) DeleteObject( hbmMask );
     HeapFree( GetProcessHeap(), 0, info );
+    return cursor;
+}
+
+
+struct system_cursors
+{
+    WORD id;
+    const char *name;
+};
+
+static const struct system_cursors user32_cursors[] =
+{
+    { OCR_NORMAL,      "left_ptr" },
+    { OCR_IBEAM,       "xterm" },
+    { OCR_WAIT,        "watch" },
+    { OCR_CROSS,       "cross" },
+    { OCR_UP,          "center_ptr" },
+    { OCR_SIZE,        "fleur" },
+    { OCR_SIZEALL,     "fleur" },
+    { OCR_ICON,        "icon" },
+    { OCR_SIZENWSE,    "nwse-resize" },
+    { OCR_SIZENESW,    "nesw-resize" },
+    { OCR_SIZEWE,      "ew-resize" },
+    { OCR_SIZENS,      "ns-resize" },
+    { OCR_NO,          "not-allowed" },
+    { OCR_HAND,        "hand2" },
+    { OCR_APPSTARTING, "left_ptr_watch" },
+    { OCR_HELP,        "question_arrow" },
+    { 0 }
+};
+
+static const struct system_cursors comctl32_cursors[] =
+{
+    { 102, "move" },
+    { 104, "copy" },
+    { 105, "left_ptr" },
+    { 106, "row-resize" },
+    { 107, "row-resize" },
+    { 108, "hand2" },
+    { 135, "col-resize" },
+    { 0 }
+};
+
+static const struct system_cursors ole32_cursors[] =
+{
+    { 1, "no-drop" },
+    { 2, "move" },
+    { 3, "copy" },
+    { 4, "alias" },
+    { 0 }
+};
+
+static const struct system_cursors riched20_cursors[] =
+{
+    { 105, "hand2" },
+    { 107, "right_ptr" },
+    { 109, "copy" },
+    { 110, "move" },
+    { 111, "no-drop" },
+    { 0 }
+};
+
+static const struct
+{
+    const struct system_cursors *cursors;
+    WCHAR name[16];
+} module_cursors[] =
+{
+    { user32_cursors, {'u','s','e','r','3','2','.','d','l','l',0} },
+    { comctl32_cursors, {'c','o','m','c','t','l','3','2','.','d','l','l',0} },
+    { ole32_cursors, {'o','l','e','3','2','.','d','l','l',0} },
+    { riched20_cursors, {'r','i','c','h','e','d','2','0','.','d','l','l',0} }
+};
+
+/***********************************************************************
+ *		create_xcursor_system_cursor
+ *
+ * Create an X cursor for a system cursor.
+ */
+static Cursor create_xcursor_system_cursor( const ICONINFOEXW *info )
+{
+    static const WCHAR idW[] = {'%','h','u',0};
+    const struct system_cursors *cursors;
+    unsigned int i;
+    Cursor cursor = 0;
+    HMODULE module;
+    HKEY key;
+    WCHAR *p, name[MAX_PATH * 2], valueW[64];
+    char valueA[64];
+    DWORD size, ret;
+
+    if (!pXcursorLibraryLoadCursor) return 0;
+    if (!info->szModName[0]) return 0;
+
+    p = strrchrW( info->szModName, '\\' );
+    strcpyW( name, p ? p + 1 : info->szModName );
+    p = name + strlenW( name );
+    *p++ = ',';
+    if (info->szResName[0]) strcpyW( p, info->szResName );
+    else sprintfW( p, idW, info->wResID );
+    valueA[0] = 0;
+
+    /* @@ Wine registry key: HKCU\Software\Wine\X11 Driver\Cursors */
+    if (!RegOpenKeyA( HKEY_CURRENT_USER, "Software\\Wine\\X11 Driver\\Cursors", &key ))
+    {
+        size = sizeof(valueW) / sizeof(WCHAR);
+        ret = RegQueryValueExW( key, name, NULL, NULL, (BYTE *)valueW, &size );
+        RegCloseKey( key );
+        if (!ret)
+        {
+            if (!valueW[0]) return 0; /* force standard cursor */
+            if (!WideCharToMultiByte( CP_UNIXCP, 0, valueW, -1, valueA, sizeof(valueA), NULL, NULL ))
+                valueA[0] = 0;
+            goto done;
+        }
+    }
+
+    if (info->szResName[0]) goto done;  /* only integer resources are supported here */
+    if (!(module = GetModuleHandleW( info->szModName ))) goto done;
+
+    for (i = 0; i < sizeof(module_cursors)/sizeof(module_cursors[0]); i++)
+        if (GetModuleHandleW( module_cursors[i].name ) == module) break;
+    if (i == sizeof(module_cursors)/sizeof(module_cursors[0])) goto done;
+
+    cursors = module_cursors[i].cursors;
+    for (i = 0; cursors[i].id; i++)
+        if (cursors[i].id == info->wResID)
+        {
+            strcpy( valueA, cursors[i].name );
+            break;
+        }
+
+done:
+    if (valueA[0])
+    {
+        wine_tsx11_lock();
+        cursor = pXcursorLibraryLoadCursor( gdi_display, valueA );
+        wine_tsx11_unlock();
+        if (!cursor) WARN( "no system cursor found for %s mapped to %s\n",
+                           debugstr_w(name), debugstr_a(valueA) );
+    }
+    else WARN( "no system cursor found for %s\n", debugstr_w(name) );
     return cursor;
 }
 
@@ -702,7 +858,7 @@
  *
  * Create an X cursor from a Windows one.
  */
-static Cursor create_xlib_cursor( HDC hdc, ICONINFO *icon, int width, int height )
+static Cursor create_xlib_cursor( HDC hdc, const ICONINFOEXW *icon, int width, int height )
 {
     XColor fg, bg;
     Cursor cursor = None;
@@ -831,18 +987,22 @@
 static Cursor create_cursor( HANDLE handle )
 {
     Cursor cursor = 0;
-    HDC hdc;
-    ICONINFO info;
+    ICONINFOEXW info;
     BITMAP bm;
 
     if (!handle) return get_empty_cursor();
 
-    if (!(hdc = CreateCompatibleDC( 0 ))) return 0;
-    if (!GetIconInfo( handle, &info ))
-    {
-        DeleteDC( hdc );
-        return 0;
-    }
+    info.cbSize = sizeof(info);
+    if (!GetIconInfoExW( handle, &info )) return 0;
+
+#ifdef SONAME_LIBXCURSOR
+    if (use_system_cursors && (cursor = create_xcursor_system_cursor( &info )))
+    {
+        DeleteObject( info.hbmColor );
+        DeleteObject( info.hbmMask );
+        return cursor;
+    }
+#endif
 
     GetObjectW( info.hbmMask, sizeof(bm), &bm );
     if (!info.hbmColor) bm.bmHeight /= 2;
@@ -856,11 +1016,17 @@
 
     if (info.hbmColor)
     {
+        HDC hdc = CreateCompatibleDC( 0 );
+        if (hdc)
+        {
 #ifdef SONAME_LIBXCURSOR
-        if (pXcursorImagesLoadCursor) cursor = create_xcursor_cursor( hdc, &info, handle, bm.bmWidth, bm.bmHeight );
+            if (pXcursorImagesLoadCursor)
+                cursor = create_xcursor_cursor( hdc, &info, handle, bm.bmWidth, bm.bmHeight );
 #endif
-        if (!cursor) cursor = create_xlib_cursor( hdc, &info, bm.bmWidth, bm.bmHeight );
+            if (!cursor) cursor = create_xlib_cursor( hdc, &info, bm.bmWidth, bm.bmHeight );
+        }
         DeleteObject( info.hbmColor );
+        DeleteDC( hdc );
     }
     else
     {
@@ -872,7 +1038,6 @@
     }
 
     DeleteObject( info.hbmMask );
-    DeleteDC( hdc );
     return cursor;
 }
 
@@ -916,7 +1081,7 @@
     {
         wine_tsx11_unlock();
         /* We still need to generate WM_MOUSEMOVE */
-        queue_raw_mouse_message( WM_MOUSEMOVE, NULL, x, y, 0, GetCurrentTime(), 0, 0 );
+        queue_raw_mouse_message( WM_MOUSEMOVE, 0, 0, x, y, 0, GetCurrentTime(), 0, 0 );
         return TRUE;
     }
 
@@ -980,9 +1145,9 @@
     int buttonNum = event->button - 1;
     WORD wData = 0;
     POINT pt;
+    HWND top_hwnd;
 
     if (buttonNum >= NB_BUTTONS) return;
-    if (!hwnd) return;
 
     switch (buttonNum)
     {
@@ -1007,9 +1172,11 @@
     }
 
     update_user_time( event->time );
-    update_mouse_state( hwnd, event->window, event->x, event->y, event->state, &pt );
-
-    X11DRV_send_mouse_input( hwnd, button_down_flags[buttonNum] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE,
+    top_hwnd = update_mouse_state( hwnd, event->window, event->x, event->y, event->state, &pt );
+    if (!top_hwnd) return;
+
+    X11DRV_send_mouse_input( top_hwnd, hwnd,
+                             button_down_flags[buttonNum] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE,
                              pt.x, pt.y, wData, EVENT_x11_time_to_win32_time(event->time), 0, 0 );
 }
 
@@ -1023,9 +1190,9 @@
     int buttonNum = event->button - 1;
     WORD wData = 0;
     POINT pt;
+    HWND top_hwnd;
 
     if (buttonNum >= NB_BUTTONS || !button_up_flags[buttonNum]) return;
-    if (!hwnd) return;
 
     switch (buttonNum)
     {
@@ -1043,9 +1210,11 @@
         break;
     }
 
-    update_mouse_state( hwnd, event->window, event->x, event->y, event->state, &pt );
-
-    X11DRV_send_mouse_input( hwnd, button_up_flags[buttonNum] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE,
+    top_hwnd = update_mouse_state( hwnd, event->window, event->x, event->y, event->state, &pt );
+    if (!top_hwnd) return;
+
+    X11DRV_send_mouse_input( top_hwnd, hwnd,
+                             button_up_flags[buttonNum] | MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE,
                              pt.x, pt.y, wData, EVENT_x11_time_to_win32_time(event->time), 0, 0 );
 }
 
@@ -1057,14 +1226,14 @@
 {
     XMotionEvent *event = &xev->xmotion;
     POINT pt;
+    HWND top_hwnd;
 
     TRACE("hwnd %p, event->is_hint %d\n", hwnd, event->is_hint);
 
-    if (!hwnd) return;
-
-    update_mouse_state( hwnd, event->window, event->x, event->y, event->state, &pt );
-
-    X11DRV_send_mouse_input( hwnd, MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
+    top_hwnd = update_mouse_state( hwnd, event->window, event->x, event->y, event->state, &pt );
+    if (!top_hwnd) return;
+
+    X11DRV_send_mouse_input( top_hwnd, hwnd, MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
                              pt.x, pt.y, 0, EVENT_x11_time_to_win32_time(event->time), 0, 0 );
 }
 
@@ -1076,16 +1245,17 @@
 {
     XCrossingEvent *event = &xev->xcrossing;
     POINT pt;
+    HWND top_hwnd;
 
     TRACE("hwnd %p, event->detail %d\n", hwnd, event->detail);
 
-    if (!hwnd) return;
     if (event->detail == NotifyVirtual || event->detail == NotifyNonlinearVirtual) return;
     if (event->window == x11drv_thread_data()->grab_window) return;
 
     /* simulate a mouse motion event */
-    update_mouse_state( hwnd, event->window, event->x, event->y, event->state, &pt );
-
-    X11DRV_send_mouse_input( hwnd, MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
+    top_hwnd = update_mouse_state( hwnd, event->window, event->x, event->y, event->state, &pt );
+    if (!top_hwnd) return;
+
+    X11DRV_send_mouse_input( top_hwnd, hwnd, MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,
                              pt.x, pt.y, 0, EVENT_x11_time_to_win32_time(event->time), 0, 0 );
 }

Modified: branches/arwinss/reactos/dll/win32/winex11.drv/opengl.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex11.drv/opengl.c?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/winex11.drv/opengl.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winex11.drv/opengl.c [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -1793,6 +1793,7 @@
     if (ctx->tid != 0 && ctx->tid != GetCurrentThreadId())
     {
         TRACE("Cannot delete context=%p because it is current in another thread.\n", ctx);
+        SetLastError(ERROR_BUSY);
         return FALSE;
     }
 
@@ -1807,6 +1808,7 @@
         wine_tsx11_unlock();
     }
 
+    free_context(ctx);
     return TRUE;
 }
 

Modified: branches/arwinss/reactos/dll/win32/winex11.drv/palette.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex11.drv/palette.c?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/winex11.drv/palette.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winex11.drv/palette.c [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -874,6 +874,49 @@
 }
 
 /***********************************************************************
+ *           X11DRV_PALETTE_GetColor
+ *
+ * Resolve PALETTEINDEX/PALETTERGB/DIBINDEX COLORREFs to an RGB COLORREF.
+ */
+COLORREF X11DRV_PALETTE_GetColor( X11DRV_PDEVICE *physDev, COLORREF color )
+{
+    HPALETTE             hPal = GetCurrentObject(physDev->hdc, OBJ_PAL );
+    unsigned char        spec_type = color >> 24;
+    unsigned             idx = color & 0xffff;
+    PALETTEENTRY         entry;
+    RGBQUAD              quad;
+
+    switch(spec_type)
+    {
+      case 2:  /* PALETTERGB */
+        idx = GetNearestPaletteIndex( hPal, color );
+        /* fall through to PALETTEINDEX */
+
+      case 1: /* PALETTEINDEX */
+        if (!GetPaletteEntries( hPal, idx, 1, &entry ))
+        {
+            WARN("PALETTEINDEX(%x) : idx %d is out of bounds, assuming black\n", color, idx);
+            return 0;
+        }
+        return RGB( entry.peRed, entry.peGreen, entry.peBlue );
+
+      case 0x10: /* DIBINDEX */
+        if( GetDIBColorTable( physDev->hdc, idx, 1, &quad ) != 1 ) {
+            WARN("DIBINDEX(%x) : idx %d is out of bounds, assuming black\n", color , idx);
+            return 0;
+        }
+        return RGB( quad.rgbRed, quad.rgbGreen, quad.rgbBlue );
+
+      default:
+        color &= 0xffffff;
+        /* fall through to RGB */
+
+      case 0: /* RGB */
+        return color;
+    }
+}
+
+/***********************************************************************
  *           X11DRV_PALETTE_ToPhysical
  *
  * Return the physical color closest to 'color'.
@@ -898,16 +941,11 @@
 
 	unsigned 	long red, green, blue;
 	unsigned	idx = color & 0xffff;
-        RGBQUAD         quad;
 
 	switch(spec_type)
         {
           case 0x10: /* DIBINDEX */
-            if( GetDIBColorTable( physDev->hdc, idx, 1, &quad ) != 1 ) {
-                WARN("DIBINDEX(%x) : idx %d is out of bounds, assuming black\n", color , idx);
-                return 0;
-            }
-            color = RGB( quad.rgbRed, quad.rgbGreen, quad.rgbBlue );
+            color = X11DRV_PALETTE_GetColor( physDev, color );
             break;
                 
           case 1: /* PALETTEINDEX */

Modified: branches/arwinss/reactos/dll/win32/winex11.drv/systray.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex11.drv/systray.c?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/winex11.drv/systray.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winex11.drv/systray.c [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -55,21 +55,33 @@
     HWND           tooltip;  /* Icon tooltip */
     UINT           id;       /* the unique id given by the app */
     UINT           callback_message;
+    int            display;  /* display index, or -1 if hidden */
     WCHAR          tiptext[256]; /* Tooltip text. If empty => tooltip disabled */
     WCHAR          tiptitle[64]; /* Tooltip title for ballon style tooltips.  If empty => tooltip is not balloon style. */
 };
 
 static struct list icon_list = LIST_INIT( icon_list );
 
-static const WCHAR tray_classname[] = {'_','_','w','i','n','e','x','1','1','_','t','r','a','y','_','w','i','n','d','o','w',0};
-
+static const WCHAR icon_classname[] = {'_','_','w','i','n','e','x','1','1','_','t','r','a','y','_','i','c','o','n',0};
+static const WCHAR tray_classname[] = {'_','_','w','i','n','e','x','1','1','_','s','t','a','n','d','a','l','o','n','e','_','t','r','a','y',0};
+
+static BOOL show_icon( struct tray_icon *icon );
+static BOOL hide_icon( struct tray_icon *icon );
 static BOOL delete_icon( struct tray_icon *icon );
 
 #define SYSTEM_TRAY_REQUEST_DOCK  0
 #define SYSTEM_TRAY_BEGIN_MESSAGE   1
 #define SYSTEM_TRAY_CANCEL_MESSAGE  2
 
+Atom systray_atom = 0;
+
+#define MIN_DISPLAYED 8
 #define ICON_BORDER 2
+
+/* stand-alone tray window */
+static HWND standalone_tray;
+static int icon_cx, icon_cy;
+static unsigned int nb_displayed;
 
 /* retrieves icon record by owner window and ID */
 static struct tray_icon *get_icon(HWND owner, UINT id)
@@ -140,8 +152,105 @@
     SendMessageW(icon->tooltip, TTM_UPDATETIPTEXTW, 0, (LPARAM)&ti);
 }
 
-/* window procedure for the tray window */
-static LRESULT WINAPI tray_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
+/* get the size of the stand-alone tray window */
+static SIZE get_window_size(void)
+{
+    SIZE size;
+    RECT rect;
+
+    rect.left = 0;
+    rect.top = 0;
+    rect.right = icon_cx * max( nb_displayed, MIN_DISPLAYED );
+    rect.bottom = icon_cy;
+    AdjustWindowRect( &rect, WS_CAPTION, FALSE );
+    size.cx = rect.right - rect.left;
+    size.cy = rect.bottom - rect.top;
+    return size;
+}
+
+/* get the position of an icon in the stand-alone tray */
+static POINT get_icon_pos( struct tray_icon *icon )
+{
+    POINT pos;
+
+    pos.x = icon_cx * icon->display;
+    pos.y = 0;
+    return pos;
+}
+
+/* window procedure for the standalone tray window */
+static LRESULT WINAPI standalone_tray_wndproc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
+{
+    switch (msg)
+    {
+    case WM_CLOSE:
+        ShowWindow( hwnd, SW_HIDE );
+        show_systray = FALSE;
+        return 0;
+    case WM_DESTROY:
+        standalone_tray = 0;
+        break;
+    }
+    return DefWindowProcW( hwnd, msg, wparam, lparam );
+}
+
+/* add an icon to the standalone tray window */
+static void add_to_standalone_tray( struct tray_icon *icon )
+{
+    SIZE size;
+    POINT pos;
+
+    if (!standalone_tray)
+    {
+        static const WCHAR winname[] = {'W','i','n','e',' ','S','y','s','t','e','m',' ','T','r','a','y',0};
+
+        size = get_window_size();
+        standalone_tray = CreateWindowExW( 0, tray_classname, winname, WS_CAPTION | WS_SYSMENU,
+                                           CW_USEDEFAULT, CW_USEDEFAULT, size.cx, size.cy, 0, 0, 0, 0 );
+        if (!standalone_tray) return;
+    }
+
+    icon->display = nb_displayed;
+    pos = get_icon_pos( icon );
+    icon->window = CreateWindowW( icon_classname, NULL, WS_CHILD | WS_VISIBLE,
+                                  pos.x, pos.y, icon_cx, icon_cy, standalone_tray, NULL, NULL, icon );
+    if (!icon->window)
+    {
+        icon->display = -1;
+        return;
+    }
+    create_tooltip( icon );
+
+    nb_displayed++;
+    size = get_window_size();
+    SetWindowPos( standalone_tray, 0, 0, 0, size.cx, size.cy, SWP_NOMOVE | SWP_NOACTIVATE | SWP_NOZORDER );
+    if (nb_displayed == 1 && show_systray) ShowWindow( standalone_tray, SW_SHOWNA );
+    TRACE( "added %u now %d icons\n", icon->id, nb_displayed );
+}
+
+/* remove an icon from the stand-alone tray */
+static void remove_from_standalone_tray( struct tray_icon *icon )
+{
+    struct tray_icon *ptr;
+    POINT pos;
+
+    if (icon->display == -1) return;
+
+    LIST_FOR_EACH_ENTRY( ptr, &icon_list, struct tray_icon, entry )
+    {
+        if (ptr == icon) continue;
+        if (ptr->display < icon->display) continue;
+        ptr->display--;
+        pos = get_icon_pos( ptr );
+        SetWindowPos( ptr->window, 0, pos.x, pos.y, 0, 0, SWP_NOSIZE | SWP_NOACTIVATE | SWP_NOZORDER );
+    }
+    icon->display = -1;
+    if (!--nb_displayed) ShowWindow( standalone_tray, SW_HIDE );
+    TRACE( "removed %u now %d icons\n", icon->id, nb_displayed );
+}
+
+/* window procedure for the individual tray icon window */
+static LRESULT WINAPI tray_icon_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
 {
     struct tray_icon *icon = NULL;
     BOOL ret;
@@ -156,6 +265,10 @@
 
     switch (msg)
     {
+    case WM_CREATE:
+        SetTimer( hwnd, 1, 1000, NULL );
+        break;
+
     case WM_PAINT:
         {
             PAINTSTRUCT ps;
@@ -170,7 +283,7 @@
             DrawIconEx( hdc, (rc.left + rc.right - cx) / 2, (rc.top + rc.bottom - cy) / 2,
                         icon->image, cx, cy, 0, 0, DI_DEFAULTSIZE|DI_NORMAL );
             EndPaint(hwnd, &ps);
-            break;
+            return 0;
         }
 
     case WM_MOUSEMOVE:
@@ -191,57 +304,109 @@
             WARN( "application window was destroyed, removing icon %u\n", icon->id );
             delete_icon( icon );
         }
-        break;
+        return 0;
 
     case WM_TIMER:
         if (!IsWindow( icon->owner )) delete_icon( icon );
         return 0;
 
-    default:
-        return DefWindowProcW(hwnd, msg, wparam, lparam);
-    }
-    return 0;
+    case WM_CLOSE:
+        if (icon->display == -1)
+        {
+            TRACE( "icon %u no longer embedded\n", icon->id );
+            hide_icon( icon );
+            add_to_standalone_tray( icon );
+        }
+        return 0;
+    }
+    return DefWindowProcW( hwnd, msg, wparam, lparam );
 }
 
 /* find the X11 window owner the system tray selection */
 static Window get_systray_selection_owner( Display *display )
 {
-    static Atom systray_atom;
     Window ret;
 
-    if (root_window != DefaultRootWindow( display )) return 0;
-
     wine_tsx11_lock();
-    if (!systray_atom)
-    {
-        if (DefaultScreen( display ) == 0)
-            systray_atom = x11drv_atom(_NET_SYSTEM_TRAY_S0);
-        else
-        {
-            char systray_buffer[29]; /* strlen(_NET_SYSTEM_TRAY_S4294967295)+1 */
-            sprintf( systray_buffer, "_NET_SYSTEM_TRAY_S%u", DefaultScreen( display ) );
-            systray_atom = XInternAtom( display, systray_buffer, False );
-        }
-    }
     ret = XGetSelectionOwner( display, systray_atom );
     wine_tsx11_unlock();
     return ret;
 }
 
-
-/* dock the given X window with the NETWM system tray */
-static void dock_systray_window( Display *display, HWND hwnd, Window systray_window )
+static BOOL init_systray(void)
+{
+    static BOOL init_done;
+    WNDCLASSEXW class;
+    Display *display;
+
+    if (root_window != DefaultRootWindow( gdi_display )) return FALSE;
+    if (init_done) return TRUE;
+
+    icon_cx = GetSystemMetrics( SM_CXSMICON ) + 2 * ICON_BORDER;
+    icon_cy = GetSystemMetrics( SM_CYSMICON ) + 2 * ICON_BORDER;
+
+    memset( &class, 0, sizeof(class) );
+    class.cbSize        = sizeof(class);
+    class.lpfnWndProc   = tray_icon_wndproc;
+    class.hIcon         = LoadIconW(0, (LPCWSTR)IDI_WINLOGO);
+    class.hCursor       = LoadCursorW( 0, (LPCWSTR)IDC_ARROW );
+    class.lpszClassName = icon_classname;
+    class.style         = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
+
+    if (!RegisterClassExW( &class ) && GetLastError() != ERROR_CLASS_ALREADY_EXISTS)
+    {
+        ERR( "Could not register icon tray window class\n" );
+        return FALSE;
+    }
+
+    class.lpfnWndProc   = standalone_tray_wndproc;
+    class.hbrBackground = (HBRUSH)COLOR_WINDOW;
+    class.lpszClassName = tray_classname;
+    class.style         = CS_DBLCLKS;
+
+    if (!RegisterClassExW( &class ) && GetLastError() != ERROR_CLASS_ALREADY_EXISTS)
+    {
+        ERR( "Could not register standalone tray window class\n" );
+        return FALSE;
+    }
+
+    display = thread_init_display();
+    wine_tsx11_lock();
+    if (DefaultScreen( display ) == 0)
+        systray_atom = x11drv_atom(_NET_SYSTEM_TRAY_S0);
+    else
+    {
+        char systray_buffer[29]; /* strlen(_NET_SYSTEM_TRAY_S4294967295)+1 */
+        sprintf( systray_buffer, "_NET_SYSTEM_TRAY_S%u", DefaultScreen( display ) );
+        systray_atom = XInternAtom( display, systray_buffer, False );
+    }
+    XSelectInput( display, root_window, StructureNotifyMask );
+    wine_tsx11_unlock();
+
+    init_done = TRUE;
+    return TRUE;
+}
+
+/* dock the given icon with the NETWM system tray */
+static void dock_systray_icon( Display *display, struct tray_icon *icon, Window systray_window )
 {
     struct x11drv_win_data *data;
     XEvent ev;
     XSetWindowAttributes attr;
 
-    if (!(data = X11DRV_get_win_data( hwnd )) &&
-        !(data = X11DRV_create_win_data( hwnd ))) return;
+    icon->window = CreateWindowW( icon_classname, NULL, WS_CLIPSIBLINGS | WS_POPUP,
+                                  CW_USEDEFAULT, CW_USEDEFAULT, icon_cx, icon_cy,
+                                  NULL, NULL, NULL, icon );
+    if (!icon->window) return;
+
+    if (!(data = X11DRV_get_win_data( icon->window )) &&
+        !(data = X11DRV_create_win_data( icon->window ))) return;
 
     TRACE( "icon window %p/%lx managed %u\n", data->hwnd, data->whole_window, data->managed );
 
     make_window_embedded( display, data );
+    create_tooltip( icon );
+    ShowWindow( icon->window, SW_SHOWNA );
 
     /* send the docking request message */
     ev.xclient.type = ClientMessage;
@@ -262,67 +427,55 @@
     wine_tsx11_unlock();
 }
 
+/* dock systray windows again with the new owner */
+void change_systray_owner( Display *display, Window systray_window )
+{
+    struct tray_icon *icon;
+
+    TRACE( "new owner %lx\n", systray_window );
+    LIST_FOR_EACH_ENTRY( icon, &icon_list, struct tray_icon, entry )
+    {
+        if (icon->display == -1) continue;
+        hide_icon( icon );
+        dock_systray_icon( display, icon, systray_window );
+    }
+}
 
 /* hide a tray icon */
 static BOOL hide_icon( struct tray_icon *icon )
 {
+    struct x11drv_win_data *data;
+
     TRACE( "id=0x%x, hwnd=%p\n", icon->id, icon->owner );
 
     if (!icon->window) return TRUE;  /* already hidden */
+
+    /* make sure we don't try to unmap it, it confuses some systray docks */
+    if ((data = X11DRV_get_win_data( icon->window )) && data->embedded) data->mapped = FALSE;
 
     DestroyWindow(icon->window);
     DestroyWindow(icon->tooltip);
     icon->window = 0;
     icon->tooltip = 0;
+    remove_from_standalone_tray( icon );
     return TRUE;
 }
 
 /* make the icon visible */
 static BOOL show_icon( struct tray_icon *icon )
 {
-    RECT rect;
-    static BOOL class_registered;
     Window systray_window;
-    Display *display = thread_display();
+    Display *display = thread_init_display();
 
     TRACE( "id=0x%x, hwnd=%p\n", icon->id, icon->owner );
 
     if (icon->window) return TRUE;  /* already shown */
 
-    if (!class_registered)
-    {
-        WNDCLASSEXW class;
-
-        ZeroMemory( &class, sizeof(class) );
-        class.cbSize        = sizeof(class);
-        class.lpfnWndProc   = tray_wndproc;
-        class.hCursor       = LoadCursorW( 0, (LPCWSTR)IDC_ARROW );
-        class.lpszClassName = tray_classname;
-        class.style         = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS;
-
-        if (!RegisterClassExW(&class) && GetLastError() != ERROR_CLASS_ALREADY_EXISTS)
-        {
-            WINE_ERR( "Could not register tray window class\n" );
-            return FALSE;
-        }
-        class_registered = TRUE;
-    }
-
-    if (!(systray_window = get_systray_selection_owner( display ))) return FALSE;
-
-    rect.left = 0;
-    rect.top = 0;
-    rect.right = GetSystemMetrics( SM_CXSMICON ) + 2*ICON_BORDER;
-    rect.bottom = GetSystemMetrics( SM_CYSMICON ) + 2*ICON_BORDER;
-
-    icon->window = CreateWindowExW( WS_EX_APPWINDOW, tray_classname, NULL, WS_CLIPSIBLINGS | WS_POPUP,
-                                    CW_USEDEFAULT, CW_USEDEFAULT,
-                                    rect.right - rect.left, rect.bottom - rect.top,
-                                    NULL, NULL, NULL, icon );
-    create_tooltip( icon );
-    dock_systray_window( display, icon->window, systray_window );
-    SetTimer( icon->window, 1, 1000, NULL );
-    ShowWindow( icon->window, SW_SHOWNA );
+    if ((systray_window = get_systray_selection_owner( display )))
+        dock_systray_icon( display, icon, systray_window );
+    else
+        add_to_standalone_tray( icon );
+
     return TRUE;
 }
 
@@ -343,8 +496,12 @@
         icon->image = CopyIcon(nid->hIcon);
         if (icon->window)
         {
-            struct x11drv_win_data *data = X11DRV_get_win_data( icon->window );
-            if (data) XClearArea( thread_display(), data->client_window, 0, 0, 0, 0, True );
+            if (icon->display != -1) InvalidateRect( icon->window, NULL, TRUE );
+            else
+            {
+                struct x11drv_win_data *data = X11DRV_get_win_data( icon->window );
+                if (data) XClearArea( gdi_display, data->client_window, 0, 0, 0, 0, True );
+            }
         }
     }
 
@@ -389,6 +546,7 @@
     ZeroMemory(icon, sizeof(struct tray_icon));
     icon->id     = nid->uID;
     icon->owner  = nid->hWnd;
+    icon->display = -1;
 
     list_add_tail(&icon_list, &icon->entry);
 
@@ -423,8 +581,7 @@
     switch (msg)
     {
     case NIM_ADD:
-        if (!get_systray_selection_owner( thread_init_display() ))
-            return -1;  /* fall back to default handling */
+        if (!init_systray()) return -1;  /* fall back to default handling */
         ret = add_icon( data );
         break;
     case NIM_DELETE:

Modified: branches/arwinss/reactos/dll/win32/winex11.drv/window.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex11.drv/window.c?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/winex11.drv/window.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winex11.drv/window.c [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -1357,6 +1357,8 @@
 {
     unsigned long info[2];
 
+    if (!data->whole_window) return;
+
     info[0] = 0; /* protocol version */
     info[1] = flags;
     wine_tsx11_lock();
@@ -1419,18 +1421,19 @@
  */
 void make_window_embedded( Display *display, struct x11drv_win_data *data )
 {
-    if (data->mapped)
-    {
-        /* the window cannot be mapped before being embedded */
-        unmap_window( display, data );
-        data->embedded = TRUE;
+    BOOL was_mapped = data->mapped;
+    /* the window cannot be mapped before being embedded */
+    if (data->mapped) unmap_window( display, data );
+
+    data->embedded = TRUE;
+    data->managed = TRUE;
+    SetPropA( data->hwnd, managed_prop, (HANDLE)1 );
+    sync_window_style( display, data );
+
+    if (was_mapped)
         map_window( display, data, 0 );
-    }
     else
-    {
-        data->embedded = TRUE;
         set_xembed_flags( display, data, 0 );
-    }
 }
 
 
@@ -1890,9 +1893,17 @@
     struct x11drv_win_data *data;
 
     if (!(data = X11DRV_get_win_data( hwnd ))) return;
-
-    FIXME( "window %p/%lx destroyed from the outside\n", hwnd, data->whole_window );
-    destroy_whole_window( display, data, TRUE );
+    if (!data->embedded) FIXME( "window %p/%lx destroyed from the outside\n", hwnd, data->whole_window );
+
+    if (!data->whole_window)
+    {
+        wine_tsx11_lock();
+        XDeleteContext( display, event->xdestroywindow.window, winContext );
+        wine_tsx11_unlock();
+    }
+    else destroy_whole_window( display, data, TRUE );
+
+    if (data->embedded) SendMessageW( hwnd, WM_CLOSE, 0, 0 );
 }
 
 
@@ -2044,6 +2055,118 @@
 }
 
 
+/* window procedure for foreign windows */
+static LRESULT WINAPI foreign_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
+{
+    switch(msg)
+    {
+    case WM_PARENTNOTIFY:
+        if (LOWORD(wparam) == WM_DESTROY)
+        {
+            TRACE( "%p: got parent notify destroy for win %lx\n", hwnd, lparam );
+            PostMessageW( hwnd, WM_CLOSE, 0, 0 );  /* so that we come back here once the child is gone */
+        }
+        return 0;
+    case WM_CLOSE:
+        if (GetWindow( hwnd, GW_CHILD )) return 0;  /* refuse to die if we still have children */
+        break;
+    }
+    return DefWindowProcW( hwnd, msg, wparam, lparam );
+}
+
+
+/***********************************************************************
+ *		create_foreign_window
+ *
+ * Create a foreign window for the specified X window and its ancestors
+ */
+HWND create_foreign_window( Display *display, Window xwin )
+{
+    static const WCHAR classW[] = {'_','_','w','i','n','e','_','x','1','1','_','f','o','r','e','i','g','n','_','w','i','n','d','o','w',0};
+    static BOOL class_registered;
+    struct x11drv_win_data *data;
+    HWND hwnd, parent;
+    Window xparent, xroot;
+    Window *xchildren;
+    unsigned int nchildren;
+    XWindowAttributes attr;
+    DWORD style = WS_CLIPCHILDREN;
+
+    if (!class_registered)
+    {
+        WNDCLASSEXW class;
+
+        memset( &class, 0, sizeof(class) );
+        class.cbSize        = sizeof(class);
+        class.lpfnWndProc   = foreign_window_proc;
+        class.lpszClassName = classW;
+        if (!RegisterClassExW( &class ) && GetLastError() != ERROR_CLASS_ALREADY_EXISTS)
+        {
+            ERR( "Could not register foreign window class\n" );
+            return FALSE;
+        }
+        class_registered = TRUE;
+    }
+
+    wine_tsx11_lock();
+    if (XFindContext( display, xwin, winContext, (char **)&hwnd )) hwnd = 0;
+    if (hwnd)  /* already created */
+    {
+        wine_tsx11_unlock();
+        return hwnd;
+    }
+
+    XSelectInput( display, xwin, StructureNotifyMask );
+    if (!XGetWindowAttributes( display, xwin, &attr ) ||
+        !XQueryTree( display, xwin, &xroot, &xparent, &xchildren, &nchildren ))
+    {
+        XSelectInput( display, xwin, 0 );
+        wine_tsx11_unlock();
+        return 0;
+    }
+    XFree( xchildren );
+    wine_tsx11_unlock();
+
+    if (xparent == xroot)
+    {
+        parent = GetDesktopWindow();
+        style |= WS_POPUP;
+        attr.x += virtual_screen_rect.left;
+        attr.y += virtual_screen_rect.top;
+    }
+    else
+    {
+        parent = create_foreign_window( display, xparent );
+        style |= WS_CHILD;
+    }
+
+    hwnd = CreateWindowW( classW, NULL, style, attr.x, attr.y, attr.width, attr.height,
+                          parent, 0, 0, NULL );
+
+    if (!(data = alloc_win_data( display, hwnd )))
+    {
+        DestroyWindow( hwnd );
+        return 0;
+    }
+    SetRect( &data->window_rect, attr.x, attr.y, attr.x + attr.width, attr.y + attr.height );
+    data->whole_rect = data->client_rect = data->window_rect;
+    data->whole_window = data->client_window = 0;
+    data->embedded = TRUE;
+    data->mapped = TRUE;
+
+    wine_tsx11_lock();
+    XSaveContext( display, xwin, winContext, (char *)data->hwnd );
+    wine_tsx11_unlock();
+
+    ShowWindow( hwnd, SW_SHOW );
+
+    TRACE( "win %lx parent %p style %08x %s -> hwnd %p\n",
+           xwin, parent, style, wine_dbgstr_rect(&data->window_rect), hwnd );
+
+    return hwnd;
+}
+
+
 /***********************************************************************
  *		X11DRV_get_whole_window
  *
@@ -2107,6 +2230,7 @@
 {
     struct x11drv_escape_set_drawable escape;
     struct x11drv_win_data *data = X11DRV_get_win_data( hwnd );
+    HWND parent;
 
     escape.code        = X11DRV_SET_DRAWABLE;
     escape.mode        = IncludeInferiors;
@@ -2114,6 +2238,15 @@
     escape.gl_drawable = 0;
     escape.pixmap      = 0;
     escape.gl_copy     = FALSE;
+
+    escape.dc_rect.left         = win_rect->left - top_rect->left;
+    escape.dc_rect.top          = win_rect->top - top_rect->top;
+    escape.dc_rect.right        = win_rect->right - top_rect->left;
+    escape.dc_rect.bottom       = win_rect->bottom - top_rect->top;
+    escape.drawable_rect.left   = top_rect->left;
+    escape.drawable_rect.top    = top_rect->top;
+    escape.drawable_rect.right  = top_rect->right;
+    escape.drawable_rect.bottom = top_rect->bottom;
 
     if (top == hwnd)
     {
@@ -2131,22 +2264,25 @@
     }
     else
     {
-        escape.drawable    = X11DRV_get_client_window( top );
+        /* find the first ancestor that has a drawable */
+        for (parent = hwnd; parent && parent != top; parent = GetAncestor( parent, GA_PARENT ))
+            if ((escape.drawable = X11DRV_get_client_window( parent ))) break;
+
+        if (escape.drawable)
+        {
+            POINT pt = { 0, 0 };
+            MapWindowPoints( top, parent, &pt, 1 );
+            OffsetRect( &escape.dc_rect, pt.x, pt.y );
+            OffsetRect( &escape.drawable_rect, -pt.x, -pt.y );
+        }
+        else escape.drawable = X11DRV_get_client_window( top );
+
         escape.fbconfig_id = data ? data->fbconfig_id : (XID)GetPropA( hwnd, fbconfig_id_prop );
         escape.gl_drawable = data ? data->gl_drawable : (Drawable)GetPropA( hwnd, gl_drawable_prop );
         escape.pixmap      = data ? data->pixmap : (Pixmap)GetPropA( hwnd, pixmap_prop );
         escape.gl_copy     = (escape.gl_drawable != 0);
         if (flags & DCX_CLIPCHILDREN) escape.mode = ClipByChildren;
     }
-
-    escape.dc_rect.left         = win_rect->left - top_rect->left;
-    escape.dc_rect.top          = win_rect->top - top_rect->top;
-    escape.dc_rect.right        = win_rect->right - top_rect->left;
-    escape.dc_rect.bottom       = win_rect->bottom - top_rect->top;
-    escape.drawable_rect.left   = top_rect->left;
-    escape.drawable_rect.top    = top_rect->top;
-    escape.drawable_rect.right  = top_rect->right;
-    escape.drawable_rect.bottom = top_rect->bottom;
 
     ExtEscape( hdc, X11DRV_ESCAPE, sizeof(escape), (LPSTR)&escape, 0, NULL );
 }
@@ -2218,6 +2354,7 @@
 
     if (!data) return;
     if (parent == old_parent) return;
+    if (data->embedded) return;
 
     if (parent != GetDesktopWindow()) /* a child window */
     {
@@ -2368,10 +2505,11 @@
     if (thread_data->current_event && thread_data->current_event->xany.window == data->whole_window)
         event_type = thread_data->current_event->type;
 
-    if (event_type != ConfigureNotify && event_type != PropertyNotify)
+    if (event_type != ConfigureNotify && event_type != PropertyNotify &&
+        event_type != GravityNotify && event_type != ReparentNotify)
         event_type = 0;  /* ignore other events */
 
-    if (data->mapped)
+    if (data->mapped && event_type != ReparentNotify)
     {
         if (((swp_flags & SWP_HIDEWINDOW) && !(new_style & WS_VISIBLE)) ||
             (event_type != ConfigureNotify &&

Modified: branches/arwinss/reactos/dll/win32/winex11.drv/winex11.drv.spec
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex11.drv/winex11.drv.spec?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/winex11.drv/winex11.drv.spec [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winex11.drv/winex11.drv.spec [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -12,6 +12,7 @@
 @ cdecl DescribePixelFormat(ptr long long ptr) X11DRV_DescribePixelFormat
 @ cdecl Ellipse(ptr long long long long) X11DRV_Ellipse
 @ cdecl EnumDeviceFonts(ptr ptr ptr long) X11DRV_EnumDeviceFonts
+@ cdecl EnumICMProfiles(ptr ptr long) X11DRV_EnumICMProfiles
 @ cdecl ExtEscape(ptr long long ptr long ptr) X11DRV_ExtEscape
 @ cdecl ExtFloodFill(ptr long long long long) X11DRV_ExtFloodFill
 @ cdecl ExtTextOut(ptr long long long ptr ptr long ptr) X11DRV_ExtTextOut

Modified: branches/arwinss/reactos/dll/win32/winex11.drv/x11drv.h
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex11.drv/x11drv.h?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/winex11.drv/x11drv.h [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winex11.drv/x11drv.h [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -502,6 +502,7 @@
 
 extern COLORREF X11DRV_PALETTE_ToLogical(X11DRV_PDEVICE *physDev, int pixel);
 extern int X11DRV_PALETTE_ToPhysical(X11DRV_PDEVICE *physDev, COLORREF color);
+extern COLORREF X11DRV_PALETTE_GetColor( X11DRV_PDEVICE *physDev, COLORREF color );
 extern int X11DRV_PALETTE_LookupPixel(ColorShifts *shifts, COLORREF color);
 extern void X11DRV_PALETTE_ComputeColorShifts(ColorShifts *shifts, unsigned long redMask, unsigned long greenMask, unsigned long blueMask);
 
@@ -596,6 +597,8 @@
 extern int use_xkb;
 extern int use_take_focus;
 extern int use_primary_selection;
+extern int use_system_cursors;
+extern int show_systray;
 extern int usexcomposite;
 extern int managed_mode;
 extern int decorated_mode;
@@ -617,6 +620,7 @@
     XATOM_CLIPBOARD = FIRST_XATOM,
     XATOM_COMPOUND_TEXT,
     XATOM_INCR,
+    XATOM_MANAGER,
     XATOM_MULTIPLE,
     XATOM_SELECTION_DATA,
     XATOM_TARGETS,
@@ -658,6 +662,7 @@
     XATOM__NET_WM_WINDOW_TYPE_NORMAL,
     XATOM__NET_WM_WINDOW_TYPE_UTILITY,
     XATOM__NET_WORKAREA,
+    XATOM__XEMBED,
     XATOM__XEMBED_INFO,
     XATOM_XdndAware,
     XATOM_XdndEnter,
@@ -688,6 +693,7 @@
 };
 
 extern Atom X11DRV_Atoms[NB_XATOMS - FIRST_XATOM];
+extern Atom systray_atom;
 
 #define x11drv_atom(name) (X11DRV_Atoms[XATOM_##name - FIRST_XATOM])
 
@@ -756,6 +762,7 @@
     BOOL        shaped : 1;     /* is window using a custom region shape? */
     int         wm_state;       /* current value of the WM_STATE property */
     DWORD       net_wm_state;   /* bit mask of active x11drv_net_wm_state values */
+    Window      embedder;       /* window id of embedder */
     unsigned long configure_serial; /* serial number of last configure request */
     HBITMAP     hWMIconBitmap;
     HBITMAP     hWMIconMask;
@@ -776,6 +783,8 @@
 extern void update_user_time( Time time );
 extern void update_net_wm_states( Display *display, struct x11drv_win_data *data );
 extern void make_window_embedded( Display *display, struct x11drv_win_data *data );
+extern void change_systray_owner( Display *display, Window systray_window );
+extern HWND create_foreign_window( Display *display, Window window );
 
 static inline void mirror_rect( const RECT *window_rect, RECT *rect )
 {
@@ -798,7 +807,7 @@
 extern void X11DRV_InitKeyboard( Display *display );
 extern void X11DRV_send_keyboard_input( WORD wVk, WORD wScan, DWORD dwFlags, DWORD time,
                                         DWORD dwExtraInfo, UINT injected_flags );
-extern void X11DRV_send_mouse_input( HWND hwnd, DWORD flags, DWORD x, DWORD y,
+extern void X11DRV_send_mouse_input( HWND top_hwnd, HWND cursor_hwnd, DWORD flags, DWORD x, DWORD y,
                                      DWORD data, DWORD time, DWORD extra_info, UINT injected_flags );
 extern DWORD CDECL X11DRV_MsgWaitForMultipleObjectsEx( DWORD count, const HANDLE *handles, DWORD timeout,
                                                        DWORD mask, DWORD flags );

Modified: branches/arwinss/reactos/dll/win32/winex11.drv/x11drv_main.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/dll/win32/winex11.drv/x11drv_main.c?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/dll/win32/winex11.drv/x11drv_main.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/dll/win32/winex11.drv/x11drv_main.c [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -83,6 +83,8 @@
 int use_xkb = 1;
 int use_take_focus = 1;
 int use_primary_selection = 0;
+int use_system_cursors = 1;
+int show_systray = 1;
 int managed_mode = 1;
 int decorated_mode = 1;
 int private_color_map = 0;
@@ -118,6 +120,7 @@
     "CLIPBOARD",
     "COMPOUND_TEXT",
     "INCR",
+    "MANAGER",
     "MULTIPLE",
     "SELECTION_DATA",
     "TARGETS",
@@ -159,6 +162,7 @@
     "_NET_WM_WINDOW_TYPE_NORMAL",
     "_NET_WM_WINDOW_TYPE_UTILITY",
     "_NET_WORKAREA",
+    "_XEMBED",
     "_XEMBED_INFO",
     "XdndAware",
     "XdndEnter",
@@ -397,6 +401,12 @@
     if (!get_config_key( hkey, appkey, "UsePrimarySelection", buffer, sizeof(buffer) ))
         use_primary_selection = IS_OPTION_TRUE( buffer[0] );
 
+    if (!get_config_key( hkey, appkey, "UseSystemCursors", buffer, sizeof(buffer) ))
+        use_system_cursors = IS_OPTION_TRUE( buffer[0] );
+
+    if (!get_config_key( hkey, appkey, "ShowSystray", buffer, sizeof(buffer) ))
+        show_systray = IS_OPTION_TRUE( buffer[0] );
+
     screen_depth = 0;
     if (!get_config_key( hkey, appkey, "ScreenDepth", buffer, sizeof(buffer) ))
         screen_depth = atoi(buffer);

Propchange: branches/arwinss/reactos/subsystems/win32/win32k/wine/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 23 22:12:41 2010
@@ -1,3 +1,3 @@
 /branches/ros-amd64-bringup/reactos/subsystems/win32/win32k/wine:35746,35789,36614,36930,38148,38151,38265,38268,39333,39345,40991,41000,41027-41028,41050,41052,41082-41086,41549,43080
 /trunk/reactos/subsystems/win32/win32k/wine:42000-43126,43669-44999,45011,45097-45099,45319,45418-45419,45535-45539,45687-45688,47605,48678
-/vendor/wine/server/current:43708,44715,45044,45206,45646,45910,46314,46696,47274,47321,47798,49173
+/vendor/wine/server/current:43708,44715,45044,45206,45646,45910,46314,46696,47274,47321,47798,49173,49721

Modified: branches/arwinss/reactos/subsystems/win32/win32k/wine/window.c
URL: http://svn.reactos.org/svn/reactos/branches/arwinss/reactos/subsystems/win32/win32k/wine/window.c?rev=49760&r1=49759&r2=49760&view=diff
==============================================================================
--- branches/arwinss/reactos/subsystems/win32/win32k/wine/window.c [iso-8859-1] (original)
+++ branches/arwinss/reactos/subsystems/win32/win32k/wine/window.c [iso-8859-1] Tue Nov 23 22:12:41 2010
@@ -564,9 +564,13 @@
 
     if (!win) return 0;
 
-    /* set last active for window and its owner */
-    win->last_active = win->handle;
-    if ((owner = get_user_object( win->owner, USER_WINDOW ))) owner->last_active = win->handle;
+    /* set last active for window and its owners */
+    owner = win;
+    while (owner)
+    {
+        owner->last_active = win->handle;
+        owner = get_user_object( owner->owner, USER_WINDOW );
+    }
     return 1;
 }
 

Propchange: branches/arwinss/reactos/subsystems/win32/win32k/wine/window.c
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Nov 23 22:12:41 2010
@@ -1,3 +1,3 @@
 /branches/ros-amd64-bringup/reactos/subsystems/win32/win32k/wine/window.c:35746,35789,36614,36930,38148,38151,38265,38268,39333,39345,40991,41000,41027-41028,41050,41052,41082-41086,41549,43080
 /trunk/reactos/subsystems/win32/win32k/wine/window.c:42000-43126,43669-44999,45011,45097-45099,45319,45418-45419,45535-45539,45687-45688,47605,48678
-/vendor/wine/server/current/window.c:43708,44715,45044,45206,45646,45910,46314,46696,47274,47321,47798,48677,49173
+/vendor/wine/server/current/window.c:43708,44715,45044,45206,45646,45910,46314,46696,47274,47321,47798,48677,49173,49721




More information about the Ros-diffs mailing list