xwm: split out weston_wm_window_set_pending_state_OR()

Having it in a separate function makes it more clear what it is, and
allows it to be called from elsewhere.

This really is the set_pending_state() alternative for override-redirect
windows, because OR windows do not get a frame window created. Also OR
windows will never hit the normal set_pending_state() because
weston_wm_window_schedule_repaint() special-cased windows without a
frame window and returned early without scheduling.

Signed-off-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Reviewed-by: Daniel Stone <daniels@collabora.com>
This commit is contained in:
Pekka Paalanen 2016-12-20 14:05:03 +02:00
parent 83626b95af
commit ed56883970

View file

@ -1216,28 +1216,39 @@ weston_wm_window_do_repaint(void *data)
weston_wm_window_set_pending_state(window);
}
static void
weston_wm_window_set_pending_state_OR(struct weston_wm_window *window)
{
int width, height;
/* for override-redirect windows */
assert(window->frame_id == XCB_WINDOW_NONE);
if (!window->surface)
return;
weston_wm_window_get_frame_size(window, &width, &height);
pixman_region32_fini(&window->surface->pending.opaque);
if (window->has_alpha) {
pixman_region32_init(&window->surface->pending.opaque);
} else {
pixman_region32_init_rect(&window->surface->pending.opaque, 0, 0,
width, height);
}
}
static void
weston_wm_window_schedule_repaint(struct weston_wm_window *window)
{
struct weston_wm *wm = window->wm;
int width, height;
if (window->frame_id == XCB_WINDOW_NONE) {
if (window->surface != NULL) {
/* Override-redirect windows go through here, but we
* cannot assert(window->override_redirect); because
* we do not deal with changing OR flag yet.
* XXX: handle OR flag changes in message handlers
*/
weston_wm_window_get_frame_size(window, &width, &height);
pixman_region32_fini(&window->surface->pending.opaque);
if (window->has_alpha) {
pixman_region32_init(&window->surface->pending.opaque);
} else {
pixman_region32_init_rect(&window->surface->pending.opaque, 0, 0,
width, height);
}
}
/* Override-redirect windows go through here, but we
* cannot assert(window->override_redirect); because
* we do not deal with changing OR flag yet.
* XXX: handle OR flag changes in message handlers
*/
weston_wm_window_set_pending_state_OR(window);
return;
}