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 <jad...@gmail.com>
---
 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@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to