Split configure_win into two

One for configuring root, one for regular windows.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-02-25 00:25:45 +00:00
parent 7a446ca1f4
commit f16d00a6a2
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 67 additions and 63 deletions

View File

@ -801,11 +801,10 @@ restack_win(session_t *ps, win *w, xcb_window_t new_above) {
}
}
void
configure_win(session_t *ps, xcb_configure_notify_event_t *ce) {
/// Handle configure event of a root window
void configure_root(session_t *ps, int width, int height) {
// On root window changes
auto bi = backend_list[ps->o.backend];
if (ce->window == ps->root) {
if (ps->o.experimental_backends) {
assert(bi);
if (!bi->root_change) {
@ -817,8 +816,8 @@ configure_win(session_t *ps, xcb_configure_notify_event_t *ce) {
free_paint(ps, &ps->tgt_buffer);
}
ps->root_width = ce->width;
ps->root_height = ce->height;
ps->root_width = width;
ps->root_height = height;
rebuild_screen_reg(ps);
rebuild_shadow_exclude_reg(ps);
@ -866,11 +865,12 @@ configure_win(session_t *ps, xcb_configure_notify_event_t *ce) {
}
}
force_repaint(ps);
return;
}
}
// Non-root window changes
/// Handle configure event of a regular window
void
configure_win(session_t *ps, xcb_configure_notify_event_t *ce) {
win *w = find_win(ps, ce->window);
region_t damage;
pixman_region32_init(&damage);
@ -1238,7 +1238,11 @@ inline static void
ev_configure_notify(session_t *ps, xcb_configure_notify_event_t *ev) {
log_trace("{ send_event: %d, id: %#010x, above: %#010x, override_redirect: %d }",
ev->event, ev->window, ev->above_sibling, ev->override_redirect);
if (ev->window == ps->root) {
configure_root(ps, ev->width, ev->height);
} else {
configure_win(ps, ev);
}
}
inline static void