From 2fa16b88a647569b6a80639d6031b975895c4086 Mon Sep 17 00:00:00 2001 From: sakurawald Date: Wed, 20 Nov 2024 21:48:02 +0800 Subject: [PATCH 1/2] feature: add `maximize-frame` and `minimize-frame` command for `lem sdl2 version`. --- frontends/sdl2/frame.lisp | 14 ++++++++++++++ frontends/sdl2/lem-sdl2.asd | 1 + 2 files changed, 15 insertions(+) create mode 100644 frontends/sdl2/frame.lisp diff --git a/frontends/sdl2/frame.lisp b/frontends/sdl2/frame.lisp new file mode 100644 index 000000000..d32fe6e8f --- /dev/null +++ b/frontends/sdl2/frame.lisp @@ -0,0 +1,14 @@ +(defpackage :lem-sdl2/frame + (:use :cl :lem) + (:export :maximize-frame + :minimize-frame)) +(in-package :lem-sdl2/frame) + +(define-command maximize-frame () () + "Maximize the frame." + (sdl2:maximize-window (lem-sdl2/display::display-window (lem-sdl2/display:current-display)))) + +(define-command minimize-frame () () + "Minimize the frame." + (sdl2:minimize-window (lem-sdl2/display::display-window (lem-sdl2/display:current-display)))) + \ No newline at end of file diff --git a/frontends/sdl2/lem-sdl2.asd b/frontends/sdl2/lem-sdl2.asd index 16ddad3e9..ba0264683 100644 --- a/frontends/sdl2/lem-sdl2.asd +++ b/frontends/sdl2/lem-sdl2.asd @@ -20,6 +20,7 @@ (:file "utils") (:file "display") (:file "view") + (:file "frame") (:file "main") (:file "drawing") (:file "graphics") From 6daba4cfd32886b0aa4da1473f11e41c910aea25 Mon Sep 17 00:00:00 2001 From: sakurawald Date: Wed, 20 Nov 2024 22:50:33 +0800 Subject: [PATCH 2/2] fix: ensure the maximize/minimize-frame command are executed in sdl2 main thread. --- frontends/sdl2/frame.lisp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontends/sdl2/frame.lisp b/frontends/sdl2/frame.lisp index d32fe6e8f..4a0ccfca3 100644 --- a/frontends/sdl2/frame.lisp +++ b/frontends/sdl2/frame.lisp @@ -6,9 +6,11 @@ (define-command maximize-frame () () "Maximize the frame." - (sdl2:maximize-window (lem-sdl2/display::display-window (lem-sdl2/display:current-display)))) + (sdl2:in-main-thread () + (sdl2:maximize-window (lem-sdl2/display::display-window (lem-sdl2/display:current-display))))) (define-command minimize-frame () () "Minimize the frame." - (sdl2:minimize-window (lem-sdl2/display::display-window (lem-sdl2/display:current-display)))) + (sdl2:in-main-thread () + (sdl2:minimize-window (lem-sdl2/display::display-window (lem-sdl2/display:current-display))))) \ No newline at end of file