Alexandre Julliard : user32: Implement Get/SetProcessDefaultLayout.

Alexandre Julliard julliard at winehq.org
Thu Sep 2 12:01:25 CDT 2010


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Sep  2 18:01:01 2010 +0200

user32: Implement Get/SetProcessDefaultLayout.

---

 dlls/user32/misc.c      |   48 -----------------------------------------------
 dlls/user32/tests/win.c |   41 ++++++++++++++++++++++++++++++++++++++++
 dlls/user32/win.c       |   33 ++++++++++++++++++++++++++++++++
 3 files changed, 74 insertions(+), 48 deletions(-)

diff --git a/dlls/user32/misc.c b/dlls/user32/misc.c
index d5a23d1..4b38dd2 100644
--- a/dlls/user32/misc.c
+++ b/dlls/user32/misc.c
@@ -199,54 +199,6 @@ VOID WINAPI SetDebugErrorLevel( DWORD dwLevel )
 }
 
 
-/******************************************************************************
- *                    GetProcessDefaultLayout [USER32.@]
- *
- * Gets the default layout for parentless windows.
- * Right now, just returns 0 (left-to-right).
- *
- * RETURNS
- *    Success: Nonzero
- *    Failure: Zero
- *
- * BUGS
- *    No RTL
- */
-BOOL WINAPI GetProcessDefaultLayout( DWORD *pdwDefaultLayout )
-{
-    if ( !pdwDefaultLayout ) {
-        SetLastError( ERROR_INVALID_PARAMETER );
-        return FALSE;
-     }
-    FIXME( "( %p ): No BiDi\n", pdwDefaultLayout );
-    *pdwDefaultLayout = 0;
-    return TRUE;
-}
-
-
-/******************************************************************************
- *                    SetProcessDefaultLayout [USER32.@]
- *
- * Sets the default layout for parentless windows.
- * Right now, only accepts 0 (left-to-right).
- *
- * RETURNS
- *    Success: Nonzero
- *    Failure: Zero
- *
- * BUGS
- *    No RTL
- */
-BOOL WINAPI SetProcessDefaultLayout( DWORD dwDefaultLayout )
-{
-    if ( dwDefaultLayout == 0 )
-        return TRUE;
-    FIXME( "( %08x ): No BiDi\n", dwDefaultLayout );
-    SetLastError( ERROR_CALL_NOT_IMPLEMENTED );
-    return FALSE;
-}
-
-
 /***********************************************************************
  *		SetWindowStationUser (USER32.@)
  */
diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c
index 057e3fc..02d4e7f 100644
--- a/dlls/user32/tests/win.c
+++ b/dlls/user32/tests/win.c
@@ -53,6 +53,8 @@ static BOOL (WINAPI *pGetMonitorInfoA)(HMONITOR,LPMONITORINFO);
 static HMONITOR (WINAPI *pMonitorFromPoint)(POINT,DWORD);
 static int  (WINAPI *pGetWindowRgnBox)(HWND,LPRECT);
 static BOOL (WINAPI *pGetGUIThreadInfo)(DWORD, GUITHREADINFO*);
+static BOOL (WINAPI *pGetProcessDefaultLayout)( DWORD *layout );
+static BOOL (WINAPI *pSetProcessDefaultLayout)( DWORD layout );
 static DWORD (WINAPI *pSetLayout)(HDC hdc, DWORD layout);
 static DWORD (WINAPI *pGetLayout)(HDC hdc);
 
@@ -4853,6 +4855,43 @@ static void test_CreateWindow(void)
             ok( hwnd != 0, "creation failed err %u\n", GetLastError());
             expect_ex_style( hwnd, 0 );
             DestroyWindow( hwnd );
+
+            if (pGetProcessDefaultLayout && pSetProcessDefaultLayout)
+            {
+                DWORD layout;
+
+                SetLastError( 0xdeadbeef );
+                ok( !pGetProcessDefaultLayout( NULL ), "GetProcessDefaultLayout succeeded\n" );
+                ok( GetLastError() == ERROR_NOACCESS, "wrong error %u\n", GetLastError() );
+                SetLastError( 0xdeadbeef );
+                ok( pGetProcessDefaultLayout( &layout ),
+                    "GetProcessDefaultLayout failed err %u\n", GetLastError ());
+                ok( layout == 0, "GetProcessDefaultLayout wrong layout %x\n", layout );
+                SetLastError( 0xdeadbeef );
+                ok( pSetProcessDefaultLayout( 7 ),
+                    "SetProcessDefaultLayout failed err %u\n", GetLastError ());
+                ok( pGetProcessDefaultLayout( &layout ),
+                    "GetProcessDefaultLayout failed err %u\n", GetLastError ());
+                ok( layout == 7, "GetProcessDefaultLayout wrong layout %x\n", layout );
+                SetLastError( 0xdeadbeef );
+                ok( pSetProcessDefaultLayout( LAYOUT_RTL ),
+                    "SetProcessDefaultLayout failed err %u\n", GetLastError ());
+                ok( pGetProcessDefaultLayout( &layout ),
+                    "GetProcessDefaultLayout failed err %u\n", GetLastError ());
+                ok( layout == LAYOUT_RTL, "GetProcessDefaultLayout wrong layout %x\n", layout );
+                hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_POPUP,
+                                      0, 0, 100, 100, 0, 0, 0, NULL);
+                ok( hwnd != 0, "creation failed err %u\n", GetLastError());
+                expect_ex_style( hwnd, WS_EX_APPWINDOW | WS_EX_LAYOUTRTL );
+                DestroyWindow( hwnd );
+                hwnd = CreateWindowEx(WS_EX_APPWINDOW, "static", NULL, WS_POPUP,
+                                      0, 0, 100, 100, parent, 0, 0, NULL);
+                ok( hwnd != 0, "creation failed err %u\n", GetLastError());
+                expect_ex_style( hwnd, WS_EX_APPWINDOW );
+                DestroyWindow( hwnd );
+                pSetProcessDefaultLayout( 0 );
+            }
+            else win_skip( "SetProcessDefaultLayout not supported\n" );
         }
         else win_skip( "SetLayout not supported\n" );
     }
@@ -6086,6 +6125,8 @@ START_TEST(win)
     pMonitorFromPoint = (void *)GetProcAddress( user32,  "MonitorFromPoint" );
     pGetWindowRgnBox = (void *)GetProcAddress( user32, "GetWindowRgnBox" );
     pGetGUIThreadInfo = (void *)GetProcAddress( user32, "GetGUIThreadInfo" );
+    pGetProcessDefaultLayout = (void *)GetProcAddress( user32, "GetProcessDefaultLayout" );
+    pSetProcessDefaultLayout = (void *)GetProcAddress( user32, "SetProcessDefaultLayout" );
     pGetLayout = (void *)GetProcAddress( gdi32, "GetLayout" );
     pSetLayout = (void *)GetProcAddress( gdi32, "SetLayout" );
 
diff --git a/dlls/user32/win.c b/dlls/user32/win.c
index e03ce46..bbc7fc2 100644
--- a/dlls/user32/win.c
+++ b/dlls/user32/win.c
@@ -40,6 +40,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(win);
 #define NB_USER_HANDLES  ((LAST_USER_HANDLE - FIRST_USER_HANDLE + 1) >> 1)
 #define USER_HANDLE_TO_INDEX(hwnd) ((LOWORD(hwnd) - FIRST_USER_HANDLE) >> 1)
 
+static DWORD process_layout;
+
 /**********************************************************************/
 
 /* helper for Get/SetWindowLong */
@@ -1199,6 +1201,7 @@ HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module,
         if (className != (LPCWSTR)DESKTOP_CLASS_ATOM &&
             (IS_INTRESOURCE(className) || strcmpiW( className, messageW )))
             parent = GetDesktopWindow();
+        if (process_layout & LAYOUT_RTL) cs->dwExStyle |= WS_EX_LAYOUTRTL;
     }
 
     WIN_FixCoordinates(cs, &sw); /* fix default coordinates */
@@ -3484,6 +3487,36 @@ BOOL WINAPI UpdateLayeredWindow( HWND hwnd, HDC hdcDst, POINT *pptDst, SIZE *psi
     return UpdateLayeredWindowIndirect( hwnd, &info );
 }
 
+
+/******************************************************************************
+ *                    GetProcessDefaultLayout [USER32.@]
+ *
+ * Gets the default layout for parentless windows.
+ */
+BOOL WINAPI GetProcessDefaultLayout( DWORD *layout )
+{
+    if (!layout)
+    {
+        SetLastError( ERROR_NOACCESS );
+        return FALSE;
+    }
+    *layout = process_layout;
+    return TRUE;
+}
+
+
+/******************************************************************************
+ *                    SetProcessDefaultLayout [USER32.@]
+ *
+ * Sets the default layout for parentless windows.
+ */
+BOOL WINAPI SetProcessDefaultLayout( DWORD layout )
+{
+    process_layout = layout;
+    return TRUE;
+}
+
+
 /* 64bit versions */
 
 #ifdef GetWindowLongPtrW




More information about the wine-cvs mailing list