diff --git a/backend.go b/backend.go
index 98f7682..4efea54 100644
--- a/backend.go
+++ b/backend.go
@@ -13,8 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with Remote-Touchpad. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Remote-Touchpad. If not, see .
*/
package main
diff --git a/backend_portal.go b/backend_portal.go
index 1f1bc6f..3de18ef 100644
--- a/backend_portal.go
+++ b/backend_portal.go
@@ -15,8 +15,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with Remote-Touchpad. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Remote-Touchpad. If not, see .
*/
package main
@@ -35,6 +35,7 @@ const (
btnReleased uint32 = 0
btnPressed uint32 = 1
+ // linux/input-event-codes.h
btnLeft int32 = 0x110
btnRight int32 = 0x111
btnMiddle int32 = 0x112
diff --git a/backend_portal_disabled.go b/backend_portal_disabled.go
index 499d5f5..05ca72f 100644
--- a/backend_portal_disabled.go
+++ b/backend_portal_disabled.go
@@ -15,8 +15,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with Remote-Touchpad. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Remote-Touchpad. If not, see .
*/
package main
diff --git a/backend_windows.go b/backend_windows.go
index 2b25cc7..78574e0 100644
--- a/backend_windows.go
+++ b/backend_windows.go
@@ -15,8 +15,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with Remote-Touchpad. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Remote-Touchpad. If not, see .
*/
package main
diff --git a/backend_windows_disabled.go b/backend_windows_disabled.go
index 5d902ea..b0051b0 100644
--- a/backend_windows_disabled.go
+++ b/backend_windows_disabled.go
@@ -15,8 +15,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with Remote-Touchpad. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Remote-Touchpad. If not, see .
*/
package main
diff --git a/backend_x11.go b/backend_x11.go
index 6749408..ad3445b 100644
--- a/backend_x11.go
+++ b/backend_x11.go
@@ -15,8 +15,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with Remote-Touchpad. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Remote-Touchpad. If not, see .
*/
package main
diff --git a/backend_x11_disabled.go b/backend_x11_disabled.go
index 8a68e22..11a8234 100644
--- a/backend_x11_disabled.go
+++ b/backend_x11_disabled.go
@@ -15,8 +15,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with Remote-Touchpad. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Remote-Touchpad. If not, see .
*/
package main
diff --git a/flatpak/com.github.unrud.RemoteTouchpad.yaml b/flatpak/com.github.unrud.RemoteTouchpad.yaml
index 9839211..ad9276c 100644
--- a/flatpak/com.github.unrud.RemoteTouchpad.yaml
+++ b/flatpak/com.github.unrud.RemoteTouchpad.yaml
@@ -34,8 +34,7 @@ modules:
dest: src/github.com/unrud/remote-touchpad
buildsystem: simple
build-commands:
- - . /usr/lib/sdk/golang/enable.sh; env GOPATH="$(pwd)" go build -tags 'portal x11'
- github.com/unrud/remote-touchpad
+ - . /usr/lib/sdk/golang/enable.sh; env GOPATH="$(pwd)" go build -tags 'portal x11' github.com/unrud/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 -Dm0644 -t /app/share/metainfo src/github.com/unrud/remote-touchpad/desktop/com.github.unrud.RemoteTouchpad.appdata.xml
diff --git a/host.go b/host.go
index 2e622a8..14ed821 100644
--- a/host.go
+++ b/host.go
@@ -13,8 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with Remote-Touchpad. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Remote-Touchpad. If not, see .
*/
package main
diff --git a/keysyms.generator.go b/keysyms.generator.go
index 17340be..74d479d 100644
--- a/keysyms.generator.go
+++ b/keysyms.generator.go
@@ -15,8 +15,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with Remote-Touchpad. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Remote-Touchpad. If not, see .
*/
package main
diff --git a/keysyms.go b/keysyms.go
index a81dfd9..dbafa70 100644
--- a/keysyms.go
+++ b/keysyms.go
@@ -13,8 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with Remote-Touchpad. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Remote-Touchpad. If not, see .
*/
package main
@@ -26,12 +26,13 @@ import "errors"
type Keysym int32
const (
- xf86AudioLowerVolume Keysym = 0x1008ff11
- xf86AudioMute Keysym = 0x1008ff12
- xf86AudioRaiseVolume Keysym = 0x1008ff13
- xf86AudioPlay Keysym = 0x1008ff14
- xf86AudioPrev Keysym = 0x1008ff16
- xf86AudioNext Keysym = 0x1008ff17
+ // X11/XF86keysym.h
+ xf86xkAudioLowerVolume Keysym = 0x1008ff11
+ xf86xkAudioMute Keysym = 0x1008ff12
+ xf86xkAudioRaiseVolume Keysym = 0x1008ff13
+ xf86xkAudioPlay Keysym = 0x1008ff14
+ xf86xkAudioPrev Keysym = 0x1008ff16
+ xf86xkAudioNext Keysym = 0x1008ff17
)
func RuneToKeysym(runeValue rune) (Keysym, error) {
@@ -51,22 +52,22 @@ func RuneToKeysym(runeValue rune) (Keysym, error) {
func KeyToKeysym(key Key) (Keysym, error) {
if key == KeyVolumeMute {
- return xf86AudioMute, nil
+ return xf86xkAudioMute, nil
}
if key == KeyVolumeDown {
- return xf86AudioLowerVolume, nil
+ return xf86xkAudioLowerVolume, nil
}
if key == KeyVolumeUp {
- return xf86AudioRaiseVolume, nil
+ return xf86xkAudioRaiseVolume, nil
}
if key == KeyMediaPlayPause {
- return xf86AudioPlay, nil
+ return xf86xkAudioPlay, nil
}
if key == KeyMediaPrevTrack {
- return xf86AudioPrev, nil
+ return xf86xkAudioPrev, nil
}
if key == KeyMediaNextTrack {
- return xf86AudioNext, nil
+ return xf86xkAudioNext, nil
}
return 0, errors.New("key not mapped to keysym")
}
diff --git a/main.go b/main.go
index 5475122..4b9d967 100644
--- a/main.go
+++ b/main.go
@@ -13,8 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with Remote-Touchpad. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Remote-Touchpad. If not, see .
*/
package main
diff --git a/qr.go b/qr.go
index 3c94b84..aae21db 100644
--- a/qr.go
+++ b/qr.go
@@ -13,8 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with Remote-Touchpad. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Remote-Touchpad. If not, see .
*/
package main
diff --git a/terminal.go b/terminal.go
index 86e559c..91de022 100644
--- a/terminal.go
+++ b/terminal.go
@@ -13,8 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with Remote-Touchpad. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Remote-Touchpad. If not, see .
*/
package main
diff --git a/terminal_posix.go b/terminal_posix.go
index 1e5ad90..e79ea61 100644
--- a/terminal_posix.go
+++ b/terminal_posix.go
@@ -15,8 +15,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with Remote-Touchpad. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Remote-Touchpad. If not, see .
*/
package main
diff --git a/terminal_windows.go b/terminal_windows.go
index 22c0c3e..5637a7d 100644
--- a/terminal_windows.go
+++ b/terminal_windows.go
@@ -13,8 +13,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with Remote-Touchpad. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Remote-Touchpad. If not, see .
*/
package main
diff --git a/webdata/fn.js b/webdata/fn.js
index 8c4fa6d..9a018b2 100644
--- a/webdata/fn.js
+++ b/webdata/fn.js
@@ -13,14 +13,15 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with Remote-Touchpad. If not, see .
+ * You should have received a copy of the GNU General Public License
+ * along with Remote-Touchpad. If not, see .
*/
-// [1 Touch, 2 Touches, 3 Touches]
+// [1 Touch, 2 Touches, 3 Touches] (as pixel)
const TOUCH_MOVE_THRESHOLD = [10, 15, 15];
+// Max time between consecutive touches for clicking or dragging (as milliseconds)
const TOUCH_TIMEOUT = 250;
-// [[px/s, mult], ...]
+// [[pixel/second, multiplicator], ...]
const POINTER_ACCELERATION = [
[0, 0],
[87, 1],
@@ -311,7 +312,7 @@ window.addEventListener("load", function() {
let text = document.getElementById("text");
function showScene(scene) {
- [opening, closed, pad, keys, keyboard].forEach(function (e) {
+ [opening, closed, pad, keys, keyboard].forEach(function(e) {
e.classList.toggle("hidden", e != scene);
});
}
@@ -336,13 +337,10 @@ window.addEventListener("load", function() {
text.value = "";
showScene(opening);
- let wsProtocol = "wss:";
- if (location.protocol == "http:") {
- wsProtocol = "ws:";
- }
- ws = new WebSocket(wsProtocol + "//" + location.hostname +
- (location.port ? ":" + location.port : "") +
- "/ws");
+ ws = new WebSocket(
+ (location.protocol == "http:" ? "ws:" : "wss:") + "//" + location.hostname +
+ (location.port ? ":" + location.port : "") + "/ws"
+ );
ws.onmessage = function(evt) {
if (authenticated) {
@@ -383,23 +381,21 @@ window.addEventListener("load", function() {
{id: "volumedownbutton", key: KEY_VOLUME_DOWN},
{id: "volumemutebutton", key: KEY_VOLUME_MUTE},
{id: "volumeupbutton", key: KEY_VOLUME_UP}].forEach(function(o) {
- document.getElementById(o.id).addEventListener("click",
- function() {
- ws.send("k" + o.key);
- });
- });
- document.getElementById("sendbutton").addEventListener("click",
- function() {
- if (text.value != "") {
- ws.send("t" + text.value);
- text.value = "";
- }
- window.history.back();
+ document.getElementById(o.id).addEventListener("click", function() {
+ ws.send("k" + o.key);
});
+ });
+ document.getElementById("sendbutton").addEventListener("click", function() {
+ if (text.value != "") {
+ ws.send("t" + text.value);
+ text.value = "";
+ }
+ window.history.back();
+ });
window.onpopstate = function() {
if (!pad.classList.contains("hidden") ||
- !keyboard.classList.contains("hidden") ||
- !keys.classList.contains("hidden")) {
+ !keyboard.classList.contains("hidden") ||
+ !keys.classList.contains("hidden")) {
if (history.state == "keys") {
showKeys();
} else if (history.state == "keyboard") {
@@ -409,10 +405,9 @@ window.addEventListener("load", function() {
}
}
};
- document.getElementById("reloadbutton").addEventListener("click",
- function() {
- location.reload();
- });
+ document.getElementById("reloadbutton").addEventListener("click", function() {
+ location.reload();
+ });
pad.addEventListener("touchstart", handleStart);
pad.addEventListener("touchend", handleEnd);
pad.addEventListener("touchcancel", handleEnd);