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

Kristian Høgsberg hoegsberg at gmail.com
Wed Jul 11 19:45:14 PDT 2012


On Thu, Jul 12, 2012 at 12:46:13AM +0300, Tiago Vignatti wrote:
> More pretty and also consistent with toytoolkit.

Looks good, just one comment below.

Kristian

> Signed-off-by: Tiago Vignatti <tiago.vignatti at intel.com>
> ---
>  src/xwayland/window-manager.c |   18 ++++++++----------
>  1 file changed, 8 insertions(+), 10 deletions(-)
> 
> diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c
> index 0f2b24d..ec5ae0a 100644
> --- a/src/xwayland/window-manager.c
> +++ b/src/xwayland/window-manager.c
> @@ -923,21 +923,18 @@ get_cursor_for_location(struct theme *t, int width, int height,
>  }
>  
>  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]);
> @@ -1006,7 +1003,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
> @@ -1020,7 +1017,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
> @@ -1249,6 +1246,8 @@ weston_wm_create_wm_window(struct weston_wm *wm)
>  				wm->wm_window,
>  				wm->atom.wm_s0,
>  				XCB_TIME_CURRENT_TIME);
> +
> +	weston_wm_window_set_cursor(wm, wm->screen->root, XWM_CURSOR_LEFT_PTR);

weston_wm_create_wm_window is an odd place to set this, lets just do
it from weston_wm_create().

>  }
>  
>  struct weston_wm *
> @@ -1314,6 +1313,7 @@ weston_wm_create(struct weston_xserver *wxs)
>  				     XCB_CW_EVENT_MASK, values);
>  	wm->theme = theme_create();
>  
> +	weston_wm_create_cursors(wm);
>  	weston_wm_create_wm_window(wm);
>  
>  	supported[0] = wm->atom.net_wm_moveresize;
> @@ -1333,8 +1333,6 @@ weston_wm_create(struct weston_xserver *wxs)
>  	wl_signal_add(&wxs->compositor->activate_signal,
>  		      &wm->activate_listener);
>  
> -	weston_wm_create_cursors(wm);
> -
>  	weston_log("created wm\n");
>  
>  	return wm;
> -- 
> 1.7.9.5
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list