Cleanup splits drag resize handling
This commit is contained in:
parent
bc7523fe32
commit
a222df75cb
1 changed files with 11 additions and 9 deletions
|
|
@ -493,14 +493,14 @@ def edge_windows(self, edge: str) -> Generator[int, None, None]:
|
|||
else:
|
||||
yield q
|
||||
|
||||
def window_on_second(self, wid: int) -> bool:
|
||||
if self.one == wid:
|
||||
def is_group_on_second(self, gid: int) -> bool:
|
||||
if self.one == gid:
|
||||
return False
|
||||
if self.two == wid:
|
||||
if self.two == gid:
|
||||
return True
|
||||
if not isinstance(self.two, Pair):
|
||||
return False
|
||||
return self.two.window_on_second(wid)
|
||||
return self.two.is_group_on_second(gid)
|
||||
|
||||
|
||||
class SplitsLayoutOpts(LayoutOpts):
|
||||
|
|
@ -759,6 +759,7 @@ def drag_resize_window(self, all_windows: WindowList, pair_id: int, increment: f
|
|||
if new_bias != pair.bias:
|
||||
pair.bias = new_bias
|
||||
return True
|
||||
break
|
||||
return False
|
||||
|
||||
def drag_resize_target_windows(
|
||||
|
|
@ -776,11 +777,12 @@ def drag_resize_target_windows(
|
|||
pair_parent_map[p.two] = p
|
||||
p = pair
|
||||
while ans.horizontal_id is None or ans.vertical_id is None:
|
||||
if not p.is_redundant:
|
||||
if ans.horizontal_id is None and p.horizontal and p.window_on_second(wg.id) != is_right:
|
||||
ans = ans._replace(horizontal_id=id(p), width_increases_rightwards=not is_right)
|
||||
if ans.vertical_id is None and not p.horizontal and p.window_on_second(wg.id) != is_bottom:
|
||||
ans = ans._replace(horizontal_id=id(p))
|
||||
if p.is_redundant:
|
||||
continue
|
||||
if ans.horizontal_id is None and p.horizontal:
|
||||
ans = ans._replace(horizontal_id=id(p), width_increases_rightwards=is_right != p.is_group_on_second(wg.id))
|
||||
if ans.vertical_id is None and not p.horizontal:
|
||||
ans = ans._replace(vertical_id=id(p), height_increases_downwards=is_bottom != p.is_group_on_second(wg.id))
|
||||
if (parent := pair_parent_map.get(p)) is None:
|
||||
break
|
||||
p = parent
|
||||
|
|
|
|||
Loading…
Reference in a new issue