Thomas Adam wrote:
> 2010/8/10 Michael Großer <michael.gros...@gmx.de>:
>> The problem: If I switch to another viewport and then
>> back to the prior one, then sometimes no window has the
>> focus. If I give a window a focus and close it, then
>> again no window has the focus.
>>
>> How can I solve this problem?
> 
> You can't.
> 
>> My idea is that I use an event to use the "Next" command
>> to give some window the focus:
>> - If I switch the viewport, I could call such a function
>> - If a window closes, I could call such a function.
> 
> So you want something like this then:
> 
> DestroyModuleConfig a:*
> *a: new_page SomeFunc
> *a: new_desk SomeFunc
> 
> AddToFunc StartFunction I Module FvwnEvent a
> 
> DestroyFunc SomeFunc
> AddToFunc   SomeFunc
> + I None (Focused) Next (AcceptsFocus, !Focused, CurrentPage) FlipFocus
> 
>> Problem:
>> - Doing something if I switch the viewport, could be possible.
>> - But, doing something if a window closes, is difficult.
> 
> No it isn't -- see FvwmEvent, with the "destroy_window" condition.
> 
> -- Thomas Adam
> 
> 

Hi!

I want to pass my experiences on to this list regarding
the focus management of windows in pages (viewports).

The attachment contains my first dirty prototype of
fvwm that is fully runnable on my three productive environments
(Debian Lenny, fvwm 2.5.26) and partially runnable on my
testing environment (Debian Squeeze, fvwm 2.5.31). In
the meantime, I succeeded updating the testing
environment from fvwm "2.5.30" to fvwm "2.5.31".

Some minor problems regarding to fvwm in general still
remain (crashing of the pager, ...), but I will face
these problems in sequence over the next weeks.

My first dirty prototype still contains some German
comments, but I will translate them into English
later, because I see that more fvwm relevant people
cope with English than with German.

I don't know if it is welcome that I post entire
working configuration settings over this list.
If so, then I could post newer versions of my
configuration settings later.

Apart from "0001_window_decorations", wich is really
hacked by me (based on fvwm95), the other config
files I programmed using the man pages and further
fvwm documentations.



Now, the topic about the focussing of windows:
My goal is that on a page (a viewport) always
one window is focussed (if at least one window
exists).

The config file "0006_focus" contains this code.
This is the working solution.



First, I have to set the focus policy:
> # set a focus policy
> Style * SloppyFocus
> Style * GrabFocus


Then, I handle the dirty details.
> # 1. if a window is already focussed, then do nothing
> #
> # 2. if no window was focussed, then focus a window under the mouse
> #
> # 3. if no window was under the mouse, then focus a visible window
> #
> # 4. if a window was not visible (because the just now disappeared
> #    window hid it), then try again to focus it
> #
> DestroyFunc focus_a_window
> AddToFunc focus_a_window
> + I Current (Focused, CurrentPage) Nop
> + I TestRc (NoMatch) Next (AcceptsFocus, CurrentPage, Visible, HasPointer) 
> Focus
> + I TestRc (NoMatch) Next (AcceptsFocus, CurrentPage, Visible) Focus
> + I TestRc (NoMatch) Next (AcceptsFocus, CurrentPage) Focus



Some more code in "0006_focus" faces a nasty bug of nedit, which
prevents me from entering some queries in "Find..." dialogs
if the mouse is not exactly over the nedit window. For several
years this bug almost drove me mad (I was using KDE 3.X); with
fvwm finally I could make a workaround.

If this kind of knowledge transfer is welcome, please
let it me know.



Best regards,
Michael



Attachment: my-fvwm-config.tar.bz2
Description: Binary data

Reply via email to