|  |  | @ -57,14 +57,16 @@ swayc_t *container_under_pointer(void) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		// if workspace, search floating
 |  |  |  | 		// if workspace, search floating
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 		if (lookup->type == C_WORKSPACE) { |  |  |  | 		if (lookup->type == C_WORKSPACE) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 			len = lookup->floating->length; |  |  |  | 			i = len = lookup->floating->length; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 			for (i = 0; i < len; ++i) { |  |  |  | 			bool got_floating = false; | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			while (--i > -1) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 				if (pointer_test(lookup->floating->items[i], &mouse_origin)) { |  |  |  | 				if (pointer_test(lookup->floating->items[i], &mouse_origin)) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 					lookup = lookup->floating->items[i]; |  |  |  | 					lookup = lookup->floating->items[i]; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					got_floating = true; | 
			
		
	
		
		
			
				
					
					|  |  |  | 					break; |  |  |  | 					break; | 
			
		
	
		
		
			
				
					
					|  |  |  | 				} |  |  |  | 				} | 
			
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 			if (i < len) { |  |  |  | 			if (got_floating) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 				continue; |  |  |  | 				continue; | 
			
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
	
		
		
			
				
					|  |  | @ -106,6 +108,12 @@ static void handle_output_destroyed(wlc_handle output) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 	if (i < list->length) { |  |  |  | 	if (i < list->length) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 		destroy_output(list->items[i]); |  |  |  | 		destroy_output(list->items[i]); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	if (list->length == 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		active_workspace = NULL; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	} else { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		//switch to other outputs active workspace
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		workspace_switch(((swayc_t *)root_container.children->items[0])->focused); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | static void handle_output_resolution_change(wlc_handle output, const struct wlc_size *from, const struct wlc_size *to) { |  |  |  | static void handle_output_resolution_change(wlc_handle output, const struct wlc_size *from, const struct wlc_size *to) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -320,9 +328,12 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct | 
			
		
	
		
		
			
				
					
					|  |  |  | 	mouse_origin = *origin; |  |  |  | 	mouse_origin = *origin; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	bool changed_floating = false; |  |  |  | 	bool changed_floating = false; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	int i = 0; |  |  |  | 	int i = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	if (!active_workspace) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		return false; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	// Do checks to determine if proper keys are being held
 |  |  |  | 	// Do checks to determine if proper keys are being held
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	swayc_t *view = active_workspace->focused; |  |  |  | 	swayc_t *view = active_workspace->focused; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	if (m1_held) { |  |  |  | 	if (m1_held && view) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 		if (view->is_floating) { |  |  |  | 		if (view->is_floating) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 			while (keys_pressed[i++]) { |  |  |  | 			while (keys_pressed[i++]) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 				if (keys_pressed[i] == config->floating_mod) { |  |  |  | 				if (keys_pressed[i] == config->floating_mod) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -338,7 +349,7 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct | 
			
		
	
		
		
			
				
					
					|  |  |  | 				} |  |  |  | 				} | 
			
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} else if (m2_held) { |  |  |  | 	} else if (m2_held && view) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 		if (view->is_floating) { |  |  |  | 		if (view->is_floating) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 			while (keys_pressed[i++]) { |  |  |  | 			while (keys_pressed[i++]) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 				if (keys_pressed[i] == config->floating_mod) { |  |  |  | 				if (keys_pressed[i] == config->floating_mod) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -400,8 +411,12 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	if (config->focus_follows_mouse && prev_handle != handle) { |  |  |  | 	if (config->focus_follows_mouse && prev_handle != handle) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		//Dont change focus if fullscreen
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		swayc_t *focused = get_focused_view(view); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		if (!(focused->type == C_VIEW && wlc_view_get_state(focused->handle) & WLC_BIT_FULLSCREEN)) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 			set_focused_container(container_under_pointer()); |  |  |  | 			set_focused_container(container_under_pointer()); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	prev_handle = handle; |  |  |  | 	prev_handle = handle; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	prev_pos = mouse_origin; |  |  |  | 	prev_pos = mouse_origin; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	if (changed_floating) { |  |  |  | 	if (changed_floating) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -414,6 +429,10 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct | 
			
		
	
		
		
			
				
					
					|  |  |  | static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct wlc_modifiers *modifiers, |  |  |  | static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct wlc_modifiers *modifiers, | 
			
		
	
		
		
			
				
					
					|  |  |  | 		uint32_t button, enum wlc_button_state state) { |  |  |  | 		uint32_t button, enum wlc_button_state state) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 	swayc_t *focused = get_focused_container(&root_container); |  |  |  | 	swayc_t *focused = get_focused_container(&root_container); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	//dont change focus if fullscreen
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	if (focused->type == C_VIEW && wlc_view_get_state(focused->handle) & WLC_BIT_FULLSCREEN) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		return false; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	if (state == WLC_BUTTON_STATE_PRESSED) { |  |  |  | 	if (state == WLC_BUTTON_STATE_PRESSED) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 		sway_log(L_DEBUG, "Mouse button %u pressed", button); |  |  |  | 		sway_log(L_DEBUG, "Mouse button %u pressed", button); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		if (button == 272) { |  |  |  | 		if (button == 272) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -424,6 +443,17 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		swayc_t *pointer = container_under_pointer(); |  |  |  | 		swayc_t *pointer = container_under_pointer(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		set_focused_container(pointer); |  |  |  | 		set_focused_container(pointer); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		if (pointer->is_floating) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			int i; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			for (i = 0; i < pointer->parent->floating->length; i++) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				if (pointer->parent->floating->items[i] == pointer) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					list_del(pointer->parent->floating, i); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					list_add(pointer->parent->floating, pointer); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 					break; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 				} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 			arrange_windows(pointer->parent, -1, -1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		return (pointer && pointer != focused); |  |  |  | 		return (pointer && pointer != focused); | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} else { |  |  |  | 	} else { | 
			
		
	
		
		
			
				
					
					|  |  |  | 		sway_log(L_DEBUG, "Mouse button %u released", button); |  |  |  | 		sway_log(L_DEBUG, "Mouse button %u released", button); | 
			
		
	
	
		
		
			
				
					|  |  | 
 |