Fix root change handling when screen is unredirected

If screen is not redirected, we don't need to reinitialize the backend
when we got a root change event.

Fixes #189

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-06-15 23:04:49 +01:00
parent 863e2c82ec
commit 5a034ea169
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
1 changed files with 41 additions and 36 deletions

View File

@ -747,9 +747,11 @@ static bool initialize_backend(session_t *ps) {
/// Handle configure event of a root window
void configure_root(session_t *ps, int width, int height) {
log_info("Root configuration changed, new geometry: %dx%d", width, height);
// On root window changes
bool has_root_change = false;
if (ps->redirected) {
// On root window changes
if (ps->o.experimental_backends) {
assert(ps->backend_data);
has_root_change = ps->backend_data->ops->root_change != NULL;
} else {
// Old backend can handle root change
@ -762,16 +764,13 @@ void configure_root(session_t *ps, int width, int height) {
destroy_backend(ps);
}
free_paint(ps, &ps->tgt_buffer);
}
ps->root_width = width;
ps->root_height = height;
rebuild_screen_reg(ps);
rebuild_shadow_exclude_reg(ps);
for (int i = 0; i < ps->ndamage; i++) {
pixman_region32_clear(&ps->damage_ring[i]);
}
ps->damage = ps->damage_ring + ps->ndamage - 1;
// Invalidate reg_ignore from the top
auto top_w = win_stack_find_next_managed(ps, &ps->window_stack);
@ -780,6 +779,11 @@ void configure_root(session_t *ps, int width, int height) {
top_w->reg_ignore_valid = false;
}
if (ps->redirected) {
for (int i = 0; i < ps->ndamage; i++) {
pixman_region32_clear(&ps->damage_ring[i]);
}
ps->damage = ps->damage_ring + ps->ndamage - 1;
#ifdef CONFIG_OPENGL
// GLX root change callback
if (BKEND_GLX == ps->o.backend && !ps->o.experimental_backends) {
@ -804,6 +808,7 @@ void configure_root(session_t *ps, int width, int height) {
}
}
force_repaint(ps);
}
return;
}