Commit e6533a6b authored by Alexandre Julliard's avatar Alexandre Julliard

Fixed DrawState16 callback support.

parent fa7ae720
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
/* ### start build ### */ /* ### start build ### */
extern WORD CALLBACK THUNK_CallTo16_word_wl (FARPROC16,WORD,LONG); 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_wlw (FARPROC16,WORD,LONG,WORD);
extern WORD CALLBACK THUNK_CallTo16_word_wlwww(FARPROC16,WORD,LONG,WORD,WORD,WORD);
/* ### stop build ### */ /* ### stop build ### */
...@@ -74,3 +75,26 @@ BOOL16 WINAPI THUNK_GrayString16( HDC16 hdc, HBRUSH16 hbr, ...@@ -74,3 +75,26 @@ BOOL16 WINAPI THUNK_GrayString16( HDC16 hdc, HBRUSH16 hbr,
} }
/**********************************************************************
* 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 );
}
...@@ -422,7 +422,7 @@ rsrc resources/version16.res ...@@ -422,7 +422,7 @@ rsrc resources/version16.res
446 stub SetMenuItemInfo 446 stub SetMenuItemInfo
447 pascal DefMDIChildProc(word word word long) DefMDIChildProc16 447 pascal DefMDIChildProc(word word word long) DefMDIChildProc16
448 pascal16 DrawAnimatedRects(word word ptr ptr) DrawAnimatedRects16 448 pascal16 DrawAnimatedRects(word word ptr ptr) DrawAnimatedRects16
449 pascal16 DrawState(word word ptr long word s_word s_word s_word s_word word) DrawState16 449 pascal16 DrawState(word word segptr long word s_word s_word s_word s_word word) DrawState16
450 pascal16 CreateIconFromResourceEx(ptr long word long word word word) CreateIconFromResourceEx16 450 pascal16 CreateIconFromResourceEx(ptr long word long word word word) CreateIconFromResourceEx16
451 pascal16 TranslateMDISysAccel(word ptr) TranslateMDISysAccel16 451 pascal16 TranslateMDISysAccel(word ptr) TranslateMDISysAccel16
452 pascal16 CreateWindowEx(long str str long s_word s_word s_word s_word 452 pascal16 CreateWindowEx(long str str long s_word s_word s_word s_word
......
...@@ -772,7 +772,7 @@ static HRGN RDW_Paint( WND* wndPtr, HRGN hrgn, UINT flags, UINT ex ) ...@@ -772,7 +772,7 @@ static HRGN RDW_Paint( WND* wndPtr, HRGN hrgn, UINT flags, UINT ex )
if (flags & RDW_UPDATENOW) if (flags & RDW_UPDATENOW)
{ {
if (wndPtr->hrgnUpdate) /* wm_painticon wparam is 1 */ if (wndPtr->hrgnUpdate) /* wm_painticon wparam is 1 */
SendMessage16( hWnd, (bIcon) ? WM_PAINTICON : WM_PAINT, bIcon, 0 ); SendMessageW( hWnd, (bIcon) ? WM_PAINTICON : WM_PAINT, bIcon, 0 );
} }
else if (flags & RDW_ERASENOW) else if (flags & RDW_ERASENOW)
{ {
...@@ -798,8 +798,8 @@ static HRGN RDW_Paint( WND* wndPtr, HRGN hrgn, UINT flags, UINT ex ) ...@@ -798,8 +798,8 @@ static HRGN RDW_Paint( WND* wndPtr, HRGN hrgn, UINT flags, UINT ex )
dcx &= ~DCX_INTERSECTRGN; dcx &= ~DCX_INTERSECTRGN;
if (( hDC = GetDCEx( hWnd, hrgnRet, dcx )) ) if (( hDC = GetDCEx( hWnd, hrgnRet, dcx )) )
{ {
if (SendMessage16( hWnd, (bIcon) ? WM_ICONERASEBKGND if (SendMessageW( hWnd, (bIcon) ? WM_ICONERASEBKGND : WM_ERASEBKGND,
: WM_ERASEBKGND, (WPARAM16)hDC, 0 )) (WPARAM)hDC, 0 ))
wndPtr->flags &= ~WIN_NEEDS_ERASEBKGND; wndPtr->flags &= ~WIN_NEEDS_ERASEBKGND;
ReleaseDC( hWnd, hDC ); ReleaseDC( hWnd, hDC );
} }
...@@ -1406,8 +1406,7 @@ BOOL WINAPI DrawAnimatedRects( HWND hwnd, INT idAni, ...@@ -1406,8 +1406,7 @@ BOOL WINAPI DrawAnimatedRects( HWND hwnd, INT idAni,
*/ */
static BOOL PAINTING_DrawStateJam(HDC hdc, UINT opcode, static BOOL PAINTING_DrawStateJam(HDC hdc, UINT opcode,
DRAWSTATEPROC func, LPARAM lp, WPARAM wp, DRAWSTATEPROC func, LPARAM lp, WPARAM wp,
LPRECT rc, UINT dtflags, LPRECT rc, UINT dtflags, BOOL unicode )
BOOL unicode, BOOL _32bit)
{ {
HDC memdc; HDC memdc;
HBITMAP hbmsave; HBITMAP hbmsave;
...@@ -1421,10 +1420,8 @@ static BOOL PAINTING_DrawStateJam(HDC hdc, UINT opcode, ...@@ -1421,10 +1420,8 @@ static BOOL PAINTING_DrawStateJam(HDC hdc, UINT opcode,
case DST_PREFIXTEXT: case DST_PREFIXTEXT:
if(unicode) if(unicode)
return DrawTextW(hdc, (LPWSTR)lp, (INT)wp, rc, dtflags); return DrawTextW(hdc, (LPWSTR)lp, (INT)wp, rc, dtflags);
else if(_32bit)
return DrawTextA(hdc, (LPSTR)lp, (INT)wp, rc, dtflags);
else else
return DrawTextA(hdc, MapSL(lp), (INT)wp, rc, dtflags); return DrawTextA(hdc, (LPSTR)lp, (INT)wp, rc, dtflags);
case DST_ICON: case DST_ICON:
return DrawIcon(hdc, rc->left, rc->top, (HICON)lp); return DrawIcon(hdc, rc->left, rc->top, (HICON)lp);
...@@ -1449,10 +1446,7 @@ static BOOL PAINTING_DrawStateJam(HDC hdc, UINT opcode, ...@@ -1449,10 +1446,7 @@ static BOOL PAINTING_DrawStateJam(HDC hdc, UINT opcode,
/* DRAWSTATEPROC assumes that it draws at the center of coordinates */ /* DRAWSTATEPROC assumes that it draws at the center of coordinates */
OffsetViewportOrgEx(hdc, rc->left, rc->top, NULL); OffsetViewportOrgEx(hdc, rc->left, rc->top, NULL);
if(_32bit)
bRet = func(hdc, lp, wp, cx, cy); bRet = func(hdc, lp, wp, cx, cy);
else
bRet = (BOOL)((DRAWSTATEPROC16)func)((HDC16)hdc, (LPARAM)lp, (WPARAM16)wp, (INT16)cx, (INT16)cy);
/* Restore origin */ /* Restore origin */
OffsetViewportOrgEx(hdc, -rc->left, -rc->top, NULL); OffsetViewportOrgEx(hdc, -rc->left, -rc->top, NULL);
return bRet; return bRet;
...@@ -1465,10 +1459,8 @@ static BOOL PAINTING_DrawStateJam(HDC hdc, UINT opcode, ...@@ -1465,10 +1459,8 @@ static BOOL PAINTING_DrawStateJam(HDC hdc, UINT opcode,
/********************************************************************** /**********************************************************************
* PAINTING_DrawState() * PAINTING_DrawState()
*/ */
static BOOL PAINTING_DrawState(HDC hdc, HBRUSH hbr, static BOOL PAINTING_DrawState(HDC hdc, HBRUSH hbr, DRAWSTATEPROC func, LPARAM lp, WPARAM wp,
DRAWSTATEPROC func, LPARAM lp, WPARAM wp, INT x, INT y, INT cx, INT cy, UINT flags, BOOL unicode )
INT x, INT y, INT cx, INT cy,
UINT flags, BOOL unicode, BOOL _32bit)
{ {
HBITMAP hbm, hbmsave; HBITMAP hbm, hbmsave;
HFONT hfsave; HFONT hfsave;
...@@ -1485,10 +1477,8 @@ static BOOL PAINTING_DrawState(HDC hdc, HBRUSH hbr, ...@@ -1485,10 +1477,8 @@ static BOOL PAINTING_DrawState(HDC hdc, HBRUSH hbr,
{ {
if(unicode) if(unicode)
len = strlenW((LPWSTR)lp); len = strlenW((LPWSTR)lp);
else if(_32bit)
len = strlen((LPSTR)lp);
else else
len = strlen(MapSL(lp)); len = strlen((LPSTR)lp);
} }
/* Find out what size the image has if not given by caller */ /* Find out what size the image has if not given by caller */
...@@ -1504,10 +1494,8 @@ static BOOL PAINTING_DrawState(HDC hdc, HBRUSH hbr, ...@@ -1504,10 +1494,8 @@ static BOOL PAINTING_DrawState(HDC hdc, HBRUSH hbr,
case DST_PREFIXTEXT: case DST_PREFIXTEXT:
if(unicode) if(unicode)
retval = GetTextExtentPoint32W(hdc, (LPWSTR)lp, len, &s); retval = GetTextExtentPoint32W(hdc, (LPWSTR)lp, len, &s);
else if(_32bit)
retval = GetTextExtentPoint32A(hdc, (LPSTR)lp, len, &s);
else else
retval = GetTextExtentPoint32A(hdc, MapSL(lp), len, &s); retval = GetTextExtentPoint32A(hdc, (LPSTR)lp, len, &s);
if(!retval) return FALSE; if(!retval) return FALSE;
break; break;
...@@ -1547,7 +1535,7 @@ static BOOL PAINTING_DrawState(HDC hdc, HBRUSH hbr, ...@@ -1547,7 +1535,7 @@ static BOOL PAINTING_DrawState(HDC hdc, HBRUSH hbr,
/* For DSS_NORMAL we just jam in the image and return */ /* For DSS_NORMAL we just jam in the image and return */
if((flags & 0x7ff0) == DSS_NORMAL) if((flags & 0x7ff0) == DSS_NORMAL)
{ {
return PAINTING_DrawStateJam(hdc, opcode, func, lp, len, &rc, dtflags, unicode, _32bit); return PAINTING_DrawStateJam(hdc, opcode, func, lp, len, &rc, dtflags, unicode);
} }
/* For all other states we need to convert the image to B/W in a local bitmap */ /* For all other states we need to convert the image to B/W in a local bitmap */
...@@ -1577,7 +1565,7 @@ static BOOL PAINTING_DrawState(HDC hdc, HBRUSH hbr, ...@@ -1577,7 +1565,7 @@ static BOOL PAINTING_DrawState(HDC hdc, HBRUSH hbr,
* so we must be sure that correct font is selected * so we must be sure that correct font is selected
*/ */
if(!hfsave && (opcode <= DST_PREFIXTEXT)) goto cleanup; if(!hfsave && (opcode <= DST_PREFIXTEXT)) goto cleanup;
tmp = PAINTING_DrawStateJam(memdc, opcode, func, lp, len, &rc, dtflags, unicode, _32bit); tmp = PAINTING_DrawStateJam(memdc, opcode, func, lp, len, &rc, dtflags, unicode);
if(hfsave) SelectObject(memdc, hfsave); if(hfsave) SelectObject(memdc, hfsave);
if(!tmp) goto cleanup; if(!tmp) goto cleanup;
...@@ -1644,7 +1632,7 @@ BOOL WINAPI DrawStateA(HDC hdc, HBRUSH hbr, ...@@ -1644,7 +1632,7 @@ BOOL WINAPI DrawStateA(HDC hdc, HBRUSH hbr,
DRAWSTATEPROC func, LPARAM ldata, WPARAM wdata, DRAWSTATEPROC func, LPARAM ldata, WPARAM wdata,
INT x, INT y, INT cx, INT cy, UINT flags) INT x, INT y, INT cx, INT cy, UINT flags)
{ {
return PAINTING_DrawState(hdc, hbr, func, ldata, wdata, x, y, cx, cy, flags, FALSE, TRUE); return PAINTING_DrawState(hdc, hbr, func, ldata, wdata, x, y, cx, cy, flags, FALSE);
} }
/********************************************************************** /**********************************************************************
...@@ -1654,20 +1642,9 @@ BOOL WINAPI DrawStateW(HDC hdc, HBRUSH hbr, ...@@ -1654,20 +1642,9 @@ BOOL WINAPI DrawStateW(HDC hdc, HBRUSH hbr,
DRAWSTATEPROC func, LPARAM ldata, WPARAM wdata, DRAWSTATEPROC func, LPARAM ldata, WPARAM wdata,
INT x, INT y, INT cx, INT cy, UINT flags) INT x, INT y, INT cx, INT cy, UINT flags)
{ {
return PAINTING_DrawState(hdc, hbr, func, ldata, wdata, x, y, cx, cy, flags, TRUE, TRUE); 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)
{
return PAINTING_DrawState(hdc, hbr, (DRAWSTATEPROC)func, ldata, wdata, x, y, cx, cy, flags, FALSE, FALSE);
}
/*********************************************************************** /***********************************************************************
* SelectPalette (USER.282) * SelectPalette (USER.282)
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment