|  |  | @ -56,23 +56,24 @@ static struct mode_state { | 
			
		
	
		
		
			
				
					
					|  |  |  | 	// initial view state
 |  |  |  | 	// initial view state
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	double x, y, w, h; |  |  |  | 	double x, y, w, h; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	swayc_t *ptr; |  |  |  | 	swayc_t *ptr; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	// containers resized with tiling resize
 |  |  |  | 	// Containers used for resizing horizontally
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 	struct { |  |  |  | 	struct { | 
			
		
	
		
		
			
				
					
					|  |  |  | 		double x, w; |  |  |  | 		double w; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 		swayc_t *ptr; |  |  |  | 		swayc_t *ptr; | 
			
		
	
		
		
			
				
					
					|  |  |  | 		struct { |  |  |  | 		struct { | 
			
		
	
		
		
			
				
					
					|  |  |  | 			double x, w; |  |  |  | 			double w; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 			swayc_t *ptr; |  |  |  | 			swayc_t *ptr; | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} sib; |  |  |  | 		} parent; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 	} lr; |  |  |  | 	} horiz; | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	// Containers used for resizing vertically
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	struct { |  |  |  | 	struct { | 
			
		
	
		
		
			
				
					
					|  |  |  | 		double y, h; |  |  |  | 		double h; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 		swayc_t *ptr; |  |  |  | 		swayc_t *ptr; | 
			
		
	
		
		
			
				
					
					|  |  |  | 		struct { |  |  |  | 		struct { | 
			
		
	
		
		
			
				
					
					|  |  |  | 			double y, h; |  |  |  | 			double h; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 			swayc_t *ptr; |  |  |  | 			swayc_t *ptr; | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} sib; |  |  |  | 		} parent; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 	} tb; |  |  |  | 	} vert; | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | } initial; |  |  |  | } initial; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | static struct { |  |  |  | static struct { | 
			
		
	
	
		
		
			
				
					|  |  | @ -92,23 +93,19 @@ static void set_initial_view(swayc_t *view) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | static void set_initial_sibling(void) { |  |  |  | static void set_initial_sibling(void) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 	bool reset = true; |  |  |  | 	bool reset = true; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	if ((initial.lr.ptr = get_swayc_in_direction(initial.ptr, lock.left ? MOVE_RIGHT: MOVE_LEFT))) { |  |  |  | 	if ((initial.horiz.ptr = get_swayc_in_direction(initial.ptr, lock.left ? MOVE_RIGHT: MOVE_LEFT))) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		initial.lr.x = initial.lr.ptr->x; |  |  |  | 		initial.horiz.w = initial.horiz.ptr->width; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		initial.lr.w = initial.lr.ptr->width; |  |  |  | 		initial.horiz.parent.ptr = get_swayc_in_direction(initial.horiz.ptr, lock.left ? MOVE_LEFT : MOVE_RIGHT); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		initial.lr.sib.ptr = get_swayc_in_direction(initial.lr.ptr, lock.left ? MOVE_LEFT : MOVE_RIGHT); |  |  |  | 		initial.horiz.parent.w = initial.horiz.parent.ptr->width; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		initial.lr.sib.x = initial.lr.sib.ptr->x; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 		initial.lr.sib.w = initial.lr.sib.ptr->width; |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 		reset = false; |  |  |  | 		reset = false; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	if ((initial.tb.ptr = get_swayc_in_direction(initial.ptr, lock.top ? MOVE_DOWN: MOVE_UP))) { |  |  |  | 	if ((initial.vert.ptr = get_swayc_in_direction(initial.ptr, lock.top ? MOVE_DOWN: MOVE_UP))) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		initial.tb.y = initial.tb.ptr->y; |  |  |  | 		initial.vert.h = initial.vert.ptr->height; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		initial.tb.h = initial.tb.ptr->height; |  |  |  | 		initial.vert.parent.ptr = get_swayc_in_direction(initial.vert.ptr, lock.top ? MOVE_UP : MOVE_DOWN); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		initial.tb.sib.ptr = get_swayc_in_direction(initial.tb.ptr, lock.top ? MOVE_UP : MOVE_DOWN); |  |  |  | 		initial.vert.parent.h = initial.vert.parent.ptr->height; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 		initial.tb.sib.y = initial.tb.sib.ptr->y; |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 		initial.tb.sib.h = initial.tb.sib.ptr->height; |  |  |  |  | 
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 		reset = false; |  |  |  | 		reset = false; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	// If nothing changes just undo the mode
 |  |  |  | 	// If nothing will change just undo the mode
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 	if (reset) { |  |  |  | 	if (reset) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 		pointer_state.mode = 0; |  |  |  | 		pointer_state.mode = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
	
		
		
			
				
					|  |  | @ -123,6 +120,16 @@ static void reset_initial_view(void) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 	pointer_state.mode = 0; |  |  |  | 	pointer_state.mode = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | static void reset_initial_sibling(void) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	initial.horiz.ptr->width = initial.horiz.w; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	initial.horiz.parent.ptr->width = initial.horiz.parent.w; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	initial.vert.ptr->height = initial.vert.h; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	initial.vert.parent.ptr->height = initial.vert.parent.h; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	arrange_windows(initial.horiz.ptr->parent, -1, -1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	arrange_windows(initial.vert.ptr->parent, -1, -1); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	pointer_state.mode = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | // Mode set left/right click
 |  |  |  | // Mode set left/right click
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | static void pointer_mode_set_left(void) { |  |  |  | static void pointer_mode_set_left(void) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -228,7 +235,7 @@ void pointer_mode_update(void) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 			if (initial.w + dx > min_sane_w) { |  |  |  | 			if (initial.w + dx > min_sane_w) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 				initial.ptr->width = initial.w + dx; |  |  |  | 				initial.ptr->width = initial.w + dx; | 
			
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} else { //lock.right
 |  |  |  | 		} else { // lock.right
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 			if (initial.w - dx > min_sane_w) { |  |  |  | 			if (initial.w - dx > min_sane_w) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 				initial.ptr->width = initial.w - dx; |  |  |  | 				initial.ptr->width = initial.w - dx; | 
			
		
	
		
		
			
				
					
					|  |  |  | 				initial.ptr->x = initial.x + dx; |  |  |  | 				initial.ptr->x = initial.x + dx; | 
			
		
	
	
		
		
			
				
					|  |  | @ -238,7 +245,7 @@ void pointer_mode_update(void) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 			if (initial.h + dy > min_sane_h) { |  |  |  | 			if (initial.h + dy > min_sane_h) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 				initial.ptr->height = initial.h + dy; |  |  |  | 				initial.ptr->height = initial.h + dy; | 
			
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		} else { //lock.bottom
 |  |  |  | 		} else { // lock.bottom
 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 			if (initial.h - dy > min_sane_h) { |  |  |  | 			if (initial.h - dy > min_sane_h) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 				initial.ptr->height = initial.h - dy; |  |  |  | 				initial.ptr->height = initial.h - dy; | 
			
		
	
		
		
			
				
					
					|  |  |  | 				initial.ptr->y = initial.y + dy; |  |  |  | 				initial.ptr->y = initial.y + dy; | 
			
		
	
	
		
		
			
				
					|  |  | @ -264,34 +271,34 @@ void pointer_mode_update(void) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 		dx -= pointer_state.right.x; |  |  |  | 		dx -= pointer_state.right.x; | 
			
		
	
		
		
			
				
					
					|  |  |  | 		dy -= pointer_state.right.y; |  |  |  | 		dy -= pointer_state.right.y; | 
			
		
	
		
		
			
				
					
					|  |  |  | 		// resize if we can
 |  |  |  | 		// resize if we can
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 		if (initial.lr.ptr) { |  |  |  | 		if (initial.horiz.ptr) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 			if (lock.left) { |  |  |  | 			if (lock.left) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 				// Check whether its fine to resize
 |  |  |  | 				// Check whether its fine to resize
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 				if (initial.w + dx > min_sane_w && initial.lr.w - dx > min_sane_w) { |  |  |  | 				if (initial.w + dx > min_sane_w && initial.horiz.w - dx > min_sane_w) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 					initial.lr.ptr->width = initial.lr.w - dx; |  |  |  | 					initial.horiz.ptr->width = initial.horiz.w - dx; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 					initial.lr.sib.ptr->width = initial.lr.sib.w + dx; |  |  |  | 					initial.horiz.parent.ptr->width = initial.horiz.parent.w + dx; | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 				} |  |  |  | 				} | 
			
		
	
		
		
			
				
					
					|  |  |  | 			} else { //lock.right
 |  |  |  | 			} else { // lock.right
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 				if (initial.w - dx > min_sane_w && initial.lr.w + dx > min_sane_w) { |  |  |  | 				if (initial.w - dx > min_sane_w && initial.horiz.w + dx > min_sane_w) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 					initial.lr.ptr->width = initial.lr.w + dx; |  |  |  | 					initial.horiz.ptr->width = initial.horiz.w + dx; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 					initial.lr.sib.ptr->width = initial.lr.sib.w - dx; |  |  |  | 					initial.horiz.parent.ptr->width = initial.horiz.parent.w - dx; | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 				} |  |  |  | 				} | 
			
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 			arrange_windows(initial.lr.ptr->parent, -1, -1); |  |  |  | 			arrange_windows(initial.horiz.ptr->parent, -1, -1); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 		if (initial.tb.ptr) { |  |  |  | 		if (initial.vert.ptr) { | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 			if (lock.top) { |  |  |  | 			if (lock.top) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 				if (initial.h + dy > min_sane_h && initial.tb.h - dy > min_sane_h) { |  |  |  | 				if (initial.h + dy > min_sane_h && initial.vert.h - dy > min_sane_h) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 					initial.tb.ptr->height = initial.tb.h - dy; |  |  |  | 					initial.vert.ptr->height = initial.vert.h - dy; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 					initial.tb.sib.ptr->height = initial.tb.sib.h + dy; |  |  |  | 					initial.vert.parent.ptr->height = initial.vert.parent.h + dy; | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 				} |  |  |  | 				} | 
			
		
	
		
		
			
				
					
					|  |  |  | 			} else { //lock.bottom
 |  |  |  | 			} else { // lock.bottom
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 				if (initial.h - dy > min_sane_h && initial.tb.h + dy > min_sane_h) { |  |  |  | 				if (initial.h - dy > min_sane_h && initial.vert.h + dy > min_sane_h) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 					initial.tb.ptr->height = initial.tb.h + dy; |  |  |  | 					initial.vert.ptr->height = initial.vert.h + dy; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  | 					initial.tb.sib.ptr->height = initial.tb.sib.h - dy; |  |  |  | 					initial.vert.parent.ptr->height = initial.vert.parent.h - dy; | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 				} |  |  |  | 				} | 
			
		
	
		
		
			
				
					
					|  |  |  | 			} |  |  |  | 			} | 
			
		
	
		
		
			
				
					
					|  |  |  | 			arrange_windows(initial.tb.ptr->parent, -1, -1); |  |  |  | 			arrange_windows(initial.vert.ptr->parent, -1, -1); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 		} |  |  |  | 		} | 
			
		
	
		
		
			
				
					
					|  |  |  | 	default: |  |  |  | 	default: | 
			
		
	
		
		
			
				
					
					|  |  |  | 		return; |  |  |  | 		return; | 
			
		
	
	
		
		
			
				
					|  |  | @ -300,15 +307,17 @@ void pointer_mode_update(void) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | void pointer_mode_reset(void) { |  |  |  | void pointer_mode_reset(void) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 	switch (pointer_state.mode) { |  |  |  | 	switch (pointer_state.mode) { | 
			
		
	
		
		
			
				
					
					|  |  |  | 	case M_FLOATING | M_DRAGGING: |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 	case M_FLOATING | M_RESIZING: |  |  |  | 	case M_FLOATING | M_RESIZING: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	case M_FLOATING | M_DRAGGING: | 
			
		
	
		
		
			
				
					
					|  |  |  | 		reset_initial_view(); |  |  |  | 		reset_initial_view(); | 
			
		
	
		
		
			
				
					
					|  |  |  | 		break; |  |  |  | 		break; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | 	case M_TILING | M_DRAGGING: |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  | 	case M_TILING | M_RESIZING: |  |  |  | 	case M_TILING | M_RESIZING: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		(void) reset_initial_sibling; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 		break; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 	case M_TILING | M_DRAGGING: | 
			
		
	
		
		
			
				
					
					|  |  |  | 	default: |  |  |  | 	default: | 
			
		
	
		
		
			
				
					
					|  |  |  | 		return; |  |  |  | 		break; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 	} |  |  |  | 	} | 
			
		
	
		
		
			
				
					
					|  |  |  | } |  |  |  | } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  |  | 
			
		
	
	
		
		
			
				
					|  |  | 
 |