Hi Glus,

You almost certainly don't want to change what code the key outputs; its far more likely you want to change what the program does in response to that key. If you reprogram the key, then you confuse your users; they're expecting WASD to output those letters, even if the program uses that information at times to obtain a direction. If you reprogram the key then when they try to input a word, unexpected things happen; at best, the keyboard becomes an exercise in cryptography.

By connecting the signal_key_press_event <https://developer.gnome.org/gtkmm/3.22/classGtk_1_1Widget.html#a4b64421cad754fbd49ae17cbfe4814d0>, you can handle the input however you like; if the program determines it's not applicable, the default is that the signal is passed up to the next handler. If you wish to block all responses to keyboard input outside your own function, simply return true (You'll possibly also have to block the key_release_event ).

Ian.


On 28/10/16 22:00, Glus Xof wrote:
Hi Ian,

2016-10-28 4:31 GMT+02:00 Ian Martin <martin...@vodafone.co.nz <mailto:martin...@vodafone.co.nz>>:

    You probably don't want to change the value that key returns;

That's exactly what I'm trying to do...

... I need a method, or some way, capable to fix, in the scope of the application, another values to a physical keyboard keys. ... I'm wonder if Gdk::Device::set_key () should be the suitable tool. If so, if I'm not wrong... could you link me the info about the macros index... the first parameter ?

    it's more likely you're trying to connect to a
    Gtk::Widget::signal_key_press_event(). That lets you do what you
    want with the signal when a user presses a key.

    Check the documentation- you have to enable a mask to use this signal.


In my case is a very bad option...

Thanks

Glus

    Ian.


    On 28/10/16 04:35, Glus Xof wrote:
    Hi guys,

    I'm looking for the way, in Gtk+, to reprogram the keyboard keys
    values...

    Maybe, should be possible from using: (I don't know)

    Glib::RefPtr<Gdk::Device> device_keyboard =
    ...get_display()->get_default_seat()->get_keyboard();

    (I don't know if I explained it so clearly...but I hope so though)

    Glus


    _______________________________________________
    gtkmm-list mailing list
    gtkmm-list@gnome.org <mailto:gtkmm-list@gnome.org>
    https://mail.gnome.org/mailman/listinfo/gtkmm-list
    <https://mail.gnome.org/mailman/listinfo/gtkmm-list>
    _______________________________________________ gtkmm-list mailing
    list gtkmm-list@gnome.org <mailto:gtkmm-list@gnome.org>
    https://mail.gnome.org/mailman/listinfo/gtkmm-list
<https://mail.gnome.org/mailman/listinfo/gtkmm-list>
_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list
_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to