mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Merge pull request #906 from zandrmartin/global-focus-pointer
add global `current_focus` pointer
This commit is contained in:
		
						commit
						a7eeb48aac
					
				
					 3 changed files with 17 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -8,6 +8,7 @@
 | 
			
		|||
typedef struct sway_container swayc_t;
 | 
			
		||||
 | 
			
		||||
extern swayc_t root_container;
 | 
			
		||||
extern swayc_t *current_focus;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Different kinds of containers.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -120,6 +120,10 @@ bool set_focused_container(swayc_t *c) {
 | 
			
		|||
		// dispatch a window event
 | 
			
		||||
		ipc_event_window(c, "focus");
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// update the global pointer
 | 
			
		||||
	current_focus = c;
 | 
			
		||||
 | 
			
		||||
	// update container focus from here to root, making necessary changes along
 | 
			
		||||
	// the way
 | 
			
		||||
	swayc_t *p = c;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,6 +15,7 @@
 | 
			
		|||
#include "log.h"
 | 
			
		||||
 | 
			
		||||
swayc_t root_container;
 | 
			
		||||
swayc_t *current_focus;
 | 
			
		||||
list_t *scratchpad;
 | 
			
		||||
 | 
			
		||||
int min_sane_h = 60;
 | 
			
		||||
| 
						 | 
				
			
			@ -27,6 +28,7 @@ void init_layout(void) {
 | 
			
		|||
	root_container.children = create_list();
 | 
			
		||||
	root_container.handle = -1;
 | 
			
		||||
	root_container.visible = true;
 | 
			
		||||
	current_focus = &root_container;
 | 
			
		||||
	scratchpad = create_list();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue