more work on floats

This commit is contained in:
Kovid Goyal
2025-04-20 09:44:00 +05:30
parent 96b0c463e8
commit 4e697abb34
2 changed files with 12 additions and 1 deletions

View File

@@ -366,6 +366,7 @@ class Layout:
self.update_visibility(all_windows)
self.blank_rects = []
self.do_layout(all_windows)
self.layout_floats(all_windows)
def layout_single_window_group(self, wg: WindowGroup, add_blank_rects: bool = True) -> None:
bw = 1 if self.must_draw_borders else 0
@@ -429,6 +430,11 @@ class Layout:
def do_layout(self, windows: WindowList) -> None:
raise NotImplementedError()
def layout_floats(self, windows: WindowList) -> None:
for gr in windows.iter_all_floating_groups():
# TODO: actually position the float based on its properties
self.layout_single_window_group(gr, False)
def neighbors_for_window(self, window: WindowType, windows: WindowList) -> NeighborsMap:
return {'left': [], 'right': [], 'top': [], 'bottom': []}

View File

@@ -239,6 +239,11 @@ class WindowList:
if g.is_visible_in_layout and not g.is_floating:
yield g
def iter_all_floating_groups(self) -> Iterator[WindowGroup]:
for g in self.groups:
if g.is_floating:
yield g
@property
def num_layoutable_groups(self) -> int:
ans = 0
@@ -468,7 +473,7 @@ class WindowList:
def compute_needs_borders_map(self, draw_active_borders: bool) -> dict[int, bool]:
ag = self.active_group
return {gr.id: ((gr is ag and draw_active_borders) or gr.needs_attention) for gr in self.groups}
return {gr.id: ((gr is ag and draw_active_borders) or gr.needs_attention) for gr in self.groups if not gr.is_floating}
@property
def num_visble_groups(self) -> int: