wlt: add scrollback-buffer grabs
This copies the grabs from kmscon over to wlterm. It is now possible to scroll up and down in the scrollback-buffer if you manually increase the buffer size. Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
This commit is contained in:
parent
de2c0e1d85
commit
e5e81a0b4c
@ -37,6 +37,7 @@
|
||||
#include "conf.h"
|
||||
#include "eloop.h"
|
||||
#include "log.h"
|
||||
#include "shl_misc.h"
|
||||
#include "text.h"
|
||||
#include "wlt_main.h"
|
||||
#include "wlt_terminal.h"
|
||||
@ -206,6 +207,15 @@ static void print_help()
|
||||
"\t --debug [off] Enable debug mode\n"
|
||||
"\t --silent [off] Suppress notices and warnings\n"
|
||||
"\n"
|
||||
"Keyboard Shortcuts and Grabs:\n"
|
||||
"\t --grab-scroll-up <grab> [<Shift>Up]\n"
|
||||
"\t Shortcut to scroll up\n"
|
||||
"\t --grab-scroll-down <grab> [<Shift>Down]\n"
|
||||
"\t Shortcut to scroll down\n"
|
||||
"\t --grab-page-up <grab> [<Shift>Prior]\n"
|
||||
"\t Shortcut to scroll page up\n"
|
||||
"\t --grab-page-down <grab> [<Shift>Next]\n"
|
||||
"\t Shortcut to scroll page down\n"
|
||||
"Font Options:\n"
|
||||
"\t --font-engine <engine> [pango]\n"
|
||||
"\t Font engine\n"
|
||||
@ -248,11 +258,35 @@ static int aftercheck_help(struct conf_option *opt, int argc, char **argv,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct conf_grab def_grab_scroll_up = {
|
||||
.mods = SHL_SHIFT_MASK,
|
||||
.keysym = XKB_KEY_Up,
|
||||
};
|
||||
|
||||
static struct conf_grab def_grab_scroll_down = {
|
||||
.mods = SHL_SHIFT_MASK,
|
||||
.keysym = XKB_KEY_Down,
|
||||
};
|
||||
|
||||
static struct conf_grab def_grab_page_up = {
|
||||
.mods = SHL_SHIFT_MASK,
|
||||
.keysym = XKB_KEY_Prior,
|
||||
};
|
||||
|
||||
static struct conf_grab def_grab_page_down = {
|
||||
.mods = SHL_SHIFT_MASK,
|
||||
.keysym = XKB_KEY_Next,
|
||||
};
|
||||
|
||||
struct conf_option options[] = {
|
||||
CONF_OPTION_BOOL('h', "help", aftercheck_help, &wlt_conf.help, false),
|
||||
CONF_OPTION_BOOL('v', "verbose", NULL, &wlt_conf.verbose, false),
|
||||
CONF_OPTION_BOOL(0, "debug", aftercheck_debug, &wlt_conf.debug, false),
|
||||
CONF_OPTION_BOOL(0, "silent", NULL, &wlt_conf.silent, false),
|
||||
CONF_OPTION_GRAB(0, "grab-scroll-up", NULL, &wlt_conf.grab_scroll_up, &def_grab_scroll_up),
|
||||
CONF_OPTION_GRAB(0, "grab-scroll-down", NULL, &wlt_conf.grab_scroll_down, &def_grab_scroll_down),
|
||||
CONF_OPTION_GRAB(0, "grab-page-up", NULL, &wlt_conf.grab_page_up, &def_grab_page_up),
|
||||
CONF_OPTION_GRAB(0, "grab-page-down", NULL, &wlt_conf.grab_page_down, &def_grab_page_down),
|
||||
CONF_OPTION_STRING(0, "font-engine", NULL, &wlt_conf.font_engine, "pango"),
|
||||
CONF_OPTION_UINT(0, "font-size", NULL, &wlt_conf.font_size, 12),
|
||||
CONF_OPTION_STRING(0, "font-name", NULL, &wlt_conf.font_name, "monospace"),
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdlib.h>
|
||||
#include "conf.h"
|
||||
|
||||
struct wlt_conf_t {
|
||||
/* show help/usage information */
|
||||
@ -45,6 +46,15 @@ struct wlt_conf_t {
|
||||
/* disable notices and warnings */
|
||||
bool silent;
|
||||
|
||||
/* scroll-up grab */
|
||||
struct conf_grab *grab_scroll_up;
|
||||
/* scroll-down grab */
|
||||
struct conf_grab *grab_scroll_down;
|
||||
/* page-up grab */
|
||||
struct conf_grab *grab_page_up;
|
||||
/* page-down grab */
|
||||
struct conf_grab *grab_page_down;
|
||||
|
||||
/* font engine */
|
||||
char *font_engine;
|
||||
/* font size */
|
||||
|
@ -33,9 +33,11 @@
|
||||
#include <string.h>
|
||||
#include <wayland-client.h>
|
||||
#include <xkbcommon/xkbcommon.h>
|
||||
#include "conf.h"
|
||||
#include "eloop.h"
|
||||
#include "log.h"
|
||||
#include "pty.h"
|
||||
#include "shl_misc.h"
|
||||
#include "text.h"
|
||||
#include "tsm_unicode.h"
|
||||
#include "tsm_screen.h"
|
||||
@ -260,6 +262,31 @@ static void widget_key(struct wlt_widget *widget, unsigned int mask,
|
||||
|
||||
ucs4 = xkb_keysym_to_utf32(sym) ? : TSM_VTE_INVALID;
|
||||
|
||||
if (SHL_HAS_BITS(mask, wlt_conf.grab_scroll_up->mods) &&
|
||||
sym == wlt_conf.grab_scroll_up->keysym) {
|
||||
tsm_screen_sb_up(term->scr, 1);
|
||||
wlt_window_schedule_redraw(term->wnd);
|
||||
return;
|
||||
}
|
||||
if (SHL_HAS_BITS(mask, wlt_conf.grab_scroll_down->mods) &&
|
||||
sym == wlt_conf.grab_scroll_down->keysym) {
|
||||
tsm_screen_sb_down(term->scr, 1);
|
||||
wlt_window_schedule_redraw(term->wnd);
|
||||
return;
|
||||
}
|
||||
if (SHL_HAS_BITS(mask, wlt_conf.grab_page_up->mods) &&
|
||||
sym == wlt_conf.grab_page_up->keysym) {
|
||||
tsm_screen_sb_page_up(term->scr, 1);
|
||||
wlt_window_schedule_redraw(term->wnd);
|
||||
return;
|
||||
}
|
||||
if (SHL_HAS_BITS(mask, wlt_conf.grab_page_down->mods) &&
|
||||
sym == wlt_conf.grab_page_down->keysym) {
|
||||
tsm_screen_sb_page_down(term->scr, 1);
|
||||
wlt_window_schedule_redraw(term->wnd);
|
||||
return;
|
||||
}
|
||||
|
||||
if (tsm_vte_handle_keyboard(term->vte, sym, mask, ucs4))
|
||||
wlt_window_schedule_redraw(term->wnd);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user