diff --git a/src/apps/diskprobe/OpenWindow.cpp b/src/apps/diskprobe/OpenWindow.cpp index a88d687066..4ededce048 100644 --- a/src/apps/diskprobe/OpenWindow.cpp +++ b/src/apps/diskprobe/OpenWindow.cpp @@ -57,12 +57,22 @@ OpenWindow::OpenWindow() .Add(probeDeviceButton, 2, 1) .SetInsets(8, 8, 8, 8) ); - - // TODO: This does not center the window, since with layout management, - // the window will still have an invalid size at this point. BScreen screen(this); - MoveTo(screen.Frame().left + (screen.Frame().Width() - Frame().Width()) / 2, - screen.Frame().top + (screen.Frame().Height() - Frame().Height()) / 2); + // move the window offscreen.. + MoveTo(screen.Frame().right+20, screen.Frame().top); + fCentered = true; +} + + +void +OpenWindow::FrameResized(float width, float height) +{ + if (fCentered) { + BScreen screen(this); + MoveTo(screen.Frame().left + (screen.Frame().Width() - width) / 2, + screen.Frame().top + (screen.Frame().Height() - height) / 2); + } + fCentered = false; } diff --git a/src/apps/diskprobe/OpenWindow.h b/src/apps/diskprobe/OpenWindow.h index 4df1c635ce..b7269751f6 100644 --- a/src/apps/diskprobe/OpenWindow.h +++ b/src/apps/diskprobe/OpenWindow.h @@ -20,11 +20,14 @@ public: virtual void MessageReceived(BMessage* message); virtual bool QuitRequested(); + virtual void FrameResized(float width, float height); + static void CollectDevices(BMenu* menu, BEntry* startEntry = NULL); private: BMenu* fDevicesMenu; + bool fCentered; }; #endif /* OPEN_WINDOW_H */