From beb636036face95abb3af3a10747509a98c14b30 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sat, 6 Aug 2011 10:41:45 +0000 Subject: [PATCH] Ensure the window is at the right position before showing it. Fixes #7011. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42587 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/notification/NotificationWindow.cpp | 15 ++++++++++++--- src/servers/notification/NotificationWindow.h | 3 ++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/servers/notification/NotificationWindow.cpp b/src/servers/notification/NotificationWindow.cpp index b7acc38ec9..4d3187f95f 100644 --- a/src/servers/notification/NotificationWindow.cpp +++ b/src/servers/notification/NotificationWindow.cpp @@ -54,7 +54,7 @@ const float kSmallPadding = 2; NotificationWindow::NotificationWindow() : - BWindow(BRect(10, 10, 30, 30), B_TRANSLATE_MARK("Notification"), + BWindow(BRect(0, 0, 0, 0), B_TRANSLATE_MARK("Notification"), kLeftTitledWindowLook, B_FLOATING_ALL_WINDOW_FEEL, B_AVOID_FRONT | B_AVOID_FOCUS | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_MINIMIZABLE | B_NOT_RESIZABLE, B_ALL_WORKSPACES) @@ -63,6 +63,7 @@ NotificationWindow::NotificationWindow() AddChild(fBorder); + SetPosition(); Show(); Hide(); @@ -363,13 +364,15 @@ NotificationWindow::ResizeAll() } ResizeTo(ViewWidth(), height); - PopupAnimation(Bounds().Width(), Bounds().Height()); + PopupAnimation(); } void -NotificationWindow::PopupAnimation(float width, float height) +NotificationWindow::SetPosition() { + float width = Bounds().Width(); + float height = Bounds().Height(); float x = 0, y = 0, sx, sy; float pad = 0; BDeskbar deskbar; @@ -423,6 +426,12 @@ NotificationWindow::PopupAnimation(float width, float height) } MoveTo(x, y); +} + +void +NotificationWindow::PopupAnimation() +{ + SetPosition(); if (IsHidden() && fViews.size() != 0) Show(); diff --git a/src/servers/notification/NotificationWindow.h b/src/servers/notification/NotificationWindow.h index a246f7e760..f1fbb76171 100644 --- a/src/servers/notification/NotificationWindow.h +++ b/src/servers/notification/NotificationWindow.h @@ -62,7 +62,8 @@ public: private: friend class AppGroupView; - void PopupAnimation(float, float); + void SetPosition(); + void PopupAnimation(); void LoadSettings(bool startMonitor = false); void LoadAppFilters(bool startMonitor = false); void SaveAppFilters();