mirror of
https://github.com/tmux/tmux.git
synced 2025-12-26 19:56:03 +00:00
Try 2. Move popup focus flag into client struct.
This commit is contained in:
14
popup.c
14
popup.c
@@ -489,8 +489,6 @@ popup_key_cb(struct client *c, void *data, struct key_event *event)
|
||||
size_t len;
|
||||
u_int px, py, x;
|
||||
enum { NONE, LEFT, RIGHT, TOP, BOTTOM } border = NONE;
|
||||
struct window *w;
|
||||
struct window_pane *wp;
|
||||
|
||||
if (pd->md != NULL) {
|
||||
if (menu_key_cb(c, pd->md, event) == 1) {
|
||||
@@ -509,20 +507,16 @@ popup_key_cb(struct client *c, void *data, struct key_event *event)
|
||||
popup_handle_drag(c, pd, m);
|
||||
goto out;
|
||||
}
|
||||
w = c->session->curw->window;
|
||||
wp = w->active;
|
||||
if (m->x < pd->px ||
|
||||
m->x > pd->px + pd->sx - 1 ||
|
||||
m->y < pd->py ||
|
||||
m->y > pd->py + pd->sy - 1) {
|
||||
if (MOUSE_BUTTONS(m->b) == MOUSE_BUTTON_3)
|
||||
goto menu;
|
||||
wp->flags |= PANE_FOCUSED;
|
||||
pd->flags &= ~POPUP_FOCUSED;
|
||||
c->flags &= ~CLIENT_OVERLAYPOPUP_FOCUSED;
|
||||
return (0);
|
||||
}
|
||||
wp->flags &= ~PANE_FOCUSED;
|
||||
pd->flags |= POPUP_FOCUSED;
|
||||
c->flags |= CLIENT_OVERLAYPOPUP_FOCUSED;
|
||||
if (pd->border_lines != BOX_LINES_NONE) {
|
||||
if (m->x == pd->px)
|
||||
border = LEFT;
|
||||
@@ -569,7 +563,7 @@ popup_key_cb(struct client *c, void *data, struct key_event *event)
|
||||
bufferevent_write(job_get_event(pd->job), buf, len);
|
||||
return (0);
|
||||
}
|
||||
if (pd->flags & POPUP_FOCUSED)
|
||||
if (c->flags & CLIENT_OVERLAYPOPUP_FOCUSED)
|
||||
input_key(&pd->s, job_get_event(pd->job), event->key);
|
||||
}
|
||||
return (0);
|
||||
@@ -734,7 +728,7 @@ popup_display(int flags, enum box_lines lines, struct cmdq_item *item, u_int px,
|
||||
|
||||
server_client_set_overlay(c, 0, popup_check_cb, popup_mode_cb,
|
||||
popup_draw_cb, popup_key_cb, popup_free_cb, popup_resize_cb, pd);
|
||||
pd->flags |= POPUP_FOCUSED;
|
||||
c->flags |= CLIENT_OVERLAYPOPUP_FOCUSED;
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user