From 79b64fdc83619c1c1defdc2e01cc337c627d10a2 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Wed, 21 May 2008 11:44:05 +0200 Subject: [PATCH] user32: Add an ASCII window procedure for scrollbars. --- dlls/user32/scroll.c | 32 +++++++++++++++++++++++++++----- dlls/user32/tests/class.c | 3 ++- dlls/user32/winproc.c | 2 +- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/dlls/user32/scroll.c b/dlls/user32/scroll.c index 6f527540d62..ddfacd6f083 100644 --- a/dlls/user32/scroll.c +++ b/dlls/user32/scroll.c @@ -108,7 +108,8 @@ static void SCROLL_DrawInterior_9x( HWND hwnd, HDC hdc, INT nBar, INT thumbSize, INT thumbPos, UINT flags, BOOL vertical, BOOL top_selected, BOOL bottom_selected ); -static LRESULT WINAPI ScrollBarWndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); +static LRESULT WINAPI ScrollBarWndProcA( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); +static LRESULT WINAPI ScrollBarWndProcW( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ); /********************************************************************* @@ -119,8 +120,8 @@ const struct builtin_class_descr SCROLL_builtin_class = { scrollbarW, /* name */ CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC, /* style */ - NULL, /* procA (winproc is Unicode only) */ - ScrollBarWndProc, /* procW */ + ScrollBarWndProcA, /* procA */ + ScrollBarWndProcW, /* procW */ sizeof(SCROLLBAR_INFO), /* extra */ IDC_ARROW, /* cursor */ 0 /* brush */ @@ -1371,7 +1372,7 @@ static BOOL SCROLL_SetScrollRange(HWND hwnd, INT nBar, INT minVal, INT maxVal) /*********************************************************************** * ScrollBarWndProc */ -static LRESULT WINAPI ScrollBarWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) +static LRESULT ScrollBarWndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam, BOOL unicode ) { if (!IsWindow( hwnd )) return 0; @@ -1550,12 +1551,33 @@ static LRESULT WINAPI ScrollBarWndProc( HWND hwnd, UINT message, WPARAM wParam, if (message >= WM_USER) WARN("unknown msg %04x wp=%04lx lp=%08lx\n", message, wParam, lParam ); - return DefWindowProcW( hwnd, message, wParam, lParam ); + if (unicode) + return DefWindowProcW( hwnd, message, wParam, lParam ); + else + return DefWindowProcA( hwnd, message, wParam, lParam ); } return 0; } +/*********************************************************************** + * ScrollBarWndProcA + */ +static LRESULT WINAPI ScrollBarWndProcA( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + return ScrollBarWndProc( hwnd, message, wParam, lParam, FALSE ); +} + + +/*********************************************************************** + * ScrollBarWndProcW + */ +static LRESULT WINAPI ScrollBarWndProcW( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam ) +{ + return ScrollBarWndProc( hwnd, message, wParam, lParam, TRUE ); +} + + /************************************************************************* * SetScrollInfo (USER32.@) * diff --git a/dlls/user32/tests/class.c b/dlls/user32/tests/class.c index 486e227be1a..8412e8be369 100644 --- a/dlls/user32/tests/class.c +++ b/dlls/user32/tests/class.c @@ -570,13 +570,14 @@ static void test_instances(void) static void test_builtinproc(void) { - /* Edit behaves differently. ScrollBar have currently only a Unicode winproc */ + /* Edit behaves differently */ static const CHAR NORMAL_CLASSES[][10] = { "Button", "Static", "ComboBox", "ComboLBox", "ListBox", + "ScrollBar", "#32770", /* dialog */ }; static const int NUM_NORMAL_CLASSES = (sizeof(NORMAL_CLASSES)/sizeof(NORMAL_CLASSES[0])); diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c index 6c85d91c722..6de86e878b0 100644 --- a/dlls/user32/winproc.c +++ b/dlls/user32/winproc.c @@ -52,7 +52,7 @@ typedef struct tagWINDOWPROC #define WINPROC_HANDLE (~0UL >> 16) #define MAX_WINPROCS 8192 -#define BUILTIN_WINPROCS 8 /* first BUILTIN_WINPROCS entries are reserved for builtin procs */ +#define BUILTIN_WINPROCS 9 /* first BUILTIN_WINPROCS entries are reserved for builtin procs */ WNDPROC EDIT_winproc_handle = 0; -- 2.11.4.GIT