Compare commits

...

2 commits

Author SHA1 Message Date
David Botton
3a3bb015a8 handle mouse events on clog-window 2025-11-16 16:17:05 -05:00
David Botton
239da8522d faster connection-cache 2025-11-16 15:19:14 -05:00

View file

@ -147,9 +147,15 @@ flushed with FLUSH-CONNECTION-CACHE or a query is made."
(defun flush-connection-cache (clog-obj)
"Flush connection cache if on CLOG-OBJ is located on."
(when *connection-cache*
(dolist (script (reverse *connection-cache*))
(unless (eq script :cache)
(clog-connection:execute (connection-id clog-obj) script)))
(let ((big (make-string-output-stream)))
(write-string "(function(){" big)
(dolist (script (reverse *connection-cache*))
(unless (eq script :cache)
(write-string script big)
(write-char #\; big)))
(write-string "})()" big)
(clog-connection:execute (connection-id clog-obj)
(get-output-stream-string big)))
(setf *connection-cache* (list :cache))))
;;;;;;;;;;;;;
@ -213,6 +219,14 @@ result or if time out DEFAULT-ANSWER. see JQUERY-QUERY (Internal)"))
;; The use of offsetLeft and offsetTop is to correct the X and Y
;; to the actual X,Y of the target.
(defparameter mouse-event-script-for-window
"+ e.clientX + ':' +
e.clientY + ':' +
e.screenX + ':' + e.screenY + ':' + e.which + ':' + e.altKey + ':' +
e.ctrlKey + ':' + e.shiftKey + ':' + e.metaKey + ':' +
e.clientX + ':' + e.clientY + ':' + e.pageX + ':' + e.pageY"
"JavaScript to collect mouse event data from browser.")
(defun parse-mouse-event (data)
(let ((f (ppcre:split ":" data)))
(list
@ -937,7 +951,9 @@ on an on-click event."))
(funcall handler obj (parse-mouse-event data))))
:one-time one-time
:cancel-event cancel-event
:call-back-script mouse-event-script))
:call-back-script (if (typep obj 'clog-window)
mouse-event-script-for-window
mouse-event-script)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; set-on-mouse-double-click ;;
@ -956,7 +972,9 @@ replace on an on-double-click event."))
(funcall handler obj (parse-mouse-event data))))
:one-time one-time
:cancel-event cancel-event
:call-back-script mouse-event-script))
:call-back-script (if (typep obj 'clog-window)
mouse-event-script-for-window
mouse-event-script)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; set-on-mouse-right-click ;;
@ -975,7 +993,9 @@ replace on an on-context-menu event."))
(lambda (data)
(funcall handler obj (parse-mouse-event data))))
:one-time one-time
:call-back-script mouse-event-script
:call-back-script (if (typep obj 'clog-window)
mouse-event-script-for-window
mouse-event-script)
:cancel-event cancel-event))
;;;;;;;;;;;;;;;;;;;;;;;;
@ -1040,7 +1060,9 @@ does not bubble."))
(funcall handler obj (parse-mouse-event data))))
:one-time one-time
:cancel-event cancel-event
:call-back-script mouse-event-script))
:call-back-script (if (typep obj 'clog-window)
mouse-event-script-for-window
mouse-event-script)))
;;;;;;;;;;;;;;;;;;;;;
;; set-on-mouse-up ;;
@ -1059,7 +1081,9 @@ ON-MOUSE-UP-HANDLER is nil unbind the event."))
(funcall handler obj (parse-mouse-event data))))
:one-time one-time
:cancel-event cancel-event
:call-back-script mouse-event-script))
:call-back-script (if (typep obj 'clog-window)
mouse-event-script-for-window
mouse-event-script)))
;;;;;;;;;;;;;;;;;;;;;;;
;; set-on-mouse-move ;;
@ -1078,7 +1102,9 @@ ON-MOUSE-MOVE-HANDLER is nil unbind the event."))
(funcall handler obj (parse-mouse-event data))))
:one-time one-time
:cancel-event cancel-event
:call-back-script mouse-event-script))
:call-back-script (if (typep obj 'clog-window)
mouse-event-script-for-window
mouse-event-script)))
;;;;;;;;;;;;;;;;;;
;; set-on-wheel ;;