summaryrefslogtreecommitdiff
path: root/LibGUI
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-06-01 20:10:37 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-06-01 20:10:37 +0200
commit51581c21fca245be7677d61282fe6fc7b6e69ca1 (patch)
treea62bcbcd5e66e9810c53afc6a17d38a5e371f830 /LibGUI
parent8d7fbbe1fbd171d3d22d81736b421ac5b7ea1f90 (diff)
downloadserenity-51581c21fca245be7677d61282fe6fc7b6e69ca1.zip
WindowServer+LibGUI: Add a way to bring a window to the front.
GWindow::move_to_front() can now be used to move a window to the top of the window stack. We use this in Terminal to bring the settings window to the front if it already exists when it's requested, in case it's hiding behind something.
Diffstat (limited to 'LibGUI')
-rw-r--r--LibGUI/GWindow.cpp11
-rw-r--r--LibGUI/GWindow.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/LibGUI/GWindow.cpp b/LibGUI/GWindow.cpp
index cccb2fda24..0e7b94e3f0 100644
--- a/LibGUI/GWindow.cpp
+++ b/LibGUI/GWindow.cpp
@@ -49,6 +49,17 @@ void GWindow::close()
delete_later();
}
+void GWindow::move_to_front()
+{
+ if (!m_window_id)
+ return;
+
+ WSAPI_ClientMessage request;
+ request.type = WSAPI_ClientMessage::Type::MoveWindowToFront;
+ request.window_id = m_window_id;
+ GEventLoop::post_message_to_server(request);
+}
+
void GWindow::show()
{
if (m_window_id)
diff --git a/LibGUI/GWindow.h b/LibGUI/GWindow.h
index 200bec1a77..3178e1820b 100644
--- a/LibGUI/GWindow.h
+++ b/LibGUI/GWindow.h
@@ -79,6 +79,7 @@ public:
void show();
void hide();
void close();
+ void move_to_front();
void start_wm_resize();