Add proper and reliable (i hope) support for modifier keys
This commit is contained in:
@@ -91,7 +91,9 @@ func (backend *Backend) handleButtonPress (
|
||||
backend.compressScrollSum(&sum)
|
||||
backend.callbackManager.RunScroll(sum.x, sum.y)
|
||||
} else {
|
||||
backend.callbackManager.RunPress(stone.Button(buttonEvent.Detail + 127))
|
||||
backend.callbackManager.RunPress (
|
||||
stone.Button(buttonEvent.Detail + 127),
|
||||
stone.Modifiers { })
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +112,15 @@ func (backend *Backend) handleKeyPress (
|
||||
) {
|
||||
keyEvent := *event.KeyPressEvent
|
||||
button := backend.keycodeToButton(keyEvent.Detail, keyEvent.State)
|
||||
backend.callbackManager.RunPress(button)
|
||||
backend.callbackManager.RunPress (button, stone.Modifiers {
|
||||
// FIXME these may not be correct in all cases
|
||||
Shift: (keyEvent.State & xproto.ModMaskShift) > 0,
|
||||
Control: (keyEvent.State & xproto.ModMaskControl) > 0,
|
||||
Alt: (keyEvent.State & xproto.ModMask1) > 0,
|
||||
// Meta: (keyEvent.State & xproto.??) > 0,
|
||||
Super: (keyEvent.State & xproto.ModMask4) > 0,
|
||||
// Hyper: (keyEvent.State & xproto.??) > 0,
|
||||
})
|
||||
}
|
||||
|
||||
func (backend *Backend) handleKeyRelease (
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package x
|
||||
|
||||
import "fmt"
|
||||
// import "fmt"
|
||||
import "unicode"
|
||||
import "github.com/jezek/xgb/xproto"
|
||||
import "github.com/jezek/xgbutil/keybind"
|
||||
@@ -138,7 +138,7 @@ func (backend *Backend) keycodeToButton (
|
||||
var selectedKeysym xproto.Keysym
|
||||
var selectedRune rune
|
||||
|
||||
fmt.Printf("AAA\t%X\t%X\t%X\t%X\n", symbol1, symbol2, symbol3, symbol4)
|
||||
// fmt.Printf("AAA\t%X\t%X\t%X\t%X\n", symbol1, symbol2, symbol3, symbol4)
|
||||
|
||||
// big ol list in the middle
|
||||
switch {
|
||||
|
||||
Reference in New Issue
Block a user