mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	wlr_tablet_v2: Register event serials
This commit is contained in:
		
							parent
							
								
									1d78bae19d
								
							
						
					
					
						commit
						1ef0c03a46
					
				
					 3 changed files with 14 additions and 11 deletions
				
			
		| 
						 | 
					@ -48,6 +48,7 @@ struct wlr_tablet_pad_client_v2 {
 | 
				
			||||||
	struct wl_client *client;
 | 
						struct wl_client *client;
 | 
				
			||||||
	struct wl_resource *resource;
 | 
						struct wl_resource *resource;
 | 
				
			||||||
	struct wlr_tablet_v2_tablet_pad *pad;
 | 
						struct wlr_tablet_v2_tablet_pad *pad;
 | 
				
			||||||
 | 
						struct wlr_tablet_seat_client_v2 *seat;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	size_t button_count;
 | 
						size_t button_count;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -276,6 +276,7 @@ void add_tablet_pad_client(struct wlr_tablet_seat_client_v2 *seat,
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	client->pad = pad;
 | 
						client->pad = pad;
 | 
				
			||||||
 | 
						client->seat = seat;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	client->groups = calloc(wl_list_length(&pad->wlr_pad->groups), sizeof(struct wl_resource*));
 | 
						client->groups = calloc(wl_list_length(&pad->wlr_pad->groups), sizeof(struct wl_resource*));
 | 
				
			||||||
	if (!client->groups) {
 | 
						if (!client->groups) {
 | 
				
			||||||
| 
						 | 
					@ -450,7 +451,8 @@ uint32_t wlr_send_tablet_v2_tablet_pad_enter(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pad->current_client = pad_client;
 | 
						pad->current_client = pad_client;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	uint32_t serial = wl_display_next_serial(wl_client_get_display(client));
 | 
						uint32_t serial = wlr_seat_client_next_serial(
 | 
				
			||||||
 | 
							pad_client->seat->seat_client);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	zwp_tablet_pad_v2_send_enter(pad_client->resource, serial,
 | 
						zwp_tablet_pad_v2_send_enter(pad_client->resource, serial,
 | 
				
			||||||
		tablet_client->resource, surface->resource);
 | 
							tablet_client->resource, surface->resource);
 | 
				
			||||||
| 
						 | 
					@ -526,7 +528,9 @@ uint32_t wlr_send_tablet_v2_tablet_pad_leave(struct wlr_tablet_v2_tablet_pad *pa
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	uint32_t serial = wl_display_next_serial(wl_client_get_display(client));
 | 
					
 | 
				
			||||||
 | 
						uint32_t serial = wlr_seat_client_next_serial(
 | 
				
			||||||
 | 
							pad->current_client->seat->seat_client);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	zwp_tablet_pad_v2_send_leave(pad->current_client->resource, serial, surface->resource);
 | 
						zwp_tablet_pad_v2_send_leave(pad->current_client->resource, serial, surface->resource);
 | 
				
			||||||
	return serial;
 | 
						return serial;
 | 
				
			||||||
| 
						 | 
					@ -546,8 +550,8 @@ uint32_t wlr_send_tablet_v2_tablet_pad_mode(struct wlr_tablet_v2_tablet_pad *pad
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pad->groups[group] = mode;
 | 
						pad->groups[group] = mode;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	struct wl_client *client = wl_resource_get_client(pad->current_client->resource);
 | 
						uint32_t serial = wlr_seat_client_next_serial(
 | 
				
			||||||
	uint32_t serial = wl_display_next_serial(wl_client_get_display(client));
 | 
							pad->current_client->seat->seat_client);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	zwp_tablet_pad_group_v2_send_mode_switch(
 | 
						zwp_tablet_pad_group_v2_send_mode_switch(
 | 
				
			||||||
		pad->current_client->groups[group], time, serial, mode);
 | 
							pad->current_client->groups[group], time, serial, mode);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -350,7 +350,7 @@ void wlr_send_tablet_v2_tablet_tool_proximity_in(
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	tool->current_client = tool_client;
 | 
						tool->current_client = tool_client;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	uint32_t serial = wl_display_next_serial(wl_client_get_display(client));
 | 
						uint32_t serial = wlr_seat_client_next_serial(tool_client->seat->seat_client);
 | 
				
			||||||
	tool->focused_surface = surface;
 | 
						tool->focused_surface = surface;
 | 
				
			||||||
	tool->proximity_serial = serial;
 | 
						tool->proximity_serial = serial;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -466,9 +466,8 @@ void wlr_send_tablet_v2_tablet_tool_button(
 | 
				
			||||||
	ssize_t index = tablet_tool_button_update(tool, button, state);
 | 
						ssize_t index = tablet_tool_button_update(tool, button, state);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (tool->current_client) {
 | 
						if (tool->current_client) {
 | 
				
			||||||
		struct wl_client *client =
 | 
							uint32_t serial = wlr_seat_client_next_serial(
 | 
				
			||||||
			wl_resource_get_client(tool->current_client->resource);
 | 
								tool->current_client->seat->seat_client);
 | 
				
			||||||
		uint32_t serial = wl_display_next_serial(wl_client_get_display(client));
 | 
					 | 
				
			||||||
		if (index >= 0) {
 | 
							if (index >= 0) {
 | 
				
			||||||
			tool->pressed_serials[index] = serial;
 | 
								tool->pressed_serials[index] = serial;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -496,9 +495,8 @@ void wlr_send_tablet_v2_tablet_tool_down(struct wlr_tablet_v2_tablet_tool *tool)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	tool->is_down = true;
 | 
						tool->is_down = true;
 | 
				
			||||||
	if (tool->current_client) {
 | 
						if (tool->current_client) {
 | 
				
			||||||
		struct wl_client *client =
 | 
							uint32_t serial = wlr_seat_client_next_serial(
 | 
				
			||||||
			wl_resource_get_client(tool->current_client->resource);
 | 
								tool->current_client->seat->seat_client);
 | 
				
			||||||
		uint32_t serial = wl_display_next_serial(wl_client_get_display(client));
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		zwp_tablet_tool_v2_send_down(tool->current_client->resource,
 | 
							zwp_tablet_tool_v2_send_down(tool->current_client->resource,
 | 
				
			||||||
			serial);
 | 
								serial);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue