mirror of
				https://gitlab.freedesktop.org/wayland/wayland.git
				synced 2025-11-03 09:01:42 -05:00 
			
		
		
		
	Remove range protocol
This commit is contained in:
		
							parent
							
								
									f4144b5012
								
							
						
					
					
						commit
						3e0d4de6ea
					
				
					 3 changed files with 3 additions and 44 deletions
				
			
		| 
						 | 
					@ -76,14 +76,6 @@
 | 
				
			||||||
      <arg name="id" type="uint" />
 | 
					      <arg name="id" type="uint" />
 | 
				
			||||||
    </event>
 | 
					    </event>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <!-- Internal, deprecated, and will be changed.  This is an object
 | 
					 | 
				
			||||||
         IDs range that is used by the client to allocate object IDs
 | 
					 | 
				
			||||||
         in "new_id" type arguments.  The server sends range
 | 
					 | 
				
			||||||
         allocations to the client before the next range is about to
 | 
					 | 
				
			||||||
         be depleted. -->
 | 
					 | 
				
			||||||
    <event name="range">
 | 
					 | 
				
			||||||
      <arg name="base" type="uint"/>
 | 
					 | 
				
			||||||
    </event>
 | 
					 | 
				
			||||||
  </interface>
 | 
					  </interface>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <interface name="wl_callback" version="1">
 | 
					  <interface name="wl_callback" version="1">
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -62,7 +62,7 @@ struct wl_display {
 | 
				
			||||||
	struct wl_proxy proxy;
 | 
						struct wl_proxy proxy;
 | 
				
			||||||
	struct wl_connection *connection;
 | 
						struct wl_connection *connection;
 | 
				
			||||||
	int fd;
 | 
						int fd;
 | 
				
			||||||
	uint32_t id, id_count, next_range;
 | 
						uint32_t id;
 | 
				
			||||||
	uint32_t mask;
 | 
						uint32_t mask;
 | 
				
			||||||
	struct wl_hash_table *objects;
 | 
						struct wl_hash_table *objects;
 | 
				
			||||||
	struct wl_list global_listener_list;
 | 
						struct wl_list global_listener_list;
 | 
				
			||||||
| 
						 | 
					@ -245,18 +245,10 @@ display_handle_global_remove(void *data,
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					 | 
				
			||||||
display_handle_range(void *data,
 | 
					 | 
				
			||||||
		     struct wl_display *display, uint32_t range)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	display->next_range = range;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static const struct wl_display_listener display_listener = {
 | 
					static const struct wl_display_listener display_listener = {
 | 
				
			||||||
	display_handle_error,
 | 
						display_handle_error,
 | 
				
			||||||
	display_handle_global,
 | 
						display_handle_global,
 | 
				
			||||||
	display_handle_global_remove,
 | 
						display_handle_global_remove,
 | 
				
			||||||
	display_handle_range,
 | 
					 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int
 | 
					static int
 | 
				
			||||||
| 
						 | 
					@ -341,8 +333,9 @@ wl_display_connect(const char *name)
 | 
				
			||||||
	wl_list_init(&display->global_listener_list);
 | 
						wl_list_init(&display->global_listener_list);
 | 
				
			||||||
	wl_list_init(&display->global_list);
 | 
						wl_list_init(&display->global_list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						display->id = 1;
 | 
				
			||||||
	display->proxy.object.interface = &wl_display_interface;
 | 
						display->proxy.object.interface = &wl_display_interface;
 | 
				
			||||||
	display->proxy.object.id = 1;
 | 
						display->proxy.object.id = display->id++;
 | 
				
			||||||
	display->proxy.display = display;
 | 
						display->proxy.display = display;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	display->proxy.object.implementation =
 | 
						display->proxy.object.implementation =
 | 
				
			||||||
| 
						 | 
					@ -504,13 +497,6 @@ wl_display_flush(struct wl_display *display)
 | 
				
			||||||
WL_EXPORT uint32_t
 | 
					WL_EXPORT uint32_t
 | 
				
			||||||
wl_display_allocate_id(struct wl_display *display)
 | 
					wl_display_allocate_id(struct wl_display *display)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (display->id_count == 0) {
 | 
					 | 
				
			||||||
		display->id_count = 256;
 | 
					 | 
				
			||||||
		display->id = display->next_range;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	display->id_count--;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return display->id++;
 | 
						return display->id++;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -70,7 +70,6 @@ struct wl_display {
 | 
				
			||||||
	int run;
 | 
						int run;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wl_list callback_list;
 | 
						struct wl_list callback_list;
 | 
				
			||||||
	uint32_t client_id_range;
 | 
					 | 
				
			||||||
	uint32_t id;
 | 
						uint32_t id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wl_list global_list;
 | 
						struct wl_list global_list;
 | 
				
			||||||
| 
						 | 
					@ -240,15 +239,6 @@ wl_client_get_display(struct wl_client *client)
 | 
				
			||||||
	return client->display;
 | 
						return client->display;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void
 | 
					 | 
				
			||||||
wl_display_post_range(struct wl_display *display, struct wl_client *client)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	wl_resource_post_event(client->display_resource,
 | 
					 | 
				
			||||||
			       WL_DISPLAY_RANGE, display->client_id_range);
 | 
					 | 
				
			||||||
	display->client_id_range += 256;
 | 
					 | 
				
			||||||
	client->id_count += 256;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
bind_display(struct wl_client *client,
 | 
					bind_display(struct wl_client *client,
 | 
				
			||||||
	     void *data, uint32_t version, uint32_t id);
 | 
						     void *data, uint32_t version, uint32_t id);
 | 
				
			||||||
| 
						 | 
					@ -292,11 +282,6 @@ WL_EXPORT void
 | 
				
			||||||
wl_client_add_resource(struct wl_client *client,
 | 
					wl_client_add_resource(struct wl_client *client,
 | 
				
			||||||
		       struct wl_resource *resource)
 | 
							       struct wl_resource *resource)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct wl_display *display = client->display;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (client->id_count-- < 64)
 | 
					 | 
				
			||||||
		wl_display_post_range(display, client);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	resource->client = client;
 | 
						resource->client = client;
 | 
				
			||||||
	wl_list_init(&resource->destroy_listener_list);
 | 
						wl_list_init(&resource->destroy_listener_list);
 | 
				
			||||||
	wl_hash_table_insert(client->objects, resource->object.id, resource);
 | 
						wl_hash_table_insert(client->objects, resource->object.id, resource);
 | 
				
			||||||
| 
						 | 
					@ -576,8 +561,6 @@ bind_display(struct wl_client *client,
 | 
				
			||||||
		wl_client_add_object(client, &wl_display_interface,
 | 
							wl_client_add_object(client, &wl_display_interface,
 | 
				
			||||||
				     &display_interface, id, display);
 | 
									     &display_interface, id, display);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	wl_display_post_range(display, client);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	wl_list_for_each(global, &display->global_list, link)
 | 
						wl_list_for_each(global, &display->global_list, link)
 | 
				
			||||||
		wl_resource_post_event(client->display_resource,
 | 
							wl_resource_post_event(client->display_resource,
 | 
				
			||||||
				       WL_DISPLAY_GLOBAL,
 | 
									       WL_DISPLAY_GLOBAL,
 | 
				
			||||||
| 
						 | 
					@ -611,8 +594,6 @@ wl_display_create(void)
 | 
				
			||||||
	wl_list_init(&display->socket_list);
 | 
						wl_list_init(&display->socket_list);
 | 
				
			||||||
	wl_list_init(&display->client_list);
 | 
						wl_list_init(&display->client_list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	display->client_id_range = 256; /* Gah, arbitrary... */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	display->id = 1;
 | 
						display->id = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!wl_display_add_global(display, &wl_display_interface, 
 | 
						if (!wl_display_add_global(display, &wl_display_interface, 
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue