mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
parent
e200824125
commit
79f534ef12
3 changed files with 7 additions and 5 deletions
|
@ -176,7 +176,7 @@ void Window::set_rect_without_repaint(const Gfx::IntRect& rect)
|
|||
m_frame.notify_window_rect_changed(old_rect, rect); // recomputes occlusions
|
||||
}
|
||||
|
||||
void Window::normalize_rect()
|
||||
void Window::normalize_rect(bool force_titlebar_visible)
|
||||
{
|
||||
Gfx::IntRect arena = WindowManager::the().arena_rect_for_type(type());
|
||||
auto min_size = 1;
|
||||
|
@ -201,7 +201,7 @@ void Window::normalize_rect()
|
|||
|
||||
// Make sure that at least half of the titlebar is visible.
|
||||
auto min_frame_y = arena.top() - (y() - old_frame_rect.y()) / 2;
|
||||
if (new_frame_rect.y() < min_frame_y) {
|
||||
if (force_titlebar_visible && new_frame_rect.y() < min_frame_y) {
|
||||
new_frame_rect.set_y(min_frame_y);
|
||||
}
|
||||
|
||||
|
|
|
@ -159,7 +159,7 @@ public:
|
|||
void set_rect(const Gfx::IntRect&);
|
||||
void set_rect(int x, int y, int width, int height) { set_rect({ x, y, width, height }); }
|
||||
void set_rect_without_repaint(const Gfx::IntRect&);
|
||||
void normalize_rect();
|
||||
void normalize_rect(bool force_titlebar_visible = true);
|
||||
|
||||
void set_taskbar_rect(const Gfx::IntRect&);
|
||||
const Gfx::IntRect& taskbar_rect() const { return m_taskbar_rect; }
|
||||
|
|
|
@ -554,8 +554,10 @@ 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();
|
||||
// "Bounce back" the window if it would end up too far outside the screen.
|
||||
// If the user has let go of Mod_Logo, maybe they didn't intentionally press it to begin with. Therefore, refuse to go into a state where knowledge about super-drags is necessary.
|
||||
bool force_titlebar_visible = !(m_keyboard_modifiers & Mod_Logo);
|
||||
m_move_window->normalize_rect(force_titlebar_visible);
|
||||
} else if (pixels_moved_from_start > 5) {
|
||||
m_move_window->set_untiled(event.position());
|
||||
m_move_origin = event.position();
|
||||
|
|
Loading…
Add table
Reference in a new issue