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 > > >