Commit f47ed292 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

win32u: Move grab_pointer registry option from winex11.

parent bb043fb6
...@@ -406,7 +406,7 @@ static const KBDTABLES kbdus_tables = ...@@ -406,7 +406,7 @@ static const KBDTABLES kbdus_tables =
LONG global_key_state_counter = 0; LONG global_key_state_counter = 0;
BOOL grab_pointer = TRUE;
static void kbd_tables_init_vsc2vk( const KBDTABLES *tables, BYTE vsc2vk[0x300] ) static void kbd_tables_init_vsc2vk( const KBDTABLES *tables, BYTE vsc2vk[0x300] )
{ {
...@@ -2503,7 +2503,10 @@ BOOL process_wine_clipcursor( BOOL empty, BOOL reset ) ...@@ -2503,7 +2503,10 @@ BOOL process_wine_clipcursor( BOOL empty, BOOL reset )
TRACE( "empty %u, reset %u\n", empty, reset ); TRACE( "empty %u, reset %u\n", empty, reset );
if (empty || reset) return user_driver->pClipCursor( NULL, reset ); if (reset) return user_driver->pClipCursor( NULL, TRUE );
if (!grab_pointer) return TRUE;
if (empty) return user_driver->pClipCursor( NULL, reset );
get_clip_cursor( &rect ); get_clip_cursor( &rect );
return user_driver->pClipCursor( &rect, FALSE ); return user_driver->pClipCursor( &rect, FALSE );
......
...@@ -4099,13 +4099,47 @@ static union sysparam_all_entry * const default_entries[] = ...@@ -4099,13 +4099,47 @@ static union sysparam_all_entry * const default_entries[] =
(union sysparam_all_entry *)&entry_AUDIODESC_ON, (union sysparam_all_entry *)&entry_AUDIODESC_ON,
}; };
void sysparams_init(void) /***********************************************************************
* get_config_key
*
* Get a config key from either the app-specific or the default config
*/
static DWORD get_config_key( HKEY defkey, HKEY appkey, const char *name,
WCHAR *buffer, DWORD size )
{ {
WCHAR nameW[128];
char buf[2048];
KEY_VALUE_PARTIAL_INFORMATION *info = (void *)buf;
asciiz_to_unicode( nameW, name );
if (appkey && query_reg_value( appkey, nameW, info, sizeof(buf) ))
{
size = min( info->DataLength, size - sizeof(WCHAR) );
memcpy( buffer, info->Data, size );
buffer[size / sizeof(WCHAR)] = 0;
return 0;
}
if (defkey && query_reg_value( defkey, nameW, info, sizeof(buf) ))
{
size = min( info->DataLength, size - sizeof(WCHAR) );
memcpy( buffer, info->Data, size );
buffer[size / sizeof(WCHAR)] = 0;
return 0;
}
return ERROR_FILE_NOT_FOUND;
}
void sysparams_init(void)
{
WCHAR buffer[MAX_PATH+16], *p, *appname;
DWORD i, dispos, dpi_scaling; DWORD i, dispos, dpi_scaling;
WCHAR layout[KL_NAMELENGTH]; WCHAR layout[KL_NAMELENGTH];
pthread_mutexattr_t attr; pthread_mutexattr_t attr;
HKEY hkey; HKEY hkey, appkey = 0;
DWORD len;
static const WCHAR software_wineW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e'}; static const WCHAR software_wineW[] = {'S','o','f','t','w','a','r','e','\\','W','i','n','e'};
static const WCHAR temporary_system_parametersW[] = static const WCHAR temporary_system_parametersW[] =
...@@ -4114,6 +4148,7 @@ void sysparams_init(void) ...@@ -4114,6 +4148,7 @@ void sysparams_init(void)
static const WCHAR oneW[] = {'1',0}; static const WCHAR oneW[] = {'1',0};
static const WCHAR kl_preloadW[] = static const WCHAR kl_preloadW[] =
{'K','e','y','b','o','a','r','d',' ','L','a','y','o','u','t','\\','P','r','e','l','o','a','d'}; {'K','e','y','b','o','a','r','d',' ','L','a','y','o','u','t','\\','P','r','e','l','o','a','d'};
static const WCHAR x11driverW[] = {'\\','X','1','1',' ','D','r','i','v','e','r',0};
pthread_mutexattr_init( &attr ); pthread_mutexattr_init( &attr );
pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_RECURSIVE ); pthread_mutexattr_settype( &attr, PTHREAD_MUTEX_RECURSIVE );
...@@ -4173,6 +4208,42 @@ void sysparams_init(void) ...@@ -4173,6 +4208,42 @@ void sysparams_init(void)
for (i = 0; i < ARRAY_SIZE( default_entries ); i++) for (i = 0; i < ARRAY_SIZE( default_entries ); i++)
default_entries[i]->hdr.init( default_entries[i] ); default_entries[i]->hdr.init( default_entries[i] );
} }
/* @@ Wine registry key: HKCU\Software\Wine\X11 Driver */
hkey = reg_open_hkcu_key( "Software\\Wine\\X11 Driver" );
/* open the app-specific key */
appname = NtCurrentTeb()->Peb->ProcessParameters->ImagePathName.Buffer;
if ((p = wcsrchr( appname, '/' ))) appname = p + 1;
if ((p = wcsrchr( appname, '\\' ))) appname = p + 1;
len = lstrlenW( appname );
if (len && len < MAX_PATH)
{
HKEY tmpkey;
int i;
for (i = 0; appname[i]; i++) buffer[i] = RtlDowncaseUnicodeChar( appname[i] );
buffer[i] = 0;
appname = buffer;
memcpy( appname + i, x11driverW, sizeof(x11driverW) );
/* @@ Wine registry key: HKCU\Software\Wine\AppDefaults\app.exe\X11 Driver */
if ((tmpkey = reg_open_hkcu_key( "Software\\Wine\\AppDefaults" )))
{
appkey = reg_open_key( tmpkey, appname, lstrlenW( appname ) * sizeof(WCHAR) );
NtClose( tmpkey );
}
}
#define IS_OPTION_TRUE(ch) \
((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1')
if (!get_config_key( hkey, appkey, "GrabPointer", buffer, sizeof(buffer) ))
grab_pointer = IS_OPTION_TRUE( buffer[0] );
#undef IS_OPTION_TRUE
} }
static BOOL update_desktop_wallpaper(void) static BOOL update_desktop_wallpaper(void)
......
...@@ -86,6 +86,7 @@ extern BOOL register_imm_window( HWND hwnd ) DECLSPEC_HIDDEN; ...@@ -86,6 +86,7 @@ extern BOOL register_imm_window( HWND hwnd ) DECLSPEC_HIDDEN;
extern void unregister_imm_window( HWND hwnd ) DECLSPEC_HIDDEN; extern void unregister_imm_window( HWND hwnd ) DECLSPEC_HIDDEN;
/* input.c */ /* input.c */
extern BOOL grab_pointer DECLSPEC_HIDDEN;
extern BOOL destroy_caret(void) DECLSPEC_HIDDEN; extern BOOL destroy_caret(void) DECLSPEC_HIDDEN;
extern LONG global_key_state_counter DECLSPEC_HIDDEN; extern LONG global_key_state_counter DECLSPEC_HIDDEN;
extern HWND get_active_window(void) DECLSPEC_HIDDEN; extern HWND get_active_window(void) DECLSPEC_HIDDEN;
......
...@@ -1526,7 +1526,7 @@ BOOL X11DRV_ClipCursor( const RECT *clip, BOOL reset ) ...@@ -1526,7 +1526,7 @@ BOOL X11DRV_ClipCursor( const RECT *clip, BOOL reset )
{ {
TRACE( "clip %p, reset %u\n", clip, reset ); TRACE( "clip %p, reset %u\n", clip, reset );
if (!reset && grab_pointer) if (!reset)
{ {
RECT virtual_rect = NtUserGetVirtualScreenRect(); RECT virtual_rect = NtUserGetVirtualScreenRect();
......
...@@ -443,7 +443,6 @@ extern BOOL use_take_focus DECLSPEC_HIDDEN; ...@@ -443,7 +443,6 @@ extern BOOL use_take_focus DECLSPEC_HIDDEN;
extern BOOL use_primary_selection DECLSPEC_HIDDEN; extern BOOL use_primary_selection DECLSPEC_HIDDEN;
extern BOOL use_system_cursors DECLSPEC_HIDDEN; extern BOOL use_system_cursors DECLSPEC_HIDDEN;
extern BOOL show_systray DECLSPEC_HIDDEN; extern BOOL show_systray DECLSPEC_HIDDEN;
extern BOOL grab_pointer DECLSPEC_HIDDEN;
extern BOOL grab_fullscreen DECLSPEC_HIDDEN; extern BOOL grab_fullscreen DECLSPEC_HIDDEN;
extern BOOL usexcomposite DECLSPEC_HIDDEN; extern BOOL usexcomposite DECLSPEC_HIDDEN;
extern BOOL managed_mode DECLSPEC_HIDDEN; extern BOOL managed_mode DECLSPEC_HIDDEN;
......
...@@ -74,7 +74,6 @@ BOOL use_take_focus = TRUE; ...@@ -74,7 +74,6 @@ BOOL use_take_focus = TRUE;
BOOL use_primary_selection = FALSE; BOOL use_primary_selection = FALSE;
BOOL use_system_cursors = TRUE; BOOL use_system_cursors = TRUE;
BOOL show_systray = TRUE; BOOL show_systray = TRUE;
BOOL grab_pointer = TRUE;
BOOL grab_fullscreen = FALSE; BOOL grab_fullscreen = FALSE;
BOOL managed_mode = TRUE; BOOL managed_mode = TRUE;
BOOL decorated_mode = TRUE; BOOL decorated_mode = TRUE;
...@@ -498,9 +497,6 @@ static void setup_options(void) ...@@ -498,9 +497,6 @@ static void setup_options(void)
if (!get_config_key( hkey, appkey, "ShowSystray", buffer, sizeof(buffer) )) if (!get_config_key( hkey, appkey, "ShowSystray", buffer, sizeof(buffer) ))
show_systray = IS_OPTION_TRUE( buffer[0] ); show_systray = IS_OPTION_TRUE( buffer[0] );
if (!get_config_key( hkey, appkey, "GrabPointer", buffer, sizeof(buffer) ))
grab_pointer = IS_OPTION_TRUE( buffer[0] );
if (!get_config_key( hkey, appkey, "GrabFullscreen", buffer, sizeof(buffer) )) if (!get_config_key( hkey, appkey, "GrabFullscreen", buffer, sizeof(buffer) ))
grab_fullscreen = IS_OPTION_TRUE( buffer[0] ); grab_fullscreen = IS_OPTION_TRUE( buffer[0] );
......
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