}
}
+static void
+binding_cancel(struct weston_keyboard_grab *grab)
+{
+ struct binding_keyboard_grab *binding_grab =
+ container_of(grab, struct binding_keyboard_grab, grab);
+
+ weston_keyboard_end_grab(grab->keyboard);
+ free(binding_grab);
+}
+
static const struct weston_keyboard_grab_interface binding_grab = {
binding_key,
binding_modifiers,
+ binding_cancel,
};
static void
void (*motion)(struct weston_pointer_grab *grab, uint32_t time);
void (*button)(struct weston_pointer_grab *grab,
uint32_t time, uint32_t button, uint32_t state);
+ void (*cancel)(struct weston_pointer_grab *grab);
};
struct weston_pointer_grab {
void (*modifiers)(struct weston_keyboard_grab *grab, uint32_t serial,
uint32_t mods_depressed, uint32_t mods_latched,
uint32_t mods_locked, uint32_t group);
+ void (*cancel)(struct weston_keyboard_grab *grab);
};
struct weston_keyboard_grab {
int touch_id,
wl_fixed_t sx,
wl_fixed_t sy);
+ void (*cancel)(struct weston_touch_grab *grab);
};
struct weston_touch_grab {
}
}
+static void
+drag_grab_cancel(struct weston_pointer_grab *grab)
+{
+ struct weston_drag *drag =
+ container_of(grab, struct weston_drag, grab);
+
+ if (drag->data_source)
+ wl_list_remove(&drag->data_source_listener.link);
+
+ data_device_end_drag_grab(drag);
+}
+
static const struct weston_pointer_grab_interface drag_grab_interface = {
drag_grab_focus,
drag_grab_motion,
drag_grab_button,
+ drag_grab_cancel,
};
static void
}
}
+static void
+default_grab_pointer_cancel(struct weston_pointer_grab *grab)
+{
+}
+
static const struct weston_pointer_grab_interface
default_pointer_grab_interface = {
default_grab_focus,
default_grab_motion,
- default_grab_button
+ default_grab_button,
+ default_grab_pointer_cancel,
};
static void
}
}
+static void
+default_grab_touch_cancel(struct weston_touch_grab *grab)
+{
+}
+
static const struct weston_touch_grab_interface default_touch_grab_interface = {
default_grab_touch_down,
default_grab_touch_up,
- default_grab_touch_motion
+ default_grab_touch_motion,
+ default_grab_touch_cancel,
};
static void
}
}
+static void
+default_grab_keyboard_cancel(struct weston_keyboard_grab *grab)
+{
+}
+
static const struct weston_keyboard_grab_interface
default_keyboard_grab_interface = {
default_grab_key,
default_grab_modifiers,
+ default_grab_keyboard_cancel,
};
static void
keyboard->grab = &keyboard->default_grab;
}
+static void
+weston_keyboard_cancel_grab(struct weston_keyboard *keyboard)
+{
+ keyboard->grab->interface->cancel(keyboard->grab);
+}
+
WL_EXPORT void
weston_pointer_start_grab(struct weston_pointer *pointer,
struct weston_pointer_grab *grab)
pointer->grab->interface->focus(pointer->grab);
}
+static void
+weston_pointer_cancel_grab(struct weston_pointer *pointer)
+{
+ pointer->grab->interface->cancel(pointer->grab);
+}
+
WL_EXPORT void
weston_touch_start_grab(struct weston_touch *touch, struct weston_touch_grab *grab)
{
touch->grab = &touch->default_grab;
}
+static void
+weston_touch_cancel_grab(struct weston_touch *touch)
+{
+ touch->grab->interface->cancel(touch->grab);
+}
+
WL_EXPORT void
weston_pointer_clamp(struct weston_pointer *pointer, wl_fixed_t *fx, wl_fixed_t *fy)
{
}
weston_keyboard_set_focus(keyboard, NULL);
- /* FIXME: We really need keyboard grab cancel here to
- * let the grab shut down properly. As it is we leak
- * the grab data. */
- weston_keyboard_end_grab(keyboard);
+ weston_keyboard_cancel_grab(keyboard);
}
WL_EXPORT void
seat->keyboard_device_count--;
if (seat->keyboard_device_count == 0) {
weston_keyboard_set_focus(seat->keyboard, NULL);
+ weston_keyboard_cancel_grab(seat->keyboard);
seat_send_updated_caps(seat);
}
}
weston_pointer_set_focus(pointer, NULL,
wl_fixed_from_int(0),
wl_fixed_from_int(0));
+ weston_pointer_cancel_grab(pointer);
if (pointer->sprite)
pointer_unmap_sprite(pointer);
seat->touch_device_count--;
if (seat->touch_device_count == 0) {
weston_touch_set_focus(seat, NULL);
+ weston_touch_cancel_grab(seat->touch);
seat_send_updated_caps(seat);
}
}
weston_compositor_schedule_repaint(es->compositor);
}
+static void
+touch_move_grab_cancel(struct weston_touch_grab *grab)
+{
+ struct weston_touch_move_grab *move =
+ (struct weston_touch_move_grab *) container_of(
+ grab, struct shell_touch_grab, grab);
+
+ shell_touch_grab_end(&move->base);
+ free(move);
+}
+
static const struct weston_touch_grab_interface touch_move_grab_interface = {
touch_move_grab_down,
touch_move_grab_up,
touch_move_grab_motion,
+ touch_move_grab_cancel,
};
static int
}
}
+static void
+move_grab_cancel(struct weston_pointer_grab *grab)
+{
+ struct shell_grab *shell_grab =
+ container_of(grab, struct shell_grab, grab);
+
+ shell_grab_end(shell_grab);
+ free(grab);
+}
+
static const struct weston_pointer_grab_interface move_grab_interface = {
noop_grab_focus,
move_grab_motion,
move_grab_button,
+ move_grab_cancel,
};
static int
}
}
+static void
+resize_grab_cancel(struct weston_pointer_grab *grab)
+{
+ struct weston_resize_grab *resize = (struct weston_resize_grab *) grab;
+
+ shell_grab_end(&resize->base);
+ free(grab);
+}
+
static const struct weston_pointer_grab_interface resize_grab_interface = {
noop_grab_focus,
resize_grab_motion,
resize_grab_button,
+ resize_grab_cancel,
};
/*
}
}
+static void
+busy_cursor_grab_cancel(struct weston_pointer_grab *base)
+{
+ struct shell_grab *grab = (struct shell_grab *) base;
+
+ shell_grab_end(grab);
+ free(grab);
+}
+
static const struct weston_pointer_grab_interface busy_cursor_grab_interface = {
busy_cursor_grab_focus,
busy_cursor_grab_motion,
busy_cursor_grab_button,
+ busy_cursor_grab_cancel,
};
static void
shseat->popup_grab.initial_up = 1;
}
+static void
+popup_grab_cancel(struct weston_pointer_grab *grab)
+{
+ popup_grab_end(grab->pointer);
+}
+
static const struct weston_pointer_grab_interface popup_grab_interface = {
popup_grab_focus,
popup_grab_motion,
popup_grab_button,
+ popup_grab_cancel,
};
static void
}
}
+static void
+rotate_grab_cancel(struct weston_pointer_grab *grab)
+{
+ struct rotate_grab *rotate =
+ container_of(grab, struct rotate_grab, base.grab);
+
+ shell_grab_end(&rotate->base);
+ free(rotate);
+}
+
static const struct weston_pointer_grab_interface rotate_grab_interface = {
noop_grab_focus,
rotate_grab_motion,
rotate_grab_button,
+ rotate_grab_cancel,
};
static void
switcher_destroy(switcher);
}
+static void
+switcher_cancel(struct weston_keyboard_grab *grab)
+{
+ struct switcher *switcher = container_of(grab, struct switcher, grab);
+
+ switcher_destroy(switcher);
+}
+
static const struct weston_keyboard_grab_interface switcher_grab = {
switcher_key,
switcher_modifier,
+ switcher_cancel,
};
static void
}
}
+static void
+debug_binding_cancel(struct weston_keyboard_grab *grab)
+{
+ struct debug_binding_grab *db = (struct debug_binding_grab *) grab;
+
+ weston_keyboard_end_grab(grab->keyboard);
+ free(db);
+}
+
struct weston_keyboard_grab_interface debug_binding_keyboard_grab = {
debug_binding_key,
- debug_binding_modifiers
+ debug_binding_modifiers,
+ debug_binding_cancel,
};
static void
mods_locked, group);
}
+static void
+input_method_context_grab_cancel(struct weston_keyboard_grab *grab)
+{
+ weston_keyboard_end_grab(grab->keyboard);
+}
+
static const struct weston_keyboard_grab_interface input_method_context_grab = {
input_method_context_grab_key,
input_method_context_grab_modifier,
+ input_method_context_grab_cancel,
};
static void