mirror of
				https://gitlab.freedesktop.org/wlroots/wlroots.git
				synced 2025-11-03 09:01:40 -05:00 
			
		
		
		
	data-offer: send WL_DATA_OFFER_ERROR_INVALID_FINISH
This commit is contained in:
		
							parent
							
								
									ae2aeb65cc
								
							
						
					
					
						commit
						7d367a9e21
					
				
					 1 changed files with 21 additions and 0 deletions
				
			
		| 
						 | 
					@ -135,6 +135,27 @@ static void data_offer_handle_finish(struct wl_client *client,
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// TODO: also fail while we have a drag-and-drop grab
 | 
				
			||||||
 | 
						if (offer->type != WLR_DATA_OFFER_DRAG) {
 | 
				
			||||||
 | 
							wl_resource_post_error(offer->resource,
 | 
				
			||||||
 | 
								WL_DATA_OFFER_ERROR_INVALID_FINISH, "Offer is not drag-and-drop");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if (!offer->source->accepted) {
 | 
				
			||||||
 | 
							wl_resource_post_error(offer->resource,
 | 
				
			||||||
 | 
								WL_DATA_OFFER_ERROR_INVALID_FINISH, "Premature finish request");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						enum wl_data_device_manager_dnd_action action =
 | 
				
			||||||
 | 
							offer->source->current_dnd_action;
 | 
				
			||||||
 | 
						if (action == WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE ||
 | 
				
			||||||
 | 
								action == WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK) {
 | 
				
			||||||
 | 
							wl_resource_post_error(offer->resource,
 | 
				
			||||||
 | 
								WL_DATA_OFFER_ERROR_INVALID_FINISH,
 | 
				
			||||||
 | 
								"Offer finished with an invalid action");
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	data_offer_dnd_finish(offer);
 | 
						data_offer_dnd_finish(offer);
 | 
				
			||||||
	data_offer_destroy(offer);
 | 
						data_offer_destroy(offer);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue