mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	move workspace from dead output to other output
This commit is contained in:
		
							parent
							
								
									ef31ee5cf6
								
							
						
					
					
						commit
						d115335951
					
				
					 3 changed files with 21 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -281,8 +281,21 @@ swayc_t *destroy_output(swayc_t *output) {
 | 
			
		|||
	if (!ASSERT_NONNULL(output)) {
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
	if (output->children->length == 0) {
 | 
			
		||||
		// TODO move workspaces to other outputs
 | 
			
		||||
	if (output->children->length > 0) {
 | 
			
		||||
		int i, len = root_container.children->length;
 | 
			
		||||
		// TODO save workspaces when there are no outputs.
 | 
			
		||||
		// TODO also check if there will ever be no outputs except for exiting
 | 
			
		||||
		// program
 | 
			
		||||
		if (len > 1) {
 | 
			
		||||
			len = output->children->length;
 | 
			
		||||
			int p = root_container.children->items[0] == output;
 | 
			
		||||
			// Move workspace from this output to another output
 | 
			
		||||
			for (i = 0; i < len; ++i) {
 | 
			
		||||
				swayc_t *child = output->children->items[i];
 | 
			
		||||
				remove_child(child);
 | 
			
		||||
				add_child(root_container.children->items[p], child);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	sway_log(L_DEBUG, "OUTPUT: Destroying output '%lu'", output->handle);
 | 
			
		||||
	free_swayc(output);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -424,8 +424,7 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	// set pointer mode
 | 
			
		||||
	pointer_mode_set(button,
 | 
			
		||||
		(modifiers->mods & config->floating_mod) == config->floating_mod);
 | 
			
		||||
	pointer_mode_set(button, !(modifiers->mods ^ config->floating_mod));
 | 
			
		||||
 | 
			
		||||
	// Return if mode has been set
 | 
			
		||||
	if (pointer_state.mode) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -169,6 +169,11 @@ static void pointer_mode_set_left(void) {
 | 
			
		|||
		pointer_state.mode = M_DRAGGING | M_FLOATING;
 | 
			
		||||
	} else {
 | 
			
		||||
		pointer_state.mode = M_DRAGGING | M_TILING;
 | 
			
		||||
		// unset mode if we cant drag tile
 | 
			
		||||
		if (initial.ptr->parent->type == C_WORKSPACE &&
 | 
			
		||||
				initial.ptr->parent->children->length == 1) {
 | 
			
		||||
			pointer_state.mode = 0;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue