diff --git a/src/kits/interface/Window.cpp b/src/kits/interface/Window.cpp index a14759f81a..aad44398ce 100644 --- a/src/kits/interface/Window.cpp +++ b/src/kits/interface/Window.cpp @@ -2078,14 +2078,34 @@ BRect BWindow::DecoratorFrame() const { BRect decoratorFrame(Frame()); - float borderWidth; - float tabHeight; - _GetDecoratorSize(&borderWidth, &tabHeight); - // TODO: Broken for tab on left window side windows... - decoratorFrame.top -= tabHeight; - decoratorFrame.left -= borderWidth; - decoratorFrame.right += borderWidth; - decoratorFrame.bottom += borderWidth; + BRect tabRect(0, 0, 0, 0); + + float borderWidth = 5.0; + + BMessage settings; + if (GetDecoratorSettings(&settings) == B_OK) { + settings.FindRect("tab frame", &tabRect); + settings.FindFloat("border width", &borderWidth); + } else { + // probably no-border window look + if (fLook == B_NO_BORDER_WINDOW_LOOK) { + borderWidth = 0.0; + } + // else use fall-back values from above + } + + if (fLook & kLeftTitledWindowLook) { + decoratorFrame.top -= borderWidth; + decoratorFrame.left -= tabRect.Width(); + decoratorFrame.right += borderWidth; + decoratorFrame.bottom += borderWidth; + } else { + decoratorFrame.top -= tabRect.Height(); + decoratorFrame.left -= borderWidth; + decoratorFrame.right += borderWidth; + decoratorFrame.bottom += borderWidth; + } + return decoratorFrame; } diff --git a/src/servers/notification/NotificationWindow.cpp b/src/servers/notification/NotificationWindow.cpp index 4d3187f95f..4621ae328f 100644 --- a/src/servers/notification/NotificationWindow.cpp +++ b/src/servers/notification/NotificationWindow.cpp @@ -62,8 +62,7 @@ NotificationWindow::NotificationWindow() fBorder = new BorderView(Bounds(), "Notification"); AddChild(fBorder); - - SetPosition(); + Show(); Hide(); @@ -371,8 +370,13 @@ NotificationWindow::ResizeAll() void NotificationWindow::SetPosition() { - float width = Bounds().Width(); - float height = Bounds().Height(); + BRect bounds = DecoratorFrame(); + float width = bounds.Width(); + float height = bounds.Height(); + + float leftOffset = Frame().left - DecoratorFrame().left; + float topOffset = DecoratorFrame().top - Frame().top; + float x = 0, y = 0, sx, sy; float pad = 0; BDeskbar deskbar; @@ -381,10 +385,8 @@ NotificationWindow::SetPosition() switch (deskbar.Location()) { case B_DESKBAR_TOP: // Put it just under, top right corner - sx = frame.right; - sy = frame.bottom + pad; - y = sy; - x = sx - width - pad; + y = frame.bottom + pad + topOffset; + x = frame.right - width; break; case B_DESKBAR_BOTTOM: // Put it just above, lower left corner @@ -396,14 +398,14 @@ NotificationWindow::SetPosition() case B_DESKBAR_LEFT_TOP: // Put it just to the right of the deskbar sx = frame.right + pad; - sy = frame.top - height; - x = sx; + //sy = frame.top - height; + x = sx + leftOffset; y = frame.top + pad; break; case B_DESKBAR_RIGHT_TOP: // Put it just to the left of the deskbar sx = frame.left - width - pad; - sy = frame.top - height; + //sy = frame.top - height; x = sx; y = frame.top + pad; break; @@ -411,7 +413,7 @@ NotificationWindow::SetPosition() // Put it to the right of the deskbar. sx = frame.right + pad; sy = frame.bottom; - x = sx; + x = sx + leftOffset; y = sy - height - pad; break; case B_DESKBAR_RIGHT_BOTTOM: @@ -516,6 +518,13 @@ NotificationWindow::SaveAppFilters() } +void NotificationWindow::Show() +{ + BWindow::Show(); + SetPosition(); +} + + void NotificationWindow::_LoadGeneralSettings(bool startMonitor) { diff --git a/src/servers/notification/NotificationWindow.h b/src/servers/notification/NotificationWindow.h index f1fbb76171..1d1658f402 100644 --- a/src/servers/notification/NotificationWindow.h +++ b/src/servers/notification/NotificationWindow.h @@ -51,6 +51,8 @@ public: virtual void WorkspaceActivated(int32, bool); virtual BHandler* ResolveSpecifier(BMessage*, int32, BMessage*, int32, const char*); + + void Show(); icon_size IconSize(); int32 Timeout();