Skip to content

Commit

Permalink
fix rendering process
Browse files Browse the repository at this point in the history
  • Loading branch information
cxxxr committed Sep 22, 2023
1 parent 69d5884 commit 71d0990
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
9 changes: 7 additions & 2 deletions frontends/sdl2/text-buffer-impl.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,16 @@
(- (lem-core/display-3::window-view-height window) y)))
(sdl2:render-fill-rect (lem-sdl2::current-renderer) rect)))

(defmethod lem-core::redraw-buffer :before ((implementation lem-sdl2::sdl2)
(buffer lem-core/display-3::text-buffer-v2)
window
force)
(sdl2:set-render-target (lem-sdl2::current-renderer)
(lem-sdl2::view-texture (lem:window-view window))))

(defmethod lem-core::redraw-buffer :around ((implementation lem-sdl2::sdl2)
(buffer lem-core/display-3::text-buffer-v2)
window
force)
(sdl2:in-main-thread ()
(sdl2:set-render-target (lem-sdl2::current-renderer)
(lem-sdl2::view-texture (lem:window-view window)))
(call-next-method)))
20 changes: 8 additions & 12 deletions src/display.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -512,9 +512,16 @@

(defmethod redraw-buffer :around (implementation buffer window force)
(with-display-error ()
(lem-if:redraw-view-before (implementation)
(screen-view (window-screen window)))
(let ((lem-if:*background-color-of-drawing-window*
(get-background-color-of-window window)))
(call-next-method))))
(call-next-method))
(when (window-use-modeline-p window)
(redraw-modeline window (or (screen-modified-p (window-screen window))
force)))
(lem-if:redraw-view-after (implementation)
(screen-view (window-screen window)))))

(defun get-background-color-of-window (window)
(cond ((typep window 'floating-window)
Expand All @@ -528,17 +535,6 @@
*inactive-window-background-color*)
(t nil)))

(defmethod redraw-buffer :before (implementation (buffer text-buffer) window force)
(lem-if:redraw-view-before (implementation)
(screen-view (window-screen window))))

(defmethod redraw-buffer :after (implementation (buffer text-buffer) window force)
(when (window-use-modeline-p window)
(redraw-modeline window (or (screen-modified-p (window-screen window))
force)))
(lem-if:redraw-view-after (implementation)
(screen-view (window-screen window))))

(defun get-cursor-y-on-screen (window)
(if (eq window (current-window))
(count-lines (window-view-point window)
Expand Down

0 comments on commit 71d0990

Please sign in to comment.