[PATCH weston 09/17] xwm: Get rid of compositor loop handlers

Tiago Vignatti tiago.vignatti at intel.com
Fri Nov 30 11:20:04 PST 2012


Warning: this removes functionality (#4)

In preparation for split xwm as a client, we want to get rid of all
interactions of the compositor event loop here. Decorations and configure
mechanisms will be overhauled later anyway.

Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
---
 src/xwayland/window-manager.c |   76 ++++++++++++-----------------------------
 1 file changed, 22 insertions(+), 54 deletions(-)

diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
index 16d592a..806cf8d 100644
--- a/src/xwayland/window-manager.c
+++ b/src/xwayland/window-manager.c
@@ -100,8 +100,6 @@ struct weston_wm_window {
 	struct weston_surface *surface;
 	struct shell_surface *shsurf;
 	struct wl_listener surface_destroy_listener;
-	struct wl_event_source *repaint_source;
-	struct wl_event_source *configure_source;
 	int properties_dirty;
 	int pid;
 	char *machine;
@@ -120,7 +118,7 @@ static struct weston_wm_window *
 get_wm_window(struct weston_surface *surface);
 
 static void
-weston_wm_window_schedule_repaint(struct weston_wm_window *window);
+weston_wm_window_draw_decoration(struct weston_wm_window *window);
 
 const char *
 get_atom_name(xcb_connection_t *c, xcb_atom_t atom)
@@ -459,7 +457,7 @@ weston_wm_handle_configure_request(struct weston_wm *wm, xcb_generic_event_t *ev
 	mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT;
 	xcb_configure_window(wm->conn, window->frame_id, mask, values);
 
-	weston_wm_window_schedule_repaint(window);
+	weston_wm_window_draw_decoration(window);
 }
 
 static void
@@ -537,10 +535,10 @@ weston_wm_window_activate(struct wl_listener *listener, void *data)
 	}
 
 	if (wm->focus_window)
-		weston_wm_window_schedule_repaint(wm->focus_window);
+		weston_wm_window_draw_decoration(wm->focus_window);
 	wm->focus_window = window;
 	if (wm->focus_window)
-		weston_wm_window_schedule_repaint(wm->focus_window);
+		weston_wm_window_draw_decoration(wm->focus_window);
 }
 
 static int
@@ -680,8 +678,6 @@ weston_wm_handle_unmap_notify(struct weston_wm *wm, xcb_generic_event_t *event)
 		return;
 
 	window = hash_table_lookup(wm->window_hash, unmap_notify->window);
-	if (window->repaint_source)
-		wl_event_source_remove(window->repaint_source);
 	if (window->cairo_surface)
 		cairo_surface_destroy(window->cairo_surface);
 
@@ -701,9 +697,8 @@ weston_wm_handle_unmap_notify(struct weston_wm *wm, xcb_generic_event_t *event)
 }
 
 static void
-weston_wm_window_draw_decoration(void *data)
+weston_wm_window_draw_decoration(struct weston_wm_window *window)
 {
-	struct weston_wm_window *window = data;
 	struct weston_wm *wm = window->wm;
 	struct theme *t = wm->theme;
 	cairo_t *cr;
@@ -711,9 +706,19 @@ weston_wm_window_draw_decoration(void *data)
 	const char *title;
 	uint32_t flags = 0;
 
-	weston_wm_window_read_properties(window);
+	if (window->frame_id == XCB_WINDOW_NONE) {
+#if 0
+		if (window->surface != NULL) {
+			window->surface->opaque_rect[0] = 0.0;
+			window->surface->opaque_rect[1] = 1.0;
+			window->surface->opaque_rect[2] = 0.0;
+			window->surface->opaque_rect[3] = 1.0;
+		}
+#endif
+		return;
+	}
 
-	window->repaint_source = NULL;
+	weston_wm_window_read_properties(window);
 
 	weston_wm_window_get_frame_size(window, &width, &height);
 	weston_wm_window_get_child_position(window, &x, &y);
@@ -767,34 +772,6 @@ weston_wm_window_draw_decoration(void *data)
 }
 
 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 0
-		if (window->surface != NULL) {
-			weston_wm_window_get_frame_size(window, &width, &height);
-			pixman_region32_fini(&window->surface->pending.opaque);
-			pixman_region32_init_rect(&window->surface->pending.opaque, 0, 0,
-						  width, height);
-			window->surface->geometry.dirty = 1;
-		}
-#endif
-		return;
-	}
-
-	if (window->repaint_source)
-		return;
-
-	window->repaint_source =
-		wl_event_loop_add_idle(wm->server->loop,
-				       weston_wm_window_draw_decoration,
-				       window);
-}
-
-static void
 weston_wm_handle_property_notify(struct weston_wm *wm, xcb_generic_event_t *event)
 {
 	xcb_property_notify_event_t *property_notify =
@@ -815,7 +792,7 @@ weston_wm_handle_property_notify(struct weston_wm *wm, xcb_generic_event_t *even
 
 	if (property_notify->atom == wm->atom.net_wm_name ||
 	    property_notify->atom == XCB_ATOM_WM_NAME)
-		weston_wm_window_schedule_repaint(window);
+		weston_wm_window_draw_decoration(window);
 }
 
 static void
@@ -1552,9 +1529,8 @@ get_wm_window(struct weston_surface *surface)
 }
 
 static void
-weston_wm_window_configure(void *data)
+weston_wm_window_configure(struct weston_wm_window *window)
 {
-	struct weston_wm_window *window = data;
 	struct weston_wm *wm = window->wm;
 	uint32_t values[2];
 	int width, height;
@@ -1576,9 +1552,7 @@ weston_wm_window_configure(void *data)
 			     XCB_CONFIG_WINDOW_HEIGHT,
 			     values);
 
-	window->configure_source = NULL;
-
-	weston_wm_window_schedule_repaint(window);
+	weston_wm_window_draw_decoration(window);
 }
 
 static void
@@ -1586,7 +1560,6 @@ send_configure(struct weston_surface *surface,
 	       uint32_t edges, int32_t width, int32_t height)
 {
 	struct weston_wm_window *window = get_wm_window(surface);
-	struct weston_wm *wm = window->wm;
 	struct theme *t = window->wm->theme;
 
 	if (window->decorate) {
@@ -1598,12 +1571,7 @@ send_configure(struct weston_surface *surface,
 		window->height = height - 2 * t->margin;
 	}
 
-	if (window->configure_source)
-		return;
-
-	window->configure_source =
-		wl_event_loop_add_idle(wm->server->loop,
-				       weston_wm_window_configure, window);
+	weston_wm_window_configure(window);
 }
 
 static const struct weston_shell_client shell_client = {
@@ -1639,7 +1607,7 @@ xserver_set_window_id(struct wl_client *client, struct wl_resource *resource,
 	wl_signal_add(&surface->resource.destroy_signal,
 		      &window->surface_destroy_listener);
 
-	weston_wm_window_schedule_repaint(window);
+	weston_wm_window_draw_decoration(window);
 
 	window->shsurf =
 		shell_interface->create_shell_surface(shell_interface->shell,
-- 
1.7.9.5



More information about the wayland-devel mailing list