Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ban mouse click event in popup-window made by popup-message function. #1693

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading