mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
WindowServer: Prevent moving a window to inaccessible region
This is based on a comment by @tomuta on #4644, and should prevent all future instances of bugs like #4644. Disadvantage: The current implementation may generate a lot of WM_WindowRectChanged events for a listener while bouncing occurs. Feel free to improve this.
This commit is contained in:
parent
2de471b9f0
commit
a671a5ba7e
1 changed files with 2 additions and 0 deletions
|
@ -559,6 +559,8 @@ bool WindowManager::process_ongoing_window_move(MouseEvent& event, Window*& hove
|
|||
} else if (m_move_window->tiled() == WindowTileType::None) {
|
||||
Gfx::IntPoint pos = m_move_window_origin.translated(event.position() - m_move_origin);
|
||||
m_move_window->set_position_without_repaint(pos);
|
||||
// "Bounce back" the window it it would end up too far outside the screen:
|
||||
m_move_window->normalize_rect();
|
||||
} else if (pixels_moved_from_start > 5) {
|
||||
m_move_window->set_untiled(event.position());
|
||||
m_move_origin = event.position();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue