mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-02-05 04:06:11 -05:00
backend/x11: only send frames when the window is mapped
Tested with WindowMaker. When switching to another workspace, minimizing, or rolling up the window, we get an UnmapNotify event, and a corresponding MapNotify event when the window appears on screen again. Fixes #2675
This commit is contained in:
parent
ef94e7e847
commit
04d448317a
3 changed files with 26 additions and 4 deletions
|
|
@ -116,14 +116,32 @@ static void handle_x11_event(struct wlr_x11_backend *x11,
|
|||
}
|
||||
break;
|
||||
}
|
||||
case XCB_UNMAP_NOTIFY: {
|
||||
xcb_unmap_notify_event_t *ev = (xcb_unmap_notify_event_t *)event;
|
||||
struct wlr_x11_output *output =
|
||||
get_x11_output_from_window_id(x11, ev->window);
|
||||
if (output != NULL) {
|
||||
wlr_log(WLR_DEBUG, "Window unmapped, stopping updates");
|
||||
output->mapped = false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case XCB_MAP_NOTIFY: {
|
||||
xcb_unmap_notify_event_t *ev = (xcb_unmap_notify_event_t *)event;
|
||||
struct wlr_x11_output *output =
|
||||
get_x11_output_from_window_id(x11, ev->window);
|
||||
if (output != NULL) {
|
||||
wlr_log(WLR_DEBUG, "Window mapped, resuming updates");
|
||||
output->mapped = true;
|
||||
wlr_output_send_frame(&output->wlr_output);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 0: {
|
||||
xcb_value_error_t *ev = (xcb_value_error_t *)event;
|
||||
handle_x11_error(x11, ev);
|
||||
break;
|
||||
}
|
||||
case XCB_UNMAP_NOTIFY:
|
||||
case XCB_MAP_NOTIFY:
|
||||
break;
|
||||
default:
|
||||
handle_x11_unknown_event(x11, event);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -600,6 +600,8 @@ struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend) {
|
|||
xcb_map_window(x11->xcb, output->win);
|
||||
xcb_flush(x11->xcb);
|
||||
|
||||
output->mapped = true;
|
||||
|
||||
wl_list_insert(&x11->outputs, &output->link);
|
||||
|
||||
wlr_output_update_enabled(wlr_output, true);
|
||||
|
|
@ -740,7 +742,8 @@ void handle_x11_present_event(struct wlr_x11_backend *x11,
|
|||
};
|
||||
wlr_output_send_present(&output->wlr_output, &present_event);
|
||||
|
||||
wlr_output_send_frame(&output->wlr_output);
|
||||
if (output->mapped)
|
||||
wlr_output_send_frame(&output->wlr_output);
|
||||
break;
|
||||
default:
|
||||
wlr_log(WLR_DEBUG, "Unhandled Present event %"PRIu16, event->event_type);
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ struct wlr_x11_output {
|
|||
pixman_region32_t exposed;
|
||||
|
||||
uint64_t last_msc;
|
||||
bool mapped;
|
||||
|
||||
struct {
|
||||
struct wlr_swapchain *swapchain;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue