This patch sets the cursor for the frame window only. The other case left is when the client itself performs a grab instead the titlebar drag. E.g. google-chrome without decoration does move a window (when click-n-drag the bar on the side of the tabs) but the cursor doesn't set back to the default one.
Signed-off-by: Tiago Vignatti <[email protected]> --- no changes since v1. src/xwayland/window-manager.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/xwayland/window-manager.c b/src/xwayland/window-manager.c index fc866a4..2ea574e 100644 --- a/src/xwayland/window-manager.c +++ b/src/xwayland/window-manager.c @@ -936,6 +936,7 @@ enum cursor_type { XWM_CURSOR_TOP_RIGHT, XWM_CURSOR_BOTTOM_LEFT, XWM_CURSOR_BOTTOM_RIGHT, + XWM_CURSOR_GRABBING, XWM_CURSOR_LEFT_PTR, }; @@ -948,6 +949,7 @@ static const char *cursors[] = { "top_right_corner", "bottom_left_corner", "bottom_right_corner", + "grabbing", "left_ptr" }; @@ -1032,7 +1034,7 @@ weston_wm_handle_button(struct weston_wm *wm, xcb_generic_event_t *event) struct weston_wm_window *window; enum theme_location location; struct theme *t = wm->theme; - int width, height; + int width, height, cursor; weston_log("XCB_BUTTON_%s (detail %d)\n", button->response_type == XCB_BUTTON_PRESS ? @@ -1050,6 +1052,11 @@ weston_wm_handle_button(struct weston_wm *wm, xcb_generic_event_t *event) switch (location) { case THEME_LOCATION_TITLEBAR: + /* desktop client shell will set the grabbing cursor + * regardless but xwayland needs to be aware about the + * cursor change as well so we repaint it */ + weston_wm_window_set_cursor(wm, window->frame_id, + XWM_CURSOR_GRABBING); shell_interface->move(window->shsurf, wm->server->compositor->seat); break; @@ -1068,6 +1075,11 @@ weston_wm_handle_button(struct weston_wm *wm, xcb_generic_event_t *event) default: break; } + } else if (button->response_type == XCB_BUTTON_RELEASE && + button->detail == 1) { + cursor = get_cursor_for_location(t, width, height, + button->event_x, button->event_y); + weston_wm_window_set_cursor(wm, window->frame_id, cursor); } } @@ -1075,6 +1087,7 @@ static void weston_wm_handle_motion(struct weston_wm *wm, xcb_generic_event_t *event) { xcb_motion_notify_event_t *motion = (xcb_motion_notify_event_t *) event; + struct weston_seat *seat = wm->server->compositor->seat; struct weston_wm_window *window; int cursor, width, height; @@ -1082,6 +1095,10 @@ weston_wm_handle_motion(struct weston_wm *wm, xcb_generic_event_t *event) if (!window) return; + /* don't change the cursor when pointer is performing a grab */ + if (seat->seat.pointer->focus != &window->surface->surface) + return; + weston_wm_window_get_frame_size(window, &width, &height); cursor = get_cursor_for_location(wm->theme, width, height, motion->event_x, motion->event_y); @@ -1111,12 +1128,17 @@ static void weston_wm_handle_leave(struct weston_wm *wm, xcb_generic_event_t *event) { xcb_leave_notify_event_t *leave = (xcb_leave_notify_event_t *) event; + struct weston_seat *seat = wm->server->compositor->seat; struct weston_wm_window *window; window = hash_table_lookup(wm->window_hash, leave->event); if (!window) return; + /* don't change the cursor when pointer is performing a grab */ + if (seat->seat.pointer->button_count != 0) + return; + weston_wm_window_set_cursor(wm, window->frame_id, XWM_CURSOR_LEFT_PTR); } -- 1.7.9.5 _______________________________________________ wayland-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/wayland-devel
