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"])
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;
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;
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 );
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;
if( no_modifier )
return 0;
-#endif
xcb_get_modifier_mapping_cookie_t r =
xcb_get_modifier_mapping( p_connection );
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;
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 );
}
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;
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
}
}
{
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 );
}
}