Skip to content

Commit

Permalink
Merge pull request #1693 from sakurawald/ban-mouse-clicking-in-popup-…
Browse files Browse the repository at this point in the history
…window

fix: ban `mouse click event` in `popup-window` made by `popup-message` function.
  • Loading branch information
cxxxr authored Dec 9, 2024
2 parents c44ffde + e8e2517 commit 772d145
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/ext/popup-message.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@
:buffer buffer
:width width
:height height
;; NOTE: Block mouse clicks on popup windows to prevent them from gaining focus.
;; If a popup window gains focus, it becomes the only active window in the window-tree,
;; which prevents Lem from being able to close it.
;; Mouse scrolling remains enabled since popup windows are used for displaying text content. :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: 2 additions & 1 deletion src/mouse.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@
(focus-window-position (current-frame)
(mouse-event-x mouse-event)
(mouse-event-y mouse-event))
(when window
(when (and 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 772d145

Please sign in to comment.