Updating branch refs/heads/master
         to e34c5b6426a5c9cf89f711b23557aa50c8763364 (commit)
       from fd296893527c2c1cccf3ce6202a7f9340992d481 (commit)

commit e34c5b6426a5c9cf89f711b23557aa50c8763364
Author: Eric Koegel <eric.koe...@gmail.com>
Date:   Wed Nov 27 17:25:10 2013 +0300

    Improve keyboard navigation in the tabwin
    
    When cycling applications have the keyboard wrap around when it
    reaches the end of a row or column.
    
    Signed-off-by: Simon Steinbeiss <simon.steinbe...@elfenbeinturm.at>

 src/tabwin.c |   37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/src/tabwin.c b/src/tabwin.c
index 35e96b8..72f79d2 100644
--- a/src/tabwin.c
+++ b/src/tabwin.c
@@ -787,10 +787,20 @@ tabwinSelectDelta (Tabwin *t, int row_delta, int 
col_delta)
     if (col_current < 0)
     {
         col_current = cols - 1;
+        row_current--;
+        if (row_current < 0)
+        {
+            row_current = rows - 1;
+        }
     }
     else if (col_current >= cols)
     {
         col_current = 0;
+        row_current++;
+        if (row_current >= rows)
+        {
+            row_current = rows - 1;
+        }
     }
 
     /* Wrap row */
@@ -798,10 +808,29 @@ tabwinSelectDelta (Tabwin *t, int row_delta, int 
col_delta)
     if (row_current < 0)
     {
         row_current = rows - 1;
+        col_current--;
+        if (col_current < 0)
+        {
+            col_current = cols - 1;
+        }
     }
     else if (row_current >= rows)
     {
         row_current = 0;
+        col_current++;
+        if (col_current >= cols)
+        {
+            if (rows != 1)
+            {
+                col_current = cols - 1;
+            }
+            else
+            {
+                /* If there's only 1 row then col needs to wrap back to
+                 * the head of the grid */
+                col_current = 0;
+            }
+        }
     }
 
     /* So here we are at the new (wrapped) position in the rectangle */
@@ -812,7 +841,10 @@ tabwinSelectDelta (Tabwin *t, int row_delta, int col_delta)
         {
             if (col_delta > 0)
             {
+                /* In this case we're going past the tail, reset to the head
+                 * of the grid */
                 col_current = 0;
+                row_current = 0;
             }
             else
             {
@@ -824,6 +856,11 @@ tabwinSelectDelta (Tabwin *t, int row_delta, int col_delta)
             if (row_delta > 0)
             {
                 row_current = 0;
+                col_current++;
+                if (col_current >= cols)
+                {
+                    col_current = 0;
+                }
             }
             else
             {
_______________________________________________
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits

Reply via email to