mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	set focus on new window
This commit is contained in:
		
							parent
							
								
									609f63934a
								
							
						
					
					
						commit
						5e9ee32d63
					
				
					 3 changed files with 21 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -7,6 +7,8 @@
 | 
			
		|||
#include "sway/layout.h"
 | 
			
		||||
#include "sway/server.h"
 | 
			
		||||
#include "sway/view.h"
 | 
			
		||||
#include "sway/input/seat.h"
 | 
			
		||||
#include "sway/input/input-manager.h"
 | 
			
		||||
#include "log.h"
 | 
			
		||||
 | 
			
		||||
static bool assert_wl_shell(struct sway_view *view) {
 | 
			
		||||
| 
						 | 
				
			
			@ -126,4 +128,9 @@ void handle_wl_shell_surface(struct wl_listener *listener, void *data) {
 | 
			
		|||
	sway_view->swayc = cont;
 | 
			
		||||
 | 
			
		||||
	arrange_windows(cont->parent, -1, -1);
 | 
			
		||||
 | 
			
		||||
	for (int i = 0; i < server->input->seats->length; ++i) {
 | 
			
		||||
		struct sway_seat *seat = server->input->seats->items[i];
 | 
			
		||||
		sway_seat_set_focus(seat, cont);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,6 +7,8 @@
 | 
			
		|||
#include "sway/layout.h"
 | 
			
		||||
#include "sway/server.h"
 | 
			
		||||
#include "sway/view.h"
 | 
			
		||||
#include "sway/input/seat.h"
 | 
			
		||||
#include "sway/input/input-manager.h"
 | 
			
		||||
#include "log.h"
 | 
			
		||||
 | 
			
		||||
static bool assert_xdg(struct sway_view *view) {
 | 
			
		||||
| 
						 | 
				
			
			@ -132,4 +134,9 @@ void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data) {
 | 
			
		|||
	sway_view->swayc = cont;
 | 
			
		||||
 | 
			
		||||
	arrange_windows(cont->parent, -1, -1);
 | 
			
		||||
 | 
			
		||||
	for (int i = 0; i < server->input->seats->length; ++i) {
 | 
			
		||||
		struct sway_seat *seat = server->input->seats->items[i];
 | 
			
		||||
		sway_seat_set_focus(seat, cont);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,6 +10,8 @@
 | 
			
		|||
#include "sway/server.h"
 | 
			
		||||
#include "sway/view.h"
 | 
			
		||||
#include "sway/output.h"
 | 
			
		||||
#include "sway/input/seat.h"
 | 
			
		||||
#include "sway/input/input-manager.h"
 | 
			
		||||
#include "log.h"
 | 
			
		||||
 | 
			
		||||
 static bool assert_xwayland(struct sway_view *view) {
 | 
			
		||||
| 
						 | 
				
			
			@ -171,4 +173,9 @@ void handle_xwayland_surface(struct wl_listener *listener, void *data) {
 | 
			
		|||
	sway_view->swayc = cont;
 | 
			
		||||
 | 
			
		||||
	arrange_windows(cont->parent, -1, -1);
 | 
			
		||||
 | 
			
		||||
	for (int i = 0; i < server->input->seats->length; ++i) {
 | 
			
		||||
		struct sway_seat *seat = server->input->seats->items[i];
 | 
			
		||||
		sway_seat_set_focus(seat, cont);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue