Cosmetics
This commit is contained in:
parent
bd376578d4
commit
9ad8590517
17 changed files with 70 additions and 74 deletions
|
|
@ -35,6 +35,7 @@ const (
|
||||||
btnReleased uint32 = 0
|
btnReleased uint32 = 0
|
||||||
btnPressed uint32 = 1
|
btnPressed uint32 = 1
|
||||||
|
|
||||||
|
// linux/input-event-codes.h
|
||||||
btnLeft int32 = 0x110
|
btnLeft int32 = 0x110
|
||||||
btnRight int32 = 0x111
|
btnRight int32 = 0x111
|
||||||
btnMiddle int32 = 0x112
|
btnMiddle int32 = 0x112
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,7 @@ modules:
|
||||||
dest: src/github.com/unrud/remote-touchpad
|
dest: src/github.com/unrud/remote-touchpad
|
||||||
buildsystem: simple
|
buildsystem: simple
|
||||||
build-commands:
|
build-commands:
|
||||||
- . /usr/lib/sdk/golang/enable.sh; env GOPATH="$(pwd)" go build -tags 'portal x11'
|
- . /usr/lib/sdk/golang/enable.sh; env GOPATH="$(pwd)" go build -tags 'portal x11' github.com/unrud/remote-touchpad
|
||||||
github.com/unrud/remote-touchpad
|
|
||||||
- install -Dm0755 -t /app/bin remote-touchpad
|
- install -Dm0755 -t /app/bin remote-touchpad
|
||||||
- install -Dm0755 -t /app/bin src/github.com/unrud/remote-touchpad/desktop/remote-touchpad-wait-on-error
|
- install -Dm0755 -t /app/bin src/github.com/unrud/remote-touchpad/desktop/remote-touchpad-wait-on-error
|
||||||
- install -Dm0644 -t /app/share/metainfo src/github.com/unrud/remote-touchpad/desktop/com.github.unrud.RemoteTouchpad.appdata.xml
|
- install -Dm0644 -t /app/share/metainfo src/github.com/unrud/remote-touchpad/desktop/com.github.unrud.RemoteTouchpad.appdata.xml
|
||||||
|
|
|
||||||
25
keysyms.go
25
keysyms.go
|
|
@ -26,12 +26,13 @@ import "errors"
|
||||||
type Keysym int32
|
type Keysym int32
|
||||||
|
|
||||||
const (
|
const (
|
||||||
xf86AudioLowerVolume Keysym = 0x1008ff11
|
// X11/XF86keysym.h
|
||||||
xf86AudioMute Keysym = 0x1008ff12
|
xf86xkAudioLowerVolume Keysym = 0x1008ff11
|
||||||
xf86AudioRaiseVolume Keysym = 0x1008ff13
|
xf86xkAudioMute Keysym = 0x1008ff12
|
||||||
xf86AudioPlay Keysym = 0x1008ff14
|
xf86xkAudioRaiseVolume Keysym = 0x1008ff13
|
||||||
xf86AudioPrev Keysym = 0x1008ff16
|
xf86xkAudioPlay Keysym = 0x1008ff14
|
||||||
xf86AudioNext Keysym = 0x1008ff17
|
xf86xkAudioPrev Keysym = 0x1008ff16
|
||||||
|
xf86xkAudioNext Keysym = 0x1008ff17
|
||||||
)
|
)
|
||||||
|
|
||||||
func RuneToKeysym(runeValue rune) (Keysym, error) {
|
func RuneToKeysym(runeValue rune) (Keysym, error) {
|
||||||
|
|
@ -51,22 +52,22 @@ func RuneToKeysym(runeValue rune) (Keysym, error) {
|
||||||
|
|
||||||
func KeyToKeysym(key Key) (Keysym, error) {
|
func KeyToKeysym(key Key) (Keysym, error) {
|
||||||
if key == KeyVolumeMute {
|
if key == KeyVolumeMute {
|
||||||
return xf86AudioMute, nil
|
return xf86xkAudioMute, nil
|
||||||
}
|
}
|
||||||
if key == KeyVolumeDown {
|
if key == KeyVolumeDown {
|
||||||
return xf86AudioLowerVolume, nil
|
return xf86xkAudioLowerVolume, nil
|
||||||
}
|
}
|
||||||
if key == KeyVolumeUp {
|
if key == KeyVolumeUp {
|
||||||
return xf86AudioRaiseVolume, nil
|
return xf86xkAudioRaiseVolume, nil
|
||||||
}
|
}
|
||||||
if key == KeyMediaPlayPause {
|
if key == KeyMediaPlayPause {
|
||||||
return xf86AudioPlay, nil
|
return xf86xkAudioPlay, nil
|
||||||
}
|
}
|
||||||
if key == KeyMediaPrevTrack {
|
if key == KeyMediaPrevTrack {
|
||||||
return xf86AudioPrev, nil
|
return xf86xkAudioPrev, nil
|
||||||
}
|
}
|
||||||
if key == KeyMediaNextTrack {
|
if key == KeyMediaNextTrack {
|
||||||
return xf86AudioNext, nil
|
return xf86xkAudioNext, nil
|
||||||
}
|
}
|
||||||
return 0, errors.New("key not mapped to keysym")
|
return 0, errors.New("key not mapped to keysym")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,10 +17,11 @@
|
||||||
* along with Remote-Touchpad. If not, see <http://www.gnu.org/licenses/>.
|
* along with Remote-Touchpad. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// [1 Touch, 2 Touches, 3 Touches]
|
// [1 Touch, 2 Touches, 3 Touches] (as pixel)
|
||||||
const TOUCH_MOVE_THRESHOLD = [10, 15, 15];
|
const TOUCH_MOVE_THRESHOLD = [10, 15, 15];
|
||||||
|
// Max time between consecutive touches for clicking or dragging (as milliseconds)
|
||||||
const TOUCH_TIMEOUT = 250;
|
const TOUCH_TIMEOUT = 250;
|
||||||
// [[px/s, mult], ...]
|
// [[pixel/second, multiplicator], ...]
|
||||||
const POINTER_ACCELERATION = [
|
const POINTER_ACCELERATION = [
|
||||||
[0, 0],
|
[0, 0],
|
||||||
[87, 1],
|
[87, 1],
|
||||||
|
|
@ -336,13 +337,10 @@ window.addEventListener("load", function() {
|
||||||
text.value = "";
|
text.value = "";
|
||||||
showScene(opening);
|
showScene(opening);
|
||||||
|
|
||||||
let wsProtocol = "wss:";
|
ws = new WebSocket(
|
||||||
if (location.protocol == "http:") {
|
(location.protocol == "http:" ? "ws:" : "wss:") + "//" + location.hostname +
|
||||||
wsProtocol = "ws:";
|
(location.port ? ":" + location.port : "") + "/ws"
|
||||||
}
|
);
|
||||||
ws = new WebSocket(wsProtocol + "//" + location.hostname +
|
|
||||||
(location.port ? ":" + location.port : "") +
|
|
||||||
"/ws");
|
|
||||||
|
|
||||||
ws.onmessage = function(evt) {
|
ws.onmessage = function(evt) {
|
||||||
if (authenticated) {
|
if (authenticated) {
|
||||||
|
|
@ -383,13 +381,11 @@ window.addEventListener("load", function() {
|
||||||
{id: "volumedownbutton", key: KEY_VOLUME_DOWN},
|
{id: "volumedownbutton", key: KEY_VOLUME_DOWN},
|
||||||
{id: "volumemutebutton", key: KEY_VOLUME_MUTE},
|
{id: "volumemutebutton", key: KEY_VOLUME_MUTE},
|
||||||
{id: "volumeupbutton", key: KEY_VOLUME_UP}].forEach(function(o) {
|
{id: "volumeupbutton", key: KEY_VOLUME_UP}].forEach(function(o) {
|
||||||
document.getElementById(o.id).addEventListener("click",
|
document.getElementById(o.id).addEventListener("click", function() {
|
||||||
function() {
|
|
||||||
ws.send("k" + o.key);
|
ws.send("k" + o.key);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
document.getElementById("sendbutton").addEventListener("click",
|
document.getElementById("sendbutton").addEventListener("click", function() {
|
||||||
function() {
|
|
||||||
if (text.value != "") {
|
if (text.value != "") {
|
||||||
ws.send("t" + text.value);
|
ws.send("t" + text.value);
|
||||||
text.value = "";
|
text.value = "";
|
||||||
|
|
@ -409,8 +405,7 @@ window.addEventListener("load", function() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
document.getElementById("reloadbutton").addEventListener("click",
|
document.getElementById("reloadbutton").addEventListener("click", function() {
|
||||||
function() {
|
|
||||||
location.reload();
|
location.reload();
|
||||||
});
|
});
|
||||||
pad.addEventListener("touchstart", handleStart);
|
pad.addEventListener("touchstart", handleStart);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue