mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:07:35 +00:00
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. :^)
This commit is contained in:
parent
8c4b7fe385
commit
42cf09fdf1
4 changed files with 10 additions and 16 deletions
|
@ -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());
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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&);
|
||||
|
|
|
@ -94,10 +94,12 @@ WSWindowFrame::WSWindowFrame(WSWindow& window)
|
|||
m_window.event(close_request);
|
||||
}));
|
||||
|
||||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue