File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -468,6 +468,28 @@ fn gg_event_fn(ce voidptr, user_data voidptr) {
468468 // dump(e)
469469 }
470470 }
471+ $if linux {
472+ if e.typ == .key_down && e.key_code in [.backspace, .delete, .enter, .tab] {
473+ // with X11, sokol does not send .char events for some keys; we will emulate them for consistency here:
474+ e.char_code = match e.key_code {
475+ .backspace { u32 (8 ) }
476+ .tab { 9 }
477+ .enter { 13 }
478+ .delete { 127 }
479+ else { u32 (e.key_code) }
480+ }
481+ e.key_code = .invalid
482+ e.typ = .char
483+ if ctx.config.event_fn != unsafe { nil } {
484+ ctx.config.event_fn (e, ctx.config.user_data)
485+ } else if ctx.config.on_event != unsafe { nil } {
486+ ctx.config.on_event (ctx.config.user_data, e)
487+ }
488+ if ctx.config.char_fn != unsafe { nil } {
489+ ctx.config.char_fn (e.char_code, ctx.config.user_data)
490+ }
491+ }
492+ }
471493}
472494
473495fn gg_cleanup_fn (user_data voidptr ) {
You can’t perform that action at this time.
0 commit comments