user32: Move loading of static icons for 16-bit windows to the 16-bit wrapper.
This commit is contained in:
parent
fadc2cda1c
commit
b96ab35cad
|
@ -2594,6 +2594,33 @@ static LRESULT static_proc16( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam,
|
||||||
{
|
{
|
||||||
switch (msg)
|
switch (msg)
|
||||||
{
|
{
|
||||||
|
case WM_NCCREATE:
|
||||||
|
{
|
||||||
|
CREATESTRUCTA *cs = (CREATESTRUCTA *)lParam;
|
||||||
|
LRESULT ret = wow_handlers32.static_proc( hwnd, msg, wParam, lParam, unicode );
|
||||||
|
|
||||||
|
if (!ret) return 0;
|
||||||
|
if (((ULONG_PTR)cs->hInstance >> 16)) return ret; /* 32-bit instance, nothing to do */
|
||||||
|
switch (cs->style & SS_TYPEMASK)
|
||||||
|
{
|
||||||
|
case SS_ICON:
|
||||||
|
{
|
||||||
|
HICON16 icon = LoadIcon16( HINSTANCE_16(cs->hInstance), cs->lpszName );
|
||||||
|
if (!icon) icon = LoadCursor16( HINSTANCE_16(cs->hInstance), cs->lpszName );
|
||||||
|
if (icon) wow_handlers32.static_proc( hwnd, STM_SETIMAGE, IMAGE_ICON,
|
||||||
|
(LPARAM)HICON_32(icon), FALSE );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SS_BITMAP:
|
||||||
|
{
|
||||||
|
HBITMAP16 bitmap = LoadBitmap16( HINSTANCE_16(cs->hInstance), cs->lpszName );
|
||||||
|
if (bitmap) wow_handlers32.static_proc( hwnd, STM_SETIMAGE, IMAGE_BITMAP,
|
||||||
|
(LPARAM)HBITMAP_32(bitmap), FALSE );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
case STM_SETICON16:
|
case STM_SETICON16:
|
||||||
wParam = (WPARAM)HICON_32( (HICON16)wParam );
|
wParam = (WPARAM)HICON_32( (HICON16)wParam );
|
||||||
return wow_handlers32.static_proc( hwnd, STM_SETICON, wParam, lParam, FALSE );
|
return wow_handlers32.static_proc( hwnd, STM_SETICON, wParam, lParam, FALSE );
|
||||||
|
|
|
@ -256,23 +256,25 @@ static HANDLE STATIC_GetImage( HWND hwnd, WPARAM wParam, DWORD style )
|
||||||
*
|
*
|
||||||
* Load the icon for an SS_ICON control.
|
* Load the icon for an SS_ICON control.
|
||||||
*/
|
*/
|
||||||
static HICON STATIC_LoadIconA( HWND hwnd, LPCSTR name, DWORD style )
|
static HICON STATIC_LoadIconA( HINSTANCE hInstance, LPCSTR name, DWORD style )
|
||||||
{
|
{
|
||||||
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE );
|
HICON hicon;
|
||||||
if ((style & SS_REALSIZEIMAGE) != 0)
|
|
||||||
|
if (hInstance && ((ULONG_PTR)hInstance >> 16))
|
||||||
{
|
{
|
||||||
return LoadImageA(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED);
|
if ((style & SS_REALSIZEIMAGE) != 0)
|
||||||
}
|
hicon = LoadImageA(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
HICON hicon = LoadIconA( hInstance, name );
|
hicon = LoadIconA( hInstance, name );
|
||||||
if (!hicon) hicon = LoadCursorA( hInstance, name );
|
if (!hicon) hicon = LoadCursorA( hInstance, name );
|
||||||
if (!hicon) hicon = LoadIconA( 0, name );
|
}
|
||||||
/* Windows doesn't try to load a standard cursor,
|
|
||||||
probably because most IDs for standard cursors conflict
|
|
||||||
with the IDs for standard icons anyway */
|
|
||||||
return hicon;
|
|
||||||
}
|
}
|
||||||
|
if (!hicon) hicon = LoadIconA( 0, name );
|
||||||
|
/* Windows doesn't try to load a standard cursor,
|
||||||
|
probably because most IDs for standard cursors conflict
|
||||||
|
with the IDs for standard icons anyway */
|
||||||
|
return hicon;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -280,47 +282,25 @@ static HICON STATIC_LoadIconA( HWND hwnd, LPCSTR name, DWORD style )
|
||||||
*
|
*
|
||||||
* Load the icon for an SS_ICON control.
|
* Load the icon for an SS_ICON control.
|
||||||
*/
|
*/
|
||||||
static HICON STATIC_LoadIconW( HWND hwnd, LPCWSTR name, DWORD style )
|
static HICON STATIC_LoadIconW( HINSTANCE hInstance, LPCWSTR name, DWORD style )
|
||||||
{
|
{
|
||||||
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE );
|
HICON hicon;
|
||||||
if ((style & SS_REALSIZEIMAGE) != 0)
|
|
||||||
{
|
|
||||||
return LoadImageW(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
HICON hicon = LoadIconW( hInstance, name );
|
|
||||||
if (!hicon) hicon = LoadCursorW( hInstance, name );
|
|
||||||
if (!hicon) hicon = LoadIconW( 0, name );
|
|
||||||
/* Windows doesn't try to load a standard cursor,
|
|
||||||
probably because most IDs for standard cursors conflict
|
|
||||||
with the IDs for standard icons anyway */
|
|
||||||
return hicon;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/***********************************************************************
|
if (hInstance && ((ULONG_PTR)hInstance >> 16))
|
||||||
* STATIC_LoadBitmapA
|
{
|
||||||
*
|
if ((style & SS_REALSIZEIMAGE) != 0)
|
||||||
* Load the bitmap for an SS_BITMAP control.
|
hicon = LoadImageW(hInstance, name, IMAGE_ICON, 0, 0, LR_SHARED);
|
||||||
*/
|
else
|
||||||
static HBITMAP STATIC_LoadBitmapA( HWND hwnd, LPCSTR name )
|
{
|
||||||
{
|
hicon = LoadIconW( hInstance, name );
|
||||||
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE );
|
if (!hicon) hicon = LoadCursorW( hInstance, name );
|
||||||
/* Windows doesn't try to load OEM Bitmaps (hInstance == NULL) */
|
}
|
||||||
return LoadBitmapA( hInstance, name );
|
}
|
||||||
}
|
if (!hicon) hicon = LoadIconW( 0, name );
|
||||||
|
/* Windows doesn't try to load a standard cursor,
|
||||||
/***********************************************************************
|
probably because most IDs for standard cursors conflict
|
||||||
* STATIC_LoadBitmapW
|
with the IDs for standard icons anyway */
|
||||||
*
|
return hicon;
|
||||||
* Load the bitmap for an SS_BITMAP control.
|
|
||||||
*/
|
|
||||||
static HBITMAP STATIC_LoadBitmapW( HWND hwnd, LPCWSTR name )
|
|
||||||
{
|
|
||||||
HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtrW( hwnd, GWLP_HINSTANCE );
|
|
||||||
/* Windows doesn't try to load OEM Bitmaps (hInstance == NULL) */
|
|
||||||
return LoadBitmapW( hInstance, name );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -471,42 +451,31 @@ LRESULT StaticWndProc_common( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam
|
||||||
|
|
||||||
case WM_NCCREATE:
|
case WM_NCCREATE:
|
||||||
{
|
{
|
||||||
LPCSTR textA;
|
CREATESTRUCTW *cs = (CREATESTRUCTW *)lParam;
|
||||||
LPCWSTR textW;
|
|
||||||
|
|
||||||
if (full_style & SS_SUNKEN)
|
if (full_style & SS_SUNKEN)
|
||||||
SetWindowLongW( hwnd, GWL_EXSTYLE,
|
SetWindowLongW( hwnd, GWL_EXSTYLE,
|
||||||
GetWindowLongW( hwnd, GWL_EXSTYLE ) | WS_EX_STATICEDGE );
|
GetWindowLongW( hwnd, GWL_EXSTYLE ) | WS_EX_STATICEDGE );
|
||||||
|
|
||||||
if(unicode)
|
|
||||||
{
|
|
||||||
textA = NULL;
|
|
||||||
textW = ((LPCREATESTRUCTW)lParam)->lpszName;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
textA = ((LPCREATESTRUCTA)lParam)->lpszName;
|
|
||||||
textW = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (style) {
|
switch (style) {
|
||||||
case SS_ICON:
|
case SS_ICON:
|
||||||
{
|
{
|
||||||
HICON hIcon;
|
HICON hIcon;
|
||||||
if(unicode)
|
if (unicode || IS_INTRESOURCE(cs->lpszName))
|
||||||
hIcon = STATIC_LoadIconW(hwnd, textW, full_style);
|
hIcon = STATIC_LoadIconW(cs->hInstance, cs->lpszName, full_style);
|
||||||
else
|
else
|
||||||
hIcon = STATIC_LoadIconA(hwnd, textA, full_style);
|
hIcon = STATIC_LoadIconA(cs->hInstance, (LPCSTR)cs->lpszName, full_style);
|
||||||
STATIC_SetIcon(hwnd, hIcon, full_style);
|
STATIC_SetIcon(hwnd, hIcon, full_style);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SS_BITMAP:
|
case SS_BITMAP:
|
||||||
|
if ((ULONG_PTR)cs->hInstance >> 16)
|
||||||
{
|
{
|
||||||
HBITMAP hBitmap;
|
HBITMAP hBitmap;
|
||||||
if(unicode)
|
if (unicode || IS_INTRESOURCE(cs->lpszName))
|
||||||
hBitmap = STATIC_LoadBitmapW(hwnd, textW);
|
hBitmap = LoadBitmapW(cs->hInstance, cs->lpszName);
|
||||||
else
|
else
|
||||||
hBitmap = STATIC_LoadBitmapA(hwnd, textA);
|
hBitmap = LoadBitmapA(cs->hInstance, (LPCSTR)cs->lpszName);
|
||||||
STATIC_SetBitmap(hwnd, hBitmap, full_style);
|
STATIC_SetBitmap(hwnd, hBitmap, full_style);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue