From: Jacek Caban jacek@codeweavers.com
Signed-off-by: Jacek Caban jacek@codeweavers.com --- dlls/user32/class.c | 4 ++++ dlls/user32/win.c | 20 ++++---------------- dlls/win32u/sysparams.c | 8 ++++++++ dlls/win32u/win32u_private.h | 1 + dlls/win32u/window.c | 1 + include/ntuser.h | 12 ++++++++++++ 6 files changed, 30 insertions(+), 16 deletions(-)
diff --git a/dlls/user32/class.c b/dlls/user32/class.c index 620477f1b14..76e2688bb82 100644 --- a/dlls/user32/class.c +++ b/dlls/user32/class.c @@ -309,6 +309,8 @@ static void load_uxtheme(void) */ BOOL WINAPI User32RegisterBuiltinClasses( const struct win_hook_params *params, ULONG size ) { + DWORD layout; + register_builtin( &BUTTON_builtin_class ); register_builtin( &COMBO_builtin_class ); register_builtin( &COMBOLBOX_builtin_class ); @@ -322,6 +324,8 @@ BOOL WINAPI User32RegisterBuiltinClasses( const struct win_hook_params *params, register_builtin( &STATIC_builtin_class ); register_builtin( &IME_builtin_class );
+ GetProcessDefaultLayout( &layout ); /* make sure that process layout is initialized */ + /* Load uxtheme.dll so that standard scrollbars and dialogs are hooked for theming support */ load_uxtheme(); return TRUE; diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 99753791f09..9d19376fe44 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -36,8 +36,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(win);
-static DWORD process_layout = ~0u; -
/*********************************************************************** * get_user_handle_ptr @@ -626,15 +624,6 @@ HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module, } }
- /* FIXME: move to win32u */ - if (!cs->hwndParent && className != (const WCHAR *)DESKTOP_CLASS_ATOM && - (IS_INTRESOURCE(className) || wcsicmp( className, L"Message" ))) - { - DWORD layout; - GetProcessDefaultLayout( &layout ); - if (layout & LAYOUT_RTL) cs->dwExStyle |= WS_EX_LAYOUTRTL; - } - menu = cs->hMenu; if (!menu && info.lpszMenuName && (cs->style & (WS_CHILD | WS_POPUP)) != WS_CHILD) menu = LoadMenuW( cs->hInstance, info.lpszMenuName ); @@ -1610,7 +1599,8 @@ BOOL WINAPI GetProcessDefaultLayout( DWORD *layout ) SetLastError( ERROR_NOACCESS ); return FALSE; } - if (process_layout == ~0u) + *layout = NtUserGetProcessDefaultLayout(); + if (*layout == ~0u) { WCHAR *str, buffer[MAX_PATH]; DWORD i, version_layout = 0; @@ -1640,9 +1630,8 @@ BOOL WINAPI GetProcessDefaultLayout( DWORD *layout )
done: HeapFree( GetProcessHeap(), 0, data ); - process_layout = version_layout; + NtUserSetProcessDefaultLayout( *layout = version_layout ); } - *layout = process_layout; return TRUE; }
@@ -1654,8 +1643,7 @@ BOOL WINAPI GetProcessDefaultLayout( DWORD *layout ) */ BOOL WINAPI SetProcessDefaultLayout( DWORD layout ) { - process_layout = layout; - return TRUE; + return NtUserSetProcessDefaultLayout( layout ); }
#ifdef _WIN64 diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index 1c1d9ddc621..d4ab352ccbd 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -360,6 +360,7 @@ union sysparam_all_entry
static UINT system_dpi; static RECT work_area; +DWORD process_layout = ~0u;
static HDC display_dc; static pthread_mutex_t display_dc_lock = PTHREAD_MUTEX_INITIALIZER; @@ -4714,6 +4715,9 @@ ULONG_PTR WINAPI NtUserCallNoParam( ULONG code ) case NtUserCallNoParam_GetInputState: return get_input_state();
+ case NtUserCallNoParam_GetProcessDefaultLayout: + return process_layout; + case NtUserCallNoParam_ReleaseCapture: return release_capture();
@@ -4805,6 +4809,10 @@ ULONG_PTR WINAPI NtUserCallOneParam( ULONG_PTR arg, ULONG code ) case NtUserCallOneParam_SetCaretBlinkTime: return set_caret_blink_time( arg );
+ case NtUserCallOneParam_SetProcessDefaultLayout: + process_layout = arg; + return TRUE; + /* temporary exports */ case NtUserCallHooks: { diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index d1bc382f031..23343c413dc 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -424,6 +424,7 @@ extern LRESULT send_message_timeout( HWND hwnd, UINT msg, WPARAM wparam, LPARAM
/* sysparams.c */ extern BOOL enable_thunk_lock DECLSPEC_HIDDEN; +extern DWORD process_layout DECLSPEC_HIDDEN; extern HBRUSH get_55aa_brush(void) DECLSPEC_HIDDEN; extern DWORD get_dialog_base_units(void) DECLSPEC_HIDDEN; extern LONG get_char_dimensions( HDC hdc, TEXTMETRICW *metric, LONG *height ) DECLSPEC_HIDDEN; diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index 5575b9a0381..431686bdcaa 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -5126,6 +5126,7 @@ HWND WINAPI NtUserCreateWindowEx( DWORD ex_style, UNICODE_STRING *class_name, (class_name->Length != sizeof(messageW) || wcsnicmp( class_name->Buffer, messageW, ARRAYSIZE(messageW) ))) { + if (process_layout & LAYOUT_RTL) cs.dwExStyle |= WS_EX_LAYOUTRTL; parent = get_desktop_window(); } } diff --git a/include/ntuser.h b/include/ntuser.h index cf8a909493b..1f3cc2f2e7e 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -725,6 +725,7 @@ enum NtUserCallNoParam_GetDesktopWindow, NtUserCallNoParam_GetDialogBaseUnits, NtUserCallNoParam_GetInputState, + NtUserCallNoParam_GetProcessDefaultLayout, NtUserCallNoParam_ReleaseCapture, /* temporary exports */ NtUserExitingThread, @@ -751,6 +752,11 @@ static inline BOOL NtUserGetInputState(void) return NtUserCallNoParam( NtUserCallNoParam_GetInputState ); }
+static inline DWORD NtUserGetProcessDefaultLayout(void) +{ + return NtUserCallNoParam( NtUserCallNoParam_GetProcessDefaultLayout ); +} + static inline BOOL NtUserReleaseCapture(void) { return NtUserCallNoParam( NtUserCallNoParam_ReleaseCapture ); @@ -780,6 +786,7 @@ enum NtUserCallOneParam_MessageBeep, NtUserCallOneParam_RealizePalette, NtUserCallOneParam_SetCaretBlinkTime, + NtUserCallOneParam_SetProcessDefaultLayout, /* temporary exports */ NtUserCallHooks, NtUserGetDeskPattern, @@ -898,6 +905,11 @@ static inline UINT NtUserRealizePalette( HDC hdc ) return NtUserCallOneParam( HandleToUlong(hdc), NtUserCallOneParam_RealizePalette ); }
+static inline UINT NtUserSetProcessDefaultLayout( DWORD layout ) +{ + return NtUserCallOneParam( layout, NtUserCallOneParam_SetProcessDefaultLayout ); +} + /* NtUserCallTwoParam codes, not compatible with Windows */ enum {