Direction focus algorithm

Clay Barnes clay at
Thu Aug 9 17:25:24 EDT 2007

I haven't use the most recent build of OB3 yet, so this may have
changed, but I've noticed a few strange focus patterns with
DireectionFocus(N|S|E|W), including that if you focus across a couple
apps in one direction, but try to go back the other direction, they
don't always traverse the same windows.  Don't get me wrong, it does
very well most of the time, I'm just trying to figure out what's
causing the issue.

Example of case where the issue arises:
|        2|        3|
|         |         |
|         |         |
>--.      |         |
| 1|      |         |
Select goes west from 3 to 2 to 1, but when going east goes straight
from 1 to 3.

My question is, is window selection based on the center of the window
or the edges?  I suspect it's center-based, because then I can imagine
that 2's center is too "diagonal" to get hit from 1.  However, it
seems like there might be a slightly less quirky way to design this.
(Going east/west, the next center (considering only the X ordinate)
would always be the next selected, and if several are the same X (+/-
some % of the screen to keep 1-pixel shifts from dictating the order),
the one with the closest Y ordinate would be selected, for example.
Or something that considers edges, etc.)

I'll think about algorithms in case you decide to change anything.  I
know it's a low priority, though, since it's already good and changes
might have a lot of unexpected consequences.

Clay Barnes


GPG Public Key:
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <>

More information about the openbox mailing list