Skip to content

Only consider window edges that transitively touch each other #21

@Flupp

Description

@Flupp

There is the following longstanding deficiency:

Currently, not only snapped window edges are considered as connected, but even edges which are only on the same row/column are considered as connected. I have not decided yet if this is a bug or a feature.

A not too inefficient algorithm to find exactly those windows that transitively touch the moved edge might look as follows; we assume a vertical edge is moved:

  • Let W be the set of all windows.
  • Let S = {the resized window}.
  • Let TODO = WS.
  • Let x be the current horizontal position of the moved vertical edge.
  • Let l be the vertical position of the lower edge of the resized window.
  • Let u be the vertical position of the upper edge of the resized window.
  • While TODO ≠ ∅:
    • Choose cTODO.
    • TODO = TODOc.
    • If c has a vertical edge that has horizontal position x and that touches the interval (l, u), then:
      • Let S = S ∪ {c}.
      • Let l = min(l, vertical position of the lower edge of c).
      • Let u = max(u, vertical position of the upper edge of c).
      • Let TODO = WS.
  • Now S should contain exactly those windows that transitively stick to the moved edge.

Runtime presumably is in O(|W|²).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions