[openbox] Directional switching

Ian Zimmerman itz at buug.org
Tue Jul 7 16:17:40 EDT 2015


On 2015-07-07 08:49 -0700, Ian Zimmerman wrote:

> I looked at the code ie. focus_find_directional in openbox/focus_cycle.c
> and I cannot say I understand it.  Is there a paper I can read with a
> rationale?  Or can the author(s) of the code explain?

After more study of the code, leading to some (still imperfect)
understanding what it was trying to do, and some experiments, I came up
with the following simplistic patch.  It seems to DTRT (ie. what I
expect, grin) in all situations I tried.

The 2 and 5 could/should be rc.xml parameters.  With defaults 1 and 1
you'd have the current behavior.  Is there interest in me pursuing that
path and providing a more complete patch?

diff --git a/openbox/focus_cycle.c b/openbox/focus_cycle.c
index de17650..a58735d 100644
--- a/openbox/focus_cycle.c
+++ b/openbox/focus_cycle.c
@@ -250,7 +250,7 @@ static ObClient *focus_find_directional(ObClient *c,
ObDirection dir,
             continue;
 
         /* Calculate score for this window.  The smaller the better. */
-        score = distance + offset;
+        score = distance * 2 + offset * 5;
 
         /* windows more than 45 degrees off the direction are
          * heavily penalized and will only be chosen if nothing


-- 
Please *no* private copies of mailing list or newsgroup messages.
Rule 420: All persons more than eight miles high to leave the court.



More information about the openbox mailing list