2011-10-12 20 views

回答

2

最簡單的方法是將包含所有菜單項的actor標記爲反應,使用clutter_actor_grab_key_focus()並將其連接到key-press-event信號來爲其分配焦點焦點。那麼你可以使用clutter_event_get_key_symbol()上的ClutterEvent傳遞給信號,並將其與CLUTTER_KEY_DownCLUTTER_KEY_Up等關鍵符號進行匹配。

那麼甚至有可能使用ClutterBindingPool來處理(鍵符號,修飾符)的元組並將它們分配給特定的回調函數。

有關詳細信息,請參閱API參考:

http://developer.gnome.org/clutter/stable/ClutterActor.html#clutter-actor-grab-key-focus http://developer.gnome.org/clutter/stable/ClutterActor.html#ClutterActor-key-press-event http://developer.gnome.org/clutter/stable/clutter-Events.html#clutter-event-get-key-symbol http://developer.gnome.org/clutter/stable/clutter-Key-Bindings.html

鍵符號的在雜波keysyms.h報頭中的列表:

http://git.gnome.org/browse/clutter/tree/clutter/clutter-keysyms.h

食譜中還有各種食譜:

https://developer.gnome.org/clutter-cookbook/stable/events-handling-key-events.html

+0

感謝您的建議。 – northlondoner