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

acm popup menu not align well with cursor on KDE plasma 6 wayland #915

Closed
eval-exec opened this issue Apr 20, 2024 · 5 comments
Closed

acm popup menu not align well with cursor on KDE plasma 6 wayland #915

eval-exec opened this issue Apr 20, 2024 · 5 comments

Comments

@eval-exec
Copy link
Contributor

eval-exec commented Apr 20, 2024

I am running KDE Plasma 6 on a HiDPI screen with a resolution of 3840x2160. I am using Xwayland to run Emacs, and the completion menu in the lsp-bridge does not align properly with the current cursor position.

lsp-bridge version: * ac40260 - (HEAD -> master, origin/master, origin/HEAD) Add new option acm-backend-lsp-block-kind-list (18 hours ago) <Andy Stewart>
system: "x86_64-linux"
host os: Linux 6.8.6, NixOS, 24.05 (Uakari), 24.05.20240416.5672bc9
DE: KDE Plasma 6.0.3
WM: KWin (Wayland)

What environment variables or configurations can affect the position of acm-popup-menu?
What information should I provide to help analyze this issue?

Thank you. 💙

image

Screencast_20240420_103416.webm
@manateelazycat
Copy link
Owner

You can take a look at

(setq acm-menu-frame-popup-position
here

Did you use a centering plugin like olivetti?

@eval-exec
Copy link
Contributor Author

eval-exec commented Apr 20, 2024

I didn't use `centering plugin like olivetti or writeroom-mode.


If I hack acm-frame-get-popup-position to this, only change

(cons (+ x window-left)
          (+ y window-top offset-y))

to

(cons (+ x window-left 88)
          (+ y window-top offset-y))

then the popup menu looks align well...

(defun acm-frame-get-popup-position (frame-popup-point &optional line-bias)
  (let* ((edges (window-pixel-edges))
         (window-left (+ (nth 0 edges)
                         ;; We need adjust left margin for buffer centering module.
                         (/ (- (window-pixel-width)
                               (window-body-width nil t))
                            2)))
         (window-top (nth 1 edges))
         (pos (posn-x-y (posn-at-point frame-popup-point)))
         (x (car pos))
         (y (+ (cdr pos) (* (or line-bias 0) (line-pixel-height))))
         (offset-y
          ;; We need move down to skip tab-line and header-line.
          (if (version< emacs-version "27.0")
              (window-header-line-height)
            (+ (window-tab-line-height)
               (window-header-line-height)))))
    (cons (+ x window-left 88)
          (+ y window-top offset-y))))

@eval-exec
Copy link
Contributor Author

@manateelazycat
What do you think using (window-absolute-pixel-position) to get the acm-frame-get-popup-position?
Ref: https://emacs.stackexchange.com/questions/19555/obtain-absolute-pixel-position-of-point

@manateelazycat
Copy link
Owner

截图 2024-04-21 07-10-50

上面是我的截图, 你的Emacs不支持svg图标渲染, 还是你禁用了图标?

@manateelazycat
Copy link
Owner

@eval-exec
I have push new patch 12302c7

This patch will adjust acm menu position follow option acm-enable-icon and acm-enable-quick-access.
截图 2024-04-21 07-39-19
截图 2024-04-21 07-39-02
截图 2024-04-21 07-38-53

Thanks for feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants