Skip to content

Commit

Permalink
feature: add clickable parameter for window. + let the `popup-win…
Browse files Browse the repository at this point in the history
…dow` made by `popup-message` un-clickable.
  • Loading branch information
sakurawald committed Dec 9, 2024
1 parent acab5e9 commit 6868caa
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/ext/popup-message.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
:buffer buffer
:width width
:height height
;; NOTE: Simply ban the mouse-click event for a popup-window, to avoid the popup-window gain the mouse focus, being the only window as current-window in window-tree, causing lem unable to delete it.
;; However, since the popup-message is a window used to display string, you can still use mouse-scroll to scroll the text.
:clickable nil
:style style)))
(buffer-start (window-view-point window))
(window-see window)
Expand Down
2 changes: 2 additions & 0 deletions src/ext/popup-window.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,7 @@
(buffer (alexandria:required-argument :buffer))
(width (alexandria:required-argument :width))
(height (alexandria:required-argument :height))
(clickable t)
style)
(let* ((style (ensure-style style))
(border-size (if (style-use-border style) +border-size+ 0))
Expand Down Expand Up @@ -335,6 +336,7 @@
:border-shape (style-shape style)
:background-color (style-background-color style)
:cursor-invisible (style-cursor-invisible style)
:clickable clickable
:style style))))

(defun update-popup-window (&key (source-window (alexandria:required-argument :source-window))
Expand Down
3 changes: 1 addition & 2 deletions src/mouse.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@
(mouse-event-x mouse-event)
(mouse-event-y mouse-event))
(when (and window
;; NOTE: Simply ban the mouse-click event for a popup-window, to avoid the popup-window gain the mouse focus, being the only window as current-window in window-tree, causing lem unable to delete it.
(not (typep window 'lem/popup-window::popup-window)))
(window-clickable window))
(handle-mouse-button-down (window-buffer window)
mouse-event
:window window
Expand Down
4 changes: 4 additions & 0 deletions src/window/window.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@
(deleted
:initform nil
:accessor window-deleted-p)
(clickable
:initarg :clickable
:initform t
:reader window-clickable)
(parameters
:initform nil
:accessor window-parameters)))
Expand Down

0 comments on commit 6868caa

Please sign in to comment.