changeset 2033:56134df9c63a

merge
author Jorge Arellano Cid <jcid@dillo.org>
date Tue, 17 May 2011 18:58:20 -0400
parents 1a32d5ed2cd7 (diff) 382160be8c2f (current diff)
children 7cad4651d972 45541ab7b1cc
files
diffstat 2 files changed, 16 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/src/ui.cc	Tue May 17 22:48:50 2011 +0000
+++ b/src/ui.cc	Tue May 17 18:58:20 2011 -0400
@@ -93,8 +93,8 @@
 };
 
 /*
- * Disable keys: Up, Down, Page_Up, Page_Down and
- * CTRL+{o,r,Home,End}
+ * Disable keys: Up, Down, Page_Up, Page_Down, Tab and
+ * CTRL+{o,r,Home,End}  SHIFT+{Left,Right}.
  */
 int CustInput::handle(int e)
 {
@@ -113,7 +113,11 @@
       if (k == FL_Escape && modifier == 0) {
          // Let the parent group handle this Esc key
          return 0;
-
+      } else if (modifier == FL_SHIFT) {
+         if (k == FL_Left || k == FL_Right) {
+            // Let these keys get to the UI
+            return 0;
+         }
       } else if (modifier == FL_CTRL) {
          if (k == 'l') {
             // Make text selected when already focused.
@@ -126,7 +130,7 @@
          }
       } else if (modifier == 0) {
          if (k == FL_Down || k == FL_Up ||
-             k == FL_Page_Down || k == FL_Page_Up) {
+             k == FL_Page_Down || k == FL_Page_Up || k == FL_Tab) {
             // Give up focus and honor the key
             a_UIcmd_focus_main_area(a_UIcmd_get_bw_by_widget(this));
             return 0;
--- a/src/uicmd.cc	Tue May 17 22:48:50 2011 +0000
+++ b/src/uicmd.cc	Tue May 17 18:58:20 2011 -0400
@@ -56,7 +56,6 @@
  * Local data
  */
 static char *save_dir = NULL;
-static UI *Gui;
 
 /*
  * Forward declarations
@@ -150,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;
@@ -157,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);
@@ -172,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);
@@ -286,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) );
 }
 
 /*
@@ -398,7 +385,7 @@
 
    int focus = 1;
    new_bw = UIcmd_tab_new(DilloTabs, old_ui, focus);
-   win->resizable(Gui);
+   win->resizable(BW2UI(new_bw));
    win->show();
 
    if (old_bw == NULL && prefs.xpos >= 0 && prefs.ypos >= 0) {
@@ -421,7 +408,6 @@
 
    // Create and set the UI
    UI *new_ui = tabs->add_new_tab(old_ui, focus);
-   Gui = new_ui;
 
    // Now create the Dw render layout and viewport
    FltkPlatform *platform = new FltkPlatform ();