}
}
-static void widget_key(struct wlt_widget *widget, unsigned int mask,
- uint32_t sym, uint32_t state, void *data)
+static bool widget_key(struct wlt_widget *widget, unsigned int mask,
+ uint32_t sym, uint32_t state, bool handled, void *data)
{
struct wlt_terminal *term = data;
uint32_t ucs4;
- if (state != WL_KEYBOARD_KEY_STATE_PRESSED)
- return;
+ if (handled || state != WL_KEYBOARD_KEY_STATE_PRESSED)
+ return false;
ucs4 = xkb_keysym_to_utf32(sym) ? : TSM_VTE_INVALID;
sym == wlt_conf.grab_scroll_up->keysym) {
tsm_screen_sb_up(term->scr, 1);
wlt_window_schedule_redraw(term->wnd);
- return;
+ return true;
}
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;
+ return true;
}
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;
+ return true;
}
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;
+ return true;
}
if (tsm_vte_handle_keyboard(term->vte, sym, mask, ucs4)) {
tsm_screen_sb_reset(term->scr);
wlt_window_schedule_redraw(term->wnd);
+ return true;
}
+
+ return false;
}
static void vte_event(struct tsm_vte *vte, const char *u8, size_t len,
struct shl_dlist *iter;
struct wlt_widget *widget;
struct itimerspec spec;
+ bool handled;
disp->last_serial = serial;
if (!disp->xkb_state)
if (num_syms == 1)
sym = syms[0];
+ handled = false;
shl_dlist_for_each(iter, &wnd->widget_list) {
widget = shl_dlist_entry(iter, struct wlt_widget, list);
- if (widget->keyboard_cb)
- widget->keyboard_cb(widget, mask, sym, state,
- widget->data);
+ if (widget->keyboard_cb) {
+ if (widget->keyboard_cb(widget, mask, sym, state,
+ handled, widget->data))
+ handled = true;
+ }
}
if (state == WL_KEYBOARD_KEY_STATE_RELEASED &&
struct wlt_widget *widget;
struct shl_dlist *iter;
unsigned int mask;
+ bool handled;
if (!wnd)
return;
mask = shl_get_xkb_mods(disp->xkb_state);
+ handled = false;
shl_dlist_for_each(iter, &wnd->widget_list) {
widget = shl_dlist_entry(iter, struct wlt_widget, list);
- if (widget->keyboard_cb)
- widget->keyboard_cb(widget, mask, disp->repeat_sym,
- WL_KEYBOARD_KEY_STATE_PRESSED,
- widget->data);
+ if (widget->keyboard_cb) {
+ if (widget->keyboard_cb(widget, mask, disp->repeat_sym,
+ WL_KEYBOARD_KEY_STATE_PRESSED,
+ handled, widget->data))
+ handled = true;
+ }
}
}