|
@@ -50,6 +50,15 @@ namespace WindowServer {
|
|
|
|
|
|
HashMap<int, NonnullRefPtr<ClientConnection>>* s_connections;
|
|
HashMap<int, NonnullRefPtr<ClientConnection>>* s_connections;
|
|
|
|
|
|
|
|
+static Gfx::Rect normalize_window_rect(Gfx::Rect rect, WindowType window_type)
|
|
|
|
+{
|
|
|
|
+ auto min_size = 1;
|
|
|
|
+ if (window_type == WindowType::Normal)
|
|
|
|
+ min_size = 50;
|
|
|
|
+ Gfx::Rect normalized_rect = { rect.x(), rect.y(), max(rect.width(), min_size), max(rect.height(), min_size) };
|
|
|
|
+ return normalized_rect;
|
|
|
|
+}
|
|
|
|
+
|
|
void ClientConnection::for_each_client(Function<void(ClientConnection&)> callback)
|
|
void ClientConnection::for_each_client(Function<void(ClientConnection&)> callback)
|
|
{
|
|
{
|
|
if (!s_connections)
|
|
if (!s_connections)
|
|
@@ -388,9 +397,10 @@ OwnPtr<Messages::WindowServer::SetWindowRectResponse> ClientConnection::handle(c
|
|
dbg() << "ClientConnection: Ignoring SetWindowRect request for fullscreen window";
|
|
dbg() << "ClientConnection: Ignoring SetWindowRect request for fullscreen window";
|
|
return nullptr;
|
|
return nullptr;
|
|
}
|
|
}
|
|
- window.set_rect(message.rect());
|
|
|
|
- window.request_update(message.rect());
|
|
|
|
- return make<Messages::WindowServer::SetWindowRectResponse>();
|
|
|
|
|
|
+ auto normalized_rect = normalize_window_rect(message.rect(), window.type());
|
|
|
|
+ window.set_rect(normalized_rect);
|
|
|
|
+ window.request_update(normalized_rect);
|
|
|
|
+ return make<Messages::WindowServer::SetWindowRectResponse>(normalized_rect);
|
|
}
|
|
}
|
|
|
|
|
|
OwnPtr<Messages::WindowServer::GetWindowRectResponse> ClientConnection::handle(const Messages::WindowServer::GetWindowRect& message)
|
|
OwnPtr<Messages::WindowServer::GetWindowRectResponse> ClientConnection::handle(const Messages::WindowServer::GetWindowRect& message)
|
|
@@ -444,8 +454,10 @@ OwnPtr<Messages::WindowServer::CreateWindowResponse> ClientConnection::handle(co
|
|
auto window = Window::construct(*this, (WindowType)message.type(), window_id, message.modal(), message.minimizable(), message.resizable(), message.fullscreen());
|
|
auto window = Window::construct(*this, (WindowType)message.type(), window_id, message.modal(), message.minimizable(), message.resizable(), message.fullscreen());
|
|
window->set_has_alpha_channel(message.has_alpha_channel());
|
|
window->set_has_alpha_channel(message.has_alpha_channel());
|
|
window->set_title(message.title());
|
|
window->set_title(message.title());
|
|
- if (!message.fullscreen())
|
|
|
|
- window->set_rect(message.rect());
|
|
|
|
|
|
+ if (!message.fullscreen()) {
|
|
|
|
+ auto normalized_rect = normalize_window_rect(message.rect(), window->type());
|
|
|
|
+ window->set_rect(normalized_rect);
|
|
|
|
+ }
|
|
if (window->type() == WindowType::Desktop) {
|
|
if (window->type() == WindowType::Desktop) {
|
|
window->set_rect(WindowManager::the().desktop_rect());
|
|
window->set_rect(WindowManager::the().desktop_rect());
|
|
window->recalculate_rect();
|
|
window->recalculate_rect();
|