From 0bca8c9d02924beeda9369fc4c3efc5d4bf7c28d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Mon, 12 Sep 2022 21:39:57 +0200 Subject: [PATCH] remote manager split. --- server/internal/remote/clipboard.go | 11 ++++++ server/internal/remote/manager.go | 54 ----------------------------- server/internal/remote/xorg.go | 51 +++++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 54 deletions(-) create mode 100644 server/internal/remote/clipboard.go create mode 100644 server/internal/remote/xorg.go diff --git a/server/internal/remote/clipboard.go b/server/internal/remote/clipboard.go new file mode 100644 index 00000000..9a7e3254 --- /dev/null +++ b/server/internal/remote/clipboard.go @@ -0,0 +1,11 @@ +package remote + +import "m1k1o/neko/internal/remote/clipboard" + +func (manager *RemoteManager) ReadClipboard() string { + return clipboard.Read() +} + +func (manager *RemoteManager) WriteClipboard(data string) { + clipboard.Write(data) +} diff --git a/server/internal/remote/manager.go b/server/internal/remote/manager.go index f37b2857..c5db7643 100644 --- a/server/internal/remote/manager.go +++ b/server/internal/remote/manager.go @@ -2,11 +2,9 @@ package remote import ( "fmt" - "os/exec" "time" "m1k1o/neko/internal/gst" - "m1k1o/neko/internal/remote/clipboard" "m1k1o/neko/internal/remote/xorg" "m1k1o/neko/internal/types" "m1k1o/neko/internal/types/config" @@ -208,55 +206,3 @@ func (manager *RemoteManager) ChangeResolution(width int, height int, rate int) return nil } - -func (manager *RemoteManager) Move(x, y int) { - xorg.Move(x, y) -} - -func (manager *RemoteManager) Scroll(x, y int) { - xorg.Scroll(x, y) -} - -func (manager *RemoteManager) ButtonDown(code int) error { - return xorg.ButtonDown(code) -} - -func (manager *RemoteManager) KeyDown(code uint64) error { - return xorg.KeyDown(code) -} - -func (manager *RemoteManager) ButtonUp(code int) error { - return xorg.ButtonUp(code) -} - -func (manager *RemoteManager) KeyUp(code uint64) error { - return xorg.KeyUp(code) -} - -func (manager *RemoteManager) ReadClipboard() string { - return clipboard.Read() -} - -func (manager *RemoteManager) WriteClipboard(data string) { - clipboard.Write(data) -} - -func (manager *RemoteManager) ResetKeys() { - xorg.ResetKeys() -} - -func (manager *RemoteManager) ScreenConfigurations() map[int]types.ScreenConfiguration { - return xorg.ScreenConfigurations -} - -func (manager *RemoteManager) GetScreenSize() *types.ScreenSize { - return xorg.GetScreenSize() -} - -func (manager *RemoteManager) SetKeyboardLayout(layout string) { - _ = exec.Command("setxkbmap", layout).Run() -} - -func (manager *RemoteManager) SetKeyboardModifiers(NumLock int, CapsLock int, ScrollLock int) { - xorg.SetKeyboardModifiers(NumLock, CapsLock, ScrollLock) -} diff --git a/server/internal/remote/xorg.go b/server/internal/remote/xorg.go new file mode 100644 index 00000000..0722e27a --- /dev/null +++ b/server/internal/remote/xorg.go @@ -0,0 +1,51 @@ +package remote + +import ( + "m1k1o/neko/internal/remote/xorg" + "m1k1o/neko/internal/types" + "os/exec" +) + +func (manager *RemoteManager) Move(x, y int) { + xorg.Move(x, y) +} + +func (manager *RemoteManager) Scroll(x, y int) { + xorg.Scroll(x, y) +} + +func (manager *RemoteManager) ButtonDown(code int) error { + return xorg.ButtonDown(code) +} + +func (manager *RemoteManager) KeyDown(code uint64) error { + return xorg.KeyDown(code) +} + +func (manager *RemoteManager) ButtonUp(code int) error { + return xorg.ButtonUp(code) +} + +func (manager *RemoteManager) KeyUp(code uint64) error { + return xorg.KeyUp(code) +} + +func (manager *RemoteManager) ResetKeys() { + xorg.ResetKeys() +} + +func (manager *RemoteManager) ScreenConfigurations() map[int]types.ScreenConfiguration { + return xorg.ScreenConfigurations +} + +func (manager *RemoteManager) GetScreenSize() *types.ScreenSize { + return xorg.GetScreenSize() +} + +func (manager *RemoteManager) SetKeyboardLayout(layout string) { + _ = exec.Command("setxkbmap", layout).Run() +} + +func (manager *RemoteManager) SetKeyboardModifiers(NumLock int, CapsLock int, ScrollLock int) { + xorg.SetKeyboardModifiers(NumLock, CapsLock, ScrollLock) +}