From b9cc06b57c0a4a7268e763f063945006c4faddc0 Mon Sep 17 00:00:00 2001 From: Adi Oanca Date: Thu, 28 Apr 2005 18:28:23 +0000 Subject: [PATCH] Show workspace number in the upper left corner git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12497 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/RootLayer.cpp | 23 +++++++++++++++++++++++ src/servers/app/RootLayer.h | 2 ++ 2 files changed, 25 insertions(+) diff --git a/src/servers/app/RootLayer.cpp b/src/servers/app/RootLayer.cpp index 6dc97d6195..3c78d104bb 100644 --- a/src/servers/app/RootLayer.cpp +++ b/src/servers/app/RootLayer.cpp @@ -51,6 +51,7 @@ #include "Decorator.h" //#define DEBUG_ROOTLAYER +#define APPSERVER_ROOTLAYER_SHOW_WORKSPACE_NUMBER #ifdef DEBUG_ROOTLAYER #define STRACE(a) printf a @@ -1445,6 +1446,17 @@ void RootLayer::KeyboardEventHandler(int32 code, BPortLink& msg) show_final_scene(exFocus, exActive); if (string) free(string); + + #ifdef APPSERVER_ROOTLAYER_SHOW_WORKSPACE_NUMBER + { + // to draw the current Workspace index on screen. + BRegion reg(fVisible); + fDriver->ConstrainClippingRegion(®); + Draw(reg.Frame()); + fDriver->ConstrainClippingRegion(NULL); + } + #endif + break; } } @@ -1994,3 +2006,14 @@ void RootLayer::show_final_scene(WinBorder *exFocus, WinBorder *exActive) if (fLastMouseMoved == NULL) debugger("RootLayer::KeyboardEventHandler: 'fLastMouseMoved' can't be null.\n"); } + +void RootLayer::Draw(const BRect &r) +{ + fDriver->FillRect(r, fLayerData->ViewColor()); +#ifdef APPSERVER_ROOTLAYER_SHOW_WORKSPACE_NUMBER + char string[30]; + sprintf(string, "Workspace %ld", fActiveWksIndex+1); + fDriver->DrawString(string, strlen(string), BPoint(5,15), + fLayerData); +#endif +} diff --git a/src/servers/app/RootLayer.h b/src/servers/app/RootLayer.h index b435e80623..9365ed3a0e 100644 --- a/src/servers/app/RootLayer.h +++ b/src/servers/app/RootLayer.h @@ -121,6 +121,8 @@ public: void GoRedraw(const Layer *layer, const BRegion ®ion); void GoChangeWinBorderFeel(const WinBorder *winBorder, int32 newFeel); + virtual void Draw(const BRect &r); + // Debug methods void PrintToStream(void); thread_id LockingThread() { return fAllRegionsLock.LockingThread(); }