1
0
Fork 0

- moved 'global bindings' to the gemtext widget.

This commit is contained in:
cage 2023-05-23 18:38:01 +02:00
parent 56dd0798a6
commit 2f26583f78
1 changed files with 100 additions and 100 deletions

View File

@ -126,10 +126,13 @@
(fit-toc-char-width main-window toc-widget-width))) (fit-toc-char-width main-window toc-widget-width)))
main-window))) main-window)))
(defun slurp-gemini-stream (main-window iri stream-wrapper &key (defun slurp-gemini-stream (main-window iri stream-wrapper
(use-cache t) &key
(process-function #'identity) (use-cache t)
(aborting-function (constantly nil))) (process-function #'identity)
(aborting-function (constantly nil)))
(ev:with-enqueued-process-and-unblock ()
(set-focus-to-gemtext main-window))
(enqueue-request-notify-error :gemini-request 1 iri use-cache) (enqueue-request-notify-error :gemini-request 1 iri use-cache)
(labels ((stream-exausted-p () (labels ((stream-exausted-p ()
(let ((status-completed (comm:make-request :gemini-stream-completed-p (let ((status-completed (comm:make-request :gemini-stream-completed-p
@ -160,10 +163,10 @@
1 1
ev:+standard-event-priority+ ev:+standard-event-priority+
iri) iri)
(ev:with-enqueued-process-and-unblock () (ev:with-enqueued-process-and-unblock ()
(set-bookmark-button-true main-window)) (set-bookmark-button-true main-window))
(ev:with-enqueued-process-and-unblock () (ev:with-enqueued-process-and-unblock ()
(set-bookmark-button-false main-window))) (set-bookmark-button-false main-window)))
(ev:with-enqueued-process-and-unblock () (ev:with-enqueued-process-and-unblock ()
(set-gemlog-toolbar-button-appearance main-window iri)) (set-gemlog-toolbar-button-appearance main-window iri))
(ev:with-enqueued-process-and-unblock () (ev:with-enqueued-process-and-unblock ()
@ -1071,12 +1074,6 @@
(gui:bind toc-listbox (gui:bind toc-listbox
#$<<ListboxSelect>>$ #$<<ListboxSelect>>$
(toc-callback-clsr main-window)) (toc-callback-clsr main-window))
(gui:bind gemtext-widget
#$<Enter>$
(lambda (e)
(declare (ignore e))
(gui:configure-mouse-pointer gemtext-widget (gui:find-cursor :xterm))
(gui:force-focus (gui:root-toplevel))))
(setf (gui:command go-button) (open-iri-clsr main-window t)) (setf (gui:command go-button) (open-iri-clsr main-window t))
(setf (gui:command reload-button) (reload-iri-clsr main-window)) (setf (gui:command reload-button) (reload-iri-clsr main-window))
(setf (gui:command back-button) (back-iri-clsr main-window)) (setf (gui:command back-button) (back-iri-clsr main-window))
@ -1325,96 +1322,99 @@
(setf (gui:text (iri-entry (tool-bar main-window))) text) (setf (gui:text (iri-entry (tool-bar main-window))) text)
(gui:clear-selection entry))) (gui:clear-selection entry)))
(defun set-focus-to-gemtext (main-window)
(gui:focus (gui:inner-text (gemtext-widget main-window))))
(defun get-address-bar-text (main-window) (defun get-address-bar-text (main-window)
(trim-blanks (gui:text (iri-entry (tool-bar main-window))))) (trim-blanks (gui:text (iri-entry (tool-bar main-window)))))
(defun initialize-keybindings (main-window) (defun initialize-keybindings (main-window)
(gui:bind (gui:root-toplevel) (let ((inner-gemtext-widget (gui:inner-text (gemtext-widget main-window))))
(client-configuration:get-keybinding :quit) (gui:bind inner-gemtext-widget
(lambda (e) (client-configuration:get-keybinding :quit)
(declare (ignore e)) (lambda (e)
(menu:quit))) (declare (ignore e))
(gui:bind (gui:root-toplevel) (menu:quit)))
(client-configuration:get-keybinding :search) (gui:bind inner-gemtext-widget
(lambda (e) (client-configuration:get-keybinding :search)
(declare (ignore e)) (lambda (e)
(funcall (menu:show-search-frame-clsr main-window))) (declare (ignore e))
:exclusive t) (funcall (menu:show-search-frame-clsr main-window)))
(gui:bind (gui:root-toplevel) :exclusive t)
(client-configuration:get-keybinding :stream) (gui:bind inner-gemtext-widget
(lambda (e) (client-configuration:get-keybinding :stream)
(declare (ignore e)) (lambda (e)
(menu:show-streams)) (declare (ignore e))
:exclusive t) (menu:show-streams))
(gui:bind (gui:root-toplevel) :exclusive t)
(client-configuration:get-keybinding :certificates) (gui:bind inner-gemtext-widget
(lambda (e) (client-configuration:get-keybinding :certificates)
(declare (ignore e)) (lambda (e)
(menu:show-certificates)) (declare (ignore e))
:exclusive t) (menu:show-certificates))
(gui:bind (gui:root-toplevel) :exclusive t)
(client-configuration:config-keybinding-tour-manage) (gui:bind inner-gemtext-widget
(lambda (e) (client-configuration:config-keybinding-tour-manage)
(declare (ignore e)) (lambda (e)
(menu:show-tour)) (declare (ignore e))
:exclusive t) (menu:show-tour))
(gui:bind (gui:root-toplevel) :exclusive t)
(client-configuration:get-keybinding :gemlog) (gui:bind inner-gemtext-widget
(lambda (e) (client-configuration:get-keybinding :gemlog)
(declare (ignore e)) (lambda (e)
(menu:manage-gemlogs)) (declare (ignore e))
:exclusive t) (menu:manage-gemlogs))
(gui:bind (gui:root-toplevel) :exclusive t)
(client-configuration:get-keybinding :about) (gui:bind inner-gemtext-widget
(lambda (e) (client-configuration:get-keybinding :about)
(declare (ignore e)) (lambda (e)
(menu:help-about)) (declare (ignore e))
:exclusive t) (menu:help-about))
(gui:bind (gui:root-toplevel) :exclusive t)
(client-configuration:get-keybinding :type-address) (gui:bind inner-gemtext-widget
(lambda (e) (client-configuration:get-keybinding :type-address)
(declare (ignore e)) (lambda (e)
(let* ((autocomplete-entry (iri-entry (tool-bar main-window))) (declare (ignore e))
(entry (nodgui.mw:autocomplete-entry-widget autocomplete-entry))) (let* ((autocomplete-entry (iri-entry (tool-bar main-window)))
(gui:focus entry) (entry (nodgui.mw:autocomplete-entry-widget autocomplete-entry)))
(gui:set-selection entry 0 :end))) (gui:focus entry)
:exclusive t) (gui:set-selection entry 0 :end)))
(gui:bind (gui:root-toplevel) :exclusive t)
(client-configuration:config-keybinding-tour-shuffle) (gui:bind inner-gemtext-widget
(lambda (e) (client-configuration:config-keybinding-tour-shuffle)
(declare (ignore e)) (lambda (e)
(client-tour-window:enqueue-shuffle-tour)) (declare (ignore e))
:exclusive t) (client-tour-window:enqueue-shuffle-tour))
(gui:bind (gui:root-toplevel) :exclusive t)
(client-configuration:config-keybinding-tour-next) (gui:bind inner-gemtext-widget
(lambda (e) (client-configuration:config-keybinding-tour-next)
(declare (ignore e)) (lambda (e)
(funcall (tour-visit-next-iri-clsr main-window))) (declare (ignore e))
:exclusive t) (funcall (tour-visit-next-iri-clsr main-window)))
(gui:bind (gui:root-toplevel) :exclusive t)
(client-configuration:get-keybinding :back) (gui:bind inner-gemtext-widget
(lambda (e) (client-configuration:get-keybinding :back)
(declare (ignore e)) (lambda (e)
(funcall (back-iri-clsr main-window))) (declare (ignore e))
:exclusive t) (funcall (back-iri-clsr main-window)))
(gui:bind (gui:root-toplevel) :exclusive t)
(client-configuration:get-keybinding :up) (gui:bind inner-gemtext-widget
(lambda (e) (client-configuration:get-keybinding :up)
(declare (ignore e)) (lambda (e)
(funcall (up-iri-clsr main-window))) (declare (ignore e))
:exclusive t) (funcall (up-iri-clsr main-window)))
(gui:bind (gui:root-toplevel) :exclusive t)
(client-configuration:config-keybinding-bookmark-toggle) (gui:bind inner-gemtext-widget
(lambda (e) (client-configuration:config-keybinding-bookmark-toggle)
(declare (ignore e)) (lambda (e)
(funcall (toggle-bookmark-iri-clsr main-window))) (declare (ignore e))
:exclusive t) (funcall (toggle-bookmark-iri-clsr main-window)))
(gui:bind (gui:root-toplevel) :exclusive t)
(client-configuration:config-keybinding-bookmark-show) (gui:bind inner-gemtext-widget
(lambda (e) (client-configuration:config-keybinding-bookmark-show)
(declare (ignore e)) (lambda (e)
(funcall (menu:show-bookmarks-clsr main-window))) (declare (ignore e))
:exclusive t)) (funcall (menu:show-bookmarks-clsr main-window))))))
(defun init-main-window (starting-iri) (defun init-main-window (starting-iri)
(setf gui:*debug-tk* nil) (setf gui:*debug-tk* nil)