mirror of
				https://github.com/labwc/labwc.git
				synced 2025-11-03 09:01:51 -05:00 
			
		
		
		
	dnd: refocus surface under cursor on drag-destroy
Keyboard focus is not changed during drag, so we need to refocus the surface under the cursor and the end of a drag-and-drop operation. Fixes issue #939
This commit is contained in:
		
							parent
							
								
									f817a9e56a
								
							
						
					
					
						commit
						3bd441caa0
					
				
					 2 changed files with 13 additions and 2 deletions
				
			
		| 
						 | 
					@ -2,6 +2,7 @@
 | 
				
			||||||
#ifndef LABWC_CURSOR_H
 | 
					#ifndef LABWC_CURSOR_H
 | 
				
			||||||
#define LABWC_CURSOR_H
 | 
					#define LABWC_CURSOR_H
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <wlr/types/wlr_cursor.h>
 | 
				
			||||||
#include <wlr/util/edges.h>
 | 
					#include <wlr/util/edges.h>
 | 
				
			||||||
#include "ssd.h"
 | 
					#include "ssd.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										14
									
								
								src/dnd.c
									
										
									
									
									
								
							
							
						
						
									
										14
									
								
								src/dnd.c
									
										
									
									
									
								
							| 
						 | 
					@ -4,6 +4,7 @@
 | 
				
			||||||
#include <wlr/types/wlr_scene.h>
 | 
					#include <wlr/types/wlr_scene.h>
 | 
				
			||||||
#include <wlr/util/log.h>
 | 
					#include <wlr/util/log.h>
 | 
				
			||||||
#include "common/mem.h"
 | 
					#include "common/mem.h"
 | 
				
			||||||
 | 
					#include "cursor.h"
 | 
				
			||||||
#include "dnd.h"
 | 
					#include "dnd.h"
 | 
				
			||||||
#include "labwc.h"  /* for struct seat */
 | 
					#include "labwc.h"  /* for struct seat */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -135,8 +136,17 @@ handle_drag_destroy(struct wl_listener *listener, void *data)
 | 
				
			||||||
	seat->drag.active = false;
 | 
						seat->drag.active = false;
 | 
				
			||||||
	wl_list_remove(&seat->drag.events.destroy.link);
 | 
						wl_list_remove(&seat->drag.events.destroy.link);
 | 
				
			||||||
	wlr_scene_node_set_enabled(&seat->drag.icons->node, false);
 | 
						wlr_scene_node_set_enabled(&seat->drag.icons->node, false);
 | 
				
			||||||
	/* TODO: Not sure we actually need the following */
 | 
					
 | 
				
			||||||
	desktop_focus_topmost_mapped_view(seat->server);
 | 
						/*
 | 
				
			||||||
 | 
						 * Keyboard focus is not changed during drag, so we need to refocus the
 | 
				
			||||||
 | 
						 * current surface under the cursor.
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						struct cursor_context ctx = get_cursor_context(seat->server);
 | 
				
			||||||
 | 
						if (!ctx.surface) {
 | 
				
			||||||
 | 
							return;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						seat_focus_surface(seat, NULL);
 | 
				
			||||||
 | 
						seat_focus_surface(seat, ctx.surface);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Public API */
 | 
					/* Public API */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue