I'm writing a source code editor, and I want to disable any of the pre-defined keystrokes, e.g Ctrl-V for paste, how can I do that?
I have found the way to do this: Return boolean True
from the method which handles the key-press-event
. Any value that doesn't evaluate to true passes control back to Gtk.
In the particular way I implement this editor, the key-press-event
signal of the toplevel vindow is connected to the method __key_event_handler
, which basically filters all the keystrokes, modified with either Ctrl or Alt keys and returns True after processing the input, or just passes the control back to Gtk otherwise. This way, I can manage all the modified keystrokes, which are meant to be editor commands, and not need to handle insertion of normal characters.