summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-09-16 18:38:42 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-09-16 18:38:42 +0200
commitd92e26d0234a0719ed76dc14325998d5ed797b38 (patch)
treeec939f0d8252f9c16062cc5f72bb8ac807eead03 /Libraries/LibGUI
parenta34f3a372900caebc308ec23691f6bfcad6d7a6e (diff)
downloadserenity-d92e26d0234a0719ed76dc14325998d5ed797b38.zip
WindowServer+LibGUI: Allow switching windows in/out of fullscreen mode
You can now call GWindow::set_fullscreen(bool) and it will go in or out of fullscreen mode. WindowServer will also remember the previous window rect when switching to fullscreen, and restore it when switching back. :^)
Diffstat (limited to 'Libraries/LibGUI')
-rw-r--r--Libraries/LibGUI/GWindow.cpp15
-rw-r--r--Libraries/LibGUI/GWindow.h2
2 files changed, 16 insertions, 1 deletions
diff --git a/Libraries/LibGUI/GWindow.cpp b/Libraries/LibGUI/GWindow.cpp
index d341bef256..997b587e78 100644
--- a/Libraries/LibGUI/GWindow.cpp
+++ b/Libraries/LibGUI/GWindow.cpp
@@ -714,3 +714,18 @@ void GWindow::save_to(AK::JsonObject& json)
json.set("size_increment", size_increment().to_string());
CObject::save_to(json);
}
+
+void GWindow::set_fullscreen(bool fullscreen)
+{
+ if (m_fullscreen == fullscreen)
+ return;
+ m_fullscreen = fullscreen;
+ if (!m_window_id)
+ return;
+
+ WSAPI_ClientMessage request;
+ request.type = WSAPI_ClientMessage::Type::SetFullscreen;
+ request.window_id = m_window_id;
+ request.value = fullscreen;
+ GWindowServerConnection::the().sync_request(request, WSAPI_ServerMessage::Type::DidSetFullscreen);
+}
diff --git a/Libraries/LibGUI/GWindow.h b/Libraries/LibGUI/GWindow.h
index e563cb1322..7591a66ad8 100644
--- a/Libraries/LibGUI/GWindow.h
+++ b/Libraries/LibGUI/GWindow.h
@@ -33,7 +33,7 @@ public:
void set_modal(bool);
bool is_fullscreen() const { return m_fullscreen; }
- void set_fullscreen(bool fullscreen) { m_fullscreen = fullscreen; }
+ void set_fullscreen(bool);
bool is_resizable() const { return m_resizable; }
void set_resizable(bool resizable) { m_resizable = resizable; }