FVWM: disallowing the transfer of focus while a key is pressed
Hello, I've been using FVWM for several years now, and I'm quite happy about it. There's one focus-related thing however, I coud not manage to figure out, even though there are a lot of focus-policy settings around: === Problem I'm looking for a way to prevent focus to shift from one window to another, as long as a key is held down. === Reason I'm using a focus-follows-mouse policy and I frequently use keys to move windows around. While doing so, sometimes (often) a second window gets between the mouse cursor, and the window I want to move. Instantly focus jumps to the second window, which is then moved instead of the one I wanted to. === Try this yourself Excerpt from my .fvwm/config, which allows me to move a window to one of the 9 positions with a single keystroke. Style * FPEnterToFocus, FPLeaveToUnfocus key 1 a 4 animatedmove 0 0 warp key 2 a 4 animatedmove 50-50w 0 warp key 3 a 4 animatedmove -0 0 warp # ... and so on, think of a keypad, 1=top-left, 5=center, 9=bottom-right Now open two terminals, put the upper one in the top-left corner, the lower one somewhere else. Move mouse to lower terminal, which gets the focus. Hold down mod4 and press 1, then 3, then release mod4. The lower window moves to the top left, where it instantly looses its focus to the upper window, which then moves to the top-right. Another example is the following setup, which allows me to jump to another page on the desktop, and take the current window with me: destroyfunc gotomovetopage addtofunc gotomovetopage + I movetopage $0 $1 + I gotopage $0 $1 key right A C4 gotomovetopage 1p 0p key left A C4 gotomovetopage -1p 0p key up A C4 gotomovetopage 0p -1p key down A C4 gotomovetopage 0p 1p When jumping over multiple pages, I loose the window on the first occasion where the mouse pointer accidentally catches another window. === Proposed Solution IMHO, disallowing the transfer of focus while a key is pressed, would remedy the situation. Is this doable with current FVWM configuration options? === Version sk@verne:~ fvwm --version fvwm 2.5.30 compiled on Oct 16 2010 at 07:00:26 with support for: ReadLine, RPlay, Stroke, XPM, PNG, SVG, Shape, XShm, SM, Bidi text, Xinerama, XRender, XCursor, XFT, NLS Thank you! Stefan -- Stefan Klinger o/klettern /\/ bis zum send plaintext only - max size 32kB - no spam \ Abfallen http://stefan-klinger.de
Re: FVWM: disallowing the transfer of focus while a key is pressed
I have no concrete idea that you could directly transform into source code, but, perhaps my question and a general idea could help to find a direction. Question: What do you mean with while a key is pressed? Only the mod4 (Win) key? And perhaps a Control key? When I see your lines of code, I think it should be enough when the mod4 (Win) key is kept down? Idea: If so: Is it possible to recognize a currently pressed mod4 key, and set another focus policy until the key is up again? Michael f...@stefan-klinger.de wrote: Hello, I've been using FVWM for several years now, and I'm quite happy about it. There's one focus-related thing however, I coud not manage to figure out, even though there are a lot of focus-policy settings around: === Problem I'm looking for a way to prevent focus to shift from one window to another, as long as a key is held down. === Reason I'm using a focus-follows-mouse policy and I frequently use keys to move windows around. While doing so, sometimes (often) a second window gets between the mouse cursor, and the window I want to move. Instantly focus jumps to the second window, which is then moved instead of the one I wanted to. === Try this yourself Excerpt from my .fvwm/config, which allows me to move a window to one of the 9 positions with a single keystroke. Style * FPEnterToFocus, FPLeaveToUnfocus key 1 a 4 animatedmove 0 0 warp key 2 a 4 animatedmove 50-50w 0 warp key 3 a 4 animatedmove -0 0 warp # ... and so on, think of a keypad, 1=top-left, 5=center, 9=bottom-right Now open two terminals, put the upper one in the top-left corner, the lower one somewhere else. Move mouse to lower terminal, which gets the focus. Hold down mod4 and press 1, then 3, then release mod4. The lower window moves to the top left, where it instantly looses its focus to the upper window, which then moves to the top-right. Another example is the following setup, which allows me to jump to another page on the desktop, and take the current window with me: destroyfunc gotomovetopage addtofunc gotomovetopage + I movetopage $0 $1 + I gotopage $0 $1 key right A C4 gotomovetopage 1p 0p key left A C4 gotomovetopage -1p 0p key up A C4 gotomovetopage 0p -1p key down A C4 gotomovetopage 0p 1p When jumping over multiple pages, I loose the window on the first occasion where the mouse pointer accidentally catches another window. === Proposed Solution IMHO, disallowing the transfer of focus while a key is pressed, would remedy the situation. Is this doable with current FVWM configuration options? === Version sk@verne:~ fvwm --version fvwm 2.5.30 compiled on Oct 16 2010 at 07:00:26 with support for: ReadLine, RPlay, Stroke, XPM, PNG, SVG, Shape, XShm, SM, Bidi text, Xinerama, XRender, XCursor, XFT, NLS Thank you! Stefan
Re: FVWM: disallowing the transfer of focus while a key is pressed
Hi, thanks for the feedback. On 2011-Dec-30, Michael Großer wrote with possible deletions: Question: What do you mean with while a key is pressed? Only the mod4 (Win) key? And perhaps a Control key? For me it would clearly be sufficient to name only one key (Win) or even just a modifier bit (mod4). But sometimes I additionally use Control, or Shift. So a modifier bitmask (with or-semantics?) could be useful for other people. Maybe the approach about while any modifier being held down is simpler. Idea: If so: Is it possible to recognize a currently pressed mod4 key, and set another focus policy until the key is up again? That should do the job, but I would not know how to do this in FVWMs config file. Basically I see two options now: 1. Change focus policy on key press/release (as you suggested), or 2. Introduce another focus policy that keeps the focus to a window, while any, or a certain, key or modifier is pressed. No insult intended, but the latter one occurs more natural to me =) Of course I'd be happy with any solution! Any ideas? Kind regards, Stefan f...@stefan-klinger.de wrote: I'm looking for a way to prevent focus to shift from one window to another, as long as a key is held down. === Reason I'm using a focus-follows-mouse policy and I frequently use keys to move windows around. While doing so, sometimes (often) a second window gets between the mouse cursor, and the window I want to move. Instantly focus jumps to the second window, which is then moved instead of the one I wanted to. -- Stefan Klinger o/klettern /\/ bis zum send plaintext only - max size 32kB - no spam \ Abfallen http://stefan-klinger.de