diff --git a/src/gui/client/main-window.lisp b/src/gui/client/main-window.lisp index 8443623..ca0e817 100644 --- a/src/gui/client/main-window.lisp +++ b/src/gui/client/main-window.lisp @@ -1389,21 +1389,21 @@ local file paths." (multiple-value-bind (select-bg select-fg) (gui-conf:main-window-select-colors) (setf gemtext-widget (make-instance 'gui:scrolled-text - :background (gui-conf:gemini-window-colors) + :background (gui-conf:gemini-window-colors) :selectbackground select-bg :selectforeground select-fg :insertwidth 0 - :takefocus (nodgui.utils:lisp-bool->tcl nil) - :padx padding-pixel - :master gemini-paned-frame - :read-only t - :font gemtext-font))) + :takefocus (nodgui.utils:lisp-bool->tcl nil) + :padx padding-pixel + :master gemini-paned-frame + :read-only t + :font gemtext-font))) (gui:configure gemtext-widget :wrap :word)) (setf info-frame (make-instance 'gui:frame :master object :relief :sunken :borderwidth 1)) (setf info-text (make-instance 'gui:text :height 2 :wrap :none :master info-frame)) (gui:configure info-text :font gui:+tk-small-caption-font+) (setf search-frame (client-search-frame:init-frame object)) - (setf stream-frame (client-stream-frame:init-frame main-paned-frame)) + (setf stream-frame (client-stream-frame:init-frame main-paned-frame object)) (gui:grid info-text 0 0 :sticky :news) (gui-goodies:gui-resize-grid-all info-frame) (gui:grid tool-bar 0 0 :sticky :news) @@ -1512,10 +1512,16 @@ local file paths." (defun get-address-bar-text (main-window) (trim-blanks (gui:text (iri-entry (tool-bar main-window))))) +(defmacro with-interrupt-rendering-enqueue-restart-rendering + ((main-window &optional (priority program-events:+standard-event-priority+)) &body body) + `(progn + (interrupt-rendering ,main-window) + (ev:with-enqueued-process-and-unblock ,priority + (restart-rendering ,main-window) + ,@body))) + (defun scale-gemtext (main-window offset) - (interrupt-rendering main-window) - (ev:with-enqueued-process-and-unblock () - (restart-rendering main-window) + (with-interrupt-rendering-enqueue-restart-rendering (main-window ()) (clear-gemtext main-window) (setf (gemtext-font-scaling main-window) (if offset diff --git a/src/gui/client/stream-frame.lisp b/src/gui/client/stream-frame.lisp index e0d9cbc..ba76881 100644 --- a/src/gui/client/stream-frame.lisp +++ b/src/gui/client/stream-frame.lisp @@ -79,18 +79,21 @@ (let ((new-rows (all-rows))) (resync-rows stream-table new-rows)))))))) -(defun revive-stream-clsr (stream-table) +(defun revive-stream-clsr (stream-table main-window) (with-accessors ((tree gui-goodies:tree)) stream-table (lambda () + (client-main-window::interrupt-rendering main-window) (a:when-let* ((selections (gui:treeview-get-selection tree)) (selection (first selections))) (let* ((url (gui:id selection)) (new-rows (all-rows))) - (client-main-window:set-address-bar-text gui-goodies:*main-frame* url) - (client-main-window::open-iri url gui-goodies:*main-frame* t) - (resync-rows stream-table new-rows)))))) + (ev:with-enqueued-process-and-unblock () + (client-main-window::restart-rendering main-window) + (client-main-window:set-address-bar-text main-window url) + (resync-rows stream-table new-rows)) + (client-main-window::open-iri url main-window t)))))) -(defun init-frame (parent-frame) +(defun init-frame (parent-frame main-window) (let* ((wrapper-frame (make-instance 'stream-frame :master parent-frame)) (table (make-instance 'stream-table :master wrapper-frame)) (buttons-frame (make-instance 'gui:frame :master wrapper-frame)) @@ -105,7 +108,7 @@ (revive-button (make-instance 'gui:button :master buttons-frame :image icons:*document-accept* - :command (revive-stream-clsr table))) + :command (revive-stream-clsr table main-window))) (close-button (make-instance 'gui:button :image icons:*cross* :master buttons-frame @@ -128,5 +131,5 @@ #$$ (lambda (e) (declare (ignore e)) - (funcall (revive-stream-clsr table)))) + (funcall (revive-stream-clsr table main-window)))) wrapper-frame))