[weston,v6,1/2] data_device : change version while initializing data_device_manager interface and data_device interface

Submitted by kabeer.khan@samsung.com on Oct. 20, 2014, 6:17 a.m.

Details

Message ID 1413785835-2461-1-git-send-email-kabeer.khan@samsung.com
State Accepted
Headers show

Not browsing as part of any series.

Commit Message

kabeer.khan@samsung.com Oct. 20, 2014, 6:17 a.m.
From: kabeer khan <kabeer.khan@samsung.com>

Signed-off-by: kabeer khan <kabeer.khan@samsung.com>
---
 src/data-device.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

Patch hide | download patch | download mbox

diff --git a/src/data-device.c b/src/data-device.c
index 75fc60c..a78ba83 100644
--- a/src/data-device.c
+++ b/src/data-device.c
@@ -761,10 +761,16 @@  data_device_set_selection(struct wl_client *client,
 				  wl_resource_get_user_data(source_resource),
 				  serial);
 }
+static void
+data_device_release(struct wl_client *client, struct wl_resource *resource)
+{
+	wl_resource_destroy(resource);
+}
 
 static const struct wl_data_device_interface data_device_interface = {
 	data_device_start_drag,
 	data_device_set_selection,
+	data_device_release
 };
 
 static void
@@ -844,7 +850,7 @@  get_data_device(struct wl_client *client,
 	struct wl_resource *resource;
 
 	resource = wl_resource_create(client,
-				      &wl_data_device_interface, 1, id);
+				      &wl_data_device_interface, wl_resource_get_version(manager_resource), id);
 	if (resource == NULL) {
 		wl_resource_post_no_memory(manager_resource);
 		return;
@@ -867,9 +873,8 @@  bind_manager(struct wl_client *client,
 {
 	struct wl_resource *resource;
 
-	resource =
-		wl_resource_create(client,
-				   &wl_data_device_manager_interface, 1, id);
+	resource = wl_resource_create(client,
+				      &wl_data_device_manager_interface, MIN(version,2), id);
 	if (resource == NULL) {
 		wl_client_post_no_memory(client);
 		return;
@@ -909,7 +914,7 @@  WL_EXPORT int
 wl_data_device_manager_init(struct wl_display *display)
 {
 	if (wl_global_create(display,
-			     &wl_data_device_manager_interface, 1,
+			     &wl_data_device_manager_interface, 2,
 			     NULL, bind_manager) == NULL)
 		return -1;
 

Comments

On Mon, 20 Oct 2014 11:47:15 +0530
kabeer.khan@samsung.com wrote:

> From: kabeer khan <kabeer.khan@samsung.com>
> 
> Signed-off-by: kabeer khan <kabeer.khan@samsung.com>
> ---
>  src/data-device.c | 15 ++++++++++-----
>  1 file changed, 10 insertions(+), 5 deletions(-)
> 
> diff --git a/src/data-device.c b/src/data-device.c
> index 75fc60c..a78ba83 100644
> --- a/src/data-device.c
> +++ b/src/data-device.c
> @@ -761,10 +761,16 @@ data_device_set_selection(struct wl_client *client,
>  				  wl_resource_get_user_data(source_resource),
>  				  serial);
>  }
> +static void
> +data_device_release(struct wl_client *client, struct wl_resource *resource)
> +{
> +	wl_resource_destroy(resource);
> +}
>  
>  static const struct wl_data_device_interface data_device_interface = {
>  	data_device_start_drag,
>  	data_device_set_selection,
> +	data_device_release
>  };
>  
>  static void
> @@ -844,7 +850,7 @@ get_data_device(struct wl_client *client,
>  	struct wl_resource *resource;
>  
>  	resource = wl_resource_create(client,
> -				      &wl_data_device_interface, 1, id);
> +				      &wl_data_device_interface, wl_resource_get_version(manager_resource), id);

I split the long line.

>  	if (resource == NULL) {
>  		wl_resource_post_no_memory(manager_resource);
>  		return;
> @@ -867,9 +873,8 @@ bind_manager(struct wl_client *client,
>  {
>  	struct wl_resource *resource;
>  
> -	resource =
> -		wl_resource_create(client,
> -				   &wl_data_device_manager_interface, 1, id);
> +	resource = wl_resource_create(client,
> +				      &wl_data_device_manager_interface, MIN(version,2), id);

I split the long line, and dropped the MIN, as per rationale in my
earlier reply:
http://lists.freedesktop.org/archives/wayland-devel/2014-November/018023.html

>  	if (resource == NULL) {
>  		wl_client_post_no_memory(client);
>  		return;
> @@ -909,7 +914,7 @@ WL_EXPORT int
>  wl_data_device_manager_init(struct wl_display *display)
>  {
>  	if (wl_global_create(display,
> -			     &wl_data_device_manager_interface, 1,
> +			     &wl_data_device_manager_interface, 2,
>  			     NULL, bind_manager) == NULL)
>  		return -1;
>  

Pushed with the mentioned changes.


Thanks,
pq