aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjcid <devnull@localhost>2008-10-02 16:57:58 +0200
committerjcid <devnull@localhost>2008-10-02 16:57:58 +0200
commit476f5e74c2a93b7893a44c34f5cd1e953242ea33 (patch)
tree7d6063a1d6e4ba4cc2823fcff3be99fba4116e54 /src
parentea461615f2b4a0a693aacd96435216b1dd2d53f9 (diff)
- Made SHIFT + {Left, Right} work even with findbar focused.
Diffstat (limited to 'src')
-rw-r--r--src/findbar.cc15
-rw-r--r--src/ui.cc7
-rw-r--r--src/uicmd.cc17
-rw-r--r--src/uicmd.hh1
4 files changed, 32 insertions, 8 deletions
diff --git a/src/findbar.cc b/src/findbar.cc
index 606fe7af..144818e3 100644
--- a/src/findbar.cc
+++ b/src/findbar.cc
@@ -34,12 +34,19 @@ int MyInput::handle(int e)
_MSG("findbar MyInput::handle()\n");
int ret = 1, k = event_key();
unsigned modifier = event_state() & (SHIFT | CTRL | ALT | META);
- if (modifier == 0) {
- if (e == KEY && k == EscapeKey) {
- _MSG("findbar MyInput: caught EscapeKey\n");
- ret = 0;
+
+ if (e == KEY) {
+ if (k == LeftKey || k == RightKey) {
+ if (modifier == SHIFT) {
+ a_UIcmd_send_event_to_tabs_by_wid(e, this);
+ return 1;
+ }
+ } else if (k == EscapeKey && modifier == 0) {
+ // Avoid clearing the text with Esc, just hide the findbar.
+ return 0;
}
}
+
if (ret)
ret = Input::handle(e);
return ret;
diff --git a/src/ui.cc b/src/ui.cc
index 0aa33a4c..378fa335 100644
--- a/src/ui.cc
+++ b/src/ui.cc
@@ -119,8 +119,11 @@ int CustInput::handle(int e)
} else if (k == 'o' || k == 'r' || k == HomeKey || k == EndKey)
return 0;
} else if (modifier == SHIFT) {
- if (k == LeftKey || k == RightKey)
- return 0;
+ if (k == LeftKey || k == RightKey) {
+ _MSG(" CustInput::handle > SHIFT+RightKey\n");
+ a_UIcmd_send_event_to_tabs_by_wid(e, this);
+ return 1;
+ }
}
}
_MSG("\n");
diff --git a/src/uicmd.cc b/src/uicmd.cc
index 0a7304dd..4be76e4d 100644
--- a/src/uicmd.cc
+++ b/src/uicmd.cc
@@ -70,10 +70,9 @@ public:
int i = value();
if (k == LeftKey) {i = i ? i-1 : children()-1;}
else {i++; if (i >= children()) i = 0;}
- if (value(i)) do_callback();
+ selected_child(child(i));
return 1;
}
- return 0;
}
}
return TabGroup::handle(e);
@@ -137,6 +136,20 @@ BrowserWindow *a_UIcmd_get_bw_by_widget(void *v_wid)
}
/*
+ * FLTK regards SHIFT + {LeftKey, Right} as navigation keys.
+ * Special handling is required to override it. Here we route
+ * these events directly to the recipient.
+ * TODO: focus is not remembered correctly.
+ */
+void a_UIcmd_send_event_to_tabs_by_wid(int e, void *v_wid)
+{
+ BrowserWindow *bw = a_UIcmd_get_bw_by_widget(v_wid);
+ UI *ui = (UI*)bw->ui;
+ if (ui->tabs())
+ ui->tabs()->handle(e);
+}
+
+/*
* Create a new UI and its associated BrowserWindow data structure.
* Use style from v_ui. If non-NULL it must be of type UI*.
*/
diff --git a/src/uicmd.hh b/src/uicmd.hh
index 77931d6f..469bcae4 100644
--- a/src/uicmd.hh
+++ b/src/uicmd.hh
@@ -10,6 +10,7 @@ extern "C" {
BrowserWindow *a_UIcmd_browser_window_new(int ww, int wh, const void *v_bw);
BrowserWindow *a_UIcmd_get_bw_by_widget(void *v_wid);
+void a_UIcmd_send_event_to_tabs_by_wid(int e, void *v_wid);
void a_UIcmd_open_urlstr(void *vbw, const char *urlstr);
void a_UIcmd_open_url(BrowserWindow *bw, const DilloUrl *url);
void a_UIcmd_open_url_nw(BrowserWindow *bw, const DilloUrl *url);