• Eliot Courtney's avatar
    Move the PIP window out of the way of the floating keyboard and tray. · 05cec5c6
    Eliot Courtney authored
    We are looking for the minimum displacement of the PIP window that makes
    it not intersect any system trays or the floating keyboard.
    
    There are four cases for how the PIP window could move.
    Case #1: Touches 0 obstacles. This corresponds to not moving.
    Case #2: Touches 1 obstacle.
      The PIP window will be touching one edge of the obstacle.
    Case #3: Touches 2 obstacles.
      The PIP window will be touching one horizontal and one vertical edge
      from two different obstacles.
    Case #4: Touches more than 2 obstacles. This is handled in case #3.
    
    To handle all these cases, we just need to check a few candidate points.
    If the PIP window is displaced by one obstacle, the shortest
    displacement is to move along the horizontal or vertical axis to be
    directly adjacent to one of the edges of that obstacle.
    
    If it is displaced by two obstacles, the shortest displacement is to
    move to be directly adjacent to a horizontal and vertical edge - one
    from each obstacle.
    
    keyboard and unified system tray update, and the PIP window moved out of
    the way of both the floating virtual keyboard and unified system tray.
    
    Bug: 883118
    Bug: 841886
    Bug: b/115291749
    Test: Added unittest
    Test: Patched in code calling GetPositionAfterMovementAreaChange on
    Change-Id: I2b500d5ba4a67fe2e309b809ec667248a19518ca
    Reviewed-on: https://chromium-review.googlesource.com/c/1221427
    Commit-Queue: Eliot Courtney <edcourtney@chromium.org>
    Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#604523}
    05cec5c6
pip_positioner.h 3.15 KB