multi-seat: re-enable scrollback search support

This commit is contained in:
Daniel Eklöf 2020-07-08 18:20:34 +02:00
parent 58415428cf
commit 04e566492c
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
4 changed files with 16 additions and 29 deletions

View file

@ -553,7 +553,7 @@ keyboard_key(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
if (term->is_searching) { if (term->is_searching) {
if (should_repeat) if (should_repeat)
start_repeater(seat, key - 8); start_repeater(seat, key - 8);
search_input(term, key, sym, effective_mods, serial); search_input(seat, term, key, sym, effective_mods, serial);
return; return;
} }

View file

@ -18,7 +18,6 @@
#include "shm.h" #include "shm.h"
#include "util.h" #include "util.h"
#if 0
static bool static bool
search_ensure_size(struct terminal *term, size_t wanted_size) search_ensure_size(struct terminal *term, size_t wanted_size)
{ {
@ -37,7 +36,6 @@ search_ensure_size(struct terminal *term, size_t wanted_size)
return true; return true;
} }
#endif
static void static void
search_cancel_keep_selection(struct terminal *term) search_cancel_keep_selection(struct terminal *term)
@ -101,7 +99,6 @@ search_cancel(struct terminal *term)
selection_cancel(term); selection_cancel(term);
} }
#if 0
static void static void
search_update_selection(struct terminal *term, search_update_selection(struct terminal *term,
int start_row, int start_col, int start_row, int start_col,
@ -171,8 +168,7 @@ search_update_selection(struct terminal *term,
selection_update(term, end_col, selection_row); selection_update(term, end_col, selection_row);
} }
} }
#endif
#if 0
static void static void
search_find_next(struct terminal *term) search_find_next(struct terminal *term)
{ {
@ -285,8 +281,7 @@ search_find_next(struct terminal *term)
selection_cancel(term); selection_cancel(term);
#undef ROW_DEC #undef ROW_DEC
} }
#endif
#if 0
static void static void
search_match_to_end_of_word(struct terminal *term, bool spaces_only) search_match_to_end_of_word(struct terminal *term, bool spaces_only)
{ {
@ -361,8 +356,7 @@ search_match_to_end_of_word(struct terminal *term, bool spaces_only)
search_update_selection( search_update_selection(
term, term->search.match.row, term->search.match.col, end_row, end_col); term, term->search.match.row, term->search.match.col, end_row, end_col);
} }
#endif
#if 0
static size_t static size_t
distance_next_word(const struct terminal *term) distance_next_word(const struct terminal *term)
{ {
@ -390,8 +384,7 @@ distance_next_word(const struct terminal *term)
return cursor - term->search.cursor; return cursor - term->search.cursor;
} }
#endif
#if 0
static size_t static size_t
distance_prev_word(const struct terminal *term) distance_prev_word(const struct terminal *term)
{ {
@ -417,8 +410,7 @@ distance_prev_word(const struct terminal *term)
return term->search.cursor - cursor; return term->search.cursor - cursor;
} }
#endif
#if 0
static bool static bool
execute_binding(struct terminal *term, enum bind_action_search action, execute_binding(struct terminal *term, enum bind_action_search action,
uint32_t serial) uint32_t serial)
@ -575,20 +567,18 @@ execute_binding(struct terminal *term, enum bind_action_search action,
assert(false); assert(false);
return false; return false;
} }
#endif
void void
search_input(struct terminal *term, uint32_t key, xkb_keysym_t sym, search_input(struct seat *seat, struct terminal *term, uint32_t key,
xkb_mod_mask_t mods, uint32_t serial) xkb_keysym_t sym, xkb_mod_mask_t mods, uint32_t serial)
{ {
#if 0
LOG_DBG("search: input: sym=%d/0x%x, mods=0x%08x", sym, sym, mods); LOG_DBG("search: input: sym=%d/0x%x, mods=0x%08x", sym, sym, mods);
enum xkb_compose_status compose_status = xkb_compose_state_get_status( enum xkb_compose_status compose_status = xkb_compose_state_get_status(
term->wl->kbd.xkb_compose_state); seat->kbd.xkb_compose_state);
/* Key bindings */ /* Key bindings */
tll_foreach(term->wl->kbd.bindings.search, it) { tll_foreach(seat->kbd.bindings.search, it) {
if (it->item.bind.mods != mods) if (it->item.bind.mods != mods)
continue; continue;
@ -614,13 +604,13 @@ search_input(struct terminal *term, uint32_t key, xkb_keysym_t sym,
if (compose_status == XKB_COMPOSE_COMPOSED) { if (compose_status == XKB_COMPOSE_COMPOSED) {
count = xkb_compose_state_get_utf8( count = xkb_compose_state_get_utf8(
term->wl->kbd.xkb_compose_state, (char *)buf, sizeof(buf)); seat->kbd.xkb_compose_state, (char *)buf, sizeof(buf));
xkb_compose_state_reset(term->wl->kbd.xkb_compose_state); xkb_compose_state_reset(seat->kbd.xkb_compose_state);
} else if (compose_status == XKB_COMPOSE_CANCELLED) { } else if (compose_status == XKB_COMPOSE_CANCELLED) {
count = 0; count = 0;
} else { } else {
count = xkb_state_key_get_utf8( count = xkb_state_key_get_utf8(
term->wl->kbd.xkb_state, key, (char *)buf, sizeof(buf)); seat->kbd.xkb_state, key, (char *)buf, sizeof(buf));
} }
const char *src = (const char *)buf; const char *src = (const char *)buf;
@ -653,5 +643,4 @@ update_search:
LOG_DBG("search: buffer: %S", term->search.buf); LOG_DBG("search: buffer: %S", term->search.buf);
search_find_next(term); search_find_next(term);
render_refresh_search(term); render_refresh_search(term);
#endif
} }

View file

@ -5,5 +5,5 @@
void search_begin(struct terminal *term); void search_begin(struct terminal *term);
void search_cancel(struct terminal *term); void search_cancel(struct terminal *term);
void search_input(struct terminal *term, uint32_t key, xkb_keysym_t sym, xkb_mod_mask_t mods, void search_input(struct seat *seat, struct terminal *term, uint32_t key,
uint32_t serial); xkb_keysym_t sym, xkb_mod_mask_t mods, uint32_t serial);

View file

@ -958,6 +958,7 @@ wayl_init(const struct config *conf, struct fdm *fdm)
goto out; goto out;
} }
/* Trigger listeners registered when handling globals */
wl_display_roundtrip(wayl->display); wl_display_roundtrip(wayl->display);
if (!wayl->have_argb8888) { if (!wayl->have_argb8888) {
@ -976,9 +977,6 @@ wayl_init(const struct config *conf, struct fdm *fdm)
it->item.ppi.scaled.x, it->item.ppi.scaled.y); it->item.ppi.scaled.x, it->item.ppi.scaled.y);
} }
#if 0
#endif
wayl->fd = wl_display_get_fd(wayl->display); wayl->fd = wl_display_get_fd(wayl->display);
if (fcntl(wayl->fd, F_SETFL, fcntl(wayl->fd, F_GETFL) | O_NONBLOCK) < 0) { if (fcntl(wayl->fd, F_SETFL, fcntl(wayl->fd, F_GETFL) | O_NONBLOCK) < 0) {
LOG_ERRNO("failed to make Wayland socket non-blocking"); LOG_ERRNO("failed to make Wayland socket non-blocking");