Skip to content

Commit

Permalink
Define maximise-frame/minimise-frame as lem-interface
Browse files Browse the repository at this point in the history
  • Loading branch information
cxxxr committed Nov 20, 2024
1 parent 09cb0eb commit 708ba0f
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 17 deletions.
16 changes: 0 additions & 16 deletions frontends/sdl2/frame.lisp

This file was deleted.

1 change: 0 additions & 1 deletion frontends/sdl2/lem-sdl2.asd
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
(:file "utils")
(:file "display")
(:file "view")
(:file "frame")
(:file "main")
(:file "drawing")
(:file "graphics")
Expand Down
12 changes: 12 additions & 0 deletions frontends/sdl2/main.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,18 @@
(sdl2:set-window-fullscreen (display:display-window display)
(if fullscreen-p :desktop)))))))

(defmethod lem-if:maximize-frame ((implementation sdl2))
(with-debug ("lem-if:maximize-frame")
(sdl2:in-main-thread ()
(display:with-display (display)
(sdl2:maximize-window (lem-sdl2/display::display-window display))))))

(defmethod lem-if:minimize-frame ((implementation sdl2))
(with-debug ("lem-if:minimize-frame")
(sdl2:in-main-thread ()
(display:with-display (display)
(sdl2:minimize-window (lem-sdl2/display::display-window display))))))

(defmethod lem-if:make-view ((implementation sdl2) window x y width height use-modeline)
(with-debug ("lem-if:make-view" window x y width height use-modeline)
(display:with-display (display)
Expand Down
8 changes: 8 additions & 0 deletions src/commands/frame.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,11 @@
(define-command toggle-frame-fullscreen () ()
"Toggles fullscreen."
(setf (display-fullscreen-p) (not (display-fullscreen-p))))

(define-command maximize-frame () ()
"Maximize the frame."
(lem-if:maximize-frame (implementation)))

(define-command minimize-frame () ()
"Minimize the frame."
(lem-if:minimize-frame (implementation)))
4 changes: 4 additions & 0 deletions src/interface.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
(defgeneric lem-if:set-display-title (implementation title))
(defgeneric lem-if:display-fullscreen-p (implementation))
(defgeneric lem-if:set-display-fullscreen-p (implementation fullscreen-p))
(defgeneric lem-if:maximize-frame (implementation)
(:method (implementation)))
(defgeneric lem-if:minimize-frame (implementation)
(:method (implementation)))
(defgeneric lem-if:make-view (implementation window x y width height use-modeline))
(defgeneric lem-if:view-width (implementation view))
(defgeneric lem-if:view-height (implementation view))
Expand Down
2 changes: 2 additions & 0 deletions src/internal-packages.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,8 @@
:set-display-title
:display-fullscreen-p
:set-display-fullscreen-p
:maximize-frame
:minimize-frame
:make-view
:view-width
:view-height
Expand Down

0 comments on commit 708ba0f

Please sign in to comment.