diff --git a/lem.asd b/lem.asd index 154a6a9d0..378223be7 100644 --- a/lem.asd +++ b/lem.asd @@ -39,7 +39,6 @@ (:file "clipboard") (:file "killring") (:file "file") - (:file "screen") (:file "frame") (:file "echo") (:file "prompt") diff --git a/src/display/physical-line.lisp b/src/display/physical-line.lisp index bb99819bc..9e4a177aa 100644 --- a/src/display/physical-line.lisp +++ b/src/display/physical-line.lisp @@ -440,7 +440,7 @@ (defun redraw-modeline (window force) (when (lem-core:window-use-modeline-p window) - (let* ((view (lem-core:screen-view (lem-core:window-screen window))) + (let* ((view (lem-core:window-view window)) (default-attribute (if (eq window (lem-core:current-window)) 'lem-core:modeline 'lem-core:modeline-inactive)) @@ -481,24 +481,23 @@ (defmethod lem-core:redraw-buffer :around (implementation buffer window force) (with-display-error () (lem-if:redraw-view-before (lem-core:implementation) - (lem-core:screen-view (lem-core:window-screen window))) + (lem-core:window-view window)) (let ((lem-if:*background-color-of-drawing-window* (get-background-color-of-window window))) (call-next-method)) (when (lem-core:window-use-modeline-p window) (redraw-modeline window - (or (lem-core::screen-modified-p (lem-core:window-screen window)) + (or (lem-core::window-need-to-redraw-p window) force))) (lem-if:redraw-view-after (lem-core:implementation) - (lem-core:screen-view (lem-core:window-screen window))))) + (lem-core:window-view window)))) (defun clear-cache-if-screen-modified (window force) - (when (or force - (lem-core::screen-modified-p (lem-core:window-screen window))) + (when (or force (lem-core::window-need-to-redraw-p window)) (setf (drawing-cache window) '()))) (defmethod lem-core:redraw-buffer (implementation (buffer lem-core:text-buffer) window force) (assert (eq buffer (lem-core:window-buffer window))) (clear-cache-if-screen-modified window force) (redraw-lines window) - (lem-core::update-screen-cache (lem-core:window-screen window) buffer)) + (lem-core::finish-redraw window)) diff --git a/src/screen.lisp b/src/screen.lisp deleted file mode 100644 index 7e85c0ec7..000000000 --- a/src/screen.lisp +++ /dev/null @@ -1,30 +0,0 @@ -(in-package :lem-core) - -(defstruct (screen (:constructor %make-screen)) - view - modified-p) - -(defun make-screen (view) - (%make-screen :view view)) - -(defun screen-delete (screen) - (lem-if:delete-view (implementation) (screen-view screen))) - -(defun screen-clear (screen) - (screen-modify screen) - (lem-if:clear (implementation) (screen-view screen))) - -(defun screen-modify (screen) - (setf (screen-modified-p screen) t)) - -(defun screen-set-size (screen width height) - (screen-modify screen) - (lem-if:set-view-size (implementation) (screen-view screen) width height)) - -(defun screen-set-pos (screen x y) - (screen-modify screen) - (lem-if:set-view-pos (implementation) (screen-view screen) x y)) - -(defun update-screen-cache (screen buffer) - (setf (screen-modified-p screen) - nil)) diff --git a/src/window.lisp b/src/window.lisp index 86a259521..015f619b3 100644 --- a/src/window.lisp +++ b/src/window.lisp @@ -94,12 +94,24 @@ (last-print-cursor-y :initform 0 :accessor window-last-print-cursor-y) + (need-to-redraw + :initform nil + :accessor window-need-to-redraw-p) + (view + :initarg :view + :accessor window-view) (parameters :initform nil :accessor window-parameters))) +(defun need-to-redraw (window) + (setf (window-need-to-redraw-p window) t)) + +(defun finish-redraw (window) + (setf (window-need-to-redraw-p window) nil)) + (defmethod set-window-buffer :before (buffer (window window)) - (screen-modify (window-screen window))) + (need-to-redraw window)) (defun window-height-without-modeline (window) (- (window-height window) @@ -116,8 +128,7 @@ (defmethod initialize-instance :after ((window window) &rest initargs) (declare (ignore initargs)) - (set-window-screen (make-screen (make-view-from-window window)) - window) + (setf (slot-value window 'view) (make-view-from-window window)) (set-window-view-point (buffer-start (copy-point (buffer-point (window-buffer window)) :right-inserting)) @@ -139,14 +150,12 @@ (defun clear-screens-of-window-list () (flet ((clear-screen (window) - (screen-clear (window-screen window)))) + (need-to-redraw window) + (lem-if:clear (implementation) (window-view window)))) (mapc #'clear-screen (uiop:ensure-list (frame-leftside-window (current-frame)))) (mapc #'clear-screen (window-list)) (mapc #'clear-screen (frame-floating-windows (current-frame))))) -(defun window-view (window) - (screen-view (window-screen window))) - (defmethod set-last-print-cursor ((window window) x y) (setf (window-last-print-cursor-x window) x (window-last-print-cursor-y window) y)) @@ -228,7 +237,7 @@ (defun %free-window (window) (delete-point (window-view-point window)) (delete-point (%window-point window)) - (screen-delete (window-screen window))) + (lem-if:delete-view (implementation) (window-view window))) (defun delete-window (window) (notify-frame-redisplay-required (current-frame)) @@ -537,7 +546,7 @@ next line because it is at the end of width." (move-to-previous-virtual-line (window-view-point window) n window)) (defun window-scroll (window n) - (screen-modify (window-screen window)) + (need-to-redraw window) (prog1 (if *use-new-vertical-move-function* (if (plusp n) (window-scroll-down-n window n) @@ -714,7 +723,8 @@ You can pass in the optional argument WINDOW-LIST to replace the default (notify-frame-redisplay-required (current-frame)) (when (floating-window-p window) (notify-floating-window-modified (current-frame))) - (screen-set-pos (window-screen window) x y) + (need-to-redraw window) + (lem-if:set-view-pos (implementation) (window-view window) x y) (set-window-x x window) (set-window-y y window)) @@ -733,10 +743,12 @@ You can pass in the optional argument WINDOW-LIST to replace the default (notify-floating-window-modified (current-frame))) (set-window-width width window) (set-window-height height window) - (screen-set-size (window-screen window) - width - (- height - (if (window-use-modeline-p window) 1 0)))) + (need-to-redraw window) + (lem-if:set-view-size (implementation) + (window-view window) + width + (- height + (if (window-use-modeline-p window) 1 0)))) (defun window-move (window dx dy) (window-set-pos window