term: wayland struct is now not a part of the terminal struct

We do however need access to it, so provide a pointer. The difference
is that now we can have a *single* wayland instance, but multiple
terminal instances.
This commit is contained in:
Daniel Eklöf 2019-10-27 18:51:14 +01:00
parent 33e4b8a5b8
commit 1adab32906
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
8 changed files with 115 additions and 114 deletions

110
main.c
View file

@ -729,6 +729,14 @@ main(int argc, char *const *argv)
struct fdm *fdm = NULL;
struct wayland wayl = {
.kbd = {
.repeat = {
.fd = timerfd_create(CLOCK_BOOTTIME, TFD_CLOEXEC | TFD_NONBLOCK),
},
},
};
struct terminal term = {
.quit = false,
.ptmx = posix_openpt(O_RDWR | O_NOCTTY),
@ -791,13 +799,7 @@ main(int argc, char *const *argv)
.normal = {.damage = tll_init(), .scroll_damage = tll_init()},
.alt = {.damage = tll_init(), .scroll_damage = tll_init()},
.grid = &term.normal,
.wl = {
.kbd = {
.repeat = {
.fd = timerfd_create(CLOCK_BOOTTIME, TFD_CLOEXEC | TFD_NONBLOCK),
},
},
},
.wl = &wayl,
.render = {
.scrollback_lines = conf.scrollback_lines,
.workers = {
@ -843,7 +845,7 @@ main(int argc, char *const *argv)
goto out;
}
if (term.flash.fd == -1 || term.blink.fd == -1 || term.wl.kbd.repeat.fd == -1) {
if (term.flash.fd == -1 || term.blink.fd == -1 || term.wl->kbd.repeat.fd == -1) {
LOG_ERR("failed to create timers");
goto out;
}
@ -895,67 +897,67 @@ main(int argc, char *const *argv)
term.cell_height = (int)ceil(term.fextents.height);
LOG_INFO("cell width=%d, height=%d", term.cell_width, term.cell_height);
term.wl.term = &term;
term.wl.display = wl_display_connect(NULL);
if (term.wl.display == NULL) {
term.wl->term = &term;
term.wl->display = wl_display_connect(NULL);
if (term.wl->display == NULL) {
LOG_ERR("failed to connect to wayland; no compositor running?");
goto out;
}
term.wl.registry = wl_display_get_registry(term.wl.display);
if (term.wl.registry == NULL) {
term.wl->registry = wl_display_get_registry(term.wl->display);
if (term.wl->registry == NULL) {
LOG_ERR("failed to get wayland registry");
goto out;
}
wl_registry_add_listener(term.wl.registry, &registry_listener, &term.wl);
wl_display_roundtrip(term.wl.display);
wl_registry_add_listener(term.wl->registry, &registry_listener, term.wl);
wl_display_roundtrip(term.wl->display);
if (term.wl.compositor == NULL) {
if (term.wl->compositor == NULL) {
LOG_ERR("no compositor");
goto out;
}
if (term.wl.shm == NULL) {
if (term.wl->shm == NULL) {
LOG_ERR("no shared memory buffers interface");
goto out;
}
if (term.wl.shell == NULL) {
if (term.wl->shell == NULL) {
LOG_ERR("no XDG shell interface");
goto out;
}
if (!term.wl.have_argb8888) {
if (!term.wl->have_argb8888) {
LOG_ERR("compositor does not support ARGB surfaces");
goto out;
}
if (term.wl.seat == NULL) {
if (term.wl->seat == NULL) {
LOG_ERR("no seat available");
goto out;
}
if (term.wl.data_device_manager == NULL) {
if (term.wl->data_device_manager == NULL) {
LOG_ERR("no clipboard available "
"(wl_data_device_manager not implemented by server)");
goto out;
}
if (term.wl.primary_selection_device_manager == NULL)
if (term.wl->primary_selection_device_manager == NULL)
LOG_WARN("no primary selection available");
tll_foreach(term.wl.monitors, it) {
tll_foreach(term.wl->monitors, it) {
LOG_INFO("%s: %dx%d+%dx%d (scale=%d, refresh=%.2fHz)",
it->item.name, it->item.width_px, it->item.height_px,
it->item.x, it->item.y, it->item.scale, it->item.refresh);
}
/* Clipboard */
term.wl.data_device = wl_data_device_manager_get_data_device(
term.wl.data_device_manager, term.wl.seat);
wl_data_device_add_listener(term.wl.data_device, &data_device_listener, &term.wl);
term.wl->data_device = wl_data_device_manager_get_data_device(
term.wl->data_device_manager, term.wl->seat);
wl_data_device_add_listener(term.wl->data_device, &data_device_listener, term.wl);
/* Primary selection */
if (term.wl.primary_selection_device_manager != NULL) {
term.wl.primary_selection_device = zwp_primary_selection_device_manager_v1_get_device(
term.wl.primary_selection_device_manager, term.wl.seat);
if (term.wl->primary_selection_device_manager != NULL) {
term.wl->primary_selection_device = zwp_primary_selection_device_manager_v1_get_device(
term.wl->primary_selection_device_manager, term.wl->seat);
zwp_primary_selection_device_v1_add_listener(
term.wl.primary_selection_device, &primary_selection_device_listener, &term.wl);
term.wl->primary_selection_device, &primary_selection_device_listener, term.wl);
}
/* Cursor */
@ -973,49 +975,49 @@ main(int argc, char *const *argv)
/* Note: theme is (re)loaded on scale and output changes */
LOG_INFO("cursor theme: %s, size: %u", cursor_theme, cursor_size);
term.wl.pointer.size = cursor_size;
term.wl.pointer.theme_name = cursor_theme != NULL ? strdup(cursor_theme) : NULL;
term.wl->pointer.size = cursor_size;
term.wl->pointer.theme_name = cursor_theme != NULL ? strdup(cursor_theme) : NULL;
term.wl.pointer.surface = wl_compositor_create_surface(term.wl.compositor);
if (term.wl.pointer.surface == NULL) {
term.wl->pointer.surface = wl_compositor_create_surface(term.wl->compositor);
if (term.wl->pointer.surface == NULL) {
LOG_ERR("failed to create cursor surface");
goto out;
}
/* Main window */
term.window.surface = wl_compositor_create_surface(term.wl.compositor);
term.window.surface = wl_compositor_create_surface(term.wl->compositor);
if (term.window.surface == NULL) {
LOG_ERR("failed to create wayland surface");
goto out;
}
wl_surface_add_listener(term.window.surface, &surface_listener, &term.wl);
wl_surface_add_listener(term.window.surface, &surface_listener, term.wl);
term.window.xdg_surface = xdg_wm_base_get_xdg_surface(term.wl.shell, term.window.surface);
xdg_surface_add_listener(term.window.xdg_surface, &xdg_surface_listener, &term.wl);
term.window.xdg_surface = xdg_wm_base_get_xdg_surface(term.wl->shell, term.window.surface);
xdg_surface_add_listener(term.window.xdg_surface, &xdg_surface_listener, term.wl);
term.window.xdg_toplevel = xdg_surface_get_toplevel(term.window.xdg_surface);
xdg_toplevel_add_listener(term.window.xdg_toplevel, &xdg_toplevel_listener, &term.wl);
xdg_toplevel_add_listener(term.window.xdg_toplevel, &xdg_toplevel_listener, term.wl);
xdg_toplevel_set_app_id(term.window.xdg_toplevel, "foot");
term_set_window_title(&term, "foot");
/* Request server-side decorations */
term.window.xdg_toplevel_decoration = zxdg_decoration_manager_v1_get_toplevel_decoration(
term.wl.xdg_decoration_manager, term.window.xdg_toplevel);
term.wl->xdg_decoration_manager, term.window.xdg_toplevel);
zxdg_toplevel_decoration_v1_set_mode(
term.window.xdg_toplevel_decoration, ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
zxdg_toplevel_decoration_v1_add_listener(
term.window.xdg_toplevel_decoration, &xdg_toplevel_decoration_listener, &term.wl);
term.window.xdg_toplevel_decoration, &xdg_toplevel_decoration_listener, term.wl);
/* Scrollback search box */
term.window.search_surface = wl_compositor_create_surface(term.wl.compositor);
term.window.search_surface = wl_compositor_create_surface(term.wl->compositor);
term.window.search_sub_surface = wl_subcompositor_get_subsurface(
term.wl.sub_compositor, term.window.search_surface, term.window.surface);
term.wl->sub_compositor, term.window.search_surface, term.window.surface);
wl_subsurface_set_desync(term.window.search_sub_surface);
wl_surface_commit(term.window.surface);
wl_display_roundtrip(term.wl.display);
wl_display_roundtrip(term.wl->display);
if (conf.width == -1) {
assert(conf.height == -1);
@ -1026,7 +1028,7 @@ main(int argc, char *const *argv)
conf.height = max(conf.height, term.cell_height);
render_resize(&term, conf.width, conf.height);
wl_display_dispatch_pending(term.wl.display);
wl_display_dispatch_pending(term.wl->display);
{
int fork_pipe[2];
@ -1102,7 +1104,7 @@ main(int argc, char *const *argv)
{
int fd = wl_display_get_fd(term.wl.display);
int fd = wl_display_get_fd(term.wl->display);
int fd_flags = fcntl(fd, F_GETFL);
if (fd_flags == -1) {
LOG_ERRNO("failed to set non blocking mode on Wayland display connection");
@ -1117,16 +1119,16 @@ main(int argc, char *const *argv)
if ((fdm = fdm_init()) == NULL)
goto out;
fdm_add(fdm, wl_display_get_fd(term.wl.display), EPOLLIN, &fdm_wayl, &term.wl);
fdm_add(fdm, wl_display_get_fd(term.wl->display), EPOLLIN, &fdm_wayl, term.wl);
fdm_add(fdm, term.ptmx, EPOLLIN, &fdm_ptmx, &term);
fdm_add(fdm, term.wl.kbd.repeat.fd, EPOLLIN, &fdm_repeat, &term.wl);
fdm_add(fdm, term.wl->kbd.repeat.fd, EPOLLIN, &fdm_repeat, term.wl);
fdm_add(fdm, term.flash.fd, EPOLLIN, &fdm_flash, &term);
fdm_add(fdm, term.blink.fd, EPOLLIN, &fdm_blink, &term);
fdm_add(fdm, term.delayed_render_timer.lower_fd, EPOLLIN, &fdm_delayed_render, &term);
fdm_add(fdm, term.delayed_render_timer.upper_fd, EPOLLIN, &fdm_delayed_render, &term);
while (true) {
wl_display_flush(term.wl.display);
wl_display_flush(term.wl->display);
if (!fdm_poll(fdm))
break;
}
@ -1136,9 +1138,9 @@ main(int argc, char *const *argv)
out:
if (fdm != NULL) {
fdm_del(fdm, wl_display_get_fd(term.wl.display));
fdm_del(fdm, wl_display_get_fd(term.wl->display));
fdm_del(fdm, term.ptmx);
fdm_del(fdm, term.wl.kbd.repeat.fd);
fdm_del(fdm, term.wl->kbd.repeat.fd);
fdm_del(fdm, term.flash.fd);
fdm_del(fdm, term.blink.fd);
fdm_del(fdm, term.delayed_render_timer.lower_fd);
@ -1162,7 +1164,7 @@ out:
shm_fini();
wayl_win_destroy(&term.window);
wayl_destroy(&term.wl);
wayl_destroy(&wayl);
free(term.vt.osc.data);
for (int row = 0; row < term.normal.num_rows; row++)
@ -1184,8 +1186,8 @@ out:
close(term.flash.fd);
if (term.blink.fd != -1)
close(term.blink.fd);
if (term.wl.kbd.repeat.fd != -1)
close(term.wl.kbd.repeat.fd);
if (term.wl->kbd.repeat.fd != -1)
close(term.wl->kbd.repeat.fd);
if (term.ptmx != -1)
close(term.ptmx);

6
osc.c
View file

@ -30,14 +30,14 @@ osc_to_clipboard(struct terminal *term, const char *target,
switch (*t) {
case 'c': {
char *copy = strdup(decoded);
if (!text_to_clipboard(term, copy, term->wl.input_serial))
if (!text_to_clipboard(term, copy, term->wl->input_serial))
free(copy);
break;
}
case 'p': {
char *copy = strdup(decoded);
if (!text_to_primary(term, copy, term->wl.input_serial))
if (!text_to_primary(term, copy, term->wl->input_serial))
free(copy);
break;
}
@ -130,7 +130,7 @@ osc_from_clipboard(struct terminal *term, const char *source)
switch (src) {
case 'c':
text_from_clipboard(term, term->wl.input_serial, &from_clipboard_cb, &ctx);
text_from_clipboard(term, term->wl->input_serial, &from_clipboard_cb, &ctx);
break;
case 'p':

View file

@ -440,7 +440,7 @@ grid_render(struct terminal *term)
assert(term->width > 0);
assert(term->height > 0);
struct buffer *buf = shm_get_buffer(term->wl.shm, term->width, term->height, 1 + term->render.workers.count);
struct buffer *buf = shm_get_buffer(term->wl->shm, term->width, term->height, 1 + term->render.workers.count);
wl_surface_attach(term->window.surface, buf->wl_buf, 0, 0);
pixman_image_t *pix = buf->pix;
@ -741,7 +741,7 @@ render_search_box(struct terminal *term)
const int width = 2 * margin + max(20, term->search.len) * term->cell_width;
const int height = 2 * margin + 1 * term->cell_height;
struct buffer *buf = shm_get_buffer(term->wl.shm, width, height, 1);
struct buffer *buf = shm_get_buffer(term->wl->shm, width, height, 1);
/* Background - yellow on empty/match, red on mismatch */
pixman_color_t color = color_hex_to_pixman(
@ -945,28 +945,28 @@ render_set_title(struct terminal *term, const char *title)
bool
render_reload_cursor_theme(struct terminal *term)
{
if (term->wl.pointer.size == 0)
if (term->wl->pointer.size == 0)
return true;
if (term->wl.pointer.theme != NULL) {
wl_cursor_theme_destroy(term->wl.pointer.theme);
term->wl.pointer.theme = NULL;
term->wl.pointer.cursor = NULL;
if (term->wl->pointer.theme != NULL) {
wl_cursor_theme_destroy(term->wl->pointer.theme);
term->wl->pointer.theme = NULL;
term->wl->pointer.cursor = NULL;
}
LOG_DBG("reloading cursor theme: %s@%d",
term->wl.pointer.theme_name, term->wl.pointer.size);
term->wl->pointer.theme_name, term->wl->pointer.size);
term->wl.pointer.theme = wl_cursor_theme_load(
term->wl.pointer.theme_name, term->wl.pointer.size * term->scale, term->wl.shm);
if (term->wl.pointer.theme == NULL) {
term->wl->pointer.theme = wl_cursor_theme_load(
term->wl->pointer.theme_name, term->wl->pointer.size * term->scale, term->wl->shm);
if (term->wl->pointer.theme == NULL) {
LOG_ERR("failed to load cursor theme");
return false;
}
term->wl.pointer.cursor = wl_cursor_theme_get_cursor(
term->wl.pointer.theme, "left_ptr");
assert(term->wl.pointer.cursor != NULL);
term->wl->pointer.cursor = wl_cursor_theme_get_cursor(
term->wl->pointer.theme, "left_ptr");
assert(term->wl->pointer.cursor != NULL);
render_update_cursor_surface(term);
return true;
@ -975,26 +975,26 @@ render_reload_cursor_theme(struct terminal *term)
void
render_update_cursor_surface(struct terminal *term)
{
if (term->wl.pointer.cursor == NULL)
if (term->wl->pointer.cursor == NULL)
return;
const int scale = term->scale;
wl_surface_set_buffer_scale(term->wl.pointer.surface, scale);
wl_surface_set_buffer_scale(term->wl->pointer.surface, scale);
struct wl_cursor_image *image = term->wl.pointer.cursor->images[0];
struct wl_cursor_image *image = term->wl->pointer.cursor->images[0];
wl_surface_attach(
term->wl.pointer.surface, wl_cursor_image_get_buffer(image), 0, 0);
term->wl->pointer.surface, wl_cursor_image_get_buffer(image), 0, 0);
wl_pointer_set_cursor(
term->wl.pointer.pointer, term->wl.pointer.serial,
term->wl.pointer.surface,
term->wl->pointer.pointer, term->wl->pointer.serial,
term->wl->pointer.surface,
image->hotspot_x / scale, image->hotspot_y / scale);
wl_surface_damage_buffer(
term->wl.pointer.surface, 0, 0, INT32_MAX, INT32_MAX);
term->wl->pointer.surface, 0, 0, INT32_MAX, INT32_MAX);
wl_surface_commit(term->wl.pointer.surface);
wl_surface_commit(term->wl->pointer.surface);
}
void

View file

@ -294,13 +294,13 @@ search_input(struct terminal *term, uint32_t key, xkb_keysym_t sym, xkb_mod_mask
{
LOG_DBG("search: input: sym=%d/0x%x, mods=0x%08x", sym, sym, mods);
const xkb_mod_mask_t ctrl = 1 << term->wl.kbd.mod_ctrl;
const xkb_mod_mask_t alt = 1 << term->wl.kbd.mod_alt;
//const xkb_mod_mask_t shift = 1 << term->wl.kbd.mod_shift;
//const xkb_mod_mask_t meta = 1 << term->wl.kbd.mod_meta;
const xkb_mod_mask_t ctrl = 1 << term->wl->kbd.mod_ctrl;
const xkb_mod_mask_t alt = 1 << term->wl->kbd.mod_alt;
//const xkb_mod_mask_t shift = 1 << term->wl->kbd.mod_shift;
//const xkb_mod_mask_t meta = 1 << term->wl->kbd.mod_meta;
enum xkb_compose_status compose_status = xkb_compose_state_get_status(
term->wl.kbd.xkb_compose_state);
term->wl->kbd.xkb_compose_state);
/* Cancel search */
if ((mods == 0 && sym == XKB_KEY_Escape) ||
@ -317,7 +317,7 @@ search_input(struct terminal *term, uint32_t key, xkb_keysym_t sym, xkb_mod_mask
/* "Commit" search - copy selection to primary and cancel search */
else if (mods == 0 && sym == XKB_KEY_Return) {
selection_finalize(term, term->wl.input_serial);
selection_finalize(term, term->wl->input_serial);
search_cancel_keep_selection(term);
return;
}
@ -449,11 +449,11 @@ search_input(struct terminal *term, uint32_t key, xkb_keysym_t sym, xkb_mod_mask
if (compose_status == XKB_COMPOSE_COMPOSED) {
count = xkb_compose_state_get_utf8(
term->wl.kbd.xkb_compose_state, (char *)buf, sizeof(buf));
xkb_compose_state_reset(term->wl.kbd.xkb_compose_state);
term->wl->kbd.xkb_compose_state, (char *)buf, sizeof(buf));
xkb_compose_state_reset(term->wl->kbd.xkb_compose_state);
} else {
count = xkb_state_key_get_utf8(
term->wl.kbd.xkb_state, key, (char *)buf, sizeof(buf));
term->wl->kbd.xkb_state, key, (char *)buf, sizeof(buf));
}
const char *src = (const char *)buf;

View file

@ -22,7 +22,7 @@ selection_enabled(const struct terminal *term)
{
return
term->mouse_tracking == MOUSE_NONE ||
term->wl.kbd.shift ||
term->wl->kbd.shift ||
term->is_searching;
}
@ -434,12 +434,12 @@ static const struct zwp_primary_selection_source_v1_listener primary_selection_s
bool
text_to_clipboard(struct terminal *term, char *text, uint32_t serial)
{
struct wl_clipboard *clipboard = &term->wl.clipboard;
struct wl_clipboard *clipboard = &term->wl->clipboard;
if (term->wl.clipboard.data_source != NULL) {
if (term->wl->clipboard.data_source != NULL) {
/* Kill previous data source */
assert(clipboard->serial != 0);
wl_data_device_set_selection(term->wl.data_device, NULL, clipboard->serial);
wl_data_device_set_selection(term->wl->data_device, NULL, clipboard->serial);
wl_data_source_destroy(clipboard->data_source);
free(clipboard->text);
@ -448,7 +448,7 @@ text_to_clipboard(struct terminal *term, char *text, uint32_t serial)
}
clipboard->data_source
= wl_data_device_manager_create_data_source(term->wl.data_device_manager);
= wl_data_device_manager_create_data_source(term->wl->data_device_manager);
if (clipboard->data_source == NULL) {
LOG_ERR("failed to create clipboard data source");
@ -460,7 +460,7 @@ text_to_clipboard(struct terminal *term, char *text, uint32_t serial)
/* Configure source */
wl_data_source_offer(clipboard->data_source, "text/plain;charset=utf-8");
wl_data_source_add_listener(clipboard->data_source, &data_source_listener, term);
wl_data_device_set_selection(term->wl.data_device, clipboard->data_source, serial);
wl_data_device_set_selection(term->wl->data_device, clipboard->data_source, serial);
wl_data_source_set_user_data(clipboard->data_source, clipboard);
/* Needed when sending the selection to other client */
@ -482,7 +482,7 @@ text_from_clipboard(struct terminal *term, uint32_t serial,
void (*cb)(const char *data, size_t size, void *user),
void *user)
{
struct wl_clipboard *clipboard = &term->wl.clipboard;
struct wl_clipboard *clipboard = &term->wl->clipboard;
if (clipboard->data_offer == NULL)
return;
@ -499,7 +499,7 @@ text_from_clipboard(struct terminal *term, uint32_t serial,
/* Give write-end of pipe to other client */
wl_data_offer_receive(
clipboard->data_offer, "text/plain;charset=utf-8", write_fd);
wl_display_roundtrip(term->wl.display);
wl_display_roundtrip(term->wl->display);
/* Don't keep our copy of the write-end open (or we'll never get EOF) */
close(write_fd);
@ -539,7 +539,7 @@ from_clipboard_cb(const char *data, size_t size, void *user)
void
selection_from_clipboard(struct terminal *term, uint32_t serial)
{
struct wl_clipboard *clipboard = &term->wl.clipboard;
struct wl_clipboard *clipboard = &term->wl->clipboard;
if (clipboard->data_offer == NULL)
return;
@ -555,18 +555,18 @@ selection_from_clipboard(struct terminal *term, uint32_t serial)
bool
text_to_primary(struct terminal *term, char *text, uint32_t serial)
{
if (term->wl.primary_selection_device_manager == NULL)
if (term->wl->primary_selection_device_manager == NULL)
return false;
struct wl_primary *primary = &term->wl.primary;
struct wl_primary *primary = &term->wl->primary;
/* TODO: somehow share code with the clipboard equivalent */
if (term->wl.primary.data_source != NULL) {
if (term->wl->primary.data_source != NULL) {
/* Kill previous data source */
assert(primary->serial != 0);
zwp_primary_selection_device_v1_set_selection(
term->wl.primary_selection_device, NULL, primary->serial);
term->wl->primary_selection_device, NULL, primary->serial);
zwp_primary_selection_source_v1_destroy(primary->data_source);
free(primary->text);
@ -576,7 +576,7 @@ text_to_primary(struct terminal *term, char *text, uint32_t serial)
primary->data_source
= zwp_primary_selection_device_manager_v1_create_source(
term->wl.primary_selection_device_manager);
term->wl->primary_selection_device_manager);
if (primary->data_source == NULL) {
LOG_ERR("failed to create clipboard data source");
@ -589,7 +589,7 @@ text_to_primary(struct terminal *term, char *text, uint32_t serial)
/* Configure source */
zwp_primary_selection_source_v1_offer(primary->data_source, "text/plain;charset=utf-8");
zwp_primary_selection_source_v1_add_listener(primary->data_source, &primary_selection_source_listener, term);
zwp_primary_selection_device_v1_set_selection(term->wl.primary_selection_device, primary->data_source, serial);
zwp_primary_selection_device_v1_set_selection(term->wl->primary_selection_device, primary->data_source, serial);
zwp_primary_selection_source_v1_set_user_data(primary->data_source, primary);
/* Needed when sending the selection to other client */
@ -600,7 +600,7 @@ text_to_primary(struct terminal *term, char *text, uint32_t serial)
void
selection_to_primary(struct terminal *term, uint32_t serial)
{
if (term->wl.primary_selection_device_manager == NULL)
if (term->wl->primary_selection_device_manager == NULL)
return;
/* Get selection as a string */
@ -614,10 +614,10 @@ text_from_primary(
struct terminal *term, void (*cb)(const char *data, size_t size, void *user),
void *user)
{
if (term->wl.primary_selection_device_manager == NULL)
if (term->wl->primary_selection_device_manager == NULL)
return;
struct wl_primary *primary = &term->wl.primary;
struct wl_primary *primary = &term->wl->primary;
if (primary->data_offer == NULL)
return;
@ -634,7 +634,7 @@ text_from_primary(
/* Give write-end of pipe to other client */
zwp_primary_selection_offer_v1_receive(
primary->data_offer, "text/plain;charset=utf-8", write_fd);
wl_display_roundtrip(term->wl.display);
wl_display_roundtrip(term->wl->display);
/* Don't keep our copy of the write-end open (or we'll never get EOF) */
close(write_fd);
@ -667,10 +667,10 @@ text_from_primary(
void
selection_from_primary(struct terminal *term)
{
if (term->wl.primary_selection_device_manager == NULL)
if (term->wl->primary_selection_device_manager == NULL)
return;
struct wl_clipboard *clipboard = &term->wl.clipboard;
struct wl_clipboard *clipboard = &term->wl->clipboard;
if (clipboard->data_offer == NULL)
return;

View file

@ -480,7 +480,7 @@ void
term_mouse_down(struct terminal *term, int button, int row, int col,
bool shift, bool alt, bool ctrl)
{
if (term->wl.kbd.shift) {
if (term->wl->kbd.shift) {
/* "raw" mouse mode */
return;
}
@ -513,7 +513,7 @@ void
term_mouse_up(struct terminal *term, int button, int row, int col,
bool shift, bool alt, bool ctrl)
{
if (term->wl.kbd.shift) {
if (term->wl->kbd.shift) {
/* "raw" mouse mode */
return;
}
@ -551,7 +551,7 @@ void
term_mouse_motion(struct terminal *term, int button, int row, int col,
bool shift, bool alt, bool ctrl)
{
if (term->wl.kbd.shift) {
if (term->wl->kbd.shift) {
/* "raw" mouse mode */
return;
}

View file

@ -246,7 +246,7 @@ struct terminal {
int max_x_advance;
} fextents;
struct wayland wl;
struct wayland *wl;
struct wl_window window;
struct {

View file

@ -12,7 +12,6 @@
#include "tllist.h"
struct monitor {
//struct terminal *term;
struct wayland *wayl;
struct wl_output *output;
struct zxdg_output_v1 *xdg;