summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-05-13 00:48:54 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-05-13 00:48:54 +0200
commit42cf09fdf1741a84cf90088287f58023c99034f4 (patch)
tree6b8a743cfaa68527c26d8811ad8ca28ee35d626d
parent8c4b7fe38530ca8fc6f86af0126098a0413ec2dd (diff)
downloadserenity-42cf09fdf1741a84cf90088287f58023c99034f4.zip
WindowServer: Don't add maximize button to non-resizable windows.
The minimize button can stay though, since it doesn't change the window size, just the visibility. :^)
-rw-r--r--Servers/WindowServer/WSClientConnection.cpp3
-rw-r--r--Servers/WindowServer/WSWindow.cpp10
-rw-r--r--Servers/WindowServer/WSWindow.h3
-rw-r--r--Servers/WindowServer/WSWindowFrame.cpp10
4 files changed, 10 insertions, 16 deletions
diff --git a/Servers/WindowServer/WSClientConnection.cpp b/Servers/WindowServer/WSClientConnection.cpp
index 1bc518d602..57bd34adc9 100644
--- a/Servers/WindowServer/WSClientConnection.cpp
+++ b/Servers/WindowServer/WSClientConnection.cpp
@@ -474,10 +474,9 @@ void WSClientConnection::handle_request(const WSAPIGetClipboardContentsRequest&)
void WSClientConnection::handle_request(const WSAPICreateWindowRequest& request)
{
int window_id = m_next_window_id++;
- auto window = make<WSWindow>(*this, request.window_type(), window_id, request.is_modal());
+ auto window = make<WSWindow>(*this, request.window_type(), window_id, request.is_modal(), request.is_resizable());
window->set_background_color(request.background_color());
window->set_has_alpha_channel(request.has_alpha_channel());
- window->set_resizable(request.is_resizable());
window->set_title(request.title());
window->set_rect(request.rect());
window->set_opacity(request.opacity());
diff --git a/Servers/WindowServer/WSWindow.cpp b/Servers/WindowServer/WSWindow.cpp
index 5c81654e7e..3b29e016fd 100644
--- a/Servers/WindowServer/WSWindow.cpp
+++ b/Servers/WindowServer/WSWindow.cpp
@@ -28,10 +28,11 @@ WSWindow::WSWindow(CObject& internal_owner, WSWindowType type)
WSWindowManager::the().add_window(*this);
}
-WSWindow::WSWindow(WSClientConnection& client, WSWindowType window_type, int window_id, bool modal)
+WSWindow::WSWindow(WSClientConnection& client, WSWindowType window_type, int window_id, bool modal, bool resizable)
: m_client(&client)
, m_type(window_type)
, m_modal(modal)
+ , m_resizable(resizable)
, m_window_id(window_id)
, m_icon(default_window_icon())
, m_icon_path(default_window_icon_path())
@@ -261,13 +262,6 @@ void WSWindow::set_visible(bool b)
invalidate();
}
-void WSWindow::set_resizable(bool resizable)
-{
- if (m_resizable == resizable)
- return;
- m_resizable = resizable;
-}
-
void WSWindow::invalidate()
{
WSWindowManager::the().invalidate(*this);
diff --git a/Servers/WindowServer/WSWindow.h b/Servers/WindowServer/WSWindow.h
index 7b4d15af1f..5c9fad376b 100644
--- a/Servers/WindowServer/WSWindow.h
+++ b/Servers/WindowServer/WSWindow.h
@@ -16,7 +16,7 @@ class WSMouseEvent;
class WSWindow final : public CObject, public InlineLinkedListNode<WSWindow> {
public:
- WSWindow(WSClientConnection&, WSWindowType, int window_id, bool modal);
+ WSWindow(WSClientConnection&, WSWindowType, int window_id, bool modal, bool resizable);
WSWindow(CObject&, WSWindowType);
virtual ~WSWindow() override;
@@ -64,7 +64,6 @@ public:
bool is_modal() const { return m_modal; }
bool is_resizable() const { return m_resizable; }
- void set_resizable(bool);
Rect rect() const { return m_rect; }
void set_rect(const Rect&);
diff --git a/Servers/WindowServer/WSWindowFrame.cpp b/Servers/WindowServer/WSWindowFrame.cpp
index 5d4cd88646..ba42e4e67e 100644
--- a/Servers/WindowServer/WSWindowFrame.cpp
+++ b/Servers/WindowServer/WSWindowFrame.cpp
@@ -94,10 +94,12 @@ WSWindowFrame::WSWindowFrame(WSWindow& window)
m_window.event(close_request);
}));
- m_buttons.append(make<WSButton>(*this, *s_maximize_button_bitmap, [this] (auto& button) {
- m_window.set_maximized(!m_window.is_maximized());
- button.set_bitmap(m_window.is_maximized() ? *s_unmaximize_button_bitmap : *s_maximize_button_bitmap);
- }));
+ if (window.is_resizable()) {
+ m_buttons.append(make<WSButton>(*this, *s_maximize_button_bitmap, [this] (auto& button) {
+ m_window.set_maximized(!m_window.is_maximized());
+ button.set_bitmap(m_window.is_maximized() ? *s_unmaximize_button_bitmap : *s_maximize_button_bitmap);
+ }));
+ }
m_buttons.append(make<WSButton>(*this, *s_minimize_button_bitmap, [this] (auto&) {
m_window.set_minimized(true);