summary refs log tree commit diff
path: root/emacs/init.el
diff options
context:
space:
mode:
authornoa@gaiwan.org2024-06-13 22:41:04 +0000
committernoa@gaiwan.org2024-06-13 22:41:04 +0000
commit87ced504ca001d7ad792235d1f972c4361233389 (patch)
treee50ae04351b048839cde597ca41dbbab31119f25 /emacs/init.el
parent1e98890925e63076719494c50166bb35d9fe5ee1 (diff)
Remove touchscreen handling code
Diffstat (limited to 'emacs/init.el')
-rw-r--r--emacs/init.el79
1 files changed, 0 insertions, 79 deletions
diff --git a/emacs/init.el b/emacs/init.el
index c9599c4..dc50c79 100644
--- a/emacs/init.el
+++ b/emacs/init.el
@@ -900,82 +900,3 @@ and when JID is not in `jabber-activity-banned'."
         calendar-mark-holidays-flag t
         calendar-date-style 'iso)
 
-;;; TOUCHSCREEN
-;; this should be obsolete in emacs 30
-;; Copyright 2024-present Naheel Azawy.  All rights reserved.
-(defvar touchscreen-last-time)
-(defvar touchscreen-last-pos-pixel)
-(defvar touchscreen-last-dist 0)
-(defvar touchscreen-begin-char)
-
-(defun touchscreen-time ()
-  "Time in seconds."
-  (time-convert (current-time) 'integer))
-
-(defun touchscreen-handle-touch-begin (input)
-  "Handle touch begining at input INPUT."
-  (interactive "e")
-  (let* ((event     (nth 1 input))
-	 (pos-pixel (nth 3 event))
-	 (pos-char  (nth 6 event))
-	 (win	 (nth 1 event)))
-    ;; (message (format "%s" input))
-    (if (not (equal (selected-window) win))
-	;; switch window
-	(select-window win))
-    ;; set globals
-    (setq touchscreen-last-time (touchscreen-time))
-    (setq touchscreen-last-pos-pixel pos-pixel)
-    (setq touchscreen-begin-char pos-char)
-    ))
-
-(defun touchscreen-handle-touch-update (input)
-  "Handle touch update at input INPUT."
-  (interactive "e")
-  (let* ((event	(nth 0 (nth 1 input)))
-	 (pos-pixel  (nth 3 event))
-	 (pos-char   (nth 6 event))
-	 (diff-time  (- (touchscreen-time) touchscreen-last-time))
-	 (diff-pixel (- (cdr touchscreen-last-pos-pixel) (cdr pos-pixel)))
-	 (diff-char  (abs (- touchscreen-begin-char pos-char))))
-
-    (if (= (length (nth 1 input)) 2)
-	;; pinch zoom
-	(let* ((event2     (nth 1 (nth 1 input)))
-	       (pos-pixel2 (nth 3 event2))
-	       (dist (sqrt (+ (expt (- (car pos-pixel2) (car pos-pixel)) 2)
-                              (expt (- (cdr pos-pixel2) (cdr pos-pixel)) 2))))
-               (dist-diff  (- dist touchscreen-last-dist)))
-          (setq touchscreen-last-dist dist)
-          (if (> dist-diff 0)
-              (text-scale-increase 0.1)
-            (if (< dist-diff 0)
-                (text-scale-decrease 0.1))))
-      (if (> diff-time 1)
-          ;; TODO: set marker on long press
-          (goto-char pos-char))
-      (if (> diff-char 1)
-          ;; scroll
-          (progn
-            (move-to-window-line nil)
-            (if (> diff-pixel 0)
-                (pixel-scroll-pixel-up diff-pixel)
-              (if (< diff-pixel 0)
-                  (pixel-scroll-pixel-down (* -1 diff-pixel))))
-            (setq touchscreen-last-time (touchscreen-time))
-            (setq touchscreen-last-pos-pixel pos-pixel))))))
-
-(defun touchscreen-handle-touch-end (input)
-  "Handle touch end at input INPUT."
-  (interactive "e")
-  (let* ((event    (nth 1 input))
-	 (pos-char (nth 6 event)))
-    (if (= touchscreen-begin-char pos-char)
-	;; move cursor
-	(goto-char pos-char))))
-
-(global-set-key [touchscreen-begin]  #'touchscreen-handle-touch-begin)
-(global-set-key [touchscreen-update] #'touchscreen-handle-touch-update)
-(global-set-key [touchscreen-end]    #'touchscreen-handle-touch-end)
-
-