https://git.reactos.org/?p=reactos.git;a=commitdiff;h=123a7c80e0cc5f0d5736ab39464823473aa8a6a6

commit 123a7c80e0cc5f0d5736ab39464823473aa8a6a6
Author:     Baruch Rutman <[email protected]>
AuthorDate: Sat Oct 20 11:53:14 2018 +0300
Commit:     Hermès Bélusca-Maïto <[email protected]>
CommitDate: Sun Jan 6 04:35:51 2019 +0100

    [NTUSER] Fix SetProcessDefaultLayout() (#1013)
    
    - Add a check in co_UserCreateWindowEx() for parentless windows,
      that checks the default layout direction; if it's LAYOUT_RTL
      add the WS_EX_LAYOUTRTL flag to the extended window styles.
    
    - Make the internal routine accepting also LAYOUT_LTR as a value for 
SetProcessDefaultLayout().
      Limit receiving value to LAYOUT_ORIENTATIONMASK (and not just LAYOUT_RTL)
      or LAYOUT_LTR, as per written in:
      
https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-setprocessdefaultlayout
    
    Now all the applications that call SetProcessDefaultLayout() to mirror the 
layout get mirrored.
    This is based on Wine.
---
 win32ss/user/ntuser/simplecall.c |  2 +-
 win32ss/user/ntuser/window.c     | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/win32ss/user/ntuser/simplecall.c b/win32ss/user/ntuser/simplecall.c
index 179d58bcde..67377de4a8 100644
--- a/win32ss/user/ntuser/simplecall.c
+++ b/win32ss/user/ntuser/simplecall.c
@@ -342,7 +342,7 @@ NtUserCallOneParam(
         case ONEPARAM_ROUTINE_SETPROCDEFLAYOUT:
         {
             PPROCESSINFO ppi;
-            if (Param & LAYOUT_ORIENTATIONMASK)
+            if (Param & LAYOUT_ORIENTATIONMASK || Param == LAYOUT_LTR)
             {
                 ppi = PsGetCurrentProcessWin32Process();
                 ppi->dwLayout = Param;
diff --git a/win32ss/user/ntuser/window.c b/win32ss/user/ntuser/window.c
index 7d6ac87155..a557c4d338 100644
--- a/win32ss/user/ntuser/window.c
+++ b/win32ss/user/ntuser/window.c
@@ -2017,6 +2017,16 @@ co_UserCreateWindowEx(CREATESTRUCTW* Cs,
          EngSetLastError(ERROR_TLW_WITH_WSCHILD);
          goto cleanup;  /* WS_CHILD needs a parent, but WS_POPUP doesn't */
     }
+    else if (Cs->lpszClass != 
(LPCWSTR)MAKEINTATOM(gpsi->atomSysClass[ICLS_DESKTOP]) &&
+             (IS_INTRESOURCE(Cs->lpszClass) ||
+              Cs->lpszClass != 
(LPCWSTR)MAKEINTATOM(gpsi->atomSysClass[ICLS_HWNDMESSAGE]) ||
+              _wcsicmp(Cs->lpszClass, L"Message") != 0))
+    {
+        if (pti->ppi->dwLayout & LAYOUT_RTL)
+        {
+            Cs->dwExStyle |= WS_EX_LAYOUTRTL;
+        }
+    }
 
     ParentWindow = hWndParent ? UserGetWindowObject(hWndParent): NULL;
     OwnerWindow = hWndOwner ? UserGetWindowObject(hWndOwner): NULL;

Reply via email to