mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 01:20:42 -05:00
wayland: fix deprecation warnings
Replace the deprecated APIs with the modern variants (which also give us full control on the versioning). Also, note that we only support version 2 of wl_seat. Version 3 is for multiple pointer/keyboards for a client, but we don't implement that yet. If a client requests version 3 of wl_seat or make a version 3 request, it will get a protocol error. https://bugzilla.gnome.org/show_bug.cgi?id=707851
This commit is contained in:
parent
72b6699efb
commit
95a9655412
@ -109,12 +109,11 @@ meta_wayland_data_source_send_offer (MetaWaylandDataSource *source,
|
|||||||
offer->source = source;
|
offer->source = source;
|
||||||
offer->source_destroy_listener.notify = destroy_offer_data_source;
|
offer->source_destroy_listener.notify = destroy_offer_data_source;
|
||||||
|
|
||||||
offer->resource = wl_client_add_object (wl_resource_get_client (target),
|
offer->resource = wl_resource_create (wl_resource_get_client (target),
|
||||||
&wl_data_offer_interface,
|
&wl_data_offer_interface,
|
||||||
&data_offer_interface,
|
MIN (1, wl_resource_get_version (target)), 0);
|
||||||
0,
|
wl_resource_set_implementation (offer->resource, &data_offer_interface,
|
||||||
offer);
|
offer, destroy_data_offer);
|
||||||
wl_resource_set_destructor (offer->resource, destroy_data_offer);
|
|
||||||
wl_resource_add_destroy_listener (source->resource,
|
wl_resource_add_destroy_listener (source->resource,
|
||||||
&offer->source_destroy_listener);
|
&offer->source_destroy_listener);
|
||||||
|
|
||||||
@ -466,12 +465,10 @@ create_data_source (struct wl_client *client,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
source->resource = wl_client_add_object (client,
|
source->resource = wl_resource_create (client, &wl_data_source_interface,
|
||||||
&wl_data_source_interface,
|
MIN (1, wl_resource_get_version (resource)), id);
|
||||||
&data_source_interface,
|
wl_resource_set_implementation (source->resource, &data_source_interface,
|
||||||
id,
|
source, destroy_data_source);
|
||||||
source);
|
|
||||||
wl_resource_set_destructor (source->resource, destroy_data_source);
|
|
||||||
|
|
||||||
source->accept = client_source_accept;
|
source->accept = client_source_accept;
|
||||||
source->send = client_source_send;
|
source->send = client_source_send;
|
||||||
@ -494,11 +491,10 @@ get_data_device (struct wl_client *client,
|
|||||||
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
|
MetaWaylandSeat *seat = wl_resource_get_user_data (seat_resource);
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
|
|
||||||
resource = wl_client_add_object (client, &wl_data_device_interface,
|
resource = wl_resource_create (client, &wl_data_device_interface,
|
||||||
&data_device_interface, id, seat);
|
MIN (1, wl_resource_get_version (manager_resource)), id);
|
||||||
|
wl_resource_set_implementation (resource, &data_device_interface, seat, unbind_data_device);
|
||||||
wl_list_insert (&seat->drag_resource_list, wl_resource_get_link (resource));
|
wl_list_insert (&seat->drag_resource_list, wl_resource_get_link (resource));
|
||||||
wl_resource_set_destructor (resource, unbind_data_device);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_data_device_manager_interface manager_interface = {
|
static const struct wl_data_device_manager_interface manager_interface = {
|
||||||
@ -510,8 +506,10 @@ static void
|
|||||||
bind_manager (struct wl_client *client,
|
bind_manager (struct wl_client *client,
|
||||||
void *data, guint32 version, guint32 id)
|
void *data, guint32 version, guint32 id)
|
||||||
{
|
{
|
||||||
wl_client_add_object (client, &wl_data_device_manager_interface,
|
struct wl_resource *resource;
|
||||||
&manager_interface, id, NULL);
|
|
||||||
|
resource = wl_resource_create (client, &wl_data_device_manager_interface, MIN (version, 1), id);
|
||||||
|
wl_resource_set_implementation (resource, &manager_interface, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -540,9 +538,9 @@ meta_wayland_data_device_set_keyboard_focus (MetaWaylandSeat *seat)
|
|||||||
int
|
int
|
||||||
meta_wayland_data_device_manager_init (struct wl_display *display)
|
meta_wayland_data_device_manager_init (struct wl_display *display)
|
||||||
{
|
{
|
||||||
if (wl_display_add_global (display,
|
if (wl_global_create (display,
|
||||||
&wl_data_device_manager_interface,
|
&wl_data_device_manager_interface, 1,
|
||||||
NULL, bind_manager) == NULL)
|
NULL, bind_manager) == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -175,10 +175,10 @@ seat_get_pointer (struct wl_client *client,
|
|||||||
MetaWaylandSeat *seat = wl_resource_get_user_data (resource);
|
MetaWaylandSeat *seat = wl_resource_get_user_data (resource);
|
||||||
struct wl_resource *cr;
|
struct wl_resource *cr;
|
||||||
|
|
||||||
cr = wl_client_add_object (client, &wl_pointer_interface,
|
cr = wl_resource_create (client, &wl_pointer_interface,
|
||||||
&pointer_interface, id, seat);
|
MIN (wl_resource_get_version (resource), 2), id);
|
||||||
|
wl_resource_set_implementation (cr, &pointer_interface, seat, unbind_resource);
|
||||||
wl_list_insert (&seat->pointer.resource_list, wl_resource_get_link (cr));
|
wl_list_insert (&seat->pointer.resource_list, wl_resource_get_link (cr));
|
||||||
wl_resource_set_destructor (cr, unbind_resource);
|
|
||||||
|
|
||||||
if (seat->pointer.focus &&
|
if (seat->pointer.focus &&
|
||||||
wl_resource_get_client (seat->pointer.focus->resource) == client)
|
wl_resource_get_client (seat->pointer.focus->resource) == client)
|
||||||
@ -205,9 +205,10 @@ seat_get_keyboard (struct wl_client *client,
|
|||||||
MetaWaylandSeat *seat = wl_resource_get_user_data (resource);
|
MetaWaylandSeat *seat = wl_resource_get_user_data (resource);
|
||||||
struct wl_resource *cr;
|
struct wl_resource *cr;
|
||||||
|
|
||||||
cr = wl_client_add_object (client, &wl_keyboard_interface, NULL, id, seat);
|
cr = wl_resource_create (client, &wl_keyboard_interface,
|
||||||
|
MIN (wl_resource_get_version (resource), 2), id);
|
||||||
|
wl_resource_set_implementation (cr, NULL, seat, unbind_resource);
|
||||||
wl_list_insert (&seat->keyboard.resource_list, wl_resource_get_link (cr));
|
wl_list_insert (&seat->keyboard.resource_list, wl_resource_get_link (cr));
|
||||||
wl_resource_set_destructor (cr, unbind_resource);
|
|
||||||
|
|
||||||
wl_keyboard_send_keymap (cr,
|
wl_keyboard_send_keymap (cr,
|
||||||
WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
|
WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1,
|
||||||
@ -248,17 +249,16 @@ bind_seat (struct wl_client *client,
|
|||||||
MetaWaylandSeat *seat = data;
|
MetaWaylandSeat *seat = data;
|
||||||
struct wl_resource *resource;
|
struct wl_resource *resource;
|
||||||
|
|
||||||
resource = wl_client_add_object (client,
|
resource = wl_resource_create (client, &wl_seat_interface, MIN (version, 2), id);
|
||||||
&wl_seat_interface,
|
wl_resource_set_implementation (resource, &seat_interface, seat, unbind_resource);
|
||||||
&seat_interface,
|
|
||||||
id,
|
|
||||||
data);
|
|
||||||
wl_list_insert (&seat->base_resource_list, wl_resource_get_link (resource));
|
wl_list_insert (&seat->base_resource_list, wl_resource_get_link (resource));
|
||||||
wl_resource_set_destructor (resource, unbind_resource);
|
|
||||||
|
|
||||||
wl_seat_send_capabilities (resource,
|
wl_seat_send_capabilities (resource,
|
||||||
WL_SEAT_CAPABILITY_POINTER |
|
WL_SEAT_CAPABILITY_POINTER |
|
||||||
WL_SEAT_CAPABILITY_KEYBOARD);
|
WL_SEAT_CAPABILITY_KEYBOARD);
|
||||||
|
|
||||||
|
if (version >= 2)
|
||||||
|
wl_seat_send_name (resource, "seat0");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -297,7 +297,7 @@ meta_wayland_seat_new (struct wl_display *display,
|
|||||||
seat->hotspot_x = 16;
|
seat->hotspot_x = 16;
|
||||||
seat->hotspot_y = 16;
|
seat->hotspot_y = 16;
|
||||||
|
|
||||||
wl_display_add_global (display, &wl_seat_interface, seat, bind_seat);
|
wl_global_create (display, &wl_seat_interface, 2, seat, bind_seat);
|
||||||
|
|
||||||
return seat;
|
return seat;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user