aboutsummaryrefslogtreecommitdiff
path: root/src/uicmd.cc
diff options
context:
space:
mode:
authorcorvid <corvid@lavabit.com>2009-07-05 22:17:41 +0000
committercorvid <corvid@lavabit.com>2009-07-05 22:17:41 +0000
commit76c4bf8a1cc85d9cd15c0bb6817a7fe92c5e6eaa (patch)
tree7ba32724cbcb56f03ea82a904c9578f29f3774c7 /src/uicmd.cc
parent1cefd820489a50fd10220e05c05a7b102c6940b2 (diff)
keybindings for scrolling
Diffstat (limited to 'src/uicmd.cc')
-rw-r--r--src/uicmd.cc35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/uicmd.cc b/src/uicmd.cc
index c832eb85..8e8a2834 100644
--- a/src/uicmd.cc
+++ b/src/uicmd.cc
@@ -23,6 +23,7 @@
#include <fltk/Tooltip.h>
#include "paths.hh"
+#include "keys.hh"
#include "ui.hh"
#include "uicmd.hh"
#include "timeout.hh"
@@ -1088,6 +1089,40 @@ void a_UIcmd_set_scroll_by_fragment(BrowserWindow *bw, const char *f)
}
/*
+ * Pass scrolling command to dw.
+ */
+void a_UIcmd_scroll(BrowserWindow *bw, int icmd)
+{
+ Layout *layout = (Layout*)bw->render_layout;
+
+ if (layout) {
+ typedef struct {
+ KeysCommand_t keys_cmd;
+ ScrollCommand dw_cmd;
+ } mapping_t;
+
+ const mapping_t map[] = {
+ {KEYS_SCREEN_UP, SCREEN_UP_CMD},
+ {KEYS_SCREEN_DOWN, SCREEN_DOWN_CMD},
+ {KEYS_LINE_UP, LINE_UP_CMD},
+ {KEYS_LINE_DOWN, LINE_DOWN_CMD},
+ {KEYS_LEFT, LEFT_CMD},
+ {KEYS_RIGHT, RIGHT_CMD},
+ {KEYS_TOP, TOP_CMD},
+ {KEYS_BOTTOM, BOTTOM_CMD},
+ };
+ KeysCommand_t keycmd = (KeysCommand_t)icmd;
+
+ for (uint_t i = 0; i < (sizeof(map)/sizeof(mapping_t)); i++) {
+ if (keycmd == map[i].keys_cmd) {
+ layout->scroll(map[i].dw_cmd);
+ break;
+ }
+ }
+ }
+}
+
+/*
* Get location's text
*/
char *a_UIcmd_get_location_text(BrowserWindow *bw)