History

video/out/wayland_common: create per-seat objects on seat hotplug

This is to allow data device and text input to be used on seats that are hotplugged after vo init.

Attila Fidan committed 1 year ago

Commit fbf366d1 parent a1424d51 file · +25 −5Browse files

Unified · Split

video/out/wayland_common.c+25−5
@@ -265,6 +265,8 @@ static void remove_feedback(struct vo_wayland_feedback_pool *fback_pool, · 264 unmodified lines
265 struct wp_presentation_feedback *fback);265 struct wp_presentation_feedback *fback);
266static void remove_output(struct vo_wayland_output *out);266static void remove_output(struct vo_wayland_output *out);
267static void remove_seat(struct vo_wayland_seat *seat);267static void remove_seat(struct vo_wayland_seat *seat);
268static void seat_create_dnd_ddev(struct vo_wayland_seat *seat);
269static void seat_create_text_input(struct vo_wayland_seat *seat);
268static void request_decoration_mode(struct vo_wayland_state *wl, uint32_t mode);270static void request_decoration_mode(struct vo_wayland_state *wl, uint32_t mode);
269static void rescale_geometry(struct vo_wayland_state *wl, double old_scale);271static void rescale_geometry(struct vo_wayland_state *wl, double old_scale);
270static void set_geometry(struct vo_wayland_state *wl, bool resize);272static void set_geometry(struct vo_wayland_state *wl, bool resize);
@@ -1851,6 +1853,12 @@ static void registry_handle_add(void *data, struct wl_registry *reg, uint32_t id · 1580 unmodified lines
1851 seat->seat = wl_registry_bind(reg, id, &wl_seat_interface, ver);1853 seat->seat = wl_registry_bind(reg, id, &wl_seat_interface, ver);
1852 wl_seat_add_listener(seat->seat, &seat_listener, seat);1854 wl_seat_add_listener(seat->seat, &seat_listener, seat);
1853 wl_list_insert(&wl->seat_list, &seat->link);1855 wl_list_insert(&wl->seat_list, &seat->link);
1856
1857 if (wl->devman)
1858 seat_create_dnd_ddev(seat);
1859
1860 if (wl->text_input_manager)
1861 seat_create_text_input(seat);
1854 }1862 }
1855 1863
1856 if (!strcmp(interface, wl_shm_interface.name) && found++) {1864 if (!strcmp(interface, wl_shm_interface.name) && found++) {
@@ -2562,6 +2570,19 @@ static void remove_seat(struct vo_wayland_seat *seat) · 705 unmodified lines
2562 return;2570 return;
2563}2571}
2564 2572
2573static void seat_create_dnd_ddev(struct vo_wayland_seat *seat)
2574{
2575 seat->dnd_ddev = wl_data_device_manager_get_data_device(seat->wl->devman, seat->seat);
2576 wl_data_device_add_listener(seat->dnd_ddev, &data_device_listener, seat);
2577}
2578
2579static void seat_create_text_input(struct vo_wayland_seat *seat)
2580{
2581 seat->text_input = talloc_zero(seat, struct vo_wayland_text_input);
2582 seat->text_input->text_input = zwp_text_input_manager_v3_get_text_input(seat->wl->text_input_manager, seat->seat);
2583 zwp_text_input_v3_add_listener(seat->text_input->text_input, &text_input_listener, seat);
2584}
2585
2565static void reset_color_management(struct vo_wayland_state *wl)2586static void reset_color_management(struct vo_wayland_state *wl)
2566{2587{
2567 if (!wl->color_surface)2588 if (!wl->color_surface)
@@ -3339,8 +3360,8 @@ bool vo_wayland_init(struct vo *vo) · 771 unmodified lines
3339 if (wl->devman) {3360 if (wl->devman) {
3340 struct vo_wayland_seat *seat;3361 struct vo_wayland_seat *seat;
3341 wl_list_for_each(seat, &wl->seat_list, link) {3362 wl_list_for_each(seat, &wl->seat_list, link) {
3342 seat->dnd_ddev = wl_data_device_manager_get_data_device(wl->devman, seat->seat);3363 if (!seat->dnd_ddev)
3343 wl_data_device_add_listener(seat->dnd_ddev, &data_device_listener, seat);3364 seat_create_dnd_ddev(seat);
3344 }3365 }
3345 } else {3366 } else {
3346 MP_VERBOSE(wl, "Compositor doesn't support the %s (ver. 3) protocol!\n",3367 MP_VERBOSE(wl, "Compositor doesn't support the %s (ver. 3) protocol!\n",
@@ -3382,9 +3403,8 @@ bool vo_wayland_init(struct vo *vo) · 35 unmodified lines
3382 if (wl->text_input_manager) {3403 if (wl->text_input_manager) {
3383 struct vo_wayland_seat *seat;3404 struct vo_wayland_seat *seat;
3384 wl_list_for_each(seat, &wl->seat_list, link) {3405 wl_list_for_each(seat, &wl->seat_list, link) {
3385 seat->text_input = talloc_zero(seat, struct vo_wayland_text_input);3406 if (!seat->text_input)
3386 seat->text_input->text_input = zwp_text_input_manager_v3_get_text_input(wl->text_input_manager, seat->seat);3407 seat_create_text_input(seat);
3387 zwp_text_input_v3_add_listener(seat->text_input->text_input, &text_input_listener, seat);
3388 }3408 }
3389 } else {3409 } else {
3390 MP_VERBOSE(wl, "Compositor doesn't support the %s protocol!\n",3410 MP_VERBOSE(wl, "Compositor doesn't support the %s protocol!\n",

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t