Skip to content

Commit

Permalink
NotificationServer: Reposition notifications on screen resolution change
Browse files Browse the repository at this point in the history
Previously notifications were (partially) drawn outside the screen rect if
they were created before changing the screen resolution to smaller
dimensions. This prevented the user from dismissing the notification as the
close button was no longer clickable.
  • Loading branch information
silvasur authored and awesomekling committed Jan 2, 2021
1 parent 2caf4e6 commit fc2c5c3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Services/NotificationServer/NotificationWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace NotificationServer {

static Vector<RefPtr<NotificationWindow>> s_windows;

static void update_notification_window_locations()
void update_notification_window_locations()
{
Gfx::IntRect last_window_rect;
for (auto& window : s_windows) {
Expand Down
2 changes: 2 additions & 0 deletions Services/NotificationServer/NotificationWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@

namespace NotificationServer {

void update_notification_window_locations();

class NotificationWindow final : public GUI::Window {
C_OBJECT(NotificationWindow);

Expand Down
4 changes: 4 additions & 0 deletions Services/NotificationServer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
*/

#include "ClientConnection.h"
#include "NotificationWindow.h"
#include <LibCore/LocalServer.h>
#include <LibGUI/Application.h>
#include <LibGUI/Desktop.h>
#include <LibGUI/WindowServerConnection.h>
#include <stdio.h>
#include <unistd.h>
Expand Down Expand Up @@ -66,5 +68,7 @@ int main(int argc, char** argv)
return 1;
}

GUI::Desktop::the().on_rect_change = [](auto&) { NotificationServer::update_notification_window_locations(); };

return app->exec();
}

0 comments on commit fc2c5c3

Please sign in to comment.