summaryrefslogtreecommitdiff
path: root/Libraries/LibGUI
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-06-11 22:46:49 +0200
committerAndreas Kling <kling@serenityos.org>2020-06-11 22:46:49 +0200
commit2ce2c4810a32810f745d0b9adb6a93a0fafdb205 (patch)
tree36916d6f96bf933d6ce33aa510754704da8094a8 /Libraries/LibGUI
parent940fbea3a7be56424f553bcca7d6d04205dd77b1 (diff)
downloadserenity-2ce2c4810a32810f745d0b9adb6a93a0fafdb205.zip
LibIPC+WindowServer+LibGUI: Detect and highlight unresponsive GUI apps
IPC::ClientConnection now tracks the time since the last time we got a message from the client and calls a virtual function on itself after 3 seconds: may_have_become_unresponsive(). Subclasses of ClientConnection can then react to this if they like. We use this mechanism in WindowServer to send out a friendly Ping message to the client. If he doesn't Pong within 1 second, we mark the client as "unresponsive" and recompose all of his windows with a darkened appearance and amended title until he Pongs us. This is a little on the aggressive side and we should figure out a way to wake up less often. Perhaps this could only be done to windows the user is currently interacting with, for example. Anyways, this is pretty cool! :^)
Diffstat (limited to 'Libraries/LibGUI')
-rw-r--r--Libraries/LibGUI/WindowServerConnection.cpp5
-rw-r--r--Libraries/LibGUI/WindowServerConnection.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/Libraries/LibGUI/WindowServerConnection.cpp b/Libraries/LibGUI/WindowServerConnection.cpp
index ed8c584dbc..7ebbe2a43a 100644
--- a/Libraries/LibGUI/WindowServerConnection.cpp
+++ b/Libraries/LibGUI/WindowServerConnection.cpp
@@ -334,4 +334,9 @@ void WindowServerConnection::handle(const Messages::WindowClient::DisplayLinkNot
});
}
+void WindowServerConnection::handle(const Messages::WindowClient::Ping&)
+{
+ post_message(Messages::WindowServer::Pong());
+}
+
}
diff --git a/Libraries/LibGUI/WindowServerConnection.h b/Libraries/LibGUI/WindowServerConnection.h
index 1bf058c42a..9f8dda6e4e 100644
--- a/Libraries/LibGUI/WindowServerConnection.h
+++ b/Libraries/LibGUI/WindowServerConnection.h
@@ -74,6 +74,7 @@ private:
virtual void handle(const Messages::WindowClient::UpdateSystemTheme&) override;
virtual void handle(const Messages::WindowClient::WindowStateChanged&) override;
virtual void handle(const Messages::WindowClient::DisplayLinkNotification&) override;
+ virtual void handle(const Messages::WindowClient::Ping&) override;
bool m_display_link_notification_pending { false };
};