Ok it kind of works now

This commit is contained in:
2023-04-10 16:47:03 -04:00
parent da47026d1c
commit 2987331a31
3 changed files with 26 additions and 6 deletions
+10 -1
View File
@@ -146,6 +146,8 @@ func (window *window) handleKeyPress (
child.HandleUnfocus()
}
}
} else if key == input.KeyEscape && window.shy {
window.Close()
} else if child, ok := window.child.(tomo.KeyboardTarget); ok {
child.HandleKeyDown(key, modifiers)
}
@@ -193,7 +195,14 @@ func (window *window) handleButtonPress (
if window.hasModal { return }
buttonEvent := *event.ButtonPressEvent
if buttonEvent.Detail >= 4 && buttonEvent.Detail <= 7 {
insideWindow := image.Pt (
int(buttonEvent.EventX),
int(buttonEvent.EventY)).In(window.metrics.bounds)
if !insideWindow && window.shy {
window.Close()
} else if buttonEvent.Detail >= 4 && buttonEvent.Detail <= 7 {
if child, ok := window.child.(tomo.ScrollTarget); ok {
sum := scrollSum { }
sum.add(buttonEvent.Detail, window, buttonEvent.State)