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

Child frames grab input events #414

Closed
raxod502 opened this issue Feb 25, 2020 · 14 comments
Closed

Child frames grab input events #414

raxod502 opened this issue Feb 25, 2020 · 14 comments
Labels

Comments

@raxod502
Copy link
Contributor

Using the childframe-based interface for LSP popups, having the mouse cursor over the childframe causes all input events to be directed to the childframe's buffer, usually causing errors because that buffer is read-only and will not react correctly to most user commands. This is extremely frustrating as you can be typing and then suddenly a documentation popup will appear and all further editing commands become no-ops (they try to act on the wrong buffer) until you realize what's going on and move the mouse.

According to the Emacs manual, this behavior may vary depending on the window manager in use. I am running Manjaro Linux KDE with the default window manager.

Workaround:

(setq lsp-ui-doc-use-childframe nil)
@brotzeit brotzeit added the bug label Feb 25, 2020
@kiennq
Copy link
Member

kiennq commented Mar 15, 2020

May be it's similar to this issue #381 (comment)?
Will setting focus-follows-mouse help?

@raxod502
Copy link
Contributor Author

Setting focus-follows-mouse does not help, but this solves the problem:

(add-to-list 'lsp-ui-doc-frame-parameters '(no-accept-focus . t))

Perchance this should just be added to lsp-ui. It seems semantically correct, and you can even still scroll in the childframe to see the rest of the text (although doing so will focus the frame, which is not super desirable -- although this could be argued both ways).

@raxod502
Copy link
Contributor Author

Actually, I am now observing the problem even with that setting. I must have done something wrong when I tested previously.

@samwalls
Copy link

samwalls commented May 19, 2020

Is there any update on this? It makes emacs very annoying to use in an i3 context when you happen to leave your cursor in the window, particularly if the window is small. I'm using the i3 edition of Manjaro Linux, with everything else default.

I would use the workaround (setq lsp-ui-doc-use-childframe nil). However, for some reason, whenever the documentation pops up, it seems to change the size or positioning of the main frame, ever so slightly, making all the text jump around. What could be causing this?

@kiennq
Copy link
Member

kiennq commented May 19, 2020

@samwalls Did you try what raxod502 mentioned? Setting lsp-ui-doc-frame-parameters to include no-accept-focus. Or setting focus-follows-mouse to nil.

@kiennq
Copy link
Member

kiennq commented May 19, 2020

Also, see i3/i3#1127

@samwalls
Copy link

samwalls commented May 19, 2020

Hey @kiennq, I've just been trying to get that to work. Using spacemacs, it seems like it does work at a first glance, although it causes an error on startup when I add it to dotspacemacs/user-config:

(Spacemacs) Error in dotspacemacs/user-config: Symbol’s value as variable is void: lsp-ui-doc-frame-parameters

Where would be the appropriate place in .spacemacs to apply that setting?

@samwalls
Copy link

Thanks for the i3 issue link. It looks like (setq mouse-autoselect-window nil) does the trick for me. However, I wouldn't rule out this issue actually occurring due to some other action taking place while editing. If it happens again, I'll make note of it here.

@marcbowes
Copy link

#414 (comment) fixed it for me. I was losing focus and sometimes getting crashes. Both are OK now.

@sebastiencs
Copy link
Member

The way the frame is focused has changed in recent commits. Can someone see if the issue still occurs

@kiennq
Copy link
Member

kiennq commented Sep 12, 2020

I notice that the cursor is gone when doc frame is focused, even by keyboard, is that intentional?
Using keyboard to focus into doc frame without visible mouse cursor is really hard

@raxod502
Copy link
Contributor Author

raxod502 commented Sep 20, 2020

I just tested and the issue appears to be resolved. I do not believe I have any special configuration related to this at present. The issue has come and gone unexpectedly in the past, however, so perhaps it is best to wait for confirmation from one or more others who have encountered the same problem.

I do not observe the problem reported by @kiennq w.r.t. the mouse cursor, but I presume that depends greatly on window manager configuration.

@kiennq
Copy link
Member

kiennq commented Sep 20, 2020

I do not observe the problem reported by @kiennq w.r.t. the mouse cursor, but I presume that depends greatly on window manager configuration.

That's already been fixed in latest version

@marcbowes
Copy link

Today I removed this from my config:

(add-to-list 'lsp-ui-doc-frame-parameters '(no-accept-focus . t))

Then I updated lsp-mode and lsp-ui. The previous problem has gone away. Also, the popup now appears top-right instead of at the cursor, which I greatly prefer (the previous behavior obscured context).

Thanks!

(My versions are now: lsp-mode-20200923.2151 and lsp-ui-20200923.1558.)

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

No branches or pull requests

6 participants