Commit d32d3b4f authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move WM_SETICON implementation from user32.

parent 27cfcaa2
...@@ -517,53 +517,11 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa ...@@ -517,53 +517,11 @@ static LRESULT DEFWND_DefWinProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lPa
case WM_SETICON: case WM_SETICON:
{ {
HICON ret; LRESULT res = NtUserMessageCall( hwnd, msg, wParam, lParam,
WND *wndPtr = WIN_GetPtr( hwnd ); 0, FNID_DEFWINDOWPROC, FALSE );
switch(wParam)
{
case ICON_SMALL:
ret = wndPtr->hIconSmall;
if (ret && !lParam && wndPtr->hIcon)
{
wndPtr->hIconSmall2 = CopyImage( wndPtr->hIcon, IMAGE_ICON,
GetSystemMetrics( SM_CXSMICON ),
GetSystemMetrics( SM_CYSMICON ), 0 );
}
else if (lParam && wndPtr->hIconSmall2)
{
DestroyIcon( wndPtr->hIconSmall2 );
wndPtr->hIconSmall2 = NULL;
}
wndPtr->hIconSmall = (HICON)lParam;
break;
case ICON_BIG:
ret = wndPtr->hIcon;
if (wndPtr->hIconSmall2)
{
DestroyIcon( wndPtr->hIconSmall2 );
wndPtr->hIconSmall2 = NULL;
}
if (lParam && !wndPtr->hIconSmall)
{
wndPtr->hIconSmall2 = CopyImage( (HICON)lParam, IMAGE_ICON,
GetSystemMetrics( SM_CXSMICON ),
GetSystemMetrics( SM_CYSMICON ), 0 );
}
wndPtr->hIcon = (HICON)lParam;
break;
default:
ret = 0;
break;
}
WIN_ReleasePtr( wndPtr );
USER_Driver->pSetWindowIcon( hwnd, wParam, (HICON)lParam );
if( (GetWindowLongW( hwnd, GWL_STYLE ) & WS_CAPTION) == WS_CAPTION ) if( (GetWindowLongW( hwnd, GWL_STYLE ) & WS_CAPTION) == WS_CAPTION )
NC_HandleNCPaint( hwnd , (HRGN)1 ); /* Repaint caption */ NC_HandleNCPaint( hwnd , (HRGN)1 ); /* Repaint caption */
return res;
return (LRESULT)ret;
} }
case WM_GETICON: case WM_GETICON:
......
...@@ -69,10 +69,6 @@ static void CDECL nulldrv_UpdateClipboard(void) ...@@ -69,10 +69,6 @@ static void CDECL nulldrv_UpdateClipboard(void)
{ {
} }
static void CDECL nulldrv_SetWindowIcon( HWND hwnd, UINT type, HICON icon )
{
}
static LRESULT CDECL nulldrv_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam ) static LRESULT CDECL nulldrv_SysCommand( HWND hwnd, WPARAM wparam, LPARAM lparam )
{ {
return -1; return -1;
...@@ -130,7 +126,7 @@ static struct user_driver_funcs lazy_load_driver = ...@@ -130,7 +126,7 @@ static struct user_driver_funcs lazy_load_driver =
NULL, NULL,
NULL, NULL,
NULL, NULL,
nulldrv_SetWindowIcon, NULL,
NULL, NULL,
NULL, NULL,
NULL, NULL,
...@@ -166,7 +162,6 @@ void CDECL __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT v ...@@ -166,7 +162,6 @@ void CDECL __wine_set_user_driver( const struct user_driver_funcs *funcs, UINT v
do { if (!driver->p##name) driver->p##name = nulldrv_##name; } while(0) do { if (!driver->p##name) driver->p##name = nulldrv_##name; } while(0)
SET_USER_FUNC(UpdateClipboard); SET_USER_FUNC(UpdateClipboard);
SET_USER_FUNC(SetWindowIcon);
SET_USER_FUNC(SysCommand); SET_USER_FUNC(SysCommand);
#undef SET_USER_FUNC #undef SET_USER_FUNC
......
...@@ -74,6 +74,54 @@ static BOOL set_window_text( HWND hwnd, const void *text, BOOL ansi ) ...@@ -74,6 +74,54 @@ static BOOL set_window_text( HWND hwnd, const void *text, BOOL ansi )
return TRUE; return TRUE;
} }
static HICON set_window_icon( HWND hwnd, WPARAM type, HICON icon )
{
HICON ret = 0;
WND *win;
if (!(win = get_win_ptr( hwnd ))) return 0;
switch (type)
{
case ICON_SMALL:
ret = win->hIconSmall;
if (ret && !icon && win->hIcon && user_callbacks)
{
win->hIconSmall2 = user_callbacks->pCopyImage( win->hIcon, IMAGE_ICON,
get_system_metrics( SM_CXSMICON ),
get_system_metrics( SM_CYSMICON ), 0 );
}
else if (icon && win->hIconSmall2)
{
NtUserDestroyCursor( win->hIconSmall2, 0 );
win->hIconSmall2 = NULL;
}
win->hIconSmall = icon;
break;
case ICON_BIG:
ret = win->hIcon;
if (win->hIconSmall2)
{
NtUserDestroyCursor( win->hIconSmall2, 0 );
win->hIconSmall2 = NULL;
}
if (icon && !win->hIconSmall && user_callbacks)
{
win->hIconSmall2 = user_callbacks->pCopyImage( icon, IMAGE_ICON,
get_system_metrics( SM_CXSMICON ),
get_system_metrics( SM_CYSMICON ), 0 );
}
win->hIcon = icon;
break;
}
release_win_ptr( win );
user_driver->pSetWindowIcon( hwnd, type, icon );
return ret;
}
LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, BOOL ansi ) LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, BOOL ansi )
{ {
LRESULT result = 0; LRESULT result = 0;
...@@ -104,6 +152,10 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, ...@@ -104,6 +152,10 @@ LRESULT default_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
case WM_SETTEXT: case WM_SETTEXT:
result = set_window_text( hwnd, (void *)lparam, ansi ); result = set_window_text( hwnd, (void *)lparam, ansi );
break; break;
case WM_SETICON:
result = (LRESULT)set_window_icon( hwnd, wparam, (HICON)lparam );
break;
} }
return result; return result;
......
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