diff --git a/popup.c b/popup.c index c13a38cf..826e1571 100644 --- a/popup.c +++ b/popup.c @@ -136,7 +136,7 @@ popup_write_screen(struct client *c, struct popup_data *pd) screen_write_stop(&ctx); } -static int +static struct screen * popup_mode_cb(struct client *c, u_int *cx, u_int *cy) { struct popup_data *pd = c->overlay_data; @@ -145,7 +145,7 @@ popup_mode_cb(struct client *c, u_int *cx, u_int *cy) return (0); *cx = pd->px + 1 + pd->s.cx; *cy = pd->py + 1 + pd->s.cy; - return (pd->s.mode); + return (&pd->s); } static int diff --git a/server-client.c b/server-client.c index 5f7ce6b8..23435b48 100644 --- a/server-client.c +++ b/server-client.c @@ -1542,7 +1542,7 @@ server_client_reset_state(struct client *c) struct window_pane *wp = w->active, *loop; struct screen *s; struct options *oo = c->session->options; - int mode, cursor, flags; + int mode = 0, cursor, flags; u_int cx = 0, cy = 0, ox, oy, sx, sy; if (c->flags & (CLIENT_CONTROL|CLIENT_SUSPENDED)) @@ -1553,18 +1553,14 @@ server_client_reset_state(struct client *c) tty->flags &= ~TTY_BLOCK; /* Get mode from overlay if any, else from screen. */ - if (c->overlay_draw != NULL) { - s = NULL; - if (c->overlay_mode == NULL) - mode = 0; - else - mode = c->overlay_mode(c, &cx, &cy); - } else { + if (c->overlay_draw != NULL && c->overlay_mode != NULL) + s = c->overlay_mode(c, &cx, &cy); + else s = wp->screen; + if (s != NULL) mode = s->mode; - if (c->prompt_string != NULL || c->message_string != NULL) - mode &= ~MODE_CURSOR; - } + if (c->prompt_string != NULL || c->message_string != NULL) + mode &= ~MODE_CURSOR; log_debug("%s: client %s mode %x", __func__, c->name, mode); /* Reset region and margin. */ diff --git a/tmux.h b/tmux.h index 726fdb26..15a8506f 100644 --- a/tmux.h +++ b/tmux.h @@ -1509,7 +1509,7 @@ RB_HEAD(client_files, client_file); typedef int (*prompt_input_cb)(struct client *, void *, const char *, int); typedef void (*prompt_free_cb)(void *); typedef int (*overlay_check_cb)(struct client *, u_int, u_int); -typedef int (*overlay_mode_cb)(struct client *, u_int *, u_int *); +typedef struct screen *(*overlay_mode_cb)(struct client *, u_int *, u_int *); typedef void (*overlay_draw_cb)(struct client *, struct screen_redraw_ctx *); typedef int (*overlay_key_cb)(struct client *, struct key_event *); typedef void (*overlay_free_cb)(struct client *);