Include missing rune, key or button in error
This commit is contained in:
parent
6f03281fc7
commit
124152f7ec
4 changed files with 10 additions and 9 deletions
|
|
@ -245,7 +245,7 @@ func (p *portalController) PointerButton(button PointerButton, press bool) error
|
|||
case PointerButtonRight:
|
||||
btn = btnRight
|
||||
default:
|
||||
return errors.New("unsupported pointer button")
|
||||
return fmt.Errorf("unsupported pointer button: %#v", button)
|
||||
}
|
||||
state := btnReleased
|
||||
if press {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
package inputcontrol
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
)
|
||||
|
|
@ -173,7 +173,7 @@ func (p *windowsController) KeyboardKey(key Key) error {
|
|||
case KeyMediaPlayPause:
|
||||
input.wVk = vkMediaPlayPause
|
||||
default:
|
||||
return errors.New("key not mapped to virtual-key code")
|
||||
return fmt.Errorf("key not mapped to virtual-key code: %#v", key)
|
||||
}
|
||||
inputs := [...]keybdInput{input, input}
|
||||
inputs[1].dwFlags |= keyeventfKeyup
|
||||
|
|
@ -195,7 +195,7 @@ func (p *windowsController) PointerButton(button PointerButton, press bool) erro
|
|||
} else if button == PointerButtonRight {
|
||||
input.dwFlags = mouseeventfRightup
|
||||
} else {
|
||||
return errors.New("unsupported pointer button")
|
||||
return fmt.Errorf("unsupported pointer button: %#v", button)
|
||||
}
|
||||
if r, _, err := sendInputProc.Call(1, uintptr(unsafe.Pointer(&input)),
|
||||
unsafe.Sizeof(input)); int(r) != 1 {
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ package inputcontrol
|
|||
import "C"
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
|
@ -309,7 +310,7 @@ func (p *x11Controller) PointerButton(button PointerButton, press bool) error {
|
|||
case PointerButtonMiddle:
|
||||
return p.sendButton(2, press)
|
||||
default:
|
||||
return errors.New("unsupported pointer button")
|
||||
return fmt.Errorf("unsupported pointer button: %#v", button)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ package inputcontrol
|
|||
|
||||
//go:generate go run keysyms.generator.go
|
||||
|
||||
import "errors"
|
||||
import "fmt"
|
||||
|
||||
type Keysym int32
|
||||
|
||||
|
|
@ -57,8 +57,8 @@ func RuneToKeysym(runeValue rune) (Keysym, error) {
|
|||
keysym, found := keysymsMap[runeValue]
|
||||
if !found {
|
||||
if runeValue < 0x100 || runeValue > 0x10ffff {
|
||||
return 0, errors.New("rune not mappend to keysym and " +
|
||||
"out of range for direct unicode mapping")
|
||||
return 0, fmt.Errorf("rune not mappend to keysym and "+
|
||||
"out of range for direct unicode mapping: %q", runeValue)
|
||||
}
|
||||
keysym = Keysym(0x01000000 + runeValue)
|
||||
}
|
||||
|
|
@ -104,6 +104,6 @@ func KeyToKeysym(key Key) (Keysym, error) {
|
|||
case KeyBrowserForward:
|
||||
return xf86xkForward, nil
|
||||
default:
|
||||
return 0, errors.New("key not mapped to keysym")
|
||||
return 0, fmt.Errorf("key not mapped to keysym: %#v", key)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue