Merge branch 'main' of github.com:Minizbot2012/orbmap into main

main
Minizbot2012 3 years ago
commit 9d43d18d6c
No known key found for this signature in database
GPG Key ID: 977C8ADE12361917

@ -1,12 +1,12 @@
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: minizbot # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
# These are supported funding model platforms
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: minizbot # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

@ -1,55 +1,55 @@
package box
type embedBox struct {
storage map[string][]byte
}
// Create new box for embed files
func newEmbedBox() *embedBox {
return &embedBox{storage: make(map[string][]byte)}
}
// Add a file to box
func (e *embedBox) Add(file string, content []byte) {
e.storage[file] = content
}
// Get file's content
func (e *embedBox) Get(file string) []byte {
if f, ok := e.storage[file]; ok {
return f
}
return nil
}
func (e *embedBox) List() []string {
keys := make([]string, 0)
for k, _ := range e.storage {
keys = append(keys, k)
}
return keys
}
// Embed box expose
var box = newEmbedBox()
// Add a file content to box
func Add(file string, content []byte) {
box.Add(file, content)
}
// Get a file from box
func Get(file string) []byte {
return box.Get(file)
}
// Lists files in box
func List() []string {
return box.List()
}
// Code generated by go generate; DO NOT EDIT.
func init() {
box.Add("orbweaver.dev", []byte{41, 2, 3, 4, 5, 15, 16, 17, 18, 19, 58, 30, 31, 32, 33, 42, 44, 45, 46, 47, 56, 103, 106, 108, 105, 57})
}
package box
type embedBox struct {
storage map[string][]byte
}
// Create new box for embed files
func newEmbedBox() *embedBox {
return &embedBox{storage: make(map[string][]byte)}
}
// Add a file to box
func (e *embedBox) Add(file string, content []byte) {
e.storage[file] = content
}
// Get file's content
func (e *embedBox) Get(file string) []byte {
if f, ok := e.storage[file]; ok {
return f
}
return nil
}
func (e *embedBox) List() []string {
keys := make([]string, 0)
for k := range e.storage {
keys = append(keys, k)
}
return keys
}
// Embed box expose
var box = newEmbedBox()
// Add a file content to box
func Add(file string, content []byte) {
box.Add(file, content)
}
// Get a file from box
func Get(file string) []byte {
return box.Get(file)
}
// Lists files in box
func List() []string {
return box.List()
}
// Code generated by go generate; DO NOT EDIT.
func init() {
box.Add("orbweaver.dev", []byte{41, 2, 3, 4, 5, 15, 16, 17, 18, 19, 58, 30, 31, 32, 33, 42, 44, 45, 46, 47, 56, 103, 106, 108, 105, 57})
}

@ -1,16 +1,16 @@
package common
var KEYCODE_WINDOWS_FROM_HID = [256]byte{
255, 255, 255, 255, 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38, 50, 49, 24, 25, 16, 19, 31, 20,
22, 47, 17, 45, 21, 44, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 255, 1, 14, 15, 255, 12, 13, 26, 27, 43, 255,
39, 40, 41, 51, 52, 53, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 87, 88, 183, 70, 69, 210, 199,
201, 211, 207, 209, 205, 203, 208, 200, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 28, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 29, 42, 56,
219, 157, 54, 184, 220, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255}
package common
var KEYCODE_WINDOWS_FROM_HID = [256]byte{
255, 255, 255, 255, 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38, 50, 49, 24, 25, 16, 19, 31, 20,
22, 47, 17, 45, 21, 44, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 255, 1, 14, 15, 255, 12, 13, 26, 27, 43, 255,
39, 40, 41, 51, 52, 53, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 87, 88, 183, 70, 69, 210, 199,
201, 211, 207, 209, 205, 203, 208, 200, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 28, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 29, 42, 56,
219, 157, 54, 184, 220, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255}

@ -1,51 +1,51 @@
package orbweaver
import (
"encoding/binary"
"os"
"strings"
"github.com/minizbot2012/orbmap/box"
)
var eventcodes []byte
var ecm map[uint16]int
func init() {
eventcodes = box.Get("orbweaver.dev")
ecm = make(map[uint16]int)
}
//KeyMap singular keymap
type KeyMap struct {
Keymap [26]uint16
Color [3]byte
}
//KeyMaps a set of keymaps
type KeyMaps struct {
Maps [7]*KeyMap
Currentmap int
MCount int
}
//ProcOrbFiles processes orbs
func ProcOrbFiles(orbs string, wd string) *KeyMaps {
keymaps := &KeyMaps{}
idx := 0
if len(orbs) > 0 {
for _, orb := range strings.Split(orbs, ",") {
KMap := &KeyMap{}
inf, _ := os.Open(wd + "/" + orb)
defer inf.Close()
err := binary.Read(inf, binary.LittleEndian, KMap)
if err != nil {
panic(err)
}
keymaps.Maps[idx] = KMap
}
} else {
panic("No orbs")
}
return keymaps
}
package orbweaver
import (
"encoding/binary"
"os"
"strings"
"github.com/minizbot2012/orbmap/box"
)
var eventcodes []byte
var ecm map[uint16]int
func init() {
eventcodes = box.Get("orbweaver.dev")
ecm = make(map[uint16]int)
}
//KeyMap singular keymap
type KeyMap struct {
Keymap [26]uint16
Color [3]byte
}
//KeyMaps a set of keymaps
type KeyMaps struct {
Maps [7]*KeyMap
Currentmap int
MCount int
}
//ProcOrbFiles processes orbs
func ProcOrbFiles(orbs string, wd string) *KeyMaps {
keymaps := &KeyMaps{}
idx := 0
if len(orbs) > 0 {
for _, orb := range strings.Split(orbs, ",") {
KMap := &KeyMap{}
inf, _ := os.Open(wd + "/" + orb)
defer inf.Close()
err := binary.Read(inf, binary.LittleEndian, KMap)
if err != nil {
panic(err)
}
keymaps.Maps[idx] = KMap
}
} else {
panic("No orbs")
}
return keymaps
}

@ -1,33 +1,33 @@
//go:generate boxy
package orbweaver
import (
"bytes"
"encoding/binary"
"os"
"github.com/minizbot2012/orbmap/interface/keyevents"
)
//OrbLoop Main loop for this device
func OrbLoop(km *KeyMaps, KeyBus chan *keyevents.KeyEvent) {
for i := 0; i < 26; i++ {
ecm[uint16(eventcodes[i])] = i
}
f, err := os.Open("/dev/input/by-id/usb-Razer_Razer_Orbweaver_Chroma-event-kbd")
if err != nil {
panic(err)
}
defer f.Close()
b := make([]byte, 24)
for {
f.Read(b)
KeyEv := &keyevents.KeyEvent{}
binary.Read(bytes.NewReader(b[16:]), binary.LittleEndian, &KeyEv)
KeyEv.Code = km.Maps[km.Currentmap].Keymap[ecm[KeyEv.Code]]
if KeyEv.Code != 0 && KeyEv.Type != 4 {
KeyBus <- KeyEv
}
}
}
//go:generate boxy
package orbweaver
import (
"bytes"
"encoding/binary"
"os"
"github.com/minizbot2012/orbmap/interface/keyevents"
)
//OrbLoop Main loop for this device
func OrbLoop(km *KeyMaps, KeyBus chan *keyevents.KeyEvent) {
for i := 0; i < 26; i++ {
ecm[uint16(eventcodes[i])] = i
}
f, err := os.Open("/dev/input/by-id/usb-Razer_Razer_Orbweaver_Chroma-event-kbd")
if err != nil {
panic(err)
}
defer f.Close()
b := make([]byte, 24)
for {
f.Read(b)
KeyEv := &keyevents.KeyEvent{}
binary.Read(bytes.NewReader(b[16:]), binary.LittleEndian, &KeyEv)
KeyEv.Code = km.Maps[km.Currentmap].Keymap[ecm[KeyEv.Code]]
if KeyEv.Code != 0 && KeyEv.Type != 4 {
KeyBus <- KeyEv
}
}
}

@ -1,146 +1,146 @@
package orbweaver
import (
"bytes"
"encoding/binary"
"encoding/hex"
"github.com/google/gousb"
"github.com/minizbot2012/orbmap/devices/common"
"github.com/minizbot2012/orbmap/interface/keyevents"
)
const (
vendor = gousb.ID(0x1532)
prod = gousb.ID(0x0207)
)
type swaps struct {
S1 *swapInt
S2 *swapInt
}
type swapInt struct {
Modifier byte
Reserved byte
K1 byte
K2 byte
K3 byte
K4 byte
K5 byte
K6 byte
}
var trans = map[int]int{
0: 0,
2: 0,
}
func (s *swapInt) contains(k byte) bool {
return (s.K1 == k || s.K2 == k || s.K3 == k || s.K4 == k || s.K5 == k || s.K6 == k)
}
func (s *swaps) swap() {
ss := s.S1
s.S1 = s.S2
s.S2 = ss
}
func (s *swapInt) Releases(s2 *swapInt) []byte {
r := make([]byte, 0)
if !s.contains(s2.K1) {
r = append(r, s2.K1)
}
if !s.contains(s2.K2) {
r = append(r, s2.K2)
}
if !s.contains(s2.K3) {
r = append(r, s2.K3)
}
if !s.contains((s2.K4)) {
r = append(r, s2.K4)
}
if !s.contains(s2.K5) {
r = append(r, s2.K5)
}
if !s.contains(s2.K6) {
r = append(r, s2.K6)
}
return r
}
func contains(s []byte, e byte) bool {
for _, a := range s {
if a == e {
return true
}
}
return false
}
//OrbLoop Main loop for this device
func OrbLoop(km *KeyMaps, KeyBus chan *keyevents.KeyEvent) {
for i := 0; i < 26; i++ {
ecm[uint16(eventcodes[i])] = i
}
ctx := gousb.NewContext()
dev, err := ctx.OpenDeviceWithVIDPID(vendor, prod)
if err != nil {
panic(err)
}
defer dev.Close()
conf, err := dev.Config(1)
if err != nil {
panic(err)
}
intf, err := conf.Interface(0, 0)
if err != nil {
panic(err)
}
defer intf.Close()
in, err := intf.InEndpoint(1)
if err != nil {
panic(err)
}
data := make([]byte, in.Desc.MaxPacketSize)
rs, _ := in.NewStream(in.Desc.MaxPacketSize, 3)
swaper := &swaps{}
swaper.S1 = &swapInt{}
swaper.S2 = &swapInt{}
for {
_, err := rs.Read(data)
if err != nil {
panic(err)
}
for i := 2; i < in.Desc.MaxPacketSize; i++ {
if data[i] != 0 {
data[i] = common.KEYCODE_WINDOWS_FROM_HID[data[i]]
}
}
binary.Read(bytes.NewReader(data), binary.LittleEndian, swaper.S1)
//data[0] = trans[data[0]]
for i := 2; i < in.Desc.MaxPacketSize; i++ {
if data[i] != 0 {
if common.KEYCODE_WINDOWS_FROM_HID[data[i]] != 255 {
if !swaper.S2.contains(data[i]) {
KeyEv := &keyevents.KeyEvent{}
KeyEv.Code = uint16(data[i])
KeyEv.Type = 1
KeyEv.Code = km.Maps[km.Currentmap].Keymap[ecm[KeyEv.Code]]
KeyBus <- KeyEv
}
}
}
}
swaper.swap()
r := swaper.S2.Releases(swaper.S1)
for _, rel := range r {
KeyEv := &keyevents.KeyEvent{}
KeyEv.Code = uint16(rel)
KeyEv.Type = 2
KeyEv.Code = km.Maps[km.Currentmap].Keymap[ecm[KeyEv.Code]]
KeyBus <- KeyEv
}
//Not quite sure how to handle this data quite yet
println(hex.EncodeToString(data))
}
}
package orbweaver
import (
"bytes"
"encoding/binary"
"encoding/hex"
"github.com/google/gousb"
"github.com/minizbot2012/orbmap/devices/common"
"github.com/minizbot2012/orbmap/interface/keyevents"
)
const (
vendor = gousb.ID(0x1532)
prod = gousb.ID(0x0207)
)
type swaps struct {
S1 *swapInt
S2 *swapInt
}
type swapInt struct {
Modifier byte
Reserved byte
K1 byte
K2 byte
K3 byte
K4 byte
K5 byte
K6 byte
}
var trans = map[int]int{
0: 0,
2: 0,
}
func (s *swapInt) contains(k byte) bool {
return (s.K1 == k || s.K2 == k || s.K3 == k || s.K4 == k || s.K5 == k || s.K6 == k)
}
func (s *swaps) swap() {
ss := s.S1
s.S1 = s.S2
s.S2 = ss
}
func (s *swapInt) Releases(s2 *swapInt) []byte {
r := make([]byte, 0)
if !s.contains(s2.K1) {
r = append(r, s2.K1)
}
if !s.contains(s2.K2) {
r = append(r, s2.K2)
}
if !s.contains(s2.K3) {
r = append(r, s2.K3)
}
if !s.contains((s2.K4)) {
r = append(r, s2.K4)
}
if !s.contains(s2.K5) {
r = append(r, s2.K5)
}
if !s.contains(s2.K6) {
r = append(r, s2.K6)
}
return r
}
func contains(s []byte, e byte) bool {
for _, a := range s {
if a == e {
return true
}
}
return false
}
//OrbLoop Main loop for this device
func OrbLoop(km *KeyMaps, KeyBus chan *keyevents.KeyEvent) {
for i := 0; i < 26; i++ {
ecm[uint16(eventcodes[i])] = i
}
ctx := gousb.NewContext()
dev, err := ctx.OpenDeviceWithVIDPID(vendor, prod)
if err != nil {
panic(err)
}
defer dev.Close()
conf, err := dev.Config(1)
if err != nil {
panic(err)
}
intf, err := conf.Interface(0, 0)
if err != nil {
panic(err)
}
defer intf.Close()
in, err := intf.InEndpoint(1)
if err != nil {
panic(err)
}
data := make([]byte, in.Desc.MaxPacketSize)
rs, _ := in.NewStream(in.Desc.MaxPacketSize, 3)
swaper := &swaps{}
swaper.S1 = &swapInt{}
swaper.S2 = &swapInt{}
for {
_, err := rs.Read(data)
if err != nil {
panic(err)
}
for i := 2; i < in.Desc.MaxPacketSize; i++ {
if data[i] != 0 {
data[i] = common.KEYCODE_WINDOWS_FROM_HID[data[i]]
}
}
binary.Read(bytes.NewReader(data), binary.LittleEndian, swaper.S1)
//data[0] = trans[data[0]]
for i := 2; i < in.Desc.MaxPacketSize; i++ {
if data[i] != 0 {
if common.KEYCODE_WINDOWS_FROM_HID[data[i]] != 255 {
if !swaper.S2.contains(data[i]) {
KeyEv := &keyevents.KeyEvent{}
KeyEv.Code = uint16(data[i])
KeyEv.Type = 1
KeyEv.Code = km.Maps[km.Currentmap].Keymap[ecm[KeyEv.Code]]
KeyBus <- KeyEv
}
}
}
}
swaper.swap()
r := swaper.S2.Releases(swaper.S1)
for _, rel := range r {
KeyEv := &keyevents.KeyEvent{}
KeyEv.Code = uint16(rel)
KeyEv.Type = 2
KeyEv.Code = km.Maps[km.Currentmap].Keymap[ecm[KeyEv.Code]]
KeyBus <- KeyEv
}
//Not quite sure how to handle this data quite yet
println(hex.EncodeToString(data))
}
}

@ -1,8 +1,8 @@
package keyevents
//KeyEvent represents a keyevent
type KeyEvent struct {
Type uint16
Code uint16
Value int
}
package keyevents
//KeyEvent represents a keyevent
type KeyEvent struct {
Type uint16
Code uint16
Value int
}

@ -1,29 +1,29 @@
package keypad
import (
"github.com/bendahl/uinput"
"github.com/minizbot2012/orbmap/interface/keyevents"
)
var vkm uinput.Keyboard = nil
//ProcKey keyboard emulator loop
func ProcKey(kb chan *keyevents.KeyEvent) {
var err error
vkm, err = uinput.CreateKeyboard("/dev/uinput", []byte("Orbmap"))
if err != nil {
panic(err)
}
defer vkm.Close()
for {
KeyEv := <-kb
if KeyEv.Type == 1 {
if KeyEv.Value == 1 {
vkm.KeyDown(int(KeyEv.Code))
} else if KeyEv.Value == 2 {
} else {
vkm.KeyUp(int(KeyEv.Code))
}
}
}
}
package keypad
import (
"github.com/bendahl/uinput"
"github.com/minizbot2012/orbmap/interface/keyevents"
)
var vkm uinput.Keyboard = nil
//ProcKey keyboard emulator loop
func ProcKey(kb chan *keyevents.KeyEvent) {
var err error
vkm, err = uinput.CreateKeyboard("/dev/uinput", []byte("Orbmap"))
if err != nil {
panic(err)
}
defer vkm.Close()
for {
KeyEv := <-kb
if KeyEv.Type == 1 {
if KeyEv.Value == 1 {
vkm.KeyDown(int(KeyEv.Code))
} else if KeyEv.Value == 2 {
} else {
vkm.KeyUp(int(KeyEv.Code))
}
}
}
}

@ -1,58 +1,58 @@
package keypad
import (
"syscall"
"unsafe"
"github.com/lxn/win"
"github.com/minizbot2012/orbmap/interface/keyevents"
)
var user32 = syscall.NewLazyDLL("user32.dll")
var procKeyBd = user32.NewProc("keybd_event")
var mapVK = user32.NewProc("MapVirtualKeyA")
func downKey(key int) {
flag := 0
var in win.KEYBD_INPUT
vs, _, _ := mapVK.Call(uintptr(uint32(key)), uintptr(1))
vsc := uint16(vs)
println(vsc)
if vsc == win.VK_SHIFT || vsc == win.VK_CONTROL || vsc == win.VK_MENU {
flag |= win.KEYEVENTF_EXTENDEDKEY
}
in.Type = 1
in.Ki.DwExtraInfo = 0
in.Ki.DwFlags = uint32(flag)
in.Ki.WScan = 0
in.Ki.WVk = vsc
win.SendInput(1, unsafe.Pointer(&in), int32(unsafe.Sizeof(in)))
}
func upKey(key int) {
flag := win.KEYEVENTF_KEYUP
var in win.KEYBD_INPUT
vs, _, _ := mapVK.Call(uintptr(uint32(key)), uintptr(1))
vsc := uint16(vs)
if vsc == win.VK_SHIFT || vsc == win.VK_CONTROL || vsc == win.VK_MENU {
flag |= win.KEYEVENTF_EXTENDEDKEY
}
in.Type = 1
in.Ki.DwExtraInfo = 0
in.Ki.DwFlags = uint32(flag)
in.Ki.WScan = 0
in.Ki.WVk = vsc
win.SendInput(1, unsafe.Pointer(&in), int32(unsafe.Sizeof(in)))
}
//ProcKey Windows support is so weird
func ProcKey(kb chan *keyevents.KeyEvent) {
for {
KeyEv := <-kb
if KeyEv.Type == 1 {
downKey(int(KeyEv.Code))
} else if KeyEv.Type == 2 {
upKey(int(KeyEv.Code))
}
}
}
package keypad
import (
"syscall"
"unsafe"
"github.com/lxn/win"
"github.com/minizbot2012/orbmap/interface/keyevents"
)
var user32 = syscall.NewLazyDLL("user32.dll")
var procKeyBd = user32.NewProc("keybd_event")
var mapVK = user32.NewProc("MapVirtualKeyA")
func downKey(key int) {
flag := 0
var in win.KEYBD_INPUT
vs, _, _ := mapVK.Call(uintptr(uint32(key)), uintptr(1))
vsc := uint16(vs)
println(vsc)
if vsc == win.VK_SHIFT || vsc == win.VK_CONTROL || vsc == win.VK_MENU {
flag |= win.KEYEVENTF_EXTENDEDKEY
}
in.Type = 1
in.Ki.DwExtraInfo = 0
in.Ki.DwFlags = uint32(flag)
in.Ki.WScan = 0
in.Ki.WVk = vsc
win.SendInput(1, unsafe.Pointer(&in), int32(unsafe.Sizeof(in)))
}
func upKey(key int) {
flag := win.KEYEVENTF_KEYUP
var in win.KEYBD_INPUT
vs, _, _ := mapVK.Call(uintptr(uint32(key)), uintptr(1))
vsc := uint16(vs)
if vsc == win.VK_SHIFT || vsc == win.VK_CONTROL || vsc == win.VK_MENU {
flag |= win.KEYEVENTF_EXTENDEDKEY
}
in.Type = 1
in.Ki.DwExtraInfo = 0
in.Ki.DwFlags = uint32(flag)
in.Ki.WScan = 0
in.Ki.WVk = vsc
win.SendInput(1, unsafe.Pointer(&in), int32(unsafe.Sizeof(in)))
}
//ProcKey Windows support is so weird
func ProcKey(kb chan *keyevents.KeyEvent) {
for {
KeyEv := <-kb
if KeyEv.Type == 1 {
downKey(int(KeyEv.Code))
} else if KeyEv.Type == 2 {
upKey(int(KeyEv.Code))
}
}
}

Loading…
Cancel
Save