win32u: Move set_standard_scroll_painted implementation from user32.

This commit is contained in:
Jacek Caban 2022-06-28 21:03:24 +02:00 committed by Alexandre Julliard
parent 22cab055e4
commit a7ff88c9a2
7 changed files with 50 additions and 17 deletions

View file

@ -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 );

View file

@ -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,

View file

@ -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 */

View file

@ -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 );
}

View file

@ -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
{

View file

@ -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.@)
*/

View file

@ -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;