diff --git a/dlls/user/.cvsignore b/dlls/user/.cvsignore index 820f01173b5..9780d115ebd 100644 --- a/dlls/user/.cvsignore +++ b/dlls/user/.cvsignore @@ -1,4 +1,10 @@ -*.spec.c -*.spec.glue.s Makefile -thunk.glue.c +ddeml.spec.c +display.spec.c +keyboard.spec.c +mouse.spec.c +property.glue.c +text.glue.c +user.spec.c +user32.spec.c +wnd16.glue.c diff --git a/dlls/user/Makefile.in b/dlls/user/Makefile.in index 8007d2fe0ff..d36827a1d07 100644 --- a/dlls/user/Makefile.in +++ b/dlls/user/Makefile.in @@ -27,7 +27,6 @@ C_SRCS = \ property.c \ resource.c \ text.c \ - thunk.c \ user_main.c \ wnd16.c \ wsprintf.c @@ -42,7 +41,9 @@ RC_SRCS16 = \ GLUE = \ dde/ddeml16.c \ - thunk.c + property.c \ + text.c \ + wnd16.c EXTRA_OBJS = \ $(TOPOBJDIR)/controls/controls.o \ diff --git a/dlls/user/property.c b/dlls/user/property.c index be2d8f615ef..a91c744652f 100644 --- a/dlls/user/property.c +++ b/dlls/user/property.c @@ -15,6 +15,9 @@ /* size of buffer needed to store an atom string */ #define ATOM_BUFFER_SIZE 256 +/* ### start build ### */ +extern WORD CALLBACK PROP_CallTo16_word_wlw(PROPENUMPROC16,WORD,LONG,WORD); +/* ### stop build ### */ /*********************************************************************** * get_properties @@ -292,10 +295,10 @@ INT16 WINAPI EnumProps16( HWND16 hwnd, PROPENUMPROC16 func ) if (list[i].string) /* it was a string originally */ { if (!GlobalGetAtomNameA( list[i].atom, string, ATOM_BUFFER_SIZE )) continue; - ret = func( hwnd, SEGPTR_GET(string), list[i].handle ); + ret = PROP_CallTo16_word_wlw( func, hwnd, SEGPTR_GET(string), list[i].handle ); } else - ret = func( hwnd, list[i].atom, list[i].handle ); + ret = PROP_CallTo16_word_wlw( func, hwnd, list[i].atom, list[i].handle ); if (!ret) break; } SEGPTR_FREE( string ); diff --git a/dlls/user/text.c b/dlls/user/text.c index 8d092c5a13a..79b12ee33d5 100644 --- a/dlls/user/text.c +++ b/dlls/user/text.c @@ -42,6 +42,24 @@ static int tabwidth; static int spacewidth; static int prefix_offset; +/* ### start build ### */ +extern WORD CALLBACK TEXT_CallTo16_word_wlw(GRAYSTRINGPROC16,WORD,LONG,WORD); +/* ### stop build ### */ + +struct gray_string_info +{ + GRAYSTRINGPROC16 proc; + LPARAM param; +}; + +/* callback for 16-bit gray string proc */ +static BOOL CALLBACK gray_string_callback( HDC hdc, LPARAM param, INT len ) +{ + const struct gray_string_info *info = (struct gray_string_info *)param; + return TEXT_CallTo16_word_wlw( info->proc, hdc, info->param, len ); +} + + /********************************************************************* * Return next line of text from a string. * @@ -585,8 +603,13 @@ BOOL16 WINAPI GrayString16( HDC16 hdc, HBRUSH16 hbr, GRAYSTRINGPROC16 gsprc, LPARAM lParam, INT16 cch, INT16 x, INT16 y, INT16 cx, INT16 cy ) { - return TEXT_GrayString(hdc, hbr, (GRAYSTRINGPROC)gsprc, lParam, cch, - x, y, cx, cy, FALSE, FALSE); + struct gray_string_info info; + + if (!gsprc) return TEXT_GrayString(hdc, hbr, NULL, lParam, cch, x, y, cx, cy, FALSE, FALSE); + info.proc = gsprc; + info.param = lParam; + return TEXT_GrayString( hdc, hbr, gray_string_callback, (LPARAM)&info, + cch, x, y, cx, cy, FALSE, FALSE); } diff --git a/dlls/user/thunk.c b/dlls/user/thunk.c deleted file mode 100644 index ce0c4e7e4da..00000000000 --- a/dlls/user/thunk.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * USER 16-bit thunks - * - * Copyright 1996, 1997 Alexandre Julliard - * Copyright 1998 Ulrich Weigand - */ - -#include "windef.h" -#include "wingdi.h" -#include "wine/winuser16.h" -#include "win.h" -#include "callback.h" - -/* ### start build ### */ -extern WORD CALLBACK THUNK_CallTo16_word_wl (FARPROC16,WORD,LONG); -extern WORD CALLBACK THUNK_CallTo16_word_wlw (FARPROC16,WORD,LONG,WORD); -extern WORD CALLBACK THUNK_CallTo16_word_wlwww(FARPROC16,WORD,LONG,WORD,WORD,WORD); -/* ### stop build ### */ - - -/******************************************************************* - * EnumWindows (USER.54) - */ -BOOL16 WINAPI EnumWindows16( WNDENUMPROC16 func, LPARAM lParam ) -{ - DECL_THUNK( thunk, func, THUNK_CallTo16_word_wl ); - return EnumWindows( (WNDENUMPROC)&thunk, lParam ); -} - - -/********************************************************************** - * EnumChildWindows (USER.55) - */ -BOOL16 WINAPI EnumChildWindows16( HWND16 parent, WNDENUMPROC16 func, LPARAM lParam ) -{ - DECL_THUNK( thunk, func, THUNK_CallTo16_word_wl ); - return EnumChildWindows( WIN_Handle32(parent), (WNDENUMPROC)&thunk, lParam ); -} - - -/********************************************************************** - * EnumTaskWindows (USER.225) - */ -BOOL16 WINAPI THUNK_EnumTaskWindows16( HTASK16 hTask, WNDENUMPROC16 func, - LPARAM lParam ) -{ - DECL_THUNK( thunk, func, THUNK_CallTo16_word_wl ); - return EnumTaskWindows16( hTask, (WNDENUMPROC16)&thunk, lParam ); -} - - -/*********************************************************************** - * EnumProps (USER.27) - */ -INT16 WINAPI THUNK_EnumProps16( HWND16 hwnd, PROPENUMPROC16 func ) -{ - DECL_THUNK( thunk, func, THUNK_CallTo16_word_wlw ); - return EnumProps16( hwnd, (PROPENUMPROC16)&thunk ); -} - - -/*********************************************************************** - * GrayString (USER.185) - */ -BOOL16 WINAPI THUNK_GrayString16( HDC16 hdc, HBRUSH16 hbr, - GRAYSTRINGPROC16 func, LPARAM lParam, - INT16 cch, INT16 x, INT16 y, - INT16 cx, INT16 cy ) -{ - DECL_THUNK( thunk, func, THUNK_CallTo16_word_wlw ); - if (!func) - return GrayString16( hdc, hbr, NULL, lParam, cch, x, y, cx, cy ); - else - return GrayString16( hdc, hbr, (GRAYSTRINGPROC16)&thunk, lParam, cch, - x, y, cx, cy ); -} - - -/********************************************************************** - * DrawState (USER.449) - */ -BOOL16 WINAPI DrawState16( HDC16 hdc, HBRUSH16 hbr, DRAWSTATEPROC16 func, LPARAM ldata, - WPARAM16 wdata, INT16 x, INT16 y, INT16 cx, INT16 cy, UINT16 flags ) -{ - UINT opcode = flags & 0xf; - DECL_THUNK( thunk, func, THUNK_CallTo16_word_wlwww ); - - if (opcode == DST_TEXT || opcode == DST_PREFIXTEXT) - { - /* make sure DrawStateA doesn't try to use ldata as a pointer */ - if (!wdata) wdata = strlen( MapSL(ldata) ); - if (!cx || !cy) - { - SIZE s; - if (!GetTextExtentPoint32A( hdc, MapSL(ldata), wdata, &s )) return FALSE; - if (!cx) cx = s.cx; - if (!cy) cy = s.cy; - } - } - return DrawStateA( hdc, hbr, (DRAWSTATEPROC)&thunk, ldata, wdata, x, y, cx, cy, flags ); -} diff --git a/dlls/user/user.spec b/dlls/user/user.spec index f4a4bbb8c18..4701c61cf6c 100644 --- a/dlls/user/user.spec +++ b/dlls/user/user.spec @@ -30,7 +30,7 @@ rsrc resources/version16.res 24 pascal16 RemoveProp(word ptr) RemoveProp16 25 pascal16 GetProp(word str) GetProp16 26 pascal16 SetProp(word str word) SetProp16 -27 pascal16 EnumProps(word segptr) THUNK_EnumProps16 +27 pascal16 EnumProps(word segptr) EnumProps16 28 pascal16 ClientToScreen(word ptr) ClientToScreen16 29 pascal16 ScreenToClient(word ptr) ScreenToClient16 30 pascal16 WindowFromPoint(long) WindowFromPoint16 @@ -189,7 +189,7 @@ rsrc resources/version16.res 182 pascal16 KillSystemTimer(word word) KillSystemTimer16 # BEAR182 183 pascal16 GetCaretPos(ptr) GetCaretPos16 184 stub QuerySendMessage # W1.1, W2.0: SYSHASKANJI -185 pascal16 GrayString(word word segptr segptr s_word s_word s_word s_word s_word) THUNK_GrayString16 +185 pascal16 GrayString(word word segptr segptr s_word s_word s_word s_word s_word) GrayString16 186 pascal16 SwapMouseButton(word) SwapMouseButton16 187 pascal16 EndMenu() EndMenu 188 pascal16 SetSysModalWindow(word) SetSysModalWindow16 @@ -231,7 +231,7 @@ rsrc resources/version16.res 222 pascal16 GetKeyboardState(ptr) GetKeyboardState 223 pascal16 SetKeyboardState(ptr) SetKeyboardState 224 pascal16 GetWindowTask(word) GetWindowTask16 -225 pascal16 EnumTaskWindows(word segptr long) THUNK_EnumTaskWindows16 +225 pascal16 EnumTaskWindows(word segptr long) EnumTaskWindows16 226 stub LockInput # not in W2.0 227 pascal16 GetNextDlgGroupItem(word word word) GetNextDlgGroupItem16 228 pascal16 GetNextDlgTabItem(word word word) GetNextDlgTabItem16 @@ -510,7 +510,7 @@ rsrc resources/version16.res 606 pascal16 FormatMessage(long segptr word word ptr word ptr) FormatMessage16 608 pascal16 GetForegroundWindow() GetForegroundWindow16 609 pascal16 SetForegroundWindow(word) SetForegroundWindow16 -610 pascal16 DestroyIcon32(word word) CURSORICON_Destroy +610 pascal16 DestroyIcon32(word word) DestroyIcon32 620 pascal ChangeDisplaySettings(ptr long) ChangeDisplaySettings16 621 pascal16 EnumDisplaySettings(str long ptr) EnumDisplaySettings16 640 pascal MsgWaitForMultipleObjects(long ptr long long long) MsgWaitForMultipleObjects16 diff --git a/dlls/user/wnd16.c b/dlls/user/wnd16.c index 96b4fcd7206..766406d0d95 100644 --- a/dlls/user/wnd16.c +++ b/dlls/user/wnd16.c @@ -7,10 +7,28 @@ #include "wine/winuser16.h" #include "user.h" #include "win.h" +#include "task.h" #include "stackframe.h" static HWND16 hwndSysModal; +/* ### start build ### */ +extern WORD CALLBACK WIN_CallTo16_word_wl(WNDENUMPROC16,WORD,LONG); +/* ### stop build ### */ + +struct wnd_enum_info +{ + WNDENUMPROC16 proc; + LPARAM param; +}; + +/* callback for 16-bit window enumeration functions */ +static BOOL CALLBACK wnd_enum_callback( HWND hwnd, LPARAM param ) +{ + const struct wnd_enum_info *info = (struct wnd_enum_info *)param; + return WIN_CallTo16_word_wl( info->proc, hwnd, info->param ); +} + /* convert insert after window handle to 32-bit */ inline static HWND full_insert_after_hwnd( HWND16 hwnd ) { @@ -338,6 +356,32 @@ BOOL16 WINAPI DestroyWindow16( HWND16 hwnd ) } +/******************************************************************* + * EnumWindows (USER.54) + */ +BOOL16 WINAPI EnumWindows16( WNDENUMPROC16 func, LPARAM lParam ) +{ + struct wnd_enum_info info; + + info.proc = func; + info.param = lParam; + return EnumWindows( wnd_enum_callback, (LPARAM)&info ); +} + + +/********************************************************************** + * EnumChildWindows (USER.55) + */ +BOOL16 WINAPI EnumChildWindows16( HWND16 parent, WNDENUMPROC16 func, LPARAM lParam ) +{ + struct wnd_enum_info info; + + info.proc = func; + info.param = lParam; + return EnumChildWindows( WIN_Handle32(parent), wnd_enum_callback, (LPARAM)&info ); +} + + /************************************************************************** * MoveWindow (USER.56) */ @@ -915,6 +959,21 @@ INT16 WINAPI DlgDirListComboBox16( HWND16 hDlg, LPSTR spec, INT16 idCBox, } +/********************************************************************** + * EnumTaskWindows (USER.225) + */ +BOOL16 WINAPI EnumTaskWindows16( HTASK16 hTask, WNDENUMPROC16 func, LPARAM lParam ) +{ + struct wnd_enum_info info; + TDB *tdb = TASK_GetPtr( hTask ); + + if (!tdb) return FALSE; + info.proc = func; + info.param = lParam; + return EnumThreadWindows( (DWORD)tdb->teb->tid, wnd_enum_callback, (LPARAM)&info ); +} + + /************************************************************************** * GetNextDlgGroupItem (USER.227) */ diff --git a/windows/.cvsignore b/windows/.cvsignore index 5b8a0dd2b2b..1fae21974e5 100644 --- a/windows/.cvsignore +++ b/windows/.cvsignore @@ -1,3 +1,4 @@ Makefile driver.glue.c hook.glue.c +painting.glue.c diff --git a/windows/Makefile.in b/windows/Makefile.in index f9ba8515972..ed4d4c6f1ca 100644 --- a/windows/Makefile.in +++ b/windows/Makefile.in @@ -41,8 +41,10 @@ C_SRCS = \ winpos.c \ winproc.c -GLUE = hook.c \ - driver.c +GLUE = \ + driver.c \ + hook.c \ + painting.c all: $(MODULE).o diff --git a/windows/painting.c b/windows/painting.c index 5eda6dba5dd..dcad3ac4936 100644 --- a/windows/painting.c +++ b/windows/painting.c @@ -43,6 +43,24 @@ DECLARE_DEBUG_CHANNEL(nonclient); #define COLOR_MAX COLOR_GRADIENTINACTIVECAPTION +/* ### start build ### */ +extern WORD CALLBACK PAINTING_CallTo16_word_wlwww(DRAWSTATEPROC16,WORD,LONG,WORD,WORD,WORD); +/* ### stop build ### */ + +struct draw_state_info +{ + DRAWSTATEPROC16 proc; + LPARAM param; +}; + +/* callback for 16-bit DrawState functions */ +static BOOL CALLBACK draw_state_callback( HDC hdc, LPARAM lparam, WPARAM wparam, int cx, int cy ) +{ + const struct draw_state_info *info = (struct draw_state_info *)lparam; + return PAINTING_CallTo16_word_wlwww( info->proc, hdc, info->param, wparam, cx, cy ); +} + + /*********************************************************************** * add_paint_count * @@ -1335,6 +1353,34 @@ BOOL WINAPI DrawStateW(HDC hdc, HBRUSH hbr, return PAINTING_DrawState(hdc, hbr, func, ldata, wdata, x, y, cx, cy, flags, TRUE); } + +/********************************************************************** + * DrawState (USER.449) + */ +BOOL16 WINAPI DrawState16( HDC16 hdc, HBRUSH16 hbr, DRAWSTATEPROC16 func, LPARAM ldata, + WPARAM16 wdata, INT16 x, INT16 y, INT16 cx, INT16 cy, UINT16 flags ) +{ + struct draw_state_info info; + UINT opcode = flags & 0xf; + + if (opcode == DST_TEXT || opcode == DST_PREFIXTEXT) + { + /* make sure DrawStateA doesn't try to use ldata as a pointer */ + if (!wdata) wdata = strlen( MapSL(ldata) ); + if (!cx || !cy) + { + SIZE s; + if (!GetTextExtentPoint32A( hdc, MapSL(ldata), wdata, &s )) return FALSE; + if (!cx) cx = s.cx; + if (!cy) cy = s.cy; + } + } + info.proc = func; + info.param = ldata; + return DrawStateA( hdc, hbr, draw_state_callback, (LPARAM)&info, wdata, x, y, cx, cy, flags ); +} + + /*********************************************************************** * SelectPalette (USER.282) */ diff --git a/windows/win.c b/windows/win.c index c3cce5a17f8..8f8404407fe 100644 --- a/windows/win.c +++ b/windows/win.c @@ -2902,18 +2902,6 @@ BOOL WINAPI EnumWindows( WNDENUMPROC lpEnumFunc, LPARAM lParam ) } -/********************************************************************** - * EnumTaskWindows16 (USER.225) - */ -BOOL16 WINAPI EnumTaskWindows16( HTASK16 hTask, WNDENUMPROC16 func, - LPARAM lParam ) -{ - TDB *tdb = TASK_GetPtr( hTask ); - if (!tdb) return FALSE; - return EnumThreadWindows( (DWORD)tdb->teb->tid, (WNDENUMPROC)func, lParam ); -} - - /********************************************************************** * EnumThreadWindows (USER32.@) */