* Fix DecoratorFrame() for kLeftTitledWindowLook windows
* Use it in notification window for better positionning. Thanks augiedoggie for reporting the problem ! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42588 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
beb636036f
commit
ee298c8b81
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user