From be7f06513d5da10ebf8cbdd13d2c81d5a9f79582 Mon Sep 17 00:00:00 2001 From: shatty Date: Sun, 10 Aug 2003 09:14:33 +0000 Subject: [PATCH] fixed swapping windows bug and simplified opening window api in anticipation of smart window locating git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4263 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/apps/terminal/TerminalApp.cpp | 3 +-- src/apps/terminal/TerminalWindow.cpp | 12 +++++++----- src/apps/terminal/TerminalWindow.h | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/apps/terminal/TerminalApp.cpp b/src/apps/terminal/TerminalApp.cpp index a316b71256..ed51a12a10 100644 --- a/src/apps/terminal/TerminalApp.cpp +++ b/src/apps/terminal/TerminalApp.cpp @@ -66,8 +66,7 @@ TerminalApp::MessageReceived(BMessage *message) void TerminalApp::OpenTerminal(BMessage * message) { - BPoint windowPoint(7,26); - TerminalWindow * terminal = new TerminalWindow(windowPoint,message); + TerminalWindow * terminal = new TerminalWindow(message); fWindowOpened = true; } diff --git a/src/apps/terminal/TerminalWindow.cpp b/src/apps/terminal/TerminalWindow.cpp index ef7f68617a..e6074c085c 100644 --- a/src/apps/terminal/TerminalWindow.cpp +++ b/src/apps/terminal/TerminalWindow.cpp @@ -24,13 +24,15 @@ #include -int id = 1; +BRect terminalWindowBounds(0,0,560,390); -TerminalWindow::TerminalWindow(BPoint topLeft, BMessage * settings) - : BWindow(BRect(topLeft,topLeft+BPoint(560,390)), - "terminal",B_DOCUMENT_WINDOW,0) +TerminalWindow::TerminalWindow(BMessage * settings) + : BWindow(terminalWindowBounds.OffsetBySelf(7,26), + "Terminal",B_DOCUMENT_WINDOW,0) { fInitStatus = B_ERROR; + int id = 1; + fInitStatus = InitWindow(id++); Show(); } @@ -349,7 +351,7 @@ TerminalWindow::SwitchTerminals(BMessage * message) return; } do { - index = (index-1)%teams.CountItems(); + index = (index+teams.CountItems()-1)%teams.CountItems(); team_id next = (team_id)teams.ItemAt(index); result = be_roster->ActivateApp(next); } while (result != B_OK); diff --git a/src/apps/terminal/TerminalWindow.h b/src/apps/terminal/TerminalWindow.h index aa35237b09..6cd9232f3f 100644 --- a/src/apps/terminal/TerminalWindow.h +++ b/src/apps/terminal/TerminalWindow.h @@ -16,7 +16,7 @@ class TerminalWindow : public BWindow { public: - TerminalWindow(BPoint topLeft, BMessage * settings = 0); + TerminalWindow(BMessage * settings = 0); virtual ~TerminalWindow(); virtual void Quit(void);