Focus policy upon iconify not predictable.

Basic FVWM questions can be asked here.
alexxey
Kitten
Kitten
Posts: 13
Joined: Thu Apr 28, 2016 3:37 pm

Focus policy upon iconify not predictable.

Postby alexxey » Sat Apr 30, 2016 2:35 pm

TL;DR: My observations:
- With style ClickToFocus, focus is automatically given to another window upon iconification.
- But, regarding which window will be given focus upon iconifying, the behaviour seems unpredictable to me, as described below.
- This behaviour seems to be not persistent across restarts.
- This behaviour seems confusing after a page switch.

=========================

I'm using FVWM 2.6.5.

My complete .fvwm2rc:

Code: Select all

Style * ClickToFocus

Key F2 WT N Iconify
Key F2 I  N Iconify

#Key n A 4 Exec exec dmenu_run
Key t A 4 Exec exec xterm

Mouse 1 I A Iconify


With the above config, here is what I did:

- Open 3 windows
- Press F2 3 times, all 3 windows got iconified (this impiles as the current window iconifies, focus goes to the next uniconified window)
- Now I can rapidly press F2 and switch between ALL 3 windows. (6 key pressed for a full cycle)

- restart fvwm, maybe a couple of restarts, or logout and start fresh.
- Rapidly press F2, now I can only switch between 2 windows, the third window never gets deiconified.

But the above behaviour cannot be reliably reproduced.

Can anyone share some insights? Thanks!


-
Last edited by alexxey on Sun May 01, 2016 6:40 pm, edited 9 times in total.

alexxey
Kitten
Kitten
Posts: 13
Joined: Thu Apr 28, 2016 3:37 pm

Re: Focus policy upon iconify not predictable.

Postby alexxey » Sun May 01, 2016 1:08 pm

I've searched through the forum and found some related posts. One theory is that these unpredictable beaviour is due to some 'applets' (such as xclock, pager, etc.) not being set as CirculateSkip. But in my test setup, there aren't any 'applet' on the desktop, not even a pager.

I even thought about examining the source code and disable the stock 'hand-out-focus-upon-iconify' behaviour, so that I can implement my own algorithm in the configuration, without the interference from the built-in behaviour.

Could anyone help me out? This is really a confusing situation.

Thanks!
Last edited by alexxey on Sun May 01, 2016 6:00 pm, edited 3 times in total.

alexxey
Kitten
Kitten
Posts: 13
Joined: Thu Apr 28, 2016 3:37 pm

Re: Focus policy upon iconify not predictable.

Postby alexxey » Sun May 01, 2016 1:23 pm

Another confusing behaviour:

1. Frest start fvwm
2. Open 3 windows, rapidly press F2 to cycle iconify/deiconify between all 3 of them, as described in the first post
3. Switch to another page
4. Open 3 windows, Now I cannot cycle through these 3 windows as in step 2. After iconifying the last window, focus goes nowhere.
5. Go back to the previous page, now I cannot cycle through the previously opened 3 windows either. \
The behaviour is the same as in step 4.

It seems as if the window ring is 'broken'. If I deiconify the first window then rapidly press F2, I can go no further than the 3rd window. If I deiconify the 3rd window first, I cannot switch to any window at all. (presumably because this is the end of the list since the ring looks like a list now)

phleagol
Cat in the hat
Cat in the hat
Posts: 39
Joined: Sun Nov 24, 2013 1:19 pm
Location: New Zealand

Re: Focus policy upon iconify not predictable.

Postby phleagol » Mon May 02, 2016 8:57 am

alexxey wrote:It seems as if the window ring is 'broken'.
I have felt that way too, altho perhaps for different reasons. Situations like when a window is closed, yet no other windows on the desktop received focus afterwards. Or where the focused window and the raised window are not exactly the same.
alexxey wrote:I even thought about examining the source code and disable the stock 'hand-out-focus-upon-iconify' behaviour, so that I can implement my own algorithm in the configuration, without the interference from the built-in behaviour.
You are obviously looking for a consistent focus behavior. But you haven't stated exactly what that desired behavior is. I mean, if the fvwm focus is slightly broken, perhaps the right question is how to fix it? And you shouldn't have to hack the source code to do this.

In my own case, I have used FvwmEvent to ensure that no iconified window is ever focused. And to ensure that a no-focus situation never arises whilst there are focusable windows on the desktop.

PS. I too have observed that the order of the window ring is sometimes not preserved. In my case, non-iconified windows always retain their order. But the order of iconified windows in the Windowlist is sometimes unexpected. Didn't give it much thought until now. Do you use the PlaceAgain command?

alexxey
Kitten
Kitten
Posts: 13
Joined: Thu Apr 28, 2016 3:37 pm

Re: Focus policy upon iconify not predictable.

Postby alexxey » Mon May 02, 2016 11:49 am

First, thank you very much for taking time to read my posts. :D

phleagol wrote:And you shouldn't have to hack the source code to do this.

In fact, I've already tweaked Iconify() in icons.c (It uses restore_focus_after_unmap() from focus.c to give focus to another window)
My tweak works to some extent, but obviously introduced a lot more problems since I'm not familliar with programming at all.

phleagol wrote:You are obviously looking for a consistent focus behavior. But you haven't stated exactly what that desired behavior is.

My desired behaviour is to give focus to "the next window" upon iconify, so that the focus would cycle through all windows.
In my setup I mapped F2 to iconify/de-iconify windows. In an ideal setup, I can press F2 in an rapid succession to cycle through all windows.

In fact, FVWM almost behaves like that, it's just the inconsistencies that prevented it from working all the time. For example, it's working fine after a fresh start, but after a page switch it began to act erratically.

And because of the inconsistencies, it's very hard to repair the behaviour in the config. I guess any custom focus policy tweaks only happen after the built-in behaviour has completed. So if the build-in behaviour is unpredictable, the final result cannot stay persistent either.

phleagol wrote:In my own case, I have used FvwmEvent to ensure that no iconified window is ever focused. And to ensure that a no-focus situation never arises whilst there are focusable windows on the desktop.

Thanks for the tip! You reminded me of a new way to fix this. Maybe I can first de-focus all windows, then focus the one I want. I'll take a look in my spare time.

phleagol wrote:Do you use the PlaceAgain command?

I havent used that command before since I only started using fvwm for less than a week. Thanks for your various tips which are invaluable to a newbie like me. :)

PS. I have been an xfce user for the past few years until the recent gtk+-3.20 update broke nearly all the themes, focing me to find an alternative. :-)

Thanks again! :D
Last edited by alexxey on Mon May 02, 2016 12:18 pm, edited 1 time in total.

alexxey
Kitten
Kitten
Posts: 13
Joined: Thu Apr 28, 2016 3:37 pm

Re: Focus policy upon iconify not predictable.

Postby alexxey » Mon May 02, 2016 12:07 pm

Update:

I'm been searching through the man page for clues when I find the 'FPReleaseFocus' style. The man page states:
These control if the focus is returned to another window when the window is closed.

But my experiment shows that it is in fact controlling the behaviour upon iconifying windows, not closing windows.

I added this:

Code: Select all

Style * !FPReleaseFocus

And miraculously, fvwm stopped giving out focus upon iconification. But it did not prevent fvwm from giving out focus upon closing windows, as stated in the man page.

With the built-in "give-out-focus-upon-iconify" behaviour finally disabled, I added my own focus policy tweak:

Code: Select all

AddToFunc StartFunction I Module FvwmEvent
DestroyModuleConfig FvwmEvent: *
*FvwmEvent: Cmd Function
*FvwmEvent: iconify TransferFocus

DestroyFunc TransferFocus
AddToFunc TransferFocus
+ I Next (!Iconic, CurrentPage, AcceptsFocus, !Sticky) Focus
+ I TestRc (NoMatch) Next (CurrentPage, AcceptsFocus, !Sticky) Focus


I'll report if it's working as expected.

alexxey
Kitten
Kitten
Posts: 13
Joined: Thu Apr 28, 2016 3:37 pm

Re: Focus policy upon iconify not predictable.

Postby alexxey » Mon May 02, 2016 12:12 pm

I finally managed to find someone who reported the same problem: https://www.mail-archive.com/fvwm@lists.math.uh.edu/msg15425.html
The author mentioned 'switch pages' which is exactly I'm experiencing, as described in post #3

So I tend to believe this could be a long-existing problem hiding in fvwm. It's seldom discovered because most user would not use Style * ClickToFocus.
With FocusFollowsMouse or SloppyFocus, this problem becomes a lot less noticeable.

phleagol
Cat in the hat
Cat in the hat
Posts: 39
Joined: Sun Nov 24, 2013 1:19 pm
Location: New Zealand

Re: Focus policy upon iconify not predictable.

Postby phleagol » Mon May 02, 2016 12:35 pm

alexxey wrote:
phleagol wrote:Do you use the PlaceAgain command?

I havent used that command before since I only started using fvwm for less than a week.
Having noticed that my iconic windows are sometimes outta order, I started to think about cmnds in my config that might be reordering iconic windows. But no answers yet.
alexxey wrote:PS. I have been an xfce user for the past few years until the recent gtk+-3.20 update broke nearly all the themes, focing me to find an alternative. :-)
I also came to fvwm from xfce. So if this is week one for you on fvwm, then you're doing okay. But our desired focus policys are quite different, so I can't be of more help on this...

somiaj
Administrator
Administrator
Posts: 46
Joined: Mon Nov 08, 2004 9:54 pm
Location: Idaho (USA)
Contact:

Re: Focus policy upon iconify not predictable.

Postby somiaj » Mon May 02, 2016 5:21 pm

phleagol wrote:
alexxey wrote:
phleagol wrote:Having noticed that my iconic windows are sometimes outta order, I started to think about cmnds in my config that might be reordering iconic windows. But no answers yet.


Check out the difference between Focus and FlipFocus

http://fvwm.org/documentation/faq/#whats-the-difference-between-the-focus-and-flipfocus-commands
-jaimos

phleagol
Cat in the hat
Cat in the hat
Posts: 39
Joined: Sun Nov 24, 2013 1:19 pm
Location: New Zealand

Re: Focus policy upon iconify not predictable.

Postby phleagol » Tue Jun 07, 2016 11:25 am

somiaj wrote:Check out the difference between Focus and FlipFocus

Fixed the problem by tweaking the options for my Windowlist menu.

User avatar
ILLUXA
Kitten
Kitten
Posts: 22
Joined: Sat May 28, 2016 4:07 pm
Location: $[HOME]

Re: Focus policy upon iconify not predictable.

Postby ILLUXA » Mon Oct 09, 2017 1:09 pm

This is what I use, and this is how most window managers transfer focus (I think)

Code: Select all

AddToFunc StartFunction I Module FvwmEvent
DestroyModuleConfig FvwmEvent: *
# when iconify/close, focus prev active window
*FvwmEvent: iconify TransferFocus
*FvwmEvent: destroy_window TransferFocus
AddToFunc TransferFocus
 + I Prev (!Iconic, CurrentPage, AcceptsFocus) FlipFocus
 + I TestRc (!Match) All (CurrentPage, AcceptsFocus) FlipFocus
Transcend or Die

FVWM 2.6.7, FreeBSD 11.1-RELEASE


Return to “Basic questions”

Who is online

Users browsing this forum: No registered users and 1 guest