From: Jacek Caban jacek@codeweavers.com
--- dlls/user32/scroll.c | 13 ++----------- dlls/user32/user_main.c | 2 +- dlls/user32/user_private.h | 2 +- dlls/win32u/dce.c | 6 +++--- dlls/win32u/ntuser_private.h | 15 ++++++++++++++- dlls/win32u/scroll.c | 28 ++++++++++++++++++++++++++++ dlls/win32u/win32u_private.h | 1 + 7 files changed, 50 insertions(+), 17 deletions(-)
diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c index d9bc69895aa..9cb07af0706 100644 --- a/dlls/user32/scroll.c +++ b/dlls/user32/scroll.c @@ -31,16 +31,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(scroll);
-/* data for a single scroll bar */ -typedef struct -{ - INT curVal; /* Current scroll-bar value */ - INT minVal; /* Minimum scroll-bar value */ - INT maxVal; /* Maximum scroll-bar value */ - INT page; /* Page size of scroll bar (Win32) */ - UINT flags; /* EnableScrollBar flags */ - BOOL painted; /* Whether the scroll bar is painted by DefWinProc() */ -} SCROLLBAR_INFO, *LPSCROLLBAR_INFO; +typedef struct scroll_info SCROLLBAR_INFO, *LPSCROLLBAR_INFO;
/* data for window that has (one or two) scroll bars */ typedef struct @@ -127,7 +118,7 @@ static inline BOOL SCROLL_ScrollInfoValid( LPCSCROLLINFO info ) * or NULL if failed (f.i. scroll bar does not exist yet) * If alloc is TRUE and the struct does not exist yet, create it. */ -static SCROLLBAR_INFO *SCROLL_GetInternalInfo( HWND hwnd, INT nBar, BOOL alloc ) +SCROLLBAR_INFO *SCROLL_GetInternalInfo( HWND hwnd, INT nBar, BOOL alloc ) { SCROLLBAR_INFO *infoPtr = NULL; WND *wndPtr = WIN_GetPtr( hwnd ); diff --git a/dlls/user32/user_main.c b/dlls/user32/user_main.c index 2391131e4a5..7a85a86d786 100644 --- a/dlls/user32/user_main.c +++ b/dlls/user32/user_main.c @@ -159,9 +159,9 @@ static const struct user_callbacks user_funcs = NtWaitForMultipleObjects, SCROLL_DrawNCScrollBar, free_win_ptr, + SCROLL_GetInternalInfo, notify_ime, post_dde_message, - SCROLL_SetStandardScrollPainted, unpack_dde_message, register_imm, unregister_imm, diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index a646f9a234d..f34818ea258 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -179,6 +179,6 @@ LRESULT WINAPI USER_ScrollBarProc(HWND, UINT, WPARAM, LPARAM, BOOL) DECLSPEC_HID void WINAPI USER_ScrollBarDraw(HWND, HDC, INT, enum SCROLL_HITTEST, const struct SCROLL_TRACKING_INFO *, BOOL, BOOL, RECT *, INT, INT, INT, BOOL) DECLSPEC_HIDDEN; -void WINAPI SCROLL_SetStandardScrollPainted(HWND hwnd, INT bar, BOOL visible); +struct scroll_info *SCROLL_GetInternalInfo( HWND hwnd, INT nBar, BOOL alloc );
#endif /* __WINE_USER_PRIVATE_H */ diff --git a/dlls/win32u/dce.c b/dlls/win32u/dce.c index 67590e80fa3..9041b5bbaaf 100644 --- a/dlls/win32u/dce.c +++ b/dlls/win32u/dce.c @@ -1188,14 +1188,14 @@ static HRGN send_ncpaint( HWND hwnd, HWND *child, UINT *flags )
if (whole_rgn) /* NOTE: WM_NCPAINT allows wParam to be 1 */ { - if ((*flags & UPDATE_NONCLIENT) && user_callbacks) + if (*flags & UPDATE_NONCLIENT) { /* Mark standard scroll bars as not painted before sending WM_NCPAINT */ style = get_window_long( hwnd, GWL_STYLE ); if (style & WS_HSCROLL) - user_callbacks->set_standard_scroll_painted( hwnd, SB_HORZ, FALSE ); + set_standard_scroll_painted( hwnd, SB_HORZ, FALSE ); if (style & WS_VSCROLL) - user_callbacks->set_standard_scroll_painted( hwnd, SB_VERT, FALSE ); + set_standard_scroll_painted( hwnd, SB_VERT, FALSE );
send_message( hwnd, WM_NCPAINT, (WPARAM)whole_rgn, 0 ); } diff --git a/dlls/win32u/ntuser_private.h b/dlls/win32u/ntuser_private.h index 82d70ec93bb..609f7018b07 100644 --- a/dlls/win32u/ntuser_private.h +++ b/dlls/win32u/ntuser_private.h @@ -37,10 +37,10 @@ struct user_callbacks NTSTATUS (WINAPI *pNtWaitForMultipleObjects)(ULONG,const HANDLE*,BOOLEAN,BOOLEAN,const LARGE_INTEGER*); void (CDECL *draw_nc_scrollbar)( HWND hwnd, HDC hdc, BOOL draw_horizontal, BOOL draw_vertical ); void (CDECL *free_win_ptr)( struct tagWND *win ); + struct scroll_info *(CDECL *get_scroll_info)( HWND hwnd, INT nBar, BOOL alloc ); void (CDECL *notify_ime)( HWND hwnd, UINT param ); BOOL (CDECL *post_dde_message)( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, DWORD dest_tid, DWORD type ); - void (WINAPI *set_standard_scroll_painted)( HWND hwnd, INT bar, BOOL visible ); BOOL (CDECL *unpack_dde_message)( HWND hwnd, UINT message, WPARAM *wparam, LPARAM *lparam, void **buffer, size_t size ); BOOL (WINAPI *register_imm)( HWND hwnd ); @@ -203,6 +203,19 @@ enum builtin_winprocs NB_BUILTIN_AW_WINPROCS = WINPROC_DESKTOP };
+/* FIXME: make it private to scroll.c */ + +/* data for a single scroll bar */ +struct scroll_info +{ + INT curVal; /* Current scroll-bar value */ + INT minVal; /* Minimum scroll-bar value */ + INT maxVal; /* Maximum scroll-bar value */ + INT page; /* Page size of scroll bar (Win32) */ + UINT flags; /* EnableScrollBar flags */ + BOOL painted; /* Whether the scroll bar is painted by DefWinProc() */ +}; + /* FIXME: make it private to class.c */ typedef struct tagWINDOWPROC { diff --git a/dlls/win32u/scroll.c b/dlls/win32u/scroll.c index ff60ec5c4ce..d6c21fc6992 100644 --- a/dlls/win32u/scroll.c +++ b/dlls/win32u/scroll.c @@ -30,6 +30,20 @@ WINE_DEFAULT_DEBUG_CHANNEL(scroll);
+static struct scroll_info *get_scroll_info_ptr( HWND hwnd, int bar, BOOL alloc ) +{ + struct scroll_info *ret = NULL; + user_lock(); + if (user_callbacks) ret = user_callbacks->get_scroll_info( hwnd, bar, alloc ); + if (!ret) user_unlock(); + return ret; +} + +static void release_scroll_info_ptr( struct scroll_info *info ) +{ + user_unlock(); +} + static BOOL show_scroll_bar( HWND hwnd, int bar, BOOL show_horz, BOOL show_vert ) { ULONG old_style, set_bits = 0, clear_bits = 0; @@ -83,6 +97,20 @@ LRESULT scroll_bar_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lpara } }
+void set_standard_scroll_painted( HWND hwnd, int bar, BOOL painted ) +{ + struct scroll_info *info; + + if (bar != SB_HORZ && bar != SB_VERT) + return; + + if ((info = get_scroll_info_ptr( hwnd, bar, FALSE ))) + { + info->painted = painted; + release_scroll_info_ptr( info ); + } +} + /************************************************************************* * NtUserShowScrollBar (win32u.@) */ diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 90ca0e9b143..684a5e59c5b 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -443,6 +443,7 @@ extern BOOL rawinput_device_get_usages( HANDLE handle, USHORT *usage_page, USHOR /* scroll.c */ extern LRESULT scroll_bar_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, BOOL ansi ) DECLSPEC_HIDDEN; +extern void set_standard_scroll_painted( HWND hwnd, int bar, BOOL painted ) DECLSPEC_HIDDEN;
/* sysparams.c */ extern BOOL enable_thunk_lock DECLSPEC_HIDDEN;