[vlc-devel] Hotkeys, action and interfaces?

Rémi Denis-Courmont remi at remlab.net
Sat Apr 23 16:47:17 CEST 2011


   Hello,

On Saturday 23 April 2011, Jean-Baptiste Kempf wrote:
> Hello,
> 
> I was wondering why most of the hotkeys code isn't in the core? Notably
> the DoAction() part?

I guess an interface plugin was more convenient when the hotkeys interface ran 
a thread of its own. I put the key mapping code in the core; previously, each 
key handler did the same mapping itself.

Eventually, key presses should be handled per video output/window, then per 
input, then per input manager/parent. As such, the hotkeys interface will go 
away. But until that rework is taken care of, I don't see any value in moving 
the action handler code to the core. It does not really bring any benefit.

> Because both Qt and mac interfaces uses
> var_SetInteger( p_intf->p_libvlc, "key-action", ACTIONID_* );

key-action was not intended to be used directly. I added it to factorize and 
optimize the key mapping (key-pressed -> key-action) logic.

I got the old RC interface to use "key-action" instead of key-pressed because 
it exposes the action names to the "user". The earlier implementation was 
mind-boggingly idiotic: it looked up the hotkey associated with the intended 
action and emulated a key press. This meant you could not trigger an action 
that was not bound to any hotkey.

Anyway, normally interfaces and video windows MUST emit their key press via 
key-pressed (NEVER directly via key-action). Conversely, to perform a specific 
action, not triggered by a hotkey, Just Do It(tm). Don't use "key-pressed" or 
"key-action" at all.

-- 
Rémi Denis-Courmont
http://www.remlab.info



More information about the vlc-devel mailing list