winex11: Detect system cursors from cursor module name in create_xcursor_system_cursor.

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
This commit is contained in:
Jacek Caban 2022-05-29 16:13:31 +02:00 committed by Alexandre Julliard
parent ef0cb9157f
commit 5e18d7d823
3 changed files with 17 additions and 44 deletions

View file

@ -128,30 +128,6 @@ static NTSTATUS x11drv_clipboard_init( UINT arg )
}
static NTSTATUS WINAPI x11drv_is_system_module( void *arg, ULONG size )
{
HMODULE module;
unsigned int i;
static const WCHAR cursor_modules[][16] =
{
{ 'u','s','e','r','3','2','.','d','l','l',0 },
{ 'c','o','m','c','t','l','3','2','.','d','l','l',0 },
{ 'o','l','e','3','2','.','d','l','l',0 },
{ 'r','i','c','h','e','d','2','0','.','d','l','l',0 }
};
if (!(module = GetModuleHandleW( arg ))) return system_module_none;
for (i = 0; i < ARRAYSIZE(cursor_modules); i++)
{
if (GetModuleHandleW( cursor_modules[i] ) == module) return i;
}
return system_module_none;
}
static NTSTATUS x11drv_load_icon( UINT id )
{
return HandleToUlong( LoadIconW( NULL, UlongToPtr( id )));
@ -189,7 +165,6 @@ static const kernel_callback kernel_callbacks[] =
x11drv_dnd_post_drop,
x11drv_ime_set_composition_string,
x11drv_ime_set_result,
x11drv_is_system_module,
x11drv_systray_change_owner,
};

View file

@ -931,12 +931,16 @@ static const struct system_cursors riched20_cursors[] =
{ 0 }
};
static const struct system_cursors *module_cursors[] =
static const struct
{
user32_cursors,
comctl32_cursors,
ole32_cursors,
riched20_cursors,
const struct system_cursors *cursors;
WCHAR name[16];
} module_cursors[] =
{
{ user32_cursors, {'u','s','e','r','3','2','.','d','l','l',0} },
{ comctl32_cursors, {'c','o','m','c','t','l','3','2','.','d','l','l',0} },
{ ole32_cursors, {'o','l','e','3','2','.','d','l','l',0} },
{ riched20_cursors, {'r','i','c','h','e','d','2','0','.','d','l','l',0} }
};
struct cursor_font_fallback
@ -1054,6 +1058,7 @@ static int find_fallback_shape( const char *name )
static Cursor create_xcursor_system_cursor( const ICONINFOEXW *info )
{
const struct system_cursors *cursors;
const WCHAR *module;
unsigned int i;
Cursor cursor = 0;
HKEY key;
@ -1094,11 +1099,14 @@ static Cursor create_xcursor_system_cursor( const ICONINFOEXW *info )
}
if (info->szResName[0]) goto done; /* only integer resources are supported here */
i = x11drv_client_func( client_func_is_system_module, info->szModName,
(lstrlenW( info->szModName ) + 1) * sizeof(WCHAR) );
if (i == system_module_none) goto done;
cursors = module_cursors[i];
if ((module = wcsrchr( info->szModName, '\\' ))) module++;
else module = info->szModName;
for (i = 0; i < ARRAY_SIZE( module_cursors ); i++)
if (!wcsicmp( module, module_cursors[i].name )) break;
if (i == ARRAY_SIZE( module_cursors )) goto done;
cursors = module_cursors[i].cursors;
for (i = 0; cursors[i].id; i++)
if (cursors[i].id == info->wResID)
{

View file

@ -75,15 +75,6 @@ struct systray_dock_params
BOOL *layered;
};
enum system_modules
{
system_module_user32,
system_module_comctl32,
system_module_ole32,
system_module_riched20,
system_module_none = 0xffff,
};
/* x11drv_tablet_info params */
struct tablet_info_params
{
@ -108,7 +99,6 @@ enum x11drv_client_funcs
client_func_dnd_post_drop,
client_func_ime_set_composition_string,
client_func_ime_set_result,
client_func_is_system_module,
client_func_systray_change_owner,
client_func_last
};