Patch by Oliver Coursiere:

Center the TV window on start. Fixes ticket #3041. Thanks!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29363 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2009-03-01 13:58:05 +00:00
parent cafd739df8
commit d5e2aa9389
2 changed files with 27 additions and 2 deletions

View File

@ -132,6 +132,8 @@ MainWin::MainWin(BRect frame_rect)
SetChannelMenuMarker();
VideoFormatChange(fSourceWidth, fSourceHeight, fWidthScale, fHeightScale);
CenterWindow();
}
@ -1175,3 +1177,25 @@ MainWin::MessageReceived(BMessage *msg)
}
}
}
void
MainWin::CenterWindow()
{
BScreen screen(this);
if (!screen.IsValid())
return;
BRect frame = screen.Frame();
BRect windowFrame = Frame();
float left = floor((frame.Width() - windowFrame.Width()) / 2);
float top = floor((frame.Height() - windowFrame.Height()) / 2);
if (left < 20)
left = 20;
if (top < 20)
top = 20;
MoveTo(left, top);
}

View File

@ -61,7 +61,7 @@ public:
void SetInterfaceMenuMarker();
void SetChannelMenuMarker();
void VideoFormatChange(int width, int height, float width_scale, float height_scale);
void UpdateWindowTitle();
@ -75,7 +75,8 @@ public:
void ToggleNoBorder();
void ToggleNoMenu();
void ToggleNoBorderNoMenu();
void CenterWindow();
void ShowContextMenu(const BPoint &screen_point);
BMenuBar * fMenuBar;