mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	input-method-v2: convert to try_from
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/884
This commit is contained in:
		
							parent
							
								
									711a1a3ed4
								
							
						
					
					
						commit
						49cb85ad72
					
				
					 2 changed files with 10 additions and 17 deletions
				
			
		| 
						 | 
					@ -120,18 +120,13 @@ void wlr_input_method_v2_send_done(struct wlr_input_method_v2 *input_method);
 | 
				
			||||||
void wlr_input_method_v2_send_unavailable(
 | 
					void wlr_input_method_v2_send_unavailable(
 | 
				
			||||||
	struct wlr_input_method_v2 *input_method);
 | 
						struct wlr_input_method_v2 *input_method);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * Returns true if the surface has the input popup surface role.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
bool wlr_surface_is_input_popup_surface_v2(struct wlr_surface *surface);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Get a struct wlr_input_popup_surface_v2 from a struct wlr_surface.
 | 
					 * Get a struct wlr_input_popup_surface_v2 from a struct wlr_surface.
 | 
				
			||||||
 * Asserts that the surface has the input popup surface role.
 | 
					 *
 | 
				
			||||||
 * May return NULL even if the surface has the input popup surface role if the
 | 
					 * Returns NULL if the surface has a different role or if the input popup
 | 
				
			||||||
 * corresponding input popup surface has been destroyed.
 | 
					 * surface has been destroyed.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
struct wlr_input_popup_surface_v2 *wlr_input_popup_surface_v2_from_wlr_surface(
 | 
					struct wlr_input_popup_surface_v2 *wlr_input_popup_surface_v2_try_from_wlr_surface(
 | 
				
			||||||
	struct wlr_surface *surface);
 | 
						struct wlr_surface *surface);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void wlr_input_popup_surface_v2_send_text_input_rectangle(
 | 
					void wlr_input_popup_surface_v2_send_text_input_rectangle(
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -123,12 +123,6 @@ static void im_delete_surrounding_text(struct wl_client *client,
 | 
				
			||||||
	input_method->pending.delete.after_length = after_length;
 | 
						input_method->pending.delete.after_length = after_length;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct wlr_input_popup_surface_v2 *wlr_input_popup_surface_v2_from_wlr_surface(
 | 
					 | 
				
			||||||
		struct wlr_surface *surface) {
 | 
					 | 
				
			||||||
	assert(wlr_surface_is_input_popup_surface_v2(surface));
 | 
					 | 
				
			||||||
	return (struct wlr_input_popup_surface_v2 *)surface->role_data;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void wlr_input_popup_surface_v2_send_text_input_rectangle(
 | 
					void wlr_input_popup_surface_v2_send_text_input_rectangle(
 | 
				
			||||||
		struct wlr_input_popup_surface_v2 *popup_surface,
 | 
							struct wlr_input_popup_surface_v2 *popup_surface,
 | 
				
			||||||
		struct wlr_box *sbox) {
 | 
							struct wlr_box *sbox) {
 | 
				
			||||||
| 
						 | 
					@ -181,8 +175,12 @@ static const struct wlr_surface_role input_popup_surface_v2_role = {
 | 
				
			||||||
	.destroy = popup_surface_surface_role_destroy,
 | 
						.destroy = popup_surface_surface_role_destroy,
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool wlr_surface_is_input_popup_surface_v2(struct wlr_surface *surface) {
 | 
					struct wlr_input_popup_surface_v2 *wlr_input_popup_surface_v2_try_from_wlr_surface(
 | 
				
			||||||
	return surface->role == &input_popup_surface_v2_role;
 | 
							struct wlr_surface *surface) {
 | 
				
			||||||
 | 
						if (surface->role != &input_popup_surface_v2_role) {
 | 
				
			||||||
 | 
							return NULL;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return (struct wlr_input_popup_surface_v2 *)surface->role_data;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void popup_resource_destroy(struct wl_resource *resource) {
 | 
					static void popup_resource_destroy(struct wl_resource *resource) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue