mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	fixed active_workspace update on focus change
This commit is contained in:
		
							parent
							
								
									a90bd212a1
								
							
						
					
					
						commit
						a31f23f90c
					
				
					 3 changed files with 11 additions and 3 deletions
				
			
		| 
						 | 
					@ -20,6 +20,8 @@ static void update_focus(swayc_t *c) {
 | 
				
			||||||
		// Case where output changes
 | 
							// Case where output changes
 | 
				
			||||||
		case C_OUTPUT:
 | 
							case C_OUTPUT:
 | 
				
			||||||
			wlc_output_focus(c->handle);
 | 
								wlc_output_focus(c->handle);
 | 
				
			||||||
 | 
								//Set new workspace to the outputs focused workspace
 | 
				
			||||||
 | 
								active_workspace = c->focused;
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Case where workspace changes
 | 
							// Case where workspace changes
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -179,8 +179,14 @@ static bool handle_view_created(wlc_handle handle) {
 | 
				
			||||||
	if (!focused || focused->type == C_OUTPUT) {
 | 
						if (!focused || focused->type == C_OUTPUT) {
 | 
				
			||||||
		focused = get_focused_container(&root_container);
 | 
							focused = get_focused_container(&root_container);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	sway_log(L_DEBUG, "creating view %ld with type %x, state %x, with parent %ld",
 | 
						sway_log(L_DEBUG, "handle:%ld type:%x state:%x parent:%ld "
 | 
				
			||||||
		handle, wlc_view_get_type(handle), wlc_view_get_state(handle), parent);
 | 
								"mask:%d (x:%d y:%d w:%d h:%d) title:%s "
 | 
				
			||||||
 | 
								"class:%s appid:%s",
 | 
				
			||||||
 | 
							handle, wlc_view_get_type(handle), wlc_view_get_state(handle), parent,
 | 
				
			||||||
 | 
							wlc_view_get_mask(handle), wlc_view_get_geometry(handle)->origin.x,
 | 
				
			||||||
 | 
							wlc_view_get_geometry(handle)->origin.y,wlc_view_get_geometry(handle)->size.w,
 | 
				
			||||||
 | 
							wlc_view_get_geometry(handle)->size.h, wlc_view_get_title(handle),
 | 
				
			||||||
 | 
							wlc_view_get_class(handle), wlc_view_get_app_id(handle));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// TODO properly figure out how each window should be handled.
 | 
						// TODO properly figure out how each window should be handled.
 | 
				
			||||||
	switch (wlc_view_get_type(handle)) {
 | 
						switch (wlc_view_get_type(handle)) {
 | 
				
			||||||
| 
						 | 
					@ -319,6 +325,7 @@ static bool handle_key(wlc_handle view, uint32_t time, const struct wlc_modifier
 | 
				
			||||||
	sway_log(L_DEBUG, "modifier %x: state %d: key %d, sym: %d",
 | 
						sway_log(L_DEBUG, "modifier %x: state %d: key %d, sym: %d",
 | 
				
			||||||
			modifiers->mods, state, key, sym);
 | 
								modifiers->mods, state, key, sym);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						//Revert floating container back to original position on keypress
 | 
				
			||||||
	if (state == WLC_KEY_STATE_PRESSED && (dragging || resizing)) {
 | 
						if (state == WLC_KEY_STATE_PRESSED && (dragging || resizing)) {
 | 
				
			||||||
		reset_floating(get_focused_view(&root_container));
 | 
							reset_floating(get_focused_view(&root_container));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -183,7 +183,6 @@ void workspace_switch(swayc_t *workspace) {
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	sway_log(L_DEBUG, "Switching to workspace %p:%s", workspace, workspace->name);
 | 
						sway_log(L_DEBUG, "Switching to workspace %p:%s", workspace, workspace->name);
 | 
				
			||||||
	active_workspace = workspace;
 | 
					 | 
				
			||||||
	set_focused_container(get_focused_view(workspace));
 | 
						set_focused_container(get_focused_view(workspace));
 | 
				
			||||||
	arrange_windows(workspace, -1, -1);
 | 
						arrange_windows(workspace, -1, -1);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue