diff options
author | Tiago Vignatti <tiago.vignatti@intel.com> | 2012-12-19 13:02:24 -0200 |
---|---|---|
committer | Tiago Vignatti <tiago.vignatti@intel.com> | 2012-12-28 14:26:20 -0200 |
commit | cb6fa5dbd24fa24d53f54b7b4aeba0f1b8a6edfa (patch) | |
tree | acb6f7a7ef3e89b63480abc147b805431876e09f | |
parent | f0ad69123576e856380ba0133c00632437bbbb43 (diff) |
clients: xwm: Fix frame repaint
It brings back a feature we removed previously:
#4 drawing scheduling and window activation
Tested-by: Scott Moreau <oreaus@gmail.com>
Signed-off-by: Tiago Vignatti <tiago.vignatti@intel.com>
-rw-r--r-- | clients/xwm.c | 42 | ||||
-rw-r--r-- | src/xwayland/window-manager.c | 10 |
2 files changed, 37 insertions, 15 deletions
diff --git a/clients/xwm.c b/clients/xwm.c index 754ae62..5a6f68c 100644 --- a/clients/xwm.c +++ b/clients/xwm.c @@ -49,10 +49,15 @@ struct xwm { struct xwm_window { struct xwm_wm *wm; xcb_window_t id; - xcb_window_t frame_id; struct wm_xwin *xwin; + + /* frame border decoration */ + xcb_window_t frame_id; struct wm_xwin *xwin_frame; cairo_surface_t *cairo_surface; + struct task paint_task; + int repaint_scheduled; + int properties_dirty; int pid; char *machine; @@ -119,6 +124,29 @@ struct motif_wm_hints { static void xwm_window_draw_decoration(struct xwm_window *window); +static void +xwm_schedule_task(struct task *task, uint32_t events) +{ + struct xwm_window *window = + container_of(task, struct xwm_window, paint_task); + + xwm_window_draw_decoration(window); + window->repaint_scheduled = 0; +} + +static void +xwm_window_schedule_repaint(struct xwm_window *window) +{ + struct xwm_wm *wm = window->wm; + + if (window->repaint_scheduled) + return; + + window->paint_task.run = xwm_schedule_task; + display_defer(wm->xwm->display, &window->paint_task); + window->repaint_scheduled = 1; +} + const char * get_atom_name(xcb_connection_t *c, xcb_atom_t atom) { @@ -456,7 +484,7 @@ xwm_handle_configure_request(struct xwm_wm *wm, xcb_generic_event_t *event) mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; xcb_configure_window(wm->conn, window->frame_id, mask, values); - xwm_window_draw_decoration(window); + xwm_window_schedule_repaint(window); } static void @@ -557,7 +585,7 @@ handle_configure(void *data, struct wm_xwin *xwin, uint32_t edges, values); xcb_flush(wm->conn); - xwm_window_draw_decoration(window); + xwm_window_schedule_repaint(window); } static void @@ -588,10 +616,10 @@ set_state_activate(struct xwm *xwm, struct xwm_window *window) } if (wm->focus_window) - xwm_window_draw_decoration(wm->focus_window); + xwm_window_schedule_repaint(wm->focus_window); wm->focus_window = window; if (wm->focus_window) - xwm_window_draw_decoration(wm->focus_window); + xwm_window_schedule_repaint(wm->focus_window); } static void @@ -804,6 +832,7 @@ xwm_window_draw_decoration(struct xwm_window *window) cairo_set_source_rgba(cr, 0, 0, 0, 0.45); tile_mask(cr, t->shadow, 2, 2, width + 8, height + 8, 64, 64); } + xcb_flush(window->wm->conn); cairo_destroy(cr); #if 0 @@ -851,7 +880,7 @@ xwm_handle_property_notify(struct xwm_wm *wm, xcb_generic_event_t *event) if (property_notify->atom == wm->atom.net_wm_name || property_notify->atom == XCB_ATOM_WM_NAME) - xwm_window_draw_decoration(window); + xwm_window_schedule_repaint(window); } static void @@ -873,6 +902,7 @@ xwm_window_create(struct xwm_wm *wm, memset(window, 0, sizeof *window); window->wm = wm; window->id = id; + window->repaint_scheduled = 0; window->properties_dirty = 1; window->override_redirect = override; window->width = width; diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c index 4648109..ee9ce95 100644 --- a/src/xwayland/window-manager.c +++ b/src/xwayland/window-manager.c @@ -107,21 +107,15 @@ xserver_handle_window_surface(struct wl_client *client, break; if (window == NULL) { - fprintf(stderr, "set_window_id for unknown window %d\n", xid); + weston_log("unknown window %d\n", xid); return; } - fprintf(stderr, "set_window_id %d for surface %p\n", xid, surface); - -// weston_wm_window_read_properties(window); - window->surface = surface; window->surface_destroy_listener.notify = surface_destroy; wl_signal_add(&surface->resource.destroy_signal, &window->surface_destroy_listener); -// weston_wm_window_draw_decoration(window); - window->shsurf = shell_interface->create_shell_surface(shell_interface->shell, weston_surface, @@ -141,7 +135,6 @@ wm_xwin_handle_set_window(struct wl_client *client, { struct xserver_window *window = resource->data; - fprintf(stderr, "%s: %d\n", __func__, window->xid); window->x = x; window->y = y; window->width = width; @@ -255,7 +248,6 @@ wm_handle_create_xwindow(struct wl_client *client, struct weston_xserver *wxs = resource->data; struct xserver_window *window; - fprintf(stderr, "%s: xid: %d\n", __func__, xid); window = malloc(sizeof *window); if (!window) { wl_resource_post_no_memory(resource); |