aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjcid <devnull@localhost>2007-11-17 18:27:45 +0100
committerjcid <devnull@localhost>2007-11-17 18:27:45 +0100
commit36937cb4383bb52812baa1d2cc35af0ce26484f3 (patch)
tree167da1742f1892abce1409d2ae2198980450b196
parent9fce735bdcebd04957360f4b673b1dfe4645f0af (diff)
Switched UI shortcuts from a global event handler to UI::handle.
-rw-r--r--ChangeLog1
-rw-r--r--src/ui.cc72
2 files changed, 32 insertions, 41 deletions
diff --git a/ChangeLog b/ChangeLog
index e6ac4e4d..0a42356e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -39,6 +39,7 @@ dillo-fltk2
- Reimplemented plain.cc using a class, and hooked memory-release.
- Reimplemented html.cc using a class, removed the linkblock,
and hooked memory-release to dw destruction.
+ - Switched UI shortcuts from a global event handler to UI::handle.
Patches: Jorge Arellano
+- Connected signals to <li> elements (fixes links within lists).
- Enabled text, background-color and geometry in preferences.
diff --git a/src/ui.cc b/src/ui.cc
index a8ed894b..a68c14ab 100644
--- a/src/ui.cc
+++ b/src/ui.cc
@@ -120,40 +120,6 @@ int NewHighlightButton::handle(int e)
// "Clear", "Search"
//};
-//
-// Global event handler function ---------------------------------------------
-//
-static int global_event_handler(int e, Window *win)
-{
- int ret = 0;
-
- if (e == SHORTCUT) {
- if (event_state(CTRL)) {
- if (event_key() == 'l') {
- a_UIcmd_open_url_dialog(win->user_data());
- ret = 1;
- } else if (event_key() == 'n') {
- a_UIcmd_browser_window_new(win->w(), win->h());
- ret = 1;
- } else if (event_key() == 'o') {
- a_UIcmd_open_file(win->user_data());
- ret = 1;
- } else if (event_key() == 'q') {
- a_UIcmd_close_bw(win->user_data());
- ret = 1;
- } else if (event_key() == 's') {
- a_UIcmd_search_dialog(win->user_data());
- ret = 1;
- }
- }
-
- _MSG("global_event_handler: Alt_R=%d\n", event_key_state(RightAltKey));
- if (event_key_state(LeftAltKey) && event_key() == 'q') {
- a_UIcmd_close_all_bw();
- }
- }
- return ret;
-}
//
// Callback functions --------------------------------------------------------
@@ -674,8 +640,6 @@ UI::UI(int win_w, int win_h, const char* label) :
FullScreen->tooltip("Hide Controls");
FullScreen->callback(fullscreen_cb, (void *)this);
- add_event_handler(global_event_handler);
-
customize(0);
//show();
@@ -686,12 +650,38 @@ UI::UI(int win_w, int win_h, const char* label) :
*/
int UI::handle(int event)
{
- if (event == KEY || event == KEYUP) {
- _MSG ("UI::handle %s key=%d\n",
- event == KEY ? "KEY" : "KEYUP", event_key());
- return 0;
+ int ret = 0;
+
+ if (event == SHORTCUT) {
+ if (event_state(CTRL)) {
+ if (event_key() == 'l') {
+ a_UIcmd_open_url_dialog(user_data());
+ ret = 1;
+ } else if (event_key() == 'n') {
+ a_UIcmd_browser_window_new(w(), h());
+ ret = 1;
+ } else if (event_key() == 'o') {
+ a_UIcmd_open_file(user_data());
+ ret = 1;
+ } else if (event_key() == 'q') {
+ a_UIcmd_close_bw(user_data());
+ ret = 1;
+ } else if (event_key() == 's') {
+ a_UIcmd_search_dialog(user_data());
+ ret = 1;
+ }
+ }
+
+ if (event_key_state(LeftAltKey) && event_key() == 'q') {
+ a_UIcmd_close_all_bw();
+ ret = 1;
+ }
}
- return Window::handle(event);
+
+ if (ret == 0) {
+ ret = Window::handle(event);
+ }
+ return ret;
}