[PATCH v2 weston 4/6] xwm: set the root window pointer to left_ptr

Tiago Vignatti tiago.vignatti at intel.com
Mon Jul 16 07:32:25 PDT 2012


More pretty and also consistent with toytoolkit.

Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
---
v2: set root cursor inside weston_wm_create.

 src/xwayland/window-manager.c |   16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
index 4d6622e..fc866a4 100644
--- a/src/xwayland/window-manager.c
+++ b/src/xwayland/window-manager.c
@@ -1006,21 +1006,18 @@ get_cursor_for_location(struct theme *t, int width, int height, int x, int y)
 }
 
 static void
-weston_wm_frame_set_cursor(struct weston_wm *wm,
-			   struct weston_wm_window *window, int cursor)
+weston_wm_window_set_cursor(struct weston_wm *wm, xcb_window_t window_id,
+			    int cursor)
 {
 	uint32_t cursor_value_list;
 
-	if (!window->frame_id)
-		return;
-
 	if (wm->last_cursor == cursor)
 		return;
 
 	wm->last_cursor = cursor;
 
 	cursor_value_list = wm->cursors[cursor];
-	xcb_change_window_attributes (wm->conn, window->frame_id,
+	xcb_change_window_attributes (wm->conn, window_id,
 				      XCB_CW_CURSOR, &cursor_value_list);
 	xcb_flush(wm->conn);
 	weston_log("%s: %s\n", __func__, cursors[cursor]);
@@ -1089,7 +1086,7 @@ weston_wm_handle_motion(struct weston_wm *wm, xcb_generic_event_t *event)
 	cursor = get_cursor_for_location(wm->theme, width, height,
 					 motion->event_x, motion->event_y);
 
-	weston_wm_frame_set_cursor(wm, window, cursor);
+	weston_wm_window_set_cursor(wm, window->frame_id, cursor);
 }
 
 static void
@@ -1107,7 +1104,7 @@ weston_wm_handle_enter(struct weston_wm *wm, xcb_generic_event_t *event)
 	cursor = get_cursor_for_location(wm->theme, width, height,
 					 enter->event_x, enter->event_y);
 
-	weston_wm_frame_set_cursor(wm, window, cursor);
+	weston_wm_window_set_cursor(wm, window->frame_id, cursor);
 }
 
 static void
@@ -1120,7 +1117,7 @@ weston_wm_handle_leave(struct weston_wm *wm, xcb_generic_event_t *event)
 	if (!window)
 		return;
 
-	weston_wm_frame_set_cursor(wm, window, XWM_CURSOR_LEFT_PTR);
+	weston_wm_window_set_cursor(wm, window->frame_id, XWM_CURSOR_LEFT_PTR);
 }
 
 static int
@@ -1453,6 +1450,7 @@ weston_wm_create(struct weston_xserver *wxs)
 		      &wm->activate_listener);
 
 	weston_wm_create_cursors(wm);
+	weston_wm_window_set_cursor(wm, wm->screen->root, XWM_CURSOR_LEFT_PTR);
 
 	weston_log("created wm\n");
 
-- 
1.7.9.5



More information about the wayland-devel mailing list