Re: Rolling my own ClutterInputDevice with python



Thanks, it turned out, I can do all those things intercepting all keyboard events with do_captured_event() then re-emitting the modified event with event.get_source().emit('key-press-event', modified_event).
The only thing I need to find out now is how to exclusively grab the keyboard device so that keys like ALT+F4 don't close the application.

Regards
Thomas



2014-08-14 16:17 GMT+02:00 Emmanuele Bassi <ebassi gmail com>:
hi;

On 14 August 2014 12:43, Thomas Schüßler <vindolin gmail com> wrote:
> Hi,
>
> in the current state of my program, I'm using a python object that watches
> an evdev InputDevice with GLib.io_add_watch().
> It's a USB remote control that emulates a keyboard/mouse.
>
> I need to filter out some keys of the remote control and manage the repeat
> rate for different keys myself.
>
> The object converts those evdev events into Clutter key-press-events and
> emits them on its focus actor.
>
> This all works as it should but when I set the focus to the stage and try a
> stage.set_key_focus() onto a ClutterText actor, no characters appear in my
> actor.
>
> Whats the correct way to implement my own InputDevice in python, so that I
> can filter/handle the repeat key for the remote myself?

you cannot implement an InputDevice outside of Clutter, let alone in Python.

InputDevice instances are pure informational classes that reflect the
devices exposed by the windowing system input API.

if you have a device that appears as a keyboard then your windowing
system should expose it as a device, and Clutter can pick it up.

rummaging through the evdev file descriptor is not a great way to deal
with input.

ciao,
 Emmanuele.


--
http://www.bassi.io
[ ] ebassi [@gmail.com]



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]