Open gjask opened 4 months ago
I have created this issue, because originally I have only sent PR which didn't get much attention. I don't know if it is normal time span for reaction or because issue was missing. Also if somebody wanted to propose better solution it is good to have issue to track all progress on this.
My proposed solution is: https://github.com/workbenchdev/demos/pull/181
Event controller demo showcases button click with Ctrl key modifier by creating
Gtk.EventControllerKey
and tracking key state in global variable. This approach is at least bit quirky (eg. fails to track key state changes made off-focus) and seems like a bad practice (global variable, really?). I know it was meant to find show case forGtk.EventControllerKey
but I believe not teaching beginners (such as myself) bad practices is important. So maybe finding different show case is in order.Proper technique for handling clicks and other events with key modifier is to use
controller.get_current_event_state()
in callback. For example like this.