gtkui: improved keyboard handling