commit 8e1d3bf
Michael Forney
·
2014-10-01 07:42:46 +0000 UTC
parent 1bb790d
Version resources properly
23 files changed,
+80,
-46
+1,
-1
1@@ -815,7 +815,7 @@ static void create_region(struct wl_client * client,
2 {
3 struct swc_region * region;
4
5- region = swc_region_new(client, id);
6+ region = swc_region_new(client, wl_resource_get_version(resource), id);
7
8 if (!region)
9 wl_resource_post_no_memory(resource);
+7,
-4
1@@ -139,7 +139,8 @@ static struct data * data_new()
2 return data;
3 }
4
5-struct wl_resource * data_source_new(struct wl_client * client, uint32_t id)
6+struct wl_resource * data_source_new(struct wl_client * client,
7+ uint32_t version, uint32_t id)
8 {
9 struct data * data;
10
11@@ -149,7 +150,8 @@ struct wl_resource * data_source_new(struct wl_client * client, uint32_t id)
12 return NULL;
13
14 /* Add the data source to the client. */
15- data->source = wl_resource_create(client, &wl_data_source_interface, 1, id);
16+ data->source = wl_resource_create(client, &wl_data_source_interface,
17+ version, id);
18
19 /* Destroy the data object when the source disappears. */
20 wl_resource_set_implementation(data->source, &data_source_implementation,
21@@ -159,12 +161,13 @@ struct wl_resource * data_source_new(struct wl_client * client, uint32_t id)
22 }
23
24 struct wl_resource * data_offer_new(struct wl_client * client,
25- struct wl_resource * source)
26+ struct wl_resource * source,
27+ uint32_t version)
28 {
29 struct data * data = wl_resource_get_user_data(source);
30 struct wl_resource * offer;
31
32- offer = wl_resource_create(client, &wl_data_offer_interface, 1, 0);
33+ offer = wl_resource_create(client, &wl_data_offer_interface, version, 0);
34 wl_resource_set_implementation(offer, &data_offer_implementation,
35 data, &swc_remove_resource);
36 wl_list_insert(&data->offers, wl_resource_get_link(offer));
+4,
-2
1@@ -28,10 +28,12 @@
2
3 struct wl_client;
4
5-struct wl_resource * data_source_new(struct wl_client * client, uint32_t id);
6+struct wl_resource * data_source_new(struct wl_client * client,
7+ uint32_t version, uint32_t id);
8
9 struct wl_resource * data_offer_new(struct wl_client * client,
10- struct wl_resource * source);
11+ struct wl_resource * source,
12+ uint32_t version);
13
14 void data_send_mime_types(struct wl_resource * source,
15 struct wl_resource * offer);
+4,
-3
1@@ -94,11 +94,12 @@ void data_device_finalize(struct data_device * data_device)
2 }
3
4 void data_device_bind(struct data_device * data_device,
5- struct wl_client * client, uint32_t id)
6+ struct wl_client * client, uint32_t version, uint32_t id)
7 {
8 struct wl_resource * resource;
9
10- resource = wl_resource_create(client, &wl_data_device_interface, 1, id);
11+ resource = wl_resource_create(client, &wl_data_device_interface,
12+ version, id);
13 wl_resource_set_implementation(resource, &data_device_implementation,
14 data_device, &swc_remove_resource);
15 wl_list_insert(&data_device->resources, &resource->link);
16@@ -110,7 +111,7 @@ static struct wl_resource * new_offer(struct wl_resource * resource,
17 {
18 struct wl_resource * offer;
19
20- offer = data_offer_new(client, source);
21+ offer = data_offer_new(client, source, wl_resource_get_version(resource));
22 wl_data_device_send_data_offer(resource, offer);
23 data_send_mime_types(source, offer);
24
+1,
-1
1@@ -48,7 +48,7 @@ bool data_device_initialize(struct data_device * data_device);
2 void data_device_finalize(struct data_device * data_device);
3
4 void data_device_bind(struct data_device * data_device,
5- struct wl_client * client, uint32_t id);
6+ struct wl_client * client, uint32_t version, uint32_t id);
7
8 void data_device_offer_selection(struct data_device * data_device,
9 struct wl_client * client);
+8,
-3
1@@ -37,7 +37,8 @@ static void create_data_source(struct wl_client * client,
2 {
3 struct wl_resource * data_source;
4
5- data_source = data_source_new(client, id);
6+ data_source = data_source_new(client,
7+ wl_resource_get_version(resource), id);
8
9 if (!data_source)
10 wl_resource_post_no_memory(resource);
11@@ -47,7 +48,8 @@ static void get_data_device(struct wl_client * client,
12 struct wl_resource * resource, uint32_t id,
13 struct wl_resource * seat_resource)
14 {
15- data_device_bind(swc.seat->data_device, client, id);
16+ data_device_bind(swc.seat->data_device, client,
17+ wl_resource_get_version(resource), id);
18 }
19
20 static struct wl_data_device_manager_interface
21@@ -61,8 +63,11 @@ static void bind_data_device_manager(struct wl_client * client, void * data,
22 {
23 struct wl_resource * resource;
24
25+ if (version >= 1)
26+ version = 1;
27+
28 resource = wl_resource_create(client, &wl_data_device_manager_interface,
29- 1, id);
30+ version, id);
31 wl_resource_set_implementation
32 (resource, &data_device_manager_implementation, NULL, NULL);
33 }
+4,
-2
1@@ -84,7 +84,8 @@ static void create_buffer(struct wl_client * client,
2 if (!buffer)
3 goto error0;
4
5- buffer_resource = swc_wayland_buffer_create_resource(client, id, buffer);
6+ buffer_resource = swc_wayland_buffer_create_resource
7+ (client, wl_resource_get_version(resource), id, buffer);
8
9 if (!buffer_resource)
10 goto error1;
11@@ -128,7 +129,8 @@ static void create_prime_buffer(struct wl_client * client,
12 if (!buffer)
13 goto error0;
14
15- buffer_resource = swc_wayland_buffer_create_resource(client, id, buffer);
16+ buffer_resource = swc_wayland_buffer_create_resource
17+ (client, wl_resource_get_version(resource), id, buffer);
18
19 if (!buffer_resource)
20 goto error1;
+4,
-2
1@@ -204,11 +204,13 @@ static void unbind(struct wl_resource * resource)
2 }
3
4 struct wl_resource * keyboard_bind(struct keyboard * keyboard,
5- struct wl_client * client, uint32_t id)
6+ struct wl_client * client,
7+ uint32_t version, uint32_t id)
8 {
9 struct wl_resource * client_resource;
10
11- client_resource = wl_resource_create(client, &wl_keyboard_interface, 3, id);
12+ client_resource = wl_resource_create(client, &wl_keyboard_interface,
13+ version, id);
14 wl_resource_set_implementation(client_resource, &keyboard_implementation,
15 keyboard, &unbind);
16 input_focus_add_resource(&keyboard->focus, client_resource);
+2,
-1
1@@ -78,7 +78,8 @@ void keyboard_reset(struct keyboard * keyboard);
2 void keyboard_set_focus(struct keyboard * keyboard,
3 struct compositor_view * view);
4 struct wl_resource * keyboard_bind(struct keyboard * keyboard,
5- struct wl_client * client, uint32_t id);
6+ struct wl_client * client,
7+ uint32_t version, uint32_t id);
8 void keyboard_handle_key(struct keyboard * keyboard, uint32_t time,
9 uint32_t key, uint32_t state);
10
+4,
-3
1@@ -226,8 +226,8 @@ static void handle_surface_destroy(struct wl_listener * listener, void * data)
2 wl_resource_destroy(panel->resource);
3 }
4
5-struct panel * panel_new(struct wl_client * client, uint32_t id,
6- struct swc_surface * surface)
7+struct panel * panel_new(struct wl_client * client, uint32_t version,
8+ uint32_t id, struct swc_surface * surface)
9 {
10 struct panel * panel;
11
12@@ -236,7 +236,8 @@ struct panel * panel_new(struct wl_client * client, uint32_t id,
13 if (!panel)
14 goto error0;
15
16- panel->resource = wl_resource_create(client, &swc_panel_interface, 1, id);
17+ panel->resource = wl_resource_create(client, &swc_panel_interface,
18+ version, id);
19
20 if (!panel->resource)
21 goto error1;
+2,
-2
1@@ -29,8 +29,8 @@
2 #include <stdbool.h>
3 #include <wayland-server.h>
4
5-struct panel * panel_new(struct wl_client * client, uint32_t id,
6- struct swc_surface * surface);
7+struct panel * panel_new(struct wl_client * client, uint32_t version,
8+ uint32_t id, struct swc_surface * surface);
9
10 #endif
11
+6,
-2
1@@ -39,7 +39,7 @@ static void create_panel(struct wl_client * client,
2 {
3 struct swc_surface * surface = wl_resource_get_user_data(surface_resource);
4
5- if (!panel_new(client, id, surface))
6+ if (!panel_new(client, wl_resource_get_version(resource), id, surface))
7 wl_client_post_no_memory(client);
8 }
9
10@@ -52,7 +52,11 @@ static void bind_panel_manager(struct wl_client * client, void * data,
11 {
12 struct wl_resource * resource;
13
14- resource = wl_resource_create(client, &swc_panel_manager_interface, 1, id);
15+ if (version >= 1)
16+ version = 1;
17+
18+ resource = wl_resource_create(client, &swc_panel_manager_interface,
19+ version, id);
20 wl_resource_set_implementation(resource, &panel_manager_implementation,
21 NULL, NULL);
22 }
+4,
-2
1@@ -325,11 +325,13 @@ static void unbind(struct wl_resource * resource)
2 }
3
4 struct wl_resource * pointer_bind(struct pointer * pointer,
5- struct wl_client * client, uint32_t id)
6+ struct wl_client * client,
7+ uint32_t version, uint32_t id)
8 {
9 struct wl_resource * client_resource;
10
11- client_resource = wl_resource_create(client, &wl_pointer_interface, 3, id);
12+ client_resource = wl_resource_create(client, &wl_pointer_interface,
13+ version, id);
14 wl_resource_set_implementation(client_resource, &pointer_implementation,
15 pointer, &unbind);
16 input_focus_add_resource(&pointer->focus, client_resource);
+2,
-1
1@@ -87,7 +87,8 @@ void pointer_set_cursor(struct pointer * pointer, uint32_t id);
2 struct button * pointer_get_button(struct pointer * pointer, uint32_t serial);
3
4 struct wl_resource * pointer_bind(struct pointer * pointer,
5- struct wl_client * client, uint32_t id);
6+ struct wl_client * client,
7+ uint32_t version, uint32_t id);
8 void pointer_handle_button(struct pointer * pointer, uint32_t time,
9 uint32_t button, uint32_t state);
10 void pointer_handle_axis(struct pointer * pointer, uint32_t time,
+4,
-2
1@@ -43,7 +43,8 @@ static void region_destroy(struct wl_resource * resource)
2 free(region);
3 }
4
5-struct swc_region * swc_region_new(struct wl_client * client, uint32_t id)
6+struct swc_region * swc_region_new(struct wl_client * client,
7+ uint32_t version, uint32_t id)
8 {
9 struct swc_region * region;
10
11@@ -56,7 +57,8 @@ struct swc_region * swc_region_new(struct wl_client * client, uint32_t id)
12 pixman_region32_init(®ion->region);
13
14 /* Add the region to the client. */
15- region->resource = wl_resource_create(client, &wl_region_interface, 1, id);
16+ region->resource = wl_resource_create(client, &wl_region_interface,
17+ version, id);
18 wl_resource_set_implementation(region->resource, ®ion_implementation,
19 region, ®ion_destroy);
20
+2,
-1
1@@ -12,7 +12,8 @@ struct swc_region
2 pixman_region32_t region;
3 };
4
5-struct swc_region * swc_region_new(struct wl_client * client, uint32_t id);
6+struct swc_region * swc_region_new(struct wl_client * client,
7+ uint32_t version, uint32_t id);
8
9 #endif
10
+7,
-6
1@@ -176,16 +176,17 @@ static struct wl_listener launch_listener = {
2 };
3
4 /* Wayland Seat Interface */
5-static void get_pointer(struct wl_client * client, struct wl_resource * resource,
6- uint32_t id)
7+static void get_pointer(struct wl_client * client,
8+ struct wl_resource * resource, uint32_t id)
9 {
10- pointer_bind(&seat.pointer, client, id);
11+ pointer_bind(&seat.pointer, client, wl_resource_get_version(resource), id);
12 }
13
14-static void get_keyboard(struct wl_client * client, struct wl_resource * resource,
15- uint32_t id)
16+static void get_keyboard(struct wl_client * client,
17+ struct wl_resource * resource, uint32_t id)
18 {
19- keyboard_bind(&seat.keyboard, client, id);
20+ keyboard_bind(&seat.keyboard, client,
21+ wl_resource_get_version(resource), id);
22 }
23
24 static void get_touch(struct wl_client * client, struct wl_resource * resource,
+2,
-1
1@@ -39,7 +39,8 @@ static void get_shell_surface(struct wl_client * client,
2 struct swc_surface * surface = wl_resource_get_user_data(surface_resource);
3 struct shell_surface * shell_surface;
4
5- shell_surface = shell_surface_new(client, id, surface);
6+ shell_surface = shell_surface_new(client, wl_resource_get_version(resource),
7+ id, surface);
8
9 if (!shell_surface)
10 wl_resource_post_no_memory(resource);
+3,
-2
1@@ -226,7 +226,8 @@ static void destroy_shell_surface(struct wl_resource * resource)
2 free(shell_surface);
3 }
4
5-struct shell_surface * shell_surface_new(struct wl_client * client, uint32_t id,
6+struct shell_surface * shell_surface_new(struct wl_client * client,
7+ uint32_t version, uint32_t id,
8 struct swc_surface * surface)
9 {
10 struct shell_surface * shell_surface;
11@@ -237,7 +238,7 @@ struct shell_surface * shell_surface_new(struct wl_client * client, uint32_t id,
12 goto error0;
13
14 shell_surface->resource = wl_resource_create
15- (client, &wl_shell_surface_interface, 1, id);
16+ (client, &wl_shell_surface_interface, version, id);
17
18 if (!shell_surface->resource)
19 goto error1;
+2,
-1
1@@ -29,7 +29,8 @@
2 struct swc_surface;
3 struct wl_client;
4
5-struct shell_surface * shell_surface_new(struct wl_client * client, uint32_t id,
6+struct shell_surface * shell_surface_new(struct wl_client * client,
7+ uint32_t version, uint32_t id,
8 struct swc_surface * surface);
9
10 #endif
+2,
-1
1@@ -121,7 +121,8 @@ static void create_buffer(struct wl_client * client,
2 if (!buffer)
3 goto error0;
4
5- buffer_resource = swc_wayland_buffer_create_resource(client, id, buffer);
6+ buffer_resource = swc_wayland_buffer_create_resource
7+ (client, wl_resource_get_version(resource), id, buffer);
8
9 if (!buffer_resource)
10 goto error1;
+3,
-2
1@@ -57,11 +57,12 @@ static void destroy_buffer(struct wl_resource * resource)
2 }
3
4 struct wl_resource * swc_wayland_buffer_create_resource
5- (struct wl_client * client, uint32_t id, struct wld_buffer * buffer)
6+ (struct wl_client * client, uint32_t version, uint32_t id,
7+ struct wld_buffer * buffer)
8 {
9 struct wl_resource * resource;
10
11- resource = wl_resource_create(client, &wl_buffer_interface, 1, id);
12+ resource = wl_resource_create(client, &wl_buffer_interface, version, id);
13
14 if (!resource)
15 {
+2,
-1
1@@ -32,7 +32,8 @@ struct wl_resource;
2 struct wld_buffer * swc_wayland_buffer_get(struct wl_resource * resource);
3
4 struct wl_resource * swc_wayland_buffer_create_resource
5- (struct wl_client * client, uint32_t id, struct wld_buffer * buffer);
6+ (struct wl_client * client, uint32_t version, uint32_t id,
7+ struct wld_buffer * buffer);
8
9 #endif
10