From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/sysparams.c | 44 +++-------------------------------------- dlls/user32/win.h | 7 ------- 2 files changed, 3 insertions(+), 48 deletions(-)
diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index 36b166c627c..46b85c0b102 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -672,29 +672,16 @@ BOOL WINAPI EnumDisplaySettingsExW( const WCHAR *device, DWORD mode, /********************************************************************** * get_win_monitor_dpi */ -UINT get_win_monitor_dpi( HWND hwnd ) +static UINT get_win_monitor_dpi( HWND hwnd ) { /* FIXME: use the monitor DPI instead */ return system_dpi; }
-/********************************************************************** - * get_thread_dpi - */ -UINT get_thread_dpi(void) -{ - switch (GetAwarenessFromDpiAwarenessContext( GetThreadDpiAwarenessContext() )) - { - case DPI_AWARENESS_UNAWARE: return USER_DEFAULT_SCREEN_DPI; - case DPI_AWARENESS_SYSTEM_AWARE: return system_dpi; - default: return 0; /* no scaling */ - } -} - /********************************************************************** * map_dpi_point */ -POINT map_dpi_point( POINT pt, UINT dpi_from, UINT dpi_to ) +static POINT map_dpi_point( POINT pt, UINT dpi_from, UINT dpi_to ) { if (dpi_from && dpi_to && dpi_from != dpi_to) { @@ -707,7 +694,7 @@ POINT map_dpi_point( POINT pt, UINT dpi_from, UINT dpi_to ) /********************************************************************** * point_win_to_phys_dpi */ -POINT point_win_to_phys_dpi( HWND hwnd, POINT pt ) +static POINT point_win_to_phys_dpi( HWND hwnd, POINT pt ) { return map_dpi_point( pt, GetDpiForWindow( hwnd ), get_win_monitor_dpi( hwnd ) ); } @@ -720,31 +707,6 @@ static POINT point_phys_to_win_dpi( HWND hwnd, POINT pt ) return map_dpi_point( pt, get_win_monitor_dpi( hwnd ), GetDpiForWindow( hwnd )); }
-/********************************************************************** - * map_dpi_rect - */ -RECT map_dpi_rect( RECT rect, UINT dpi_from, UINT dpi_to ) -{ - if (dpi_from && dpi_to && dpi_from != dpi_to) - { - rect.left = MulDiv( rect.left, dpi_to, dpi_from ); - rect.top = MulDiv( rect.top, dpi_to, dpi_from ); - rect.right = MulDiv( rect.right, dpi_to, dpi_from ); - rect.bottom = MulDiv( rect.bottom, dpi_to, dpi_from ); - } - return rect; -} - -/********************************************************************** - * rect_win_to_thread_dpi - */ -RECT rect_win_to_thread_dpi( HWND hwnd, RECT rect ) -{ - UINT dpi = get_thread_dpi(); - if (!dpi) dpi = get_win_monitor_dpi( hwnd ); - return map_dpi_rect( rect, GetDpiForWindow( hwnd ), dpi ); -} - /********************************************************************** * SetProcessDpiAwarenessContext (USER32.@) */ diff --git a/dlls/user32/win.h b/dlls/user32/win.h index ffd4f37d5f0..9c61d5ce0a3 100644 --- a/dlls/user32/win.h +++ b/dlls/user32/win.h @@ -37,13 +37,6 @@ extern HDESK open_winstation_desktop( HWINSTA hwinsta, LPCWSTR name, DWORD flags
extern void WINPOS_ActivateOtherWindow( HWND hwnd ) DECLSPEC_HIDDEN;
-extern UINT get_win_monitor_dpi( HWND hwnd ) DECLSPEC_HIDDEN; -extern UINT get_thread_dpi(void) DECLSPEC_HIDDEN; -extern POINT map_dpi_point( POINT pt, UINT dpi_from, UINT dpi_to ) DECLSPEC_HIDDEN; -extern POINT point_win_to_phys_dpi( HWND hwnd, POINT pt ) DECLSPEC_HIDDEN; -extern RECT map_dpi_rect( RECT rect, UINT dpi_from, UINT dpi_to ) DECLSPEC_HIDDEN; -extern RECT rect_win_to_thread_dpi( HWND hwnd, RECT rect ) DECLSPEC_HIDDEN; - static inline void mirror_rect( const RECT *window_rect, RECT *rect ) { int width = window_rect->right - window_rect->left;
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/sysparams.c | 21 --------------------- dlls/user32/user32.spec | 2 +- dlls/win32u/syscall.c | 1 + dlls/win32u/sysparams.c | 21 +++++++++++++++++++++ dlls/win32u/win32u.spec | 2 +- dlls/wow64win/syscall.h | 1 + dlls/wow64win/user.c | 8 ++++++++ include/ntuser.h | 1 + 8 files changed, 34 insertions(+), 23 deletions(-)
diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index 46b85c0b102..285d7828c63 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -691,14 +691,6 @@ static POINT map_dpi_point( POINT pt, UINT dpi_from, UINT dpi_to ) return pt; }
-/********************************************************************** - * point_win_to_phys_dpi - */ -static POINT point_win_to_phys_dpi( HWND hwnd, POINT pt ) -{ - return map_dpi_point( pt, GetDpiForWindow( hwnd ), get_win_monitor_dpi( hwnd ) ); -} - /********************************************************************** * point_phys_to_win_dpi */ @@ -879,19 +871,6 @@ DPI_AWARENESS_CONTEXT WINAPI SetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT return ULongToHandle( prev ); }
-/********************************************************************** - * LogicalToPhysicalPointForPerMonitorDPI (USER32.@) - */ -BOOL WINAPI LogicalToPhysicalPointForPerMonitorDPI( HWND hwnd, POINT *pt ) -{ - RECT rect; - - if (!GetWindowRect( hwnd, &rect )) return FALSE; - if (pt->x < rect.left || pt->y < rect.top || pt->x > rect.right || pt->y > rect.bottom) return FALSE; - *pt = point_win_to_phys_dpi( hwnd, *pt ); - return TRUE; -} - /********************************************************************** * PhysicalToLogicalPointForPerMonitorDPI (USER32.@) */ diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index 800dc4a9240..3a822aa380d 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -513,7 +513,7 @@ @ stdcall LockWindowUpdate(long) NtUserLockWindowUpdate @ stdcall LockWorkStation() @ stdcall LogicalToPhysicalPoint(long ptr) -@ stdcall LogicalToPhysicalPointForPerMonitorDPI(long ptr) +@ stdcall LogicalToPhysicalPointForPerMonitorDPI(long ptr) NtUserLogicalToPerMonitorDPIPhysicalPoint @ stdcall LookupIconIdFromDirectory(ptr long) @ stdcall LookupIconIdFromDirectoryEx(ptr long long long long) @ stub MBToWCSEx diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index 5f78d8c6ab9..7212f6df0b0 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -218,6 +218,7 @@ static void * const syscalls[] = NtUserIsClipboardFormatAvailable, NtUserKillTimer, NtUserLockWindowUpdate, + NtUserLogicalToPerMonitorDPIPhysicalPoint, NtUserMapVirtualKeyEx, NtUserMenuItemFromPoint, NtUserMessageCall, diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index be68a2cff32..defcaeb7f0e 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -1720,6 +1720,14 @@ POINT map_dpi_point( POINT pt, UINT dpi_from, UINT dpi_to ) return pt; }
+/********************************************************************** + * point_win_to_phys_dpi + */ +static POINT point_win_to_phys_dpi( HWND hwnd, POINT pt ) +{ + return map_dpi_point( pt, get_dpi_for_window( hwnd ), get_win_monitor_dpi( hwnd ) ); +} + /********************************************************************** * point_phys_to_win_dpi */ @@ -2440,6 +2448,19 @@ BOOL WINAPI NtUserGetDpiForMonitor( HMONITOR monitor, UINT type, UINT *x, UINT * return TRUE; }
+/********************************************************************** + * LogicalToPhysicalPointForPerMonitorDPI (win32u.@) + */ +BOOL WINAPI NtUserLogicalToPerMonitorDPIPhysicalPoint( HWND hwnd, POINT *pt ) +{ + RECT rect; + + if (!get_window_rect( hwnd, &rect, get_thread_dpi() )) return FALSE; + if (pt->x < rect.left || pt->y < rect.top || pt->x > rect.right || pt->y > rect.bottom) return FALSE; + *pt = point_win_to_phys_dpi( hwnd, *pt ); + return TRUE; +} + /* retrieve the cached base keys for a given entry */ static BOOL get_base_keys( enum parameter_key index, HKEY *base_key, HKEY *volatile_key ) { diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index 3054bed8347..d1339af9dcc 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1067,7 +1067,7 @@ @ stub NtUserLockWindowStation @ stdcall -syscall NtUserLockWindowUpdate(long) @ stub NtUserLockWorkStation -@ stub NtUserLogicalToPerMonitorDPIPhysicalPoint +@ stdcall -syscall NtUserLogicalToPerMonitorDPIPhysicalPoint(long ptr) @ stub NtUserLogicalToPhysicalDpiPointForWindow @ stub NtUserLogicalToPhysicalPoint @ stub NtUserMNDragLeave diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h index 3c59dd00b3e..fb0c2c7de7e 100644 --- a/dlls/wow64win/syscall.h +++ b/dlls/wow64win/syscall.h @@ -204,6 +204,7 @@ SYSCALL_ENTRY( NtUserIsClipboardFormatAvailable ) \ SYSCALL_ENTRY( NtUserKillTimer ) \ SYSCALL_ENTRY( NtUserLockWindowUpdate ) \ + SYSCALL_ENTRY( NtUserLogicalToPerMonitorDPIPhysicalPoint ) \ SYSCALL_ENTRY( NtUserMapVirtualKeyEx ) \ SYSCALL_ENTRY( NtUserMenuItemFromPoint ) \ SYSCALL_ENTRY( NtUserMessageCall ) \ diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index 38024f50548..ca8a40000dd 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -2665,6 +2665,14 @@ NTSTATUS WINAPI wow64_NtUserLockWindowUpdate( UINT *args ) return NtUserLockWindowUpdate( hwnd ); }
+NTSTATUS WINAPI wow64_NtUserLogicalToPerMonitorDPIPhysicalPoint( UINT *args ) +{ + HWND hwnd = get_handle( &args ); + POINT *pt = get_ptr( &args ); + + return NtUserLogicalToPerMonitorDPIPhysicalPoint( hwnd, pt ); +} + NTSTATUS WINAPI wow64_NtUserMapVirtualKeyEx( UINT *args ) { UINT code = get_ulong( &args ); diff --git a/include/ntuser.h b/include/ntuser.h index 963b02dfd8c..f1f263af7b7 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -773,6 +773,7 @@ BOOL WINAPI NtUserInvalidateRect( HWND hwnd, const RECT *rect, BOOL erase ); BOOL WINAPI NtUserInvalidateRgn( HWND hwnd, HRGN hrgn, BOOL erase ); BOOL WINAPI NtUserKillTimer( HWND hwnd, UINT_PTR id ); BOOL WINAPI NtUserLockWindowUpdate( HWND hwnd ); +BOOL WINAPI NtUserLogicalToPerMonitorDPIPhysicalPoint( HWND hwnd, POINT *pt ); UINT WINAPI NtUserMapVirtualKeyEx( UINT code, UINT type, HKL layout ); INT WINAPI NtUserMenuItemFromPoint( HWND hwnd, HMENU handle, int x, int y ); LRESULT WINAPI NtUserMessageCall( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/sysparams.c | 50 ----------------------------------------- dlls/user32/user32.spec | 2 +- dlls/win32u/syscall.c | 1 + dlls/win32u/sysparams.c | 17 ++++++++++++++ dlls/win32u/win32u.spec | 2 +- dlls/wow64win/syscall.h | 1 + dlls/wow64win/user.c | 8 +++++++ include/ntuser.h | 1 + 8 files changed, 30 insertions(+), 52 deletions(-)
diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index 285d7828c63..3f87702f32d 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -669,36 +669,6 @@ BOOL WINAPI EnumDisplaySettingsExW( const WCHAR *device, DWORD mode, return NtUserEnumDisplaySettings( &str, mode, dev_mode, flags ); }
-/********************************************************************** - * get_win_monitor_dpi - */ -static UINT get_win_monitor_dpi( HWND hwnd ) -{ - /* FIXME: use the monitor DPI instead */ - return system_dpi; -} - -/********************************************************************** - * map_dpi_point - */ -static POINT map_dpi_point( POINT pt, UINT dpi_from, UINT dpi_to ) -{ - if (dpi_from && dpi_to && dpi_from != dpi_to) - { - pt.x = MulDiv( pt.x, dpi_to, dpi_from ); - pt.y = MulDiv( pt.y, dpi_to, dpi_from ); - } - return pt; -} - -/********************************************************************** - * point_phys_to_win_dpi - */ -static POINT point_phys_to_win_dpi( HWND hwnd, POINT pt ) -{ - return map_dpi_point( pt, get_win_monitor_dpi( hwnd ), GetDpiForWindow( hwnd )); -} - /********************************************************************** * SetProcessDpiAwarenessContext (USER32.@) */ @@ -871,26 +841,6 @@ DPI_AWARENESS_CONTEXT WINAPI SetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT return ULongToHandle( prev ); }
-/********************************************************************** - * PhysicalToLogicalPointForPerMonitorDPI (USER32.@) - */ -BOOL WINAPI PhysicalToLogicalPointForPerMonitorDPI( HWND hwnd, POINT *pt ) -{ - DPI_AWARENESS_CONTEXT context; - RECT rect; - BOOL ret = FALSE; - - context = SetThreadDpiAwarenessContext( DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE ); - if (GetWindowRect( hwnd, &rect ) && - pt->x >= rect.left && pt->y >= rect.top && pt->x <= rect.right && pt->y <= rect.bottom) - { - *pt = point_phys_to_win_dpi( hwnd, *pt ); - ret = TRUE; - } - SetThreadDpiAwarenessContext( context ); - return ret; -} - /*********************************************************************** * MonitorFromRect (USER32.@) */ diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index 3a822aa380d..1bf3ebdc90d 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -565,7 +565,7 @@ @ stdcall PeekMessageA(ptr long long long long) @ stdcall PeekMessageW(ptr long long long long) @ stdcall PhysicalToLogicalPoint(long ptr) -@ stdcall PhysicalToLogicalPointForPerMonitorDPI(long ptr) +@ stdcall PhysicalToLogicalPointForPerMonitorDPI(long ptr) NtUserPerMonitorDPIPhysicalToLogicalPoint @ stub PlaySoundEvent @ stdcall PostMessageA(long long long long) @ stdcall PostMessageW(long long long long) diff --git a/dlls/win32u/syscall.c b/dlls/win32u/syscall.c index 7212f6df0b0..f9e608ed0b7 100644 --- a/dlls/win32u/syscall.c +++ b/dlls/win32u/syscall.c @@ -230,6 +230,7 @@ static void * const syscalls[] = NtUserOpenInputDesktop, NtUserOpenWindowStation, NtUserPeekMessage, + NtUserPerMonitorDPIPhysicalToLogicalPoint, NtUserPostMessage, NtUserPostThreadMessage, NtUserQueryInputContext, diff --git a/dlls/win32u/sysparams.c b/dlls/win32u/sysparams.c index defcaeb7f0e..848b14dbcb3 100644 --- a/dlls/win32u/sysparams.c +++ b/dlls/win32u/sysparams.c @@ -2461,6 +2461,23 @@ BOOL WINAPI NtUserLogicalToPerMonitorDPIPhysicalPoint( HWND hwnd, POINT *pt ) return TRUE; }
+/********************************************************************** + * NtUserPerMonitorDPIPhysicalToLogicalPoint (win32u.@) + */ +BOOL WINAPI NtUserPerMonitorDPIPhysicalToLogicalPoint( HWND hwnd, POINT *pt ) +{ + RECT rect; + BOOL ret = FALSE; + + if (get_window_rect( hwnd, &rect, 0 ) && + pt->x >= rect.left && pt->y >= rect.top && pt->x <= rect.right && pt->y <= rect.bottom) + { + *pt = point_phys_to_win_dpi( hwnd, *pt ); + ret = TRUE; + } + return ret; +} + /* retrieve the cached base keys for a given entry */ static BOOL get_base_keys( enum parameter_key index, HKEY *base_key, HKEY *volatile_key ) { diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index d1339af9dcc..df722586ded 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1099,7 +1099,7 @@ @ stub NtUserPaintMenuBar @ stub NtUserPaintMonitor @ stdcall -syscall NtUserPeekMessage(ptr long long long long) -@ stub NtUserPerMonitorDPIPhysicalToLogicalPoint +@ stdcall -syscall NtUserPerMonitorDPIPhysicalToLogicalPoint(long ptr) @ stub NtUserPhysicalToLogicalDpiPointForWindow @ stub NtUserPhysicalToLogicalPoint @ stub NtUserPostKeyboardInputMessage diff --git a/dlls/wow64win/syscall.h b/dlls/wow64win/syscall.h index fb0c2c7de7e..009a457fe6e 100644 --- a/dlls/wow64win/syscall.h +++ b/dlls/wow64win/syscall.h @@ -216,6 +216,7 @@ SYSCALL_ENTRY( NtUserOpenInputDesktop ) \ SYSCALL_ENTRY( NtUserOpenWindowStation ) \ SYSCALL_ENTRY( NtUserPeekMessage ) \ + SYSCALL_ENTRY( NtUserPerMonitorDPIPhysicalToLogicalPoint ) \ SYSCALL_ENTRY( NtUserPostMessage ) \ SYSCALL_ENTRY( NtUserPostThreadMessage ) \ SYSCALL_ENTRY( NtUserQueryInputContext ) \ diff --git a/dlls/wow64win/user.c b/dlls/wow64win/user.c index ca8a40000dd..041285fa37f 100644 --- a/dlls/wow64win/user.c +++ b/dlls/wow64win/user.c @@ -3100,6 +3100,14 @@ NTSTATUS WINAPI wow64_NtUserPeekMessage( UINT *args ) return TRUE; }
+NTSTATUS WINAPI wow64_NtUserPerMonitorDPIPhysicalToLogicalPoint( UINT *args ) +{ + HWND hwnd = get_handle( &args ); + POINT *pt = get_ptr( &args ); + + return NtUserPerMonitorDPIPhysicalToLogicalPoint( hwnd, pt ); +} + NTSTATUS WINAPI wow64_NtUserPostMessage( UINT *args ) { HWND hwnd = get_handle( &args ); diff --git a/include/ntuser.h b/include/ntuser.h index f1f263af7b7..f7fa18ee983 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -788,6 +788,7 @@ BOOL WINAPI NtUserOpenClipboard( HWND hwnd, ULONG unk ); HDESK WINAPI NtUserOpenDesktop( OBJECT_ATTRIBUTES *attr, DWORD flags, ACCESS_MASK access ); HDESK WINAPI NtUserOpenInputDesktop( DWORD flags, BOOL inherit, ACCESS_MASK access ); BOOL WINAPI NtUserPeekMessage( MSG *msg_out, HWND hwnd, UINT first, UINT last, UINT flags ); +BOOL WINAPI NtUserPerMonitorDPIPhysicalToLogicalPoint( HWND hwnd, POINT *pt ); BOOL WINAPI NtUserPostMessage( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam ); BOOL WINAPI NtUserPostThreadMessage( DWORD thread, UINT msg, WPARAM wparam, LPARAM lparam ); UINT_PTR WINAPI NtUserQueryInputContext( HIMC handle, UINT attr );
From: Jacek Caban jacek@codeweavers.com
And use it instead of WINPOS_ActivateOtherWindow. --- dlls/user32/dialog.c | 2 +- dlls/user32/win.h | 2 -- dlls/user32/winpos.c | 62 -------------------------------------------- dlls/win32u/window.c | 4 +++ include/ntuser.h | 6 +++++ 5 files changed, 11 insertions(+), 65 deletions(-)
diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c index fc7ddb303ff..9773f67df13 100644 --- a/dlls/user32/dialog.c +++ b/dlls/user32/dialog.c @@ -949,7 +949,7 @@ BOOL WINAPI EndDialog( HWND hwnd, INT_PTR retval ) if (owner) SetForegroundWindow( owner ); else - WINPOS_ActivateOtherWindow( hwnd ); + NtUserActivateOtherWindow( hwnd ); }
/* unblock dialog loop */ diff --git a/dlls/user32/win.h b/dlls/user32/win.h index 9c61d5ce0a3..ae470739cbe 100644 --- a/dlls/user32/win.h +++ b/dlls/user32/win.h @@ -35,8 +35,6 @@ extern HWND *WIN_ListChildren( HWND hwnd ) DECLSPEC_HIDDEN; extern void MDI_CalcDefaultChildPos( HWND hwndClient, INT total, LPPOINT lpPos, INT delta, UINT *id ) DECLSPEC_HIDDEN; extern HDESK open_winstation_desktop( HWINSTA hwinsta, LPCWSTR name, DWORD flags, BOOL inherit, ACCESS_MASK access ) DECLSPEC_HIDDEN;
-extern void WINPOS_ActivateOtherWindow( HWND hwnd ) DECLSPEC_HIDDEN; - static inline void mirror_rect( const RECT *window_rect, RECT *rect ) { int width = window_rect->right - window_rect->left; diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c index f7f4e8bb427..97a2228d00c 100644 --- a/dlls/user32/winpos.c +++ b/dlls/user32/winpos.c @@ -242,68 +242,6 @@ BOOL WINAPI AnimateWindow(HWND hwnd, DWORD dwTime, DWORD dwFlags) }
-/******************************************************************* - * can_activate_window - * - * Check if we can activate the specified window. - */ -static BOOL can_activate_window( HWND hwnd ) -{ - LONG style; - - if (!hwnd) return FALSE; - style = GetWindowLongW( hwnd, GWL_STYLE ); - if (!(style & WS_VISIBLE)) return FALSE; - if ((style & (WS_POPUP|WS_CHILD)) == WS_CHILD) return FALSE; - return !(style & WS_DISABLED); -} - - -/******************************************************************* - * WINPOS_ActivateOtherWindow - * - * Activates window other than pWnd. - */ -void WINPOS_ActivateOtherWindow(HWND hwnd) -{ - HWND hwndTo, fg; - - if ((GetWindowLongW( hwnd, GWL_STYLE ) & WS_POPUP) && (hwndTo = GetWindow( hwnd, GW_OWNER ))) - { - hwndTo = NtUserGetAncestor( hwndTo, GA_ROOT ); - if (can_activate_window( hwndTo )) goto done; - } - - hwndTo = hwnd; - for (;;) - { - if (!(hwndTo = GetWindow( hwndTo, GW_HWNDNEXT ))) break; - if (can_activate_window( hwndTo )) goto done; - } - - hwndTo = GetTopWindow( 0 ); - for (;;) - { - if (hwndTo == hwnd) - { - hwndTo = 0; - break; - } - if (can_activate_window( hwndTo )) goto done; - if (!(hwndTo = GetWindow( hwndTo, GW_HWNDNEXT ))) break; - } - - done: - fg = NtUserGetForegroundWindow(); - TRACE("win = %p fg = %p\n", hwndTo, fg); - if (!fg || (hwnd == fg)) - { - if (SetForegroundWindow( hwndTo )) return; - } - if (!NtUserSetActiveWindow( hwndTo )) NtUserSetActiveWindow( 0 ); -} - - /*********************************************************************** * BeginDeferWindowPos (USER32.@) */ diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index d9c771e5d3d..d53dfde2fbb 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -5364,6 +5364,10 @@ ULONG_PTR WINAPI NtUserCallHwnd( HWND hwnd, DWORD code ) { switch (code) { + case NtUserCallHwnd_ActivateOtherWindow: + activate_other_window( hwnd ); + return 0; + case NtUserCallHwnd_ArrangeIconicWindows: return arrange_iconic_windows( hwnd );
diff --git a/include/ntuser.h b/include/ntuser.h index f7fa18ee983..961d34d4db6 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -1126,6 +1126,7 @@ static inline BOOL NtUserUnhookWindowsHook( INT id, HOOKPROC proc ) /* NtUserCallHwnd codes, not compatible with Windows */ enum { + NtUserCallHwnd_ActivateOtherWindow, NtUserCallHwnd_ArrangeIconicWindows, NtUserCallHwnd_DrawMenuBar, NtUserCallHwnd_GetDefaultImeWindow, @@ -1149,6 +1150,11 @@ enum NtUserIsCurrehtThreadWindow, };
+static inline void NtUserActivateOtherWindow( HWND hwnd ) +{ + NtUserCallHwnd( hwnd, NtUserCallHwnd_ActivateOtherWindow ); +} + static inline UINT NtUserArrangeIconicWindows( HWND parent ) { return NtUserCallHwnd( parent, NtUserCallHwnd_ArrangeIconicWindows );
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/win.c | 14 -------------- dlls/user32/win.h | 1 - 2 files changed, 15 deletions(-)
diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 7d873155c3b..6b40f25dd46 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -85,20 +85,6 @@ static HWND *list_window_children( HDESK desktop, HWND hwnd, UNICODE_STRING *cla }
-/******************************************************************* - * get_hwnd_message_parent - * - * Return the parent for HWND_MESSAGE windows. - */ -HWND get_hwnd_message_parent(void) -{ - struct ntuser_thread_info *thread_info = NtUserGetThreadInfo(); - - if (!thread_info->msg_window) GetDesktopWindow(); /* trigger creation */ - return UlongToHandle( thread_info->msg_window ); -} - - /******************************************************************* * is_desktop_window * diff --git a/dlls/user32/win.h b/dlls/user32/win.h index ae470739cbe..18774928354 100644 --- a/dlls/user32/win.h +++ b/dlls/user32/win.h @@ -24,7 +24,6 @@ #include "user_private.h"
/* Window functions */ -extern HWND get_hwnd_message_parent(void) DECLSPEC_HIDDEN; extern BOOL is_desktop_window( HWND hwnd ) DECLSPEC_HIDDEN; extern HWND WIN_GetFullHandle( HWND hwnd ) DECLSPEC_HIDDEN; extern HWND WIN_IsCurrentProcess( HWND hwnd ) DECLSPEC_HIDDEN;
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/button.c | 10 +-------- dlls/user32/class.c | 13 ----------- dlls/user32/clipboard.c | 18 +-------------- dlls/user32/combo.c | 8 ------- dlls/user32/cursoricon.c | 17 +++----------- dlls/user32/dde_client.c | 13 ++--------- dlls/user32/dde_misc.c | 11 +--------- dlls/user32/dde_private.h | 3 +++ dlls/user32/dde_server.c | 13 ++--------- dlls/user32/defdlg.c | 10 +-------- dlls/user32/defwnd.c | 9 -------- dlls/user32/dialog.c | 17 +++----------- dlls/user32/edit.c | 12 ++-------- dlls/user32/focus.c | 8 ------- dlls/user32/hook.c | 12 ---------- dlls/user32/icontitle.c | 10 +-------- dlls/user32/input.c | 17 -------------- dlls/user32/mdi.c | 15 ++----------- dlls/user32/message.c | 19 +++------------- dlls/user32/nonclient.c | 7 ------ dlls/user32/scroll.c | 8 +------ dlls/user32/user_main.c | 15 +++---------- dlls/user32/user_private.h | 21 ++++++++++++++++++ dlls/user32/win.c | 10 +-------- dlls/user32/win.h | 45 -------------------------------------- dlls/user32/winpos.c | 1 - dlls/user32/winproc.c | 11 +--------- 27 files changed, 52 insertions(+), 301 deletions(-) delete mode 100644 dlls/user32/win.h
diff --git a/dlls/user32/button.c b/dlls/user32/button.c index afc0f53134a..2c661ffcce0 100644 --- a/dlls/user32/button.c +++ b/dlls/user32/button.c @@ -38,18 +38,10 @@ * - BN_UNPUSHED/BN_UNHILITE */
-#include <stdarg.h> -#include <string.h> -#include <stdlib.h> - #define OEMRESOURCE
-#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "controls.h" -#include "win.h" #include "user_private.h" +#include "controls.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(button); diff --git a/dlls/user32/class.c b/dlls/user32/class.c index 4e55b3bcc33..0cfdf552a5d 100644 --- a/dlls/user32/class.c +++ b/dlls/user32/class.c @@ -19,21 +19,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <assert.h> -#include <stdarg.h> -#include <stdlib.h> -#include <string.h> - -#include "winerror.h" -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winnls.h" -#include "win.h" #include "user_private.h" #include "controls.h" -#include "wine/server.h" -#include "wine/list.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(class); diff --git a/dlls/user32/clipboard.c b/dlls/user32/clipboard.c index 7e5a3e0b022..8ae20e53189 100644 --- a/dlls/user32/clipboard.c +++ b/dlls/user32/clipboard.c @@ -24,24 +24,8 @@ */
#include <assert.h> -#include <stdarg.h> -#include <stdlib.h> -#include <sys/types.h> -#include <fcntl.h> -#include <string.h> - -#include "ntstatus.h" -#define WIN32_NO_STATUS -#include "windef.h" -#include "winbase.h" -#include "winnls.h" -#include "wingdi.h" -#include "winuser.h" -#include "winerror.h" #include "user_private.h" -#include "win.h" - -#include "wine/list.h" +#include "winnls.h" #include "wine/server.h" #include "wine/debug.h"
diff --git a/dlls/user32/combo.c b/dlls/user32/combo.c index 31deadb2ba9..5ea61c607be 100644 --- a/dlls/user32/combo.c +++ b/dlls/user32/combo.c @@ -21,18 +21,10 @@ * - CB_SETTOPINDEX */
-#include <stdarg.h> -#include <string.h> - #define OEMRESOURCE
-#include "windef.h" -#include "winbase.h" -#include "ntuser.h" #include "user_private.h" -#include "win.h" #include "controls.h" -#include "winternl.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(combo); diff --git a/dlls/user32/cursoricon.c b/dlls/user32/cursoricon.c index 3e83ada3ee5..0bfaca130d7 100644 --- a/dlls/user32/cursoricon.c +++ b/dlls/user32/cursoricon.c @@ -24,23 +24,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <assert.h> -#include <stdarg.h> -#include <string.h> -#include <stdlib.h> #include <png.h> +#include <stdlib.h>
-#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winerror.h" -#include "winnls.h" -#include "wine/exception.h" -#include "wine/server.h" -#include "controls.h" -#include "win.h" #include "user_private.h" -#include "wine/list.h" +#include "controls.h" +#include "wine/exception.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(cursor); diff --git a/dlls/user32/dde_client.c b/dlls/user32/dde_client.c index dae520bfeb3..bdfb19ea9c4 100644 --- a/dlls/user32/dde_client.c +++ b/dlls/user32/dde_client.c @@ -23,18 +23,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <stdarg.h> -#include <string.h> -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "winnls.h" -#include "dde.h" -#include "ddeml.h" -#include "win.h" -#include "wine/debug.h" +#include "user_private.h" #include "dde_private.h" +#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ddeml);
diff --git a/dlls/user32/dde_misc.c b/dlls/user32/dde_misc.c index 1751a5f481a..39b439976cd 100644 --- a/dlls/user32/dde_misc.c +++ b/dlls/user32/dde_misc.c @@ -23,16 +23,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <string.h> -#include <stdarg.h> -#include <stdio.h> -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "dde.h" -#include "ddeml.h" -#include "win.h" +#include "user_private.h" #include "dde_private.h" #include "wine/debug.h"
diff --git a/dlls/user32/dde_private.h b/dlls/user32/dde_private.h index 7e3d9769127..9766e6a9c42 100644 --- a/dlls/user32/dde_private.h +++ b/dlls/user32/dde_private.h @@ -25,6 +25,9 @@ #ifndef __WINE_DDEML_PRIVATE_H #define __WINE_DDEML_PRIVATE_H
+#include "dde.h" +#include "ddeml.h" + /* defined in atom.c file. */ #define MAX_ATOM_LEN 255 diff --git a/dlls/user32/dde_server.c b/dlls/user32/dde_server.c index 7f5dff5605c..ecc7fbaee34 100644 --- a/dlls/user32/dde_server.c +++ b/dlls/user32/dde_server.c @@ -23,19 +23,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <stdarg.h> -#include <string.h> #include <wchar.h> -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "winnls.h" -#include "dde.h" -#include "ddeml.h" -#include "win.h" -#include "wine/debug.h" +#include "user_private.h" #include "dde_private.h" +#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(ddeml);
diff --git a/dlls/user32/defdlg.c b/dlls/user32/defdlg.c index 238951aa21c..88b64ee469c 100644 --- a/dlls/user32/defdlg.c +++ b/dlls/user32/defdlg.c @@ -18,16 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "controls.h" -#include "win.h" #include "user_private.h" -#include "wine/debug.h" +#include "controls.h"
/*********************************************************************** diff --git a/dlls/user32/defwnd.c b/dlls/user32/defwnd.c index 34a4f294429..b4b42b86ae1 100644 --- a/dlls/user32/defwnd.c +++ b/dlls/user32/defwnd.c @@ -19,15 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <string.h> -#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winnls.h" -#include "imm.h" -#include "win.h" #include "user_private.h" #include "controls.h" #include "wine/debug.h" diff --git a/dlls/user32/dialog.c b/dlls/user32/dialog.c index 9773f67df13..68c0d804ca7 100644 --- a/dlls/user32/dialog.c +++ b/dlls/user32/dialog.c @@ -18,22 +18,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <ctype.h> -#include <errno.h> -#include <limits.h> #include <stdlib.h> -#include <stdarg.h> -#include <stdio.h> -#include <string.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "winnls.h" -#include "controls.h" -#include "win.h" +#include <limits.h> +#include <errno.h> #include "user_private.h" +#include "controls.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(dialog); diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c index 49cf2751f0a..e48d63f2870 100644 --- a/dlls/user32/edit.c +++ b/dlls/user32/edit.c @@ -27,18 +27,10 @@ * */
-#include <stdarg.h> -#include <string.h> #include <stdlib.h> - -#include "windef.h" -#include "winbase.h" -#include "winnt.h" -#include "win.h" -#include "imm.h" -#include "usp10.h" -#include "controls.h" #include "user_private.h" +#include "controls.h" +#include "usp10.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(edit); diff --git a/dlls/user32/focus.c b/dlls/user32/focus.c index bf80777ca97..2d15aa9c6e7 100644 --- a/dlls/user32/focus.c +++ b/dlls/user32/focus.c @@ -20,14 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "win.h" -#include "imm.h" #include "user_private.h" #include "wine/server.h"
diff --git a/dlls/user32/hook.c b/dlls/user32/hook.c index 4a905eb8e5e..cb4b20d6252 100644 --- a/dlls/user32/hook.c +++ b/dlls/user32/hook.c @@ -62,21 +62,9 @@ * WH_MOUSE_LL Implemented but should use SendMessage instead */
-#include <stdarg.h> -#include <assert.h> - -#include "windef.h" -#include "winbase.h" -#include "winnls.h" -#include "wingdi.h" -#include "winuser.h" -#include "winerror.h" -#include "win.h" #include "user_private.h" -#include "wine/server.h" #include "wine/asm.h" #include "wine/debug.h" -#include "winternl.h"
WINE_DEFAULT_DEBUG_CHANNEL(hook); WINE_DECLARE_DEBUG_CHANNEL(relay); diff --git a/dlls/user32/icontitle.c b/dlls/user32/icontitle.c index 718da3006e2..cce3f45250f 100644 --- a/dlls/user32/icontitle.c +++ b/dlls/user32/icontitle.c @@ -18,16 +18,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <stdarg.h> -#include <stdio.h> -#include <string.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" +#include "user_private.h" #include "controls.h" -#include "win.h"
static BOOL bMultiLineTitle; static HFONT hIconTitleFont; diff --git a/dlls/user32/input.c b/dlls/user32/input.c index 106f890da7a..aa03a46a900 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -24,25 +24,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <stdlib.h> -#include <string.h> -#include <stdarg.h> -#include <stdio.h> -#include <ctype.h> -#include <assert.h> - #define NONAMELESSUNION
-#include "ntstatus.h" -#define WIN32_NO_STATUS -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "winnls.h" -#include "winternl.h" -#include "winerror.h" -#include "win.h" #include "user_private.h" #include "dbt.h" #include "wine/server.h" diff --git a/dlls/user32/mdi.c b/dlls/user32/mdi.c index be567e6024d..ce608b3ba9f 100644 --- a/dlls/user32/mdi.c +++ b/dlls/user32/mdi.c @@ -80,23 +80,12 @@ * */
-#include <stdlib.h> -#include <stdarg.h> -#include <stdio.h> -#include <string.h> -#include <math.h> - #define OEMRESOURCE
-#include "windef.h" -#include "winbase.h" -#include "winnls.h" -#include "wingdi.h" -#include "winuser.h" +#include <math.h> +#include "user_private.h" #include "wownt32.h" -#include "win.h" #include "controls.h" -#include "user_private.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(mdi); diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 7be93d94e39..744aa8cb9bd 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -19,28 +19,15 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <assert.h> -#include <stdarg.h> - #define NONAMELESSUNION #define NONAMELESSSTRUCT + #include "ntstatus.h" #define WIN32_NO_STATUS -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "winerror.h" -#include "winnls.h" -#include "dbt.h" -#include "dde.h" -#include "imm.h" -#include "hidusage.h" -#include "ddk/imm.h" -#include "wine/server.h" #include "user_private.h" -#include "win.h" #include "controls.h" +#include "dde.h" +#include "wine/server.h" #include "wine/debug.h" #include "wine/exception.h"
diff --git a/dlls/user32/nonclient.c b/dlls/user32/nonclient.c index 095bcb3e24d..a6b72f74997 100644 --- a/dlls/user32/nonclient.c +++ b/dlls/user32/nonclient.c @@ -18,13 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winnls.h" -#include "win.h" #include "user_private.h" #include "controls.h" #include "wine/debug.h" diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c index 976f88ea7dd..788b5091698 100644 --- a/dlls/user32/scroll.c +++ b/dlls/user32/scroll.c @@ -19,15 +19,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <stdarg.h> - -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" +#include "user_private.h" #include "controls.h" -#include "win.h" #include "wine/debug.h" -#include "user_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(scroll);
diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c index f16f8e04464..bb728907b01 100644 --- a/dlls/user32/user_main.c +++ b/dlls/user32/user_main.c @@ -18,21 +18,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <stdarg.h> -#include <stdio.h> -#include <string.h> -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" +#include "user_private.h" +#include "controls.h" #include "imm.h" #include "ddk/imm.h" - -#include "controls.h" -#include "user_private.h" -#include "win.h" #include "wine/debug.h" -#include "wine/exception.h" +
WINE_DEFAULT_DEBUG_CHANNEL(graphics); WINE_DECLARE_DEBUG_CHANNEL(message); diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index a67c22cdc39..f4169ebb642 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -27,6 +27,7 @@ #include "wingdi.h" #include "ntuser.h" #include "winreg.h" +#include "winnls.h" #include "wine/heap.h"
#define GET_WORD(ptr) (*(const WORD *)(ptr)) @@ -162,4 +163,24 @@ void WINAPI USER_ScrollBarDraw(HWND, HDC, INT, enum SCROLL_HITTEST, INT, INT, INT, BOOL) DECLSPEC_HIDDEN; struct scroll_info *SCROLL_GetInternalInfo( HWND hwnd, INT nBar, BOOL alloc );
+/* Window functions */ +BOOL is_desktop_window( HWND hwnd ) DECLSPEC_HIDDEN; +HWND WIN_GetFullHandle( HWND hwnd ) DECLSPEC_HIDDEN; +HWND WIN_IsCurrentProcess( HWND hwnd ) DECLSPEC_HIDDEN; +HWND WIN_IsCurrentThread( HWND hwnd ) DECLSPEC_HIDDEN; +ULONG WIN_SetStyle( HWND hwnd, ULONG set_bits, ULONG clear_bits ) DECLSPEC_HIDDEN; +HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module, BOOL unicode ) DECLSPEC_HIDDEN; +HWND *WIN_ListChildren( HWND hwnd ) DECLSPEC_HIDDEN; +void MDI_CalcDefaultChildPos( HWND hwndClient, INT total, LPPOINT lpPos, INT delta, UINT *id ) DECLSPEC_HIDDEN; +HDESK open_winstation_desktop( HWINSTA hwinsta, LPCWSTR name, DWORD flags, BOOL inherit, + ACCESS_MASK access ) DECLSPEC_HIDDEN; + +static inline void mirror_rect( const RECT *window_rect, RECT *rect ) +{ + int width = window_rect->right - window_rect->left; + int tmp = rect->left; + rect->left = width - rect->right; + rect->right = width - tmp; +} + #endif /* __WINE_USER_PRIVATE_H */ diff --git a/dlls/user32/win.c b/dlls/user32/win.c index 6b40f25dd46..0605f94abe1 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -18,19 +18,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <assert.h> -#include <stdlib.h> -#include <string.h> -#include <limits.h> - #include "user_private.h" -#include "winnls.h" +#include "controls.h" #include "winver.h" #include "wine/server.h" #include "wine/asm.h" -#include "win.h" -#include "controls.h" -#include "winerror.h" #include "wine/exception.h" #include "wine/debug.h"
diff --git a/dlls/user32/win.h b/dlls/user32/win.h deleted file mode 100644 index 18774928354..00000000000 --- a/dlls/user32/win.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Window definitions - * - * Copyright 1993 Alexandre Julliard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#ifndef __WINE_WIN_H -#define __WINE_WIN_H - -#include "user_private.h" - - /* Window functions */ -extern BOOL is_desktop_window( HWND hwnd ) DECLSPEC_HIDDEN; -extern HWND WIN_GetFullHandle( HWND hwnd ) DECLSPEC_HIDDEN; -extern HWND WIN_IsCurrentProcess( HWND hwnd ) DECLSPEC_HIDDEN; -extern HWND WIN_IsCurrentThread( HWND hwnd ) DECLSPEC_HIDDEN; -extern ULONG WIN_SetStyle( HWND hwnd, ULONG set_bits, ULONG clear_bits ) DECLSPEC_HIDDEN; -extern HWND WIN_CreateWindowEx( CREATESTRUCTW *cs, LPCWSTR className, HINSTANCE module, BOOL unicode ) DECLSPEC_HIDDEN; -extern HWND *WIN_ListChildren( HWND hwnd ) DECLSPEC_HIDDEN; -extern void MDI_CalcDefaultChildPos( HWND hwndClient, INT total, LPPOINT lpPos, INT delta, UINT *id ) DECLSPEC_HIDDEN; -extern HDESK open_winstation_desktop( HWINSTA hwinsta, LPCWSTR name, DWORD flags, BOOL inherit, ACCESS_MASK access ) DECLSPEC_HIDDEN; - -static inline void mirror_rect( const RECT *window_rect, RECT *rect ) -{ - int width = window_rect->right - window_rect->left; - int tmp = rect->left; - rect->left = width - rect->right; - rect->right = width - tmp; -} - -#endif /* __WINE_WIN_H */ diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c index 97a2228d00c..cee549d1ea9 100644 --- a/dlls/user32/winpos.c +++ b/dlls/user32/winpos.c @@ -20,7 +20,6 @@ */
#include "user_private.h" -#include "win.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(win); diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c index deae1a061f8..2ca802e647a 100644 --- a/dlls/user32/winproc.c +++ b/dlls/user32/winproc.c @@ -19,18 +19,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <assert.h> -#include <stdarg.h> -#include <string.h> - -#include "windef.h" -#include "winbase.h" -#include "winnls.h" -#include "wingdi.h" +#include "user_private.h" #include "controls.h" -#include "win.h" #include "dbt.h" -#include "user_private.h" #include "wine/asm.h" #include "wine/debug.h"
From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/exticon.c | 25 +++++++------------------ dlls/user32/input.c | 24 +++++++++++------------- dlls/user32/message.c | 3 --- dlls/user32/sysparams.c | 29 +++++++++++++---------------- 4 files changed, 31 insertions(+), 50 deletions(-)
diff --git a/dlls/user32/exticon.c b/dlls/user32/exticon.c index 80106a62edb..415bb9864b8 100644 --- a/dlls/user32/exticon.c +++ b/dlls/user32/exticon.c @@ -22,18 +22,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#include <stdarg.h> -#include <string.h> -#include <stdlib.h> /* abs() */ -#include <sys/types.h> - -#define NONAMELESSUNION -#define NONAMELESSSTRUCT -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "winnls.h" +#include <stdlib.h> #include "user_private.h" #include "wine/debug.h"
@@ -115,9 +104,9 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_id( const IMAGE_RESOURCE_DI while (min <= max) { pos = (min + max) / 2; - if (entry[pos].u.Id == id) - return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s2.OffsetToDirectory); - if (entry[pos].u.Id > id) max = pos - 1; + if (entry[pos].Id == id) + return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].OffsetToDirectory); + if (entry[pos].Id > id) max = pos - 1; else min = pos + 1; } return NULL; @@ -134,7 +123,7 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_default( const IMAGE_RESOURCE_ { const IMAGE_RESOURCE_DIRECTORY_ENTRY *entry; entry = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(dir + 1); - return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry->u2.s2.OffsetToDirectory); + return (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry->OffsetToDirectory); }
/************************************************************************* @@ -453,7 +442,7 @@ static UINT ICO_ExtractIconExW(
while(n<iconDirCount && xprdeTmp) { - if(xprdeTmp->u.Id == iId) + if(xprdeTmp->Id == iId) { nIconIndex = n; break; @@ -489,7 +478,7 @@ static UINT ICO_ExtractIconExW( const IMAGE_RESOURCE_DIRECTORY *resdir;
/* go down this resource entry, name */ - resdir = (const IMAGE_RESOURCE_DIRECTORY *)((const char *)rootresdir + xresent->u2.s2.OffsetToDirectory); + resdir = (const IMAGE_RESOURCE_DIRECTORY *)((const char *)rootresdir + xresent->OffsetToDirectory);
/* default language (0) */ resdir = find_entry_default(resdir,rootresdir); diff --git a/dlls/user32/input.c b/dlls/user32/input.c index aa03a46a900..a329150f745 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -24,8 +24,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#define NONAMELESSUNION - #include "user_private.h" #include "dbt.h" #include "wine/server.h" @@ -80,11 +78,11 @@ void WINAPI keybd_event( BYTE bVk, BYTE bScan, INPUT input;
input.type = INPUT_KEYBOARD; - input.u.ki.wVk = bVk; - input.u.ki.wScan = bScan; - input.u.ki.dwFlags = dwFlags; - input.u.ki.time = 0; - input.u.ki.dwExtraInfo = dwExtraInfo; + input.ki.wVk = bVk; + input.ki.wScan = bScan; + input.ki.dwFlags = dwFlags; + input.ki.time = 0; + input.ki.dwExtraInfo = dwExtraInfo; NtUserSendInput( 1, &input, sizeof(input) ); }
@@ -98,12 +96,12 @@ void WINAPI mouse_event( DWORD dwFlags, DWORD dx, DWORD dy, INPUT input;
input.type = INPUT_MOUSE; - input.u.mi.dx = dx; - input.u.mi.dy = dy; - input.u.mi.mouseData = dwData; - input.u.mi.dwFlags = dwFlags; - input.u.mi.time = 0; - input.u.mi.dwExtraInfo = dwExtraInfo; + input.mi.dx = dx; + input.mi.dy = dy; + input.mi.mouseData = dwData; + input.mi.dwFlags = dwFlags; + input.mi.time = 0; + input.mi.dwExtraInfo = dwExtraInfo; NtUserSendInput( 1, &input, sizeof(input) ); }
diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 744aa8cb9bd..92096e4a81d 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -19,9 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */
-#define NONAMELESSUNION -#define NONAMELESSSTRUCT - #include "ntstatus.h" #define WIN32_NO_STATUS #include "user_private.h" diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index 3f87702f32d..7ebe8099419 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -26,9 +26,6 @@ #include <string.h> #include <wchar.h>
-#define NONAMELESSUNION -#define NONAMELESSSTRUCT - #include "windef.h" #include "winbase.h" #include "winnls.h" @@ -644,14 +641,14 @@ BOOL WINAPI EnumDisplaySettingsExA(LPCSTR lpszDeviceName, DWORD iModeNum, lpDevMode->dmBitsPerPel = devmodeW.dmBitsPerPel; lpDevMode->dmPelsHeight = devmodeW.dmPelsHeight; lpDevMode->dmPelsWidth = devmodeW.dmPelsWidth; - lpDevMode->u2.dmDisplayFlags = devmodeW.u2.dmDisplayFlags; + lpDevMode->dmDisplayFlags = devmodeW.dmDisplayFlags; lpDevMode->dmDisplayFrequency = devmodeW.dmDisplayFrequency; lpDevMode->dmFields = devmodeW.dmFields;
- lpDevMode->u1.s2.dmPosition.x = devmodeW.u1.s2.dmPosition.x; - lpDevMode->u1.s2.dmPosition.y = devmodeW.u1.s2.dmPosition.y; - lpDevMode->u1.s2.dmDisplayOrientation = devmodeW.u1.s2.dmDisplayOrientation; - lpDevMode->u1.s2.dmDisplayFixedOutput = devmodeW.u1.s2.dmDisplayFixedOutput; + lpDevMode->dmPosition.x = devmodeW.dmPosition.x; + lpDevMode->dmPosition.y = devmodeW.dmPosition.y; + lpDevMode->dmDisplayOrientation = devmodeW.dmDisplayOrientation; + lpDevMode->dmDisplayFixedOutput = devmodeW.dmDisplayFixedOutput; } if (lpszDeviceName) RtlFreeUnicodeString(&nameW); return ret; @@ -1051,7 +1048,7 @@ BOOL WINAPI PhysicalToLogicalPoint( HWND hwnd, POINT *point ) static DISPLAYCONFIG_ROTATION get_dc_rotation(const DEVMODEW *devmode) { if (devmode->dmFields & DM_DISPLAYORIENTATION) - return devmode->u1.s2.dmDisplayOrientation + 1; + return devmode->dmDisplayOrientation + 1; else return DISPLAYCONFIG_ROTATION_IDENTITY; } @@ -1060,7 +1057,7 @@ static DISPLAYCONFIG_SCANLINE_ORDERING get_dc_scanline_ordering(const DEVMODEW * { if (!(devmode->dmFields & DM_DISPLAYFLAGS)) return DISPLAYCONFIG_SCANLINE_ORDERING_UNSPECIFIED; - else if (devmode->u2.dmDisplayFlags & DM_INTERLACED) + else if (devmode->dmDisplayFlags & DM_INTERLACED) return DISPLAYCONFIG_SCANLINE_ORDERING_INTERLACED; else return DISPLAYCONFIG_SCANLINE_ORDERING_PROGRESSIVE; @@ -1078,7 +1075,7 @@ static DISPLAYCONFIG_PIXELFORMAT get_dc_pixelformat(DWORD dmBitsPerPel) static void set_mode_target_info(DISPLAYCONFIG_MODE_INFO *info, const LUID *gpu_luid, UINT32 target_id, UINT32 flags, const DEVMODEW *devmode) { - DISPLAYCONFIG_TARGET_MODE *mode = &(info->u.targetMode); + DISPLAYCONFIG_TARGET_MODE *mode = &info->targetMode;
info->infoType = DISPLAYCONFIG_MODE_INFO_TYPE_TARGET; info->adapterId = *gpu_luid; @@ -1102,7 +1099,7 @@ static void set_mode_target_info(DISPLAYCONFIG_MODE_INFO *info, const LUID *gpu_ mode->targetVideoSignalInfo.totalSize.cx = devmode->dmPelsWidth; mode->targetVideoSignalInfo.totalSize.cy = devmode->dmPelsHeight; } - mode->targetVideoSignalInfo.u.videoStandard = D3DKMDT_VSS_OTHER; + mode->targetVideoSignalInfo.videoStandard = D3DKMDT_VSS_OTHER; mode->targetVideoSignalInfo.scanLineOrdering = get_dc_scanline_ordering(devmode); }
@@ -1111,7 +1108,7 @@ static void set_path_target_info(DISPLAYCONFIG_PATH_TARGET_INFO *info, const LUI { info->adapterId = *gpu_luid; info->id = target_id; - info->u.modeInfoIdx = mode_index; + info->modeInfoIdx = mode_index; info->outputTechnology = DISPLAYCONFIG_OUTPUT_TECHNOLOGY_DISPLAYPORT_EXTERNAL; info->rotation = get_dc_rotation(devmode); info->scaling = DISPLAYCONFIG_SCALING_IDENTITY; @@ -1125,7 +1122,7 @@ static void set_path_target_info(DISPLAYCONFIG_PATH_TARGET_INFO *info, const LUI static void set_mode_source_info(DISPLAYCONFIG_MODE_INFO *info, const LUID *gpu_luid, UINT32 source_id, const DEVMODEW *devmode) { - DISPLAYCONFIG_SOURCE_MODE *mode = &(info->u.sourceMode); + DISPLAYCONFIG_SOURCE_MODE *mode = &(info->sourceMode);
info->infoType = DISPLAYCONFIG_MODE_INFO_TYPE_SOURCE; info->adapterId = *gpu_luid; @@ -1136,7 +1133,7 @@ static void set_mode_source_info(DISPLAYCONFIG_MODE_INFO *info, const LUID *gpu_ mode->pixelFormat = get_dc_pixelformat(devmode->dmBitsPerPel); if (devmode->dmFields & DM_POSITION) { - mode->position = devmode->u1.s2.dmPosition; + mode->position = devmode->dmPosition; } else { @@ -1150,7 +1147,7 @@ static void set_path_source_info(DISPLAYCONFIG_PATH_SOURCE_INFO *info, const LUI { info->adapterId = *gpu_luid; info->id = source_id; - info->u.modeInfoIdx = mode_index; + info->modeInfoIdx = mode_index; info->statusFlags = DISPLAYCONFIG_SOURCE_IN_USE; }
This merge request was approved by Huw Davies.