summaryrefslogtreecommitdiff
path: root/Userland
diff options
context:
space:
mode:
Diffstat (limited to 'Userland')
-rw-r--r--Userland/Libraries/LibGfx/Rect.cpp10
-rw-r--r--Userland/Libraries/LibGfx/Rect.h2
-rw-r--r--Userland/Services/WindowServer/Window.cpp21
-rw-r--r--Userland/Services/WindowServer/Window.h6
4 files changed, 7 insertions, 32 deletions
diff --git a/Userland/Libraries/LibGfx/Rect.cpp b/Userland/Libraries/LibGfx/Rect.cpp
index 64db8e6270..5f99fe2842 100644
--- a/Userland/Libraries/LibGfx/Rect.cpp
+++ b/Userland/Libraries/LibGfx/Rect.cpp
@@ -309,16 +309,6 @@ void Rect<T>::align_within(Rect<T> const& other, TextAlignment alignment)
}
}
-template<typename T>
-void Rect<T>::set_size_around(Size<T> const& new_size, Point<T> const& fixed_point)
-{
- const T new_x = fixed_point.x() - (T)(new_size.width() * ((float)(fixed_point.x() - x()) / width()));
- const T new_y = fixed_point.y() - (T)(new_size.height() * ((float)(fixed_point.y() - y()) / height()));
-
- set_location({ new_x, new_y });
- set_size(new_size);
-}
-
template<>
String IntRect::to_string() const
{
diff --git a/Userland/Libraries/LibGfx/Rect.h b/Userland/Libraries/LibGfx/Rect.h
index 9c6f63afaf..fcee570127 100644
--- a/Userland/Libraries/LibGfx/Rect.h
+++ b/Userland/Libraries/LibGfx/Rect.h
@@ -107,8 +107,6 @@ public:
m_size = size;
}
- void set_size_around(Size<T> const&, Point<T> const& fixed_point);
-
void set_size(T width, T height)
{
m_size.set_width(width);
diff --git a/Userland/Services/WindowServer/Window.cpp b/Userland/Services/WindowServer/Window.cpp
index 43fc259806..c914b8315d 100644
--- a/Userland/Services/WindowServer/Window.cpp
+++ b/Userland/Services/WindowServer/Window.cpp
@@ -415,7 +415,7 @@ void Window::set_occluded(bool occluded)
WindowManager::the().notify_occlusion_state_changed(*this);
}
-void Window::set_maximized(bool maximized, Optional<Gfx::IntPoint> fixed_point)
+void Window::set_maximized(bool maximized)
{
if (is_maximized() == maximized)
return;
@@ -427,13 +427,7 @@ void Window::set_maximized(bool maximized, Optional<Gfx::IntPoint> fixed_point)
m_unmaximized_rect = m_floating_rect;
set_rect(WindowManager::the().tiled_window_rect(*this));
} else {
- if (fixed_point.has_value()) {
- auto new_rect = Gfx::IntRect(m_rect);
- new_rect.set_size_around(m_unmaximized_rect.size(), fixed_point.value());
- set_rect(new_rect);
- } else {
- set_rect(m_unmaximized_rect);
- }
+ set_rect(m_unmaximized_rect);
}
m_frame.did_set_maximized({}, maximized);
Core::EventLoop::current().post_event(*this, make<ResizeEvent>(m_rect));
@@ -920,21 +914,14 @@ void Window::check_untile_due_to_resize(Gfx::IntRect const& new_rect)
m_tile_type = new_tile_type;
}
-bool Window::set_untiled(Optional<Gfx::IntPoint> fixed_point)
+bool Window::set_untiled()
{
if (m_tile_type == WindowTileType::None)
return false;
VERIFY(!resize_aspect_ratio().has_value());
m_tile_type = WindowTileType::None;
-
- if (fixed_point.has_value()) {
- auto new_rect = Gfx::IntRect(m_rect);
- new_rect.set_size_around(m_floating_rect.size(), fixed_point.value());
- set_rect(new_rect);
- } else {
- set_rect(m_floating_rect);
- }
+ set_rect(m_floating_rect);
Core::EventLoop::current().post_event(*this, make<ResizeEvent>(m_rect));
diff --git a/Userland/Services/WindowServer/Window.h b/Userland/Services/WindowServer/Window.h
index f3dfc83f02..94ab480be0 100644
--- a/Userland/Services/WindowServer/Window.h
+++ b/Userland/Services/WindowServer/Window.h
@@ -109,7 +109,7 @@ public:
void set_resizable(bool);
bool is_maximized() const { return m_tile_type == WindowTileType::Maximized; }
- void set_maximized(bool, Optional<Gfx::IntPoint> fixed_point = {});
+ void set_maximized(bool);
bool is_always_on_top() const { return m_always_on_top; }
void set_always_on_top(bool);
@@ -122,7 +122,7 @@ public:
void set_tiled(WindowTileType);
WindowTileType tile_type_based_on_rect(Gfx::IntRect const&) const;
void check_untile_due_to_resize(Gfx::IntRect const&);
- bool set_untiled(Optional<Gfx::IntPoint> fixed_point = {});
+ bool set_untiled();
Gfx::IntRect floating_rect() const { return m_floating_rect; }
void set_floating_rect(Gfx::IntRect rect) { m_floating_rect = rect; }
@@ -265,7 +265,7 @@ public:
// The screen can change, so "tiled" and "fixed aspect ratio" are mutually exclusive.
// Similarly for "maximized" and "fixed aspect ratio".
// In order to resolve this, undo those properties first:
- set_untiled(position());
+ set_untiled();
set_maximized(false);
m_resize_aspect_ratio = ratio;
}