[PATCH weston 6/8] window: Fix issue causing pointer to have the wrong sprite
Kristian Høgsberg
hoegsberg at gmail.com
Mon Oct 15 11:25:34 PDT 2012
On Thu, Sep 27, 2012 at 06:40:44PM +0200, Jonas Ådahl wrote:
> There is no event notifying when a move is finished and if a window
> requests to be moved but no move is performed and no enter/leave events
> are received, the pointer gets stuck in a grab-state. To avoid this,
> change the sprite to LEFT_PTR if an button-released event is received.
>
> Signed-off-by: Jonas Ådahl <jadahl at gmail.com>
Right, that's a problem, but I think we're better off just not setting
the cursor in the client. It was always a bit hacky and fragile that
the client should set the cursor for the servers grab. Today the
server sets the cursor with the help of desktop-shell, so we can just
drop the cursor setting code.
Kristian
> ---
> clients/window.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/clients/window.c b/clients/window.c
> index 330d96f..4d31964 100644
> --- a/clients/window.c
> +++ b/clients/window.c
> @@ -1798,6 +1798,9 @@ frame_button_handler(struct widget *widget,
> display->serial, location);
> break;
> }
> + } else if (button == BTN_LEFT &&
> + state == WL_POINTER_BUTTON_STATE_RELEASED) {
> + input_set_pointer_image(input, CURSOR_LEFT_PTR);
> } else if (button == BTN_RIGHT &&
> state == WL_POINTER_BUTTON_STATE_PRESSED) {
> window_show_frame_menu(window, input, time);
> @@ -2033,12 +2036,15 @@ pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial,
> state == WL_POINTER_BUTTON_STATE_PRESSED)
> input_grab(input, input->focus_widget, button);
>
> - widget = input->grab;
> + if (input->grab != NULL)
> + widget = input->grab;
> + else
> + widget = input->focus_widget;
> if (widget && widget->button_handler)
> (*widget->button_handler)(widget,
> input, time,
> button, state,
> - input->grab->user_data);
> + widget->user_data);
>
> if (input->grab && input->grab_button == button &&
> state == WL_POINTER_BUTTON_STATE_RELEASED)
> @@ -3216,7 +3222,7 @@ menu_motion_handler(struct widget *widget,
> {
> struct menu *menu = data;
>
> - if (widget == menu->widget)
> + if (input->focus_widget == menu->widget)
> menu_set_item(data, y);
>
> return CURSOR_LEFT_PTR;
> --
> 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