X backend conforms to new API
This commit is contained in:
parent
8cfb8eeaef
commit
77ef7554ac
@ -27,6 +27,8 @@ func (window *Window) handleConfigureNotify (
|
|||||||
connection *xgbutil.XUtil,
|
connection *xgbutil.XUtil,
|
||||||
event xevent.ConfigureNotifyEvent,
|
event xevent.ConfigureNotifyEvent,
|
||||||
) {
|
) {
|
||||||
|
if window.child == nil { return }
|
||||||
|
|
||||||
configureEvent := *event.ConfigureNotifyEvent
|
configureEvent := *event.ConfigureNotifyEvent
|
||||||
|
|
||||||
newWidth := int(configureEvent.Width)
|
newWidth := int(configureEvent.Width)
|
||||||
@ -66,33 +68,29 @@ func (window *Window) handleKeyPress (
|
|||||||
NumberPad: numberPad,
|
NumberPad: numberPad,
|
||||||
}
|
}
|
||||||
|
|
||||||
keyDownEvent := tomo.EventKeyDown {
|
if key == tomo.KeyTab && modifiers.Alt {
|
||||||
Key: key,
|
if _, ok := window.child.(tomo.Selectable); ok {
|
||||||
Modifiers: modifiers,
|
direction := tomo.SelectionDirectionForward
|
||||||
Repeated: false, // FIXME: return correct value here
|
if modifiers.Shift {
|
||||||
}
|
direction = tomo.SelectionDirectionBackward
|
||||||
|
|
||||||
if keyDownEvent.Key == tomo.KeyTab && keyDownEvent.Modifiers.Alt {
|
|
||||||
if window.child.Selectable() {
|
|
||||||
direction := 1
|
|
||||||
if keyDownEvent.Modifiers.Shift {
|
|
||||||
direction = -1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
window.advanceSelectionInChild(direction)
|
window.advanceSelectionInChild(direction)
|
||||||
}
|
}
|
||||||
} else {
|
} else if child, ok := window.child.(tomo.KeyboardTarget); ok {
|
||||||
window.child.Handle(keyDownEvent)
|
// FIXME: pass correct value for repeated
|
||||||
|
child.HandleKeyDown(key, modifiers, false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (window *Window) advanceSelectionInChild (direction int) {
|
func (window *Window) advanceSelectionInChild (direction tomo.SelectionDirection) {
|
||||||
if window.child.Selected() {
|
child := window.child.(tomo.Selectable)
|
||||||
if !window.child.AdvanceSelection(direction) {
|
if child.Selected() {
|
||||||
window.child.Handle(tomo.EventDeselect { })
|
if !child.HandleSelection(direction) {
|
||||||
|
child.HandleDeselection()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
window.child.Handle(tomo.EventSelect { })
|
child.HandleSelection(tomo.SelectionDirectionNeutral)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||