* 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:
@@ -2078,14 +2078,34 @@ BRect
|
|||||||
BWindow::DecoratorFrame() const
|
BWindow::DecoratorFrame() const
|
||||||
{
|
{
|
||||||
BRect decoratorFrame(Frame());
|
BRect decoratorFrame(Frame());
|
||||||
float borderWidth;
|
BRect tabRect(0, 0, 0, 0);
|
||||||
float tabHeight;
|
|
||||||
_GetDecoratorSize(&borderWidth, &tabHeight);
|
float borderWidth = 5.0;
|
||||||
// TODO: Broken for tab on left window side windows...
|
|
||||||
decoratorFrame.top -= tabHeight;
|
BMessage settings;
|
||||||
decoratorFrame.left -= borderWidth;
|
if (GetDecoratorSettings(&settings) == B_OK) {
|
||||||
decoratorFrame.right += borderWidth;
|
settings.FindRect("tab frame", &tabRect);
|
||||||
decoratorFrame.bottom += borderWidth;
|
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;
|
return decoratorFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -62,8 +62,7 @@ NotificationWindow::NotificationWindow()
|
|||||||
fBorder = new BorderView(Bounds(), "Notification");
|
fBorder = new BorderView(Bounds(), "Notification");
|
||||||
|
|
||||||
AddChild(fBorder);
|
AddChild(fBorder);
|
||||||
|
|
||||||
SetPosition();
|
|
||||||
Show();
|
Show();
|
||||||
Hide();
|
Hide();
|
||||||
|
|
||||||
@@ -371,8 +370,13 @@ NotificationWindow::ResizeAll()
|
|||||||
void
|
void
|
||||||
NotificationWindow::SetPosition()
|
NotificationWindow::SetPosition()
|
||||||
{
|
{
|
||||||
float width = Bounds().Width();
|
BRect bounds = DecoratorFrame();
|
||||||
float height = Bounds().Height();
|
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 x = 0, y = 0, sx, sy;
|
||||||
float pad = 0;
|
float pad = 0;
|
||||||
BDeskbar deskbar;
|
BDeskbar deskbar;
|
||||||
@@ -381,10 +385,8 @@ NotificationWindow::SetPosition()
|
|||||||
switch (deskbar.Location()) {
|
switch (deskbar.Location()) {
|
||||||
case B_DESKBAR_TOP:
|
case B_DESKBAR_TOP:
|
||||||
// Put it just under, top right corner
|
// Put it just under, top right corner
|
||||||
sx = frame.right;
|
y = frame.bottom + pad + topOffset;
|
||||||
sy = frame.bottom + pad;
|
x = frame.right - width;
|
||||||
y = sy;
|
|
||||||
x = sx - width - pad;
|
|
||||||
break;
|
break;
|
||||||
case B_DESKBAR_BOTTOM:
|
case B_DESKBAR_BOTTOM:
|
||||||
// Put it just above, lower left corner
|
// Put it just above, lower left corner
|
||||||
@@ -396,14 +398,14 @@ NotificationWindow::SetPosition()
|
|||||||
case B_DESKBAR_LEFT_TOP:
|
case B_DESKBAR_LEFT_TOP:
|
||||||
// Put it just to the right of the deskbar
|
// Put it just to the right of the deskbar
|
||||||
sx = frame.right + pad;
|
sx = frame.right + pad;
|
||||||
sy = frame.top - height;
|
//sy = frame.top - height;
|
||||||
x = sx;
|
x = sx + leftOffset;
|
||||||
y = frame.top + pad;
|
y = frame.top + pad;
|
||||||
break;
|
break;
|
||||||
case B_DESKBAR_RIGHT_TOP:
|
case B_DESKBAR_RIGHT_TOP:
|
||||||
// Put it just to the left of the deskbar
|
// Put it just to the left of the deskbar
|
||||||
sx = frame.left - width - pad;
|
sx = frame.left - width - pad;
|
||||||
sy = frame.top - height;
|
//sy = frame.top - height;
|
||||||
x = sx;
|
x = sx;
|
||||||
y = frame.top + pad;
|
y = frame.top + pad;
|
||||||
break;
|
break;
|
||||||
@@ -411,7 +413,7 @@ NotificationWindow::SetPosition()
|
|||||||
// Put it to the right of the deskbar.
|
// Put it to the right of the deskbar.
|
||||||
sx = frame.right + pad;
|
sx = frame.right + pad;
|
||||||
sy = frame.bottom;
|
sy = frame.bottom;
|
||||||
x = sx;
|
x = sx + leftOffset;
|
||||||
y = sy - height - pad;
|
y = sy - height - pad;
|
||||||
break;
|
break;
|
||||||
case B_DESKBAR_RIGHT_BOTTOM:
|
case B_DESKBAR_RIGHT_BOTTOM:
|
||||||
@@ -516,6 +518,13 @@ NotificationWindow::SaveAppFilters()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void NotificationWindow::Show()
|
||||||
|
{
|
||||||
|
BWindow::Show();
|
||||||
|
SetPosition();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
NotificationWindow::_LoadGeneralSettings(bool startMonitor)
|
NotificationWindow::_LoadGeneralSettings(bool startMonitor)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,6 +51,8 @@ public:
|
|||||||
virtual void WorkspaceActivated(int32, bool);
|
virtual void WorkspaceActivated(int32, bool);
|
||||||
virtual BHandler* ResolveSpecifier(BMessage*, int32, BMessage*,
|
virtual BHandler* ResolveSpecifier(BMessage*, int32, BMessage*,
|
||||||
int32, const char*);
|
int32, const char*);
|
||||||
|
|
||||||
|
void Show();
|
||||||
|
|
||||||
icon_size IconSize();
|
icon_size IconSize();
|
||||||
int32 Timeout();
|
int32 Timeout();
|
||||||
|
|||||||
Reference in New Issue
Block a user