1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:27:35 +00:00

WindowServer: Fix crash when initiating resize from a window edge.

This commit is contained in:
Andreas Kling 2019-03-14 18:49:12 +01:00
parent b7ad35d040
commit 49f273c4ca

View file

@ -630,10 +630,8 @@ void WSWindowManager::start_window_resize(WSWindow& window, WSMouseEvent& event)
ASSERT(outer_rect.contains(event.position())); ASSERT(outer_rect.contains(event.position()));
int window_relative_x = event.x() - outer_rect.x(); int window_relative_x = event.x() - outer_rect.x();
int window_relative_y = event.y() - outer_rect.y(); int window_relative_y = event.y() - outer_rect.y();
int hot_area_row = window_relative_y / (outer_rect.height() / 3); int hot_area_row = min(2, window_relative_y / (outer_rect.height() / 3));
int hot_area_column = window_relative_x / (outer_rect.width() / 3); int hot_area_column = min(2, window_relative_x / (outer_rect.width() / 3));
ASSERT(hot_area_row >= 0 && hot_area_row <= 2);
ASSERT(hot_area_column >= 0 && hot_area_column <= 2);
m_resize_direction = direction_for_hot_area[hot_area_row][hot_area_column]; m_resize_direction = direction_for_hot_area[hot_area_row][hot_area_column];
if (m_resize_direction == ResizeDirection::None) { if (m_resize_direction == ResizeDirection::None) {
ASSERT(!m_resize_window); ASSERT(!m_resize_window);