From 8a0ea31a5a616378e62c4d67f5f5ba156b1f054d Mon Sep 17 00:00:00 2001 From: Philippe Saint-Pierre Date: Sat, 12 Sep 2009 01:39:18 +0000 Subject: [PATCH] Fonts Preflet : The centering didn't work. * Make use of CenterOnScreen(); to center the window rather than the dirty trick I tried months ago. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33071 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/preferences/fonts/MainWindow.cpp | 22 +++------------------- src/preferences/fonts/MainWindow.h | 3 --- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/src/preferences/fonts/MainWindow.cpp b/src/preferences/fonts/MainWindow.cpp index d45b62f83d..52335a2e1e 100644 --- a/src/preferences/fonts/MainWindow.cpp +++ b/src/preferences/fonts/MainWindow.cpp @@ -36,8 +36,7 @@ static const uint32 kMsgCheckFonts = 'chkf'; MainWindow::MainWindow() : BWindow(BRect(0, 0, 1, 1), "Fonts", B_TITLED_WINDOW, - B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS), - fCentered(false) + B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS) { fDefaultsButton = new BButton("defaults", "Defaults", new BMessage(kMsgSetDefaults), B_WILL_DRAW); @@ -77,19 +76,14 @@ MainWindow::MainWindow() if (fSettings.WindowCorner() == BPoint(-1, -1)) { // center window on screen - fCentered = true; + CenterOnScreen(); } else { MoveTo(fSettings.WindowCorner()); // make sure window is on screen BScreen screen(this); if (!screen.Frame().InsetByCopy(10, 10).Intersects(Frame())) - fCentered = true; - } - - if (fCentered) { - // draw offscreen to avoid flashing windows - MoveTo(BPoint(-1000, -1000)); + CenterOnScreen(); } fRunner = new BMessageRunner(this, new BMessage(kMsgCheckFonts), 3000000); @@ -99,16 +93,6 @@ MainWindow::MainWindow() } -void -MainWindow::Show() -{ - BWindow::Show(); - - if (fCentered) - _Center(); -} - - MainWindow::~MainWindow() { delete fRunner; diff --git a/src/preferences/fonts/MainWindow.h b/src/preferences/fonts/MainWindow.h index c14a9b8c89..8fb1ada1ab 100644 --- a/src/preferences/fonts/MainWindow.h +++ b/src/preferences/fonts/MainWindow.h @@ -27,14 +27,11 @@ public: virtual bool QuitRequested(); virtual void MessageReceived(BMessage *message); - virtual void Show(); private: void _Center(); - bool fCentered; - BMessageRunner* fRunner; FontView* fFontsView; BButton* fDefaultsButton;