mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
xorg modifiers fix mask.
This commit is contained in:
parent
a0d8f1b880
commit
8a9dceafec
@ -68,8 +68,10 @@ func (manager *DesktopManagerCtx) SetKeyboardModifiers(mod types.KeyboardModifie
|
||||
}
|
||||
|
||||
func (manager *DesktopManagerCtx) GetKeyboardModifiers() types.KeyboardModifiers {
|
||||
NumLock := xorg.GetKeyboardModifier(xorg.KBD_NUM_LOCK)
|
||||
CapsLock := xorg.GetKeyboardModifier(xorg.KBD_CAPS_LOCK)
|
||||
modifiers := xorg.GetKeyboardModifiers()
|
||||
|
||||
NumLock := (modifiers & xorg.KBD_NUM_LOCK) != 0
|
||||
CapsLock := (modifiers & xorg.KBD_CAPS_LOCK) != 0
|
||||
|
||||
return types.KeyboardModifiers{
|
||||
NumLock: &NumLock,
|
||||
|
@ -132,11 +132,11 @@ void XSetKeyboardModifier(int mod, int on) {
|
||||
XFlush(display);
|
||||
}
|
||||
|
||||
int XGetKeyboardModifier(int mod) {
|
||||
char XGetKeyboardModifiers() {
|
||||
XkbStateRec xkbState;
|
||||
Display *display = getXDisplay();
|
||||
XkbGetState(display, XkbUseCoreKbd, &xkbState);
|
||||
return xkbState.locked_mods & mod;
|
||||
return xkbState.locked_mods;
|
||||
}
|
||||
|
||||
XFixesCursorImage *XGetCursorImage(void) {
|
||||
|
@ -17,7 +17,7 @@ import (
|
||||
"demodesk/neko/internal/types"
|
||||
)
|
||||
|
||||
type KbdModifiers int
|
||||
type KbdModifiers uint8
|
||||
|
||||
const (
|
||||
KBD_CAPS_LOCK KbdModifiers = 2
|
||||
@ -230,11 +230,11 @@ func SetKeyboardModifier(mod KbdModifiers, active bool) {
|
||||
C.XSetKeyboardModifier(C.int(mod), num)
|
||||
}
|
||||
|
||||
func GetKeyboardModifier(mod KbdModifiers) bool {
|
||||
func GetKeyboardModifiers() KbdModifiers {
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
|
||||
return C.XGetKeyboardModifier(C.int(mod)) == C.int(1)
|
||||
return KbdModifiers(C.XGetKeyboardModifiers())
|
||||
}
|
||||
|
||||
func GetCursorImage() *types.CursorImage {
|
||||
|
@ -27,5 +27,5 @@ short XGetScreenRate();
|
||||
|
||||
void SetKeyboardLayout(char *layout);
|
||||
void XSetKeyboardModifier(int mod, int on);
|
||||
int XGetKeyboardModifier(int mod);
|
||||
char XGetKeyboardModifiers();
|
||||
XFixesCursorImage *XGetCursorImage(void);
|
||||
|
Loading…
Reference in New Issue
Block a user