diff src/uicmd.cc @ 2032:1a32d5ed2cd7

Made KEYS_LEFT_TAB and KEYS_RIGHT_TAB no longer handled as a special case * Made TAB-key focus the main area from location input. * Made KEYS_LEFT_TAB and KEYS_RIGHT_TAB cycle..
author Jorge Arellano Cid <jcid@dillo.org>
date Tue, 17 May 2011 18:57:29 -0400
parents ae8f0d070aea
children 45541ab7b1cc
line wrap: on
line diff
--- a/src/uicmd.cc	Tue May 17 13:58:58 2011 -0400
+++ b/src/uicmd.cc	Tue May 17 18:57:29 2011 -0400
@@ -149,6 +149,7 @@
          ret = 1;
       } else if (cmd == KEYS_NOP) {
          // Do nothing
+         _MSG("CustTabs::handle KEYS_NOP\n");
       } else if (cmd == KEYS_NEW_TAB) {
          a_UIcmd_open_url_nt(bw, NULL, 1);
          ret = 1;
@@ -156,10 +157,10 @@
          a_UIcmd_close_bw(bw);
          ret = 1;
       } else if (cmd == KEYS_LEFT_TAB) {
-         MSG("CustTabs::handle KEYS_LEFT_TAB\n");
+         prev_tab();
          ret = 1;
       } else if (cmd == KEYS_RIGHT_TAB) {
-         MSG("CustTabs::handle KEYS_RIGHT_TAB\n");
+         next_tab();
          ret = 1;
       } else if (cmd == KEYS_NEW_WINDOW) {
          a_UIcmd_open_url_nw(bw, NULL);
@@ -171,19 +172,6 @@
          a_Timeout_add(0.0, a_UIcmd_close_all_bw, NULL);
          ret = 1;
       }
-
-   } else if (e == FL_KEYUP) {
-      int k = Fl::event_key();
-      // We're only interested in some flags
-      unsigned modifier = Fl::event_state() & (FL_SHIFT | FL_CTRL | FL_ALT);
-      if (k == FL_Up || k == FL_Down || k == FL_Tab) {
-         ;
-      } else if (k == FL_Left || k == FL_Right) {
-         if (modifier == FL_SHIFT) {
-            (k == FL_Left) ? prev_tab() : next_tab();
-            ret = 1;
-         }
-      }
    }
 
    return (ret) ? ret : CustGroup::handle(e);
@@ -285,16 +273,16 @@
 {
    int idx;
 
-   if ((idx = get_btn_idx((UI*)Wizard->value())) > 1)
-      switch_tab( (CustTabButton*)child(idx-1) );
+   if ((idx = get_btn_idx((UI*)Wizard->value())) != -1)
+      switch_tab( (CustTabButton*)child(idx > 1 ? idx-1 : num_tabs()) );
 }
 
 void CustTabs::next_tab()
 {
    int idx;
 
-   if ((idx = get_btn_idx((UI*)Wizard->value())) > 0 && idx < num_tabs())
-      switch_tab( (CustTabButton*)child(idx+1) );
+   if ((idx = get_btn_idx((UI*)Wizard->value())) != -1)
+      switch_tab( (CustTabButton*)child(idx < num_tabs() ? idx+1 : 1) );
 }
 
 /*