mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-25 22:25:58 +01:00
rootston: only allow one drag icon per seat
This commit is contained in:
parent
d6de329d98
commit
faa00a4a33
4 changed files with 15 additions and 16 deletions
|
@ -29,7 +29,7 @@ struct roots_seat {
|
||||||
struct wl_list views; // roots_seat_view::link
|
struct wl_list views; // roots_seat_view::link
|
||||||
bool has_focus;
|
bool has_focus;
|
||||||
|
|
||||||
struct wl_list drag_icons; // roots_drag_icon::link
|
struct roots_drag_icon *drag_icon; // can be NULL
|
||||||
|
|
||||||
struct wl_list keyboards;
|
struct wl_list keyboards;
|
||||||
struct wl_list pointers;
|
struct wl_list pointers;
|
||||||
|
@ -61,7 +61,6 @@ struct roots_seat_view {
|
||||||
struct roots_drag_icon {
|
struct roots_drag_icon {
|
||||||
struct roots_seat *seat;
|
struct roots_seat *seat;
|
||||||
struct wlr_drag_icon *wlr_drag_icon;
|
struct wlr_drag_icon *wlr_drag_icon;
|
||||||
struct wl_list link;
|
|
||||||
|
|
||||||
double x, y;
|
double x, y;
|
||||||
|
|
||||||
|
|
|
@ -151,9 +151,8 @@ static void roots_passthrough_cursor(struct roots_cursor *cursor,
|
||||||
wlr_seat_pointer_clear_focus(seat->seat);
|
wlr_seat_pointer_clear_focus(seat->seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct roots_drag_icon *drag_icon;
|
if (seat->drag_icon != NULL) {
|
||||||
wl_list_for_each(drag_icon, &seat->drag_icons, link) {
|
roots_drag_icon_update_position(seat->drag_icon);
|
||||||
roots_drag_icon_update_position(drag_icon);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -120,17 +120,16 @@ static void drag_icons_for_each_surface(struct roots_input *input,
|
||||||
void *user_data) {
|
void *user_data) {
|
||||||
struct roots_seat *seat;
|
struct roots_seat *seat;
|
||||||
wl_list_for_each(seat, &input->seats, link) {
|
wl_list_for_each(seat, &input->seats, link) {
|
||||||
struct roots_drag_icon *drag_icon;
|
struct roots_drag_icon *drag_icon = seat->drag_icon;
|
||||||
wl_list_for_each(drag_icon, &seat->drag_icons, link) {
|
if (drag_icon == NULL || !drag_icon->wlr_drag_icon->mapped) {
|
||||||
if (!drag_icon->wlr_drag_icon->mapped) {
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
surface_for_each_surface(drag_icon->wlr_drag_icon->surface,
|
surface_for_each_surface(drag_icon->wlr_drag_icon->surface,
|
||||||
drag_icon->x, drag_icon->y, 0, layout_data,
|
drag_icon->x, drag_icon->y, 0, layout_data,
|
||||||
iterator, user_data);
|
iterator, user_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void layer_for_each_surface(struct wl_list *layer,
|
static void layer_for_each_surface(struct wl_list *layer,
|
||||||
const struct wlr_box *output_layout_box,
|
const struct wlr_box *output_layout_box,
|
||||||
|
|
|
@ -594,7 +594,9 @@ static void roots_drag_icon_handle_destroy(struct wl_listener *listener,
|
||||||
wl_container_of(listener, icon, destroy);
|
wl_container_of(listener, icon, destroy);
|
||||||
roots_drag_icon_damage_whole(icon);
|
roots_drag_icon_damage_whole(icon);
|
||||||
|
|
||||||
wl_list_remove(&icon->link);
|
assert(icon->seat->drag_icon == icon);
|
||||||
|
icon->seat->drag_icon = NULL;
|
||||||
|
|
||||||
wl_list_remove(&icon->surface_commit.link);
|
wl_list_remove(&icon->surface_commit.link);
|
||||||
wl_list_remove(&icon->unmap.link);
|
wl_list_remove(&icon->unmap.link);
|
||||||
wl_list_remove(&icon->destroy.link);
|
wl_list_remove(&icon->destroy.link);
|
||||||
|
@ -622,7 +624,8 @@ static void roots_seat_handle_new_drag_icon(struct wl_listener *listener,
|
||||||
icon->destroy.notify = roots_drag_icon_handle_destroy;
|
icon->destroy.notify = roots_drag_icon_handle_destroy;
|
||||||
wl_signal_add(&wlr_drag_icon->events.destroy, &icon->destroy);
|
wl_signal_add(&wlr_drag_icon->events.destroy, &icon->destroy);
|
||||||
|
|
||||||
wl_list_insert(&seat->drag_icons, &icon->link);
|
assert(seat->drag_icon == NULL);
|
||||||
|
seat->drag_icon = icon;
|
||||||
|
|
||||||
roots_drag_icon_update_position(icon);
|
roots_drag_icon_update_position(icon);
|
||||||
}
|
}
|
||||||
|
@ -706,7 +709,6 @@ struct roots_seat *roots_seat_create(struct roots_input *input, char *name) {
|
||||||
wl_list_init(&seat->tablet_pads);
|
wl_list_init(&seat->tablet_pads);
|
||||||
wl_list_init(&seat->switches);
|
wl_list_init(&seat->switches);
|
||||||
wl_list_init(&seat->views);
|
wl_list_init(&seat->views);
|
||||||
wl_list_init(&seat->drag_icons);
|
|
||||||
|
|
||||||
seat->input = input;
|
seat->input = input;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue