summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTiago Vignatti <tiago.vignatti@intel.com>2012-06-05 14:59:08 +0300
committerTiago Vignatti <tiago.vignatti@intel.com>2012-06-11 20:33:36 +0300
commit9ee1403b44fe72e261e8cd16cc53656308ba0676 (patch)
treedd4ac74f9b186cf162d6e2d23e4de2f5aadd7bb1
parent69435ad21ede8010ef072a9d481730813b891eef (diff)
xwm: set opaque area for non-decorated surfaces
the lack of it was causing ugly artifacts on those. Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
-rw-r--r--src/xwayland/window-manager.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
index 278081a..0831bef 100644
--- a/src/xwayland/window-manager.c
+++ b/src/xwayland/window-manager.c
@@ -600,6 +600,37 @@ weston_wm_handle_unmap_notify(struct weston_wm *wm, xcb_generic_event_t *event)
}
static void
+weston_wm_window_draw_opaque(void *data)
+{
+ struct weston_wm_window *window = data;
+ struct weston_wm *wm = window->wm;
+ struct theme *t = wm->theme;
+ int x, y, width, height;
+
+ window->repaint_source = NULL;
+
+ if (!window->surface)
+ return;
+
+ weston_wm_window_get_frame_size(window, &width, &height);
+ weston_wm_window_get_child_position(window, &x, &y);
+
+ /* We leave an extra pixel around the X window area to
+ * make sure we don't sample from the undefined alpha
+ * channel when filtering. */
+ window->surface->opaque_rect[0] =
+ (double) (x - t->margin - 1) / width;
+ window->surface->opaque_rect[1] =
+ (double) (x + window->width + t->margin + 1) / width;
+ window->surface->opaque_rect[2] =
+ (double) (y - t->margin - 1) / height;
+ window->surface->opaque_rect[3] =
+ (double) (y + window->height + t->margin + 1) / height;
+
+ pixman_region32_init_rect(&window->surface->input, 0, 0, width, height);
+}
+
+static void
weston_wm_window_draw_decoration(void *data)
{
struct weston_wm_window *window = data;
@@ -666,13 +697,19 @@ static void
weston_wm_window_schedule_repaint(struct weston_wm_window *window)
{
struct weston_wm *wm = window->wm;
+ void *function;
- if (window->frame_id == XCB_WINDOW_NONE || window->repaint_source)
+ if (window->repaint_source)
return;
+ if (window->frame_id == XCB_WINDOW_NONE)
+ function = weston_wm_window_draw_opaque;
+ else
+ function = weston_wm_window_draw_decoration;
+
window->repaint_source =
wl_event_loop_add_idle(wm->server->loop,
- weston_wm_window_draw_decoration,
+ function,
window);
}