Commit c2785e60 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Remove legacy xcb-keysyms support

Special credits to Debian for releasing Squeeze.
parent 0aa7bd8a
......@@ -3200,24 +3200,14 @@ AS_IF([test "${enable_xcb}" != "no"], [
dnl xcb-utils
PKG_CHECK_MODULES(XCB_KEYSYMS, [xcb-keysyms >= 0.3.4], [
have_xcb_keysyms="yes"
], [
PKG_CHECK_MODULES(XCB_KEYSYMS, [xcb-keysyms], [
have_xcb_keysyms="yes"
VLC_ADD_CFLAGS([globalhotkeys], [-DXCB_KEYSYM_OLD_API])
], [
have_xcb_keysyms="no"
need_xid_provider="yes"
AC_MSG_WARN([libxcb-keysyms not found. Hotkeys will not be supported.])
])
])
AS_IF([test "${have_xcb_keysyms}" = "yes"], [
PKG_CHECK_MODULES(XPROTO, [xproto])
VLC_ADD_PLUGIN([globalhotkeys])
VLC_ADD_CFLAGS([globalhotkeys], [${XCB_KEYSYMS_CFLAGS} ${XCB_CFLAGS}])
VLC_ADD_LIBS([globalhotkeys], [${XCB_KEYSYMS_LIBS} ${XCB_LIBS}])
VLC_ADD_CFLAGS([xcb_window], [-DHAVE_XCB_KEYSYMS])
], [
need_xid_provider="yes"
AC_MSG_WARN([libxcb-keysyms (0.3.4 or later) not found. Hotkeys will work.])
])
])
AM_CONDITIONAL([HAVE_XCB], [test "${have_xcb}" = "yes"])
......
......@@ -56,11 +56,7 @@ vlc_module_end()
typedef struct
{
#ifdef XCB_KEYSYM_OLD_API /* as seen in Debian Lenny */
xcb_keycode_t i_x11;
#else
xcb_keycode_t *p_keys;
#endif
unsigned i_modifier;
uint32_t i_vlc;
} hotkey_mapping_t;
......@@ -130,11 +126,11 @@ static int Open( vlc_object_t *p_this )
if( vlc_clone( &p_sys->thread, Thread, p_intf, VLC_THREAD_PRIORITY_LOW ) )
{
#ifndef XCB_KEYSYM_OLD_API /* as seen in Debian Lenny */
if( p_sys->p_map )
{
free( p_sys->p_map->p_keys );
#endif
free( p_sys->p_map );
free( p_sys->p_map );
}
goto error;
}
return VLC_SUCCESS;
......@@ -161,12 +157,11 @@ static void Close( vlc_object_t *p_this )
vlc_cancel( p_sys->thread );
vlc_join( p_sys->thread, NULL );
#ifndef XCB_KEYSYM_OLD_API /* as seen in Debian Lenny */
if( p_sys->p_map )
{
free( p_sys->p_map->p_keys );
#endif
free( p_sys->p_map );
free( p_sys->p_map );
}
xcb_key_symbols_free( p_sys->p_symbols );
xcb_disconnect( p_sys->p_connection );
free( p_sys );
......@@ -186,11 +181,6 @@ static unsigned GetModifier( xcb_connection_t *p_connection, xcb_key_symbols_t *
if( sym == 0 )
return 0; /* no modifier */
#ifdef XCB_KEYSYM_OLD_API /* as seen in Debian Lenny */
const xcb_keycode_t key = xcb_key_symbols_get_keycode( p_symbols, sym );
if( key == 0 )
return 0;
#else
const xcb_keycode_t *p_keys = xcb_key_symbols_get_keycode( p_symbols, sym );
if( !p_keys )
return 0;
......@@ -209,7 +199,6 @@ static unsigned GetModifier( xcb_connection_t *p_connection, xcb_key_symbols_t *
if( no_modifier )
return 0;
#endif
xcb_get_modifier_mapping_cookie_t r =
xcb_get_modifier_mapping( p_connection );
......@@ -224,20 +213,12 @@ static unsigned GetModifier( xcb_connection_t *p_connection, xcb_key_symbols_t *
for( int i = 0; i < 8; i++ )
for( int j = 0; j < p_map->keycodes_per_modifier; j++ )
#ifdef XCB_KEYSYM_OLD_API /* as seen in Debian Lenny */
if( p_keycode[i * p_map->keycodes_per_modifier + j] == key )
{
free( p_map );
return pi_mask[i];
}
#else
for( int k = 0; p_keys[k] != XCB_NO_SYMBOL; k++ )
if( p_keycode[i*p_map->keycodes_per_modifier + j] == p_keys[k])
{
free( p_map );
return pi_mask[i];
}
#endif
free( p_map ); // FIXME to check
return 0;
......@@ -319,15 +300,11 @@ static bool Mapping( intf_thread_t *p_intf )
if( i_vlc_key == KEY_UNSET )
continue;
#ifdef XCB_KEYSYM_OLD_API /* as seen in Debian Lenny */
const xcb_keycode_t key = xcb_key_symbols_get_keycode(
p_sys->p_symbols, GetX11Key( i_vlc_key & ~KEY_MODIFIER ) );
#else
xcb_keycode_t *p_keys = xcb_key_symbols_get_keycode(
p_sys->p_symbols, GetX11Key( i_vlc_key & ~KEY_MODIFIER ) );
if( !p_keys )
continue;
#endif
const unsigned i_modifier = GetX11Modifier( p_sys->p_connection,
p_sys->p_symbols, i_vlc_key & KEY_MODIFIER );
......@@ -350,11 +327,7 @@ static bool Mapping( intf_thread_t *p_intf )
}
hotkey_mapping_t *p_map = &p_sys->p_map[p_sys->i_map++];
#ifdef XCB_KEYSYM_OLD_API /* as seen in Debian Lenny */
p_map->i_x11 = key;
#else
p_map->p_keys = p_keys;
#endif
p_map->i_modifier = i_modifier|i_ignored;
p_map->i_vlc = i_vlc_key;
active = true;
......@@ -370,18 +343,12 @@ static void Register( intf_thread_t *p_intf )
for( int i = 0; i < p_sys->i_map; i++ )
{
const hotkey_mapping_t *p_map = &p_sys->p_map[i];
#ifdef XCB_KEYSYM_OLD_API /* as seen in Debian Lenny */
xcb_grab_key( p_sys->p_connection, true, p_sys->root,
p_map->i_modifier, p_map->i_x11,
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC );
#else
for( int j = 0; p_map->p_keys[j] != XCB_NO_SYMBOL; j++ )
{
xcb_grab_key( p_sys->p_connection, true, p_sys->root,
p_map->i_modifier, p_map->p_keys[j],
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC );
}
#endif
}
}
......@@ -427,29 +394,16 @@ static void *Thread( void *p_data )
{
hotkey_mapping_t *p_map = &p_sys->p_map[i];
#ifdef XCB_KEYSYM_OLD_API /* as seen in Debian Lenny */
if( p_map->i_x11 == e->detail &&
p_map->i_modifier == e->state )
{
var_SetInteger( p_intf->p_libvlc, "global-key-pressed",
p_map->i_vlc );
break;
}
#else
bool loop_break = false;
for( int j = 0; p_map->p_keys[j] != XCB_NO_SYMBOL; j++ )
if( p_map->p_keys[j] == e->detail &&
p_map->i_modifier == e->state )
{
var_SetInteger( p_intf->p_libvlc, "global-key-pressed",
p_map->i_vlc );
loop_break = true;
break;
}
if( loop_break )
break;
#endif
for( int j = 0; p_map->p_keys[j] != XCB_NO_SYMBOL; j++ )
if( p_map->p_keys[j] == e->detail &&
p_map->i_modifier == e->state )
{
var_SetInteger( p_intf->p_libvlc, "global-key-pressed",
p_map->i_vlc );
goto done;
}
}
done:
free( p_event );
}
}
......
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