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
XMonad.Prompt and XMonad.Actions.TreeSelect can freeze the UI #445
Comments
Theoretically, this is a duplicate of xmonad/xmonad/issues/116, but since that issue is in the wrong repo anyways I'll leave this open. There are some I was wondering why I had never run into this issue (despite not setting I don't have a lot of X11 Fu, but I will try to look into this when I have the time (which is, frankly, not much at the moment); if anyone feels like they're up for a good treasure hunt, go ahead! |
Thanks, I will go have a look. It wasn't hard to try different things until I figured out a simple scenario to recreate. And given that there are workarounds, I just wanted to report it. Thanks for the response |
The workarounds are certainly not ideal; so definitely thank you for reporting this! So doing the simplest possible thing (literally just grabbing the pointer) actually seems to work: diff --git a/XMonad/Prompt.hs b/XMonad/Prompt.hs
index 3beee72..ced30a5 100644
--- a/XMonad/Prompt.hs
+++ b/XMonad/Prompt.hs
@@ -596,8 +596,9 @@ runXP st = do
let d = dpy st
w = win st
st' <- bracket
- (grabKeyboard d w True grabModeAsync grabModeAsync currentTime)
- (\_ -> ungrabKeyboard d currentTime)
+ (do grabPointer d w False buttonPressMask grabModeAsync grabModeAsync none none currentTime
+ grabKeyboard d w True grabModeAsync grabModeAsync currentTime)
+ (\_ -> ungrabPointer d currentTime >> ungrabKeyboard d currentTime)
(\status ->
(flip execStateT st $
when (status == grabSuccess) $ do (the Can you confirm? I guess this would technically count as a regression as, e.g. with |
I'll read about out how to compile XMonad and apply this patch and will let you know. Thanks |
I tested the patch and it is working, I can see how the mouse hovering over other applications does not get a response from those applications as before. Also, I clicked everywhere and the system didn't freeze. With the "faulty" implementation, if someone wanted to do something in another screen while the prompt was up, the action wouldn't work any way, so even if it is a regression, seems to be an explicit rule if it is documented that way "It's a feature" :) I didn't test extensively, But for the sample xmonad.hs I had and my actual xmonad.hs it is working well. An interesting thing is that XMonad.Actions.TreeSelect has the same problem. I had originally correlated the problem but I see that they don't depend on each other (No imports) However, I saw the code and it calls the same "grabKeyboard" function in an almost identical way. Should I edit the title on this report and open another one for TreeSelect? Thanks, |
On Tue, Jan 19 2021 22:34, Raul Suarez wrote:
I tested the patch and it is working, I can see how the mouse hovering
over other applications does not get a response from those
applications as before. Also, I clicked everywhere and the system
didn't freeze.
[...]
I didn't test extensively, But for the sample xmonad.hs I had and my
actual xmonad.hs it is working well.
That's good to hear!
With the "faulty" implementation, if someone wanted to do something in
another screen while the prompt was up, the action wouldn't work any
way, so even if it is a regression, seems to be an explicit rule if it
is documented that way "It's a feature" :)
Oh you're right—I tested this once again and I seem to be
misremembering that selecting anything actually worked. In that case
it's probably fine to include even this simple fix; I'll fix the
`TreeSelect' implementation as well this weekend and prepare a pull
request
|
If this is not done, trying to select another window with the mouse when the prompt is up, the X server may stop handling keyboard and pointer requests, making it appear that xmonad froze. As the pointer can't do useful things anyways when the prompt is up, simply grabbing it solves this problem. C.f.: - xmonad/xmonad/issues/116 - xmonad/issues/445
If this is not done, trying to select another window with the mouse when treeselect is up, the X server may stop handling keyboard and pointer requests, making it appear that xmonad froze. As the pointer can't do useful things anyways when the treeselect window is shown, simply grabbing it solves this problem. C.f.: - xmonad/xmonad/issues/116 - xmonad/issues/445
If this is not done, trying to select another window with the mouse when the prompt is up, the X server executes a pointer/keyboard grab until `allowEvents' is called; which it never is and so both remain frozen indefinitely. C.f.: - xmonad/xmonad/issues/116 - xmonad/issues/445
If this is not done, trying to select another window with the mouse when the treeselect window is up, the X server executes a pointer/keyboard grab until `allowEvents' is called; which it never is and so both remain frozen indefinitely. C.f.: - xmonad/xmonad/issues/116 - xmonad/issues/445
If this is not done, trying to select another window with the mouse when the prompt is up, the X server executes a pointer/keyboard grab until `allowEvents' is called; which it never is and so both remain frozen indefinitely. C.f.: - xmonad/xmonad/issues/116 - xmonad/issues/445
If this is not done, trying to select another window with the mouse when the treeselect window is up, the X server executes a pointer/keyboard grab until `allowEvents' is called; which it never is and so both remain frozen indefinitely. C.f.: - xmonad/xmonad/issues/116 - xmonad/issues/445
If this is not done, trying to select another window with the mouse when the prompt is up, the X server executes a pointer/keyboard grab until `allowEvents' is called; which it never is and so both remain frozen indefinitely. C.f.: - xmonad/xmonad/issues/116 - xmonad/issues/445
If this is not done, trying to select another window with the mouse when the treeselect window is up, the X server executes a pointer/keyboard grab until `allowEvents' is called; which it never is and so both remain frozen indefinitely. C.f.: - xmonad/xmonad/issues/116 - xmonad/issues/445
If this is not done, trying to select another window with the mouse when the treeselect window is up, the X server executes a pointer/keyboard grab until `allowEvents' is called; which it never is and so both remain frozen indefinitely. C.f.: - xmonad/xmonad/issues/116 - xmonad/issues/445
If this is not done, trying to select another window with the mouse when the treeselect window is up, the X server executes a pointer/keyboard grab until `allowEvents' is called; which it never is and so both remain frozen indefinitely. C.f.: - xmonad/xmonad/issues/116 - xmonad/issues/445
Problem Description
When invoking an XMonad.Prompt or an XMonad.Actions.TreeSelect, if the user clicks with the mouse in another application, XMonad stops responding to mouse or keyboard input when "clickJustFocuses = False"
Steps to reproduce:
Workaround:
Configuration File
Checklist
[ X] I've read CONTRIBUTING.md
I tested my configuration with xmonad-testing (No, I don't know how to do this. I will try to follow the instructions in the repository, but I searched and couldn't find this reported as a bug.
The text was updated successfully, but these errors were encountered: