summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastien Helleu <flashcode@flashtux.org>2006-03-03 10:40:43 +0000
committerSebastien Helleu <flashcode@flashtux.org>2006-03-03 10:40:43 +0000
commit92db79989e2f2a2b4b2fba35bb13acb26f5a38a0 (patch)
tree0d06d44b5f6c945af96e6ccad40421c004321813 /src
parent5d32ac0d576571ab967e40e97e66284296d02398 (diff)
downloadweechat-92db79989e2f2a2b4b2fba35bb13acb26f5a38a0.zip
Keys alt-{home|end} to scroll top/bottom, alt-{f11-f12} to scroll nicklist top/bottom
Diffstat (limited to 'src')
-rw-r--r--src/gui/curses/gui-display.c38
-rw-r--r--src/gui/curses/gui-input.c6
-rw-r--r--src/gui/gtk/gui-display.c39
-rw-r--r--src/gui/gui-action.c20
-rw-r--r--src/gui/gui-keyboard.c4
-rw-r--r--src/gui/gui.h4
6 files changed, 108 insertions, 3 deletions
diff --git a/src/gui/curses/gui-display.c b/src/gui/curses/gui-display.c
index 5d7df5c26..aad6816ce 100644
--- a/src/gui/curses/gui-display.c
+++ b/src/gui/curses/gui-display.c
@@ -2796,6 +2796,44 @@ gui_window_scroll_down (t_gui_window *window)
}
/*
+ * gui_window_scroll_top: scroll to top of buffer
+ */
+
+void
+gui_window_scroll_top (t_gui_window *window)
+{
+ if (!gui_ok)
+ return;
+
+ if (!window->first_line_displayed)
+ {
+ window->start_line = window->buffer->lines;
+ window->start_line_pos = 0;
+ gui_draw_buffer_chat (window->buffer, 0);
+ gui_draw_buffer_status (window->buffer, 0);
+ }
+}
+
+/*
+ * gui_window_scroll_bottom: scroll to bottom of buffer
+ */
+
+void
+gui_window_scroll_bottom (t_gui_window *window)
+{
+ if (!gui_ok)
+ return;
+
+ if (window->start_line)
+ {
+ window->start_line = NULL;
+ window->start_line_pos = 0;
+ gui_draw_buffer_chat (window->buffer, 0);
+ gui_draw_buffer_status (window->buffer, 0);
+ }
+}
+
+/*
* gui_window_nick_beginning: go to beginning of nicklist
*/
diff --git a/src/gui/curses/gui-input.c b/src/gui/curses/gui-input.c
index 5641add76..47356e505 100644
--- a/src/gui/curses/gui-input.c
+++ b/src/gui/curses/gui-input.c
@@ -89,11 +89,13 @@ gui_input_default_key_bindings ()
gui_key_bind ( /* pgdn */ "meta2-6~", "page_down");
gui_key_bind ( /* m-pgup */ "meta-meta2-5~", "scroll_up");
gui_key_bind ( /* m-pgdn */ "meta-meta2-6~", "scroll_down");
+ gui_key_bind ( /* m-home */ "meta-meta2-1~", "scroll_top");
+ gui_key_bind ( /* m-end */ "meta-meta2-4~", "scroll_bottom");
gui_key_bind ( /* F10 */ "meta2-21~", "infobar_clear");
gui_key_bind ( /* F11 */ "meta2-23~", "nick_page_up");
gui_key_bind ( /* F12 */ "meta2-24~", "nick_page_down");
- gui_key_bind ( /* m-F11 */ "meta-meta2-1~", "nick_beginning");
- gui_key_bind ( /* m-F12 */ "meta-meta2-4~", "nick_end");
+ gui_key_bind ( /* m-F11 */ "meta-meta2-23~", "nick_beginning");
+ gui_key_bind ( /* m-F12 */ "meta-meta2-24~", "nick_end");
gui_key_bind ( /* ^L */ "ctrl-L", "refresh");
gui_key_bind ( /* m-a */ "meta-a", "jump_smart");
gui_key_bind ( /* m-b */ "meta-b", "previous_word");
diff --git a/src/gui/gtk/gui-display.c b/src/gui/gtk/gui-display.c
index 7d108b8d3..ef8c21c0f 100644
--- a/src/gui/gtk/gui-display.c
+++ b/src/gui/gtk/gui-display.c
@@ -1476,6 +1476,44 @@ gui_window_scroll_down (t_gui_window *window)
}
/*
+ * gui_window_scroll_top: scroll to top of buffer
+ */
+
+void
+gui_window_scroll_top (t_gui_window *window)
+{
+ if (!gui_ok)
+ return;
+
+ if (!window->first_line_displayed)
+ {
+ window->start_line = window->buffer->lines;
+ window->start_line_pos = 0;
+ gui_draw_buffer_chat (window->buffer, 0);
+ gui_draw_buffer_status (window->buffer, 0);
+ }
+}
+
+/*
+ * gui_window_scroll_bottom: scroll to bottom of buffer
+ */
+
+void
+gui_window_scroll_bottom (t_gui_window *window)
+{
+ if (!gui_ok)
+ return;
+
+ if (window->start_line)
+ {
+ window->start_line = NULL;
+ window->start_line_pos = 0;
+ gui_draw_buffer_chat (window->buffer, 0);
+ gui_draw_buffer_status (window->buffer, 0);
+ }
+}
+
+/*
* gui_window_nick_beginning: go to beginning of nicklist
*/
@@ -2152,7 +2190,6 @@ void
gui_init ()
{
GdkColor color_fg, color_bg;
- GtkRcStyle *rc_style;
gui_init_colors ();
diff --git a/src/gui/gui-action.c b/src/gui/gui-action.c
index ca6ee2821..908473e6c 100644
--- a/src/gui/gui-action.c
+++ b/src/gui/gui-action.c
@@ -899,6 +899,26 @@ gui_action_scroll_down (t_gui_window *window)
}
/*
+ * gui_action_scroll_top: scroll to top of buffer
+ */
+
+void
+gui_action_scroll_top (t_gui_window *window)
+{
+ gui_window_scroll_top (window);
+}
+
+/*
+ * gui_action_scroll_bottom: scroll to bottom of buffer
+ */
+
+void
+gui_action_scroll_bottom (t_gui_window *window)
+{
+ gui_window_scroll_bottom (window);
+}
+
+/*
* gui_action_nick_beginning: go to beginning of nicklist
*/
diff --git a/src/gui/gui-keyboard.c b/src/gui/gui-keyboard.c
index c2c824846..c0cfe5f15 100644
--- a/src/gui/gui-keyboard.c
+++ b/src/gui/gui-keyboard.c
@@ -91,6 +91,10 @@ t_gui_key_function gui_key_functions[] =
N_("scroll a few lines up") },
{ "scroll_down", gui_action_scroll_down,
N_("scroll a few lines down") },
+ { "scroll_top", gui_action_scroll_top,
+ N_("scroll to top of buffer") },
+ { "scroll_bottom", gui_action_scroll_bottom,
+ N_("scroll to bottom of buffer") },
{ "nick_beginning", gui_action_nick_beginning,
N_("display beginning of nicklist") },
{ "nick_end", gui_action_nick_end,
diff --git a/src/gui/gui.h b/src/gui/gui.h
index aba2e9c98..37001239b 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -473,6 +473,8 @@ extern void gui_action_page_up (t_gui_window *);
extern void gui_action_page_down (t_gui_window *);
extern void gui_action_scroll_up (t_gui_window *);
extern void gui_action_scroll_down (t_gui_window *);
+extern void gui_action_scroll_top (t_gui_window *);
+extern void gui_action_scroll_bottom (t_gui_window *);
extern void gui_action_nick_beginning (t_gui_window *);
extern void gui_action_nick_end (t_gui_window *);
extern void gui_action_nick_page_up (t_gui_window *);
@@ -530,6 +532,8 @@ extern void gui_window_page_up (t_gui_window *);
extern void gui_window_page_down (t_gui_window *);
extern void gui_window_scroll_up (t_gui_window *);
extern void gui_window_scroll_down (t_gui_window *);
+extern void gui_window_scroll_top (t_gui_window *);
+extern void gui_window_scroll_bottom (t_gui_window *);
extern void gui_window_nick_beginning (t_gui_window *);
extern void gui_window_nick_end (t_gui_window *);
extern void gui_window_nick_page_up (t_gui_window *);