comctl32/button: Use duplicated image for drawing.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47794 Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
38480c5916
commit
5fcd20396f
|
@ -90,11 +90,12 @@ typedef struct _BUTTON_INFO
|
||||||
HIMAGELIST glyph; /* this is a font character code when split_style doesn't have BCSS_IMAGE */
|
HIMAGELIST glyph; /* this is a font character code when split_style doesn't have BCSS_IMAGE */
|
||||||
SIZE glyph_size;
|
SIZE glyph_size;
|
||||||
RECT text_margin;
|
RECT text_margin;
|
||||||
|
HANDLE image; /* Original handle set with BM_SETIMAGE and returned with BM_GETIMAGE. */
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
HICON icon;
|
HICON icon;
|
||||||
HBITMAP bitmap;
|
HBITMAP bitmap;
|
||||||
HANDLE image;
|
HANDLE image; /* Duplicated handle used for drawing. */
|
||||||
} u;
|
} u;
|
||||||
} BUTTON_INFO;
|
} BUTTON_INFO;
|
||||||
|
|
||||||
|
@ -488,6 +489,10 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
|
||||||
|
|
||||||
case WM_NCDESTROY:
|
case WM_NCDESTROY:
|
||||||
SetWindowLongPtrW( hWnd, 0, 0 );
|
SetWindowLongPtrW( hWnd, 0, 0 );
|
||||||
|
if (infoPtr->image_type == IMAGE_BITMAP)
|
||||||
|
DeleteObject(infoPtr->u.bitmap);
|
||||||
|
else if (infoPtr->image_type == IMAGE_ICON)
|
||||||
|
DestroyIcon(infoPtr->u.icon);
|
||||||
heap_free(infoPtr->note);
|
heap_free(infoPtr->note);
|
||||||
heap_free(infoPtr);
|
heap_free(infoPtr);
|
||||||
break;
|
break;
|
||||||
|
@ -859,13 +864,14 @@ static LRESULT CALLBACK BUTTON_WindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L
|
||||||
|
|
||||||
case BM_SETIMAGE:
|
case BM_SETIMAGE:
|
||||||
infoPtr->image_type = (DWORD)wParam;
|
infoPtr->image_type = (DWORD)wParam;
|
||||||
oldHbitmap = infoPtr->u.image;
|
oldHbitmap = infoPtr->image;
|
||||||
infoPtr->u.image = (HANDLE)lParam;
|
infoPtr->u.image = CopyImage((HANDLE)lParam, infoPtr->image_type, 0, 0, 0);
|
||||||
|
infoPtr->image = (HANDLE)lParam;
|
||||||
InvalidateRect( hWnd, NULL, FALSE );
|
InvalidateRect( hWnd, NULL, FALSE );
|
||||||
return (LRESULT)oldHbitmap;
|
return (LRESULT)oldHbitmap;
|
||||||
|
|
||||||
case BM_GETIMAGE:
|
case BM_GETIMAGE:
|
||||||
return (LRESULT)infoPtr->u.image;
|
return (LRESULT)infoPtr->image;
|
||||||
|
|
||||||
case BCM_SETIMAGELIST:
|
case BCM_SETIMAGELIST:
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue