From e32785759f5ebbc48ff625e6fe2352ef786aac2d Mon Sep 17 00:00:00 2001 From: Adi Oanca Date: Tue, 18 Jan 2005 22:23:34 +0000 Subject: [PATCH] Fixed cursor bug; made some cursor handlers temporaly unavailable. :-D - this is part of moving PollerThread into RootLayer class. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10852 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/server/AppServer.cpp | 7 +- src/servers/app/server/CursorHandler.cpp | 2 + src/servers/app/server/CursorManager.cpp | 117 ----------------------- src/servers/app/server/DisplayDriver.cpp | 42 +++++++- src/servers/app/server/RootLayer.cpp | 3 +- src/servers/app/server/RootLayer.h | 1 + src/servers/app/server/ServerApp.cpp | 19 +++- src/servers/app/server/ServerWindow.cpp | 3 +- 8 files changed, 64 insertions(+), 130 deletions(-) diff --git a/src/servers/app/server/AppServer.cpp b/src/servers/app/server/AppServer.cpp index 49d73764b7..4b75fa12fa 100644 --- a/src/servers/app/server/AppServer.cpp +++ b/src/servers/app/server/AppServer.cpp @@ -130,15 +130,14 @@ AppServer::AppServer(void) gui_colorset.SetToDefaults(); InitDecorators(); + + // Create the cursor manager. Object declared in CursorManager.cpp + cursormanager= new CursorManager(); // Set up the Desktop desktop= new Desktop(); desktop->Init(); - // Create the cursor manager. Object declared in CursorManager.cpp - cursormanager= new CursorManager(); - cursormanager->SetCursor(B_CURSOR_DEFAULT); - // Create the bitmap allocator. Object declared in BitmapManager.cpp bitmapmanager= new BitmapManager(); diff --git a/src/servers/app/server/CursorHandler.cpp b/src/servers/app/server/CursorHandler.cpp index 96f7cdb08c..a9b6e79489 100644 --- a/src/servers/app/server/CursorHandler.cpp +++ b/src/servers/app/server/CursorHandler.cpp @@ -99,6 +99,8 @@ void CursorHandler::MoveTo(const BPoint &pt) return; fCursorPos=pt; +if (!fSavedData) + debugger("NULL savedata\n"); fDriver->CopyBitmap(fSavedData,fSavedData->Bounds(),fOldPosition,&(fDriver->fDrawData)); fPosition.OffsetTo(fCursorPos.x-fCursor->GetHotSpot().x, fCursorPos.y-fCursor->GetHotSpot().y); diff --git a/src/servers/app/server/CursorManager.cpp b/src/servers/app/server/CursorManager.cpp index 661fdfcc6f..3a292e0aa6 100644 --- a/src/servers/app/server/CursorManager.cpp +++ b/src/servers/app/server/CursorManager.cpp @@ -24,8 +24,6 @@ // Description: Handles the system's cursor infrastructure // //------------------------------------------------------------------------------ -#include "DisplayDriver.h" -#include "Desktop.h" #include "CursorManager.h" #include "ServerCursor.h" #include "CursorData.h" @@ -175,121 +173,6 @@ void CursorManager::RemoveAppCursors(team_id team) Unlock(); } -//! Wrapper around the DisplayDriver ShowCursor call -void CursorManager::ShowCursor(void) -{ - Lock(); - - DisplayDriver *driver = desktop->ActiveScreen()->DDriver(); - driver->ShowCursor(); - Unlock(); -} - -//! Wrapper around the DisplayDriver HideCursor call -void CursorManager::HideCursor(void) -{ - Lock(); - - DisplayDriver *driver = desktop->ActiveScreen()->DDriver(); - driver->HideCursor(); - Unlock(); -} - -//! Wrapper around the DisplayDriver ObscureCursor call -void CursorManager::ObscureCursor(void) -{ - Lock(); - - DisplayDriver *driver = desktop->ActiveScreen()->DDriver(); - driver->ObscureCursor(); - Unlock(); -} - -/*! - \brief Set the screen's cursor - \param token ID of the screen's new cursor -*/ -void CursorManager::SetCursor(int32 token) -{ - Lock(); - ServerCursor *c=FindCursor(token); - if(c) - { - DisplayDriver *driver = desktop->ActiveScreen()->DDriver(); - driver->SetCursor(c); - fCurrentWhich=B_CURSOR_OTHER; - } - Unlock(); -} - -void CursorManager::SetCursor(cursor_which which) -{ - Lock(); - - DisplayDriver *driver = desktop->ActiveScreen()->DDriver(); - switch(which) - { - case B_CURSOR_DEFAULT: - { - driver->SetCursor(fDefaultCursor); - fCurrentWhich=which; - break; - } - case B_CURSOR_TEXT: - { - driver->SetCursor(fTextCursor); - fCurrentWhich=which; - break; - } - case B_CURSOR_MOVE: - { - driver->SetCursor(fMoveCursor); - fCurrentWhich=which; - break; - } - case B_CURSOR_DRAG: - { - driver->SetCursor(fDragCursor); - fCurrentWhich=which; - break; - } - case B_CURSOR_RESIZE: - { - driver->SetCursor(fResizeCursor); - fCurrentWhich=which; - break; - } - case B_CURSOR_RESIZE_NWSE: - { - driver->SetCursor(fNWSECursor); - fCurrentWhich=which; - break; - } - case B_CURSOR_RESIZE_NESW: - { - driver->SetCursor(fNESWCursor); - fCurrentWhich=which; - break; - } - case B_CURSOR_RESIZE_NS: - { - driver->SetCursor(fNSCursor); - fCurrentWhich=which; - break; - } - case B_CURSOR_RESIZE_EW: - { - driver->SetCursor(fEWCursor); - fCurrentWhich=which; - break; - } - default: - break; - } - - Unlock(); -} - /*! \brief Sets all the cursors from a specified CursorSet \param path Path to the cursor set diff --git a/src/servers/app/server/DisplayDriver.cpp b/src/servers/app/server/DisplayDriver.cpp index 531e83c6b5..ece00a5cca 100644 --- a/src/servers/app/server/DisplayDriver.cpp +++ b/src/servers/app/server/DisplayDriver.cpp @@ -41,6 +41,46 @@ static Blitter blitter; +int8 default_cursor_data[] = { +16,1,0,0, +255,224, // ***********----- +128,16, // *----------*---- +128,16, // *----------*---- +128,96, // *--------**----- +128,16, // *----------*---- +128,8, // *-----------*--- +128,8, // *-----------*--- +128,16, // *----------*---- +128,32, // *---------*----- +144,64, // *--*-----*------ +144,128, // *--*----*------- +105,0, // -**-*--*-------- +6,0, // -----**--------- + +0,0, // ---------------- +0,0, // ---------------- +0,0, // ---------------- + +// default_cursor mask - black pixels are always opaque +255,224, +255,240, +255,240, +255,224, +255,240, +255,248, +255,248, +255,240, +255,224, +255,192, +255,128, +111,0, +6,0, + +0,0, +0,0, +0,0 +}; + /*! \brief Sets up internal variables needed by all DisplayDriver subclasses @@ -51,7 +91,7 @@ DisplayDriver::DisplayDriver(void) : fCursorHandler(this) { _locker=new BLocker(); - + fCursorHandler.SetCursor(new ServerCursor(default_cursor_data)); // _is_cursor_hidden=false; // _is_cursor_obscured=false; // _cursor=NULL; diff --git a/src/servers/app/server/RootLayer.cpp b/src/servers/app/server/RootLayer.cpp index 08770125ca..3d859a657a 100644 --- a/src/servers/app/server/RootLayer.cpp +++ b/src/servers/app/server/RootLayer.cpp @@ -59,7 +59,6 @@ //#define DISPLAYDRIVER_TEST_HACK - RootLayer::RootLayer(const char *name, int32 workspaceCount, Desktop *desktop, DisplayDriver *driver) : Layer(BRect(0,0,0,0), name, 0, B_FOLLOW_ALL, B_WILL_DRAW, driver) @@ -77,7 +76,7 @@ RootLayer::RootLayer(const char *name, int32 workspaceCount, fActiveWorkspace = NULL; fRows = 0; fColumns = 0; - + // TODO: this should eventually be replaced by a method to convert the monitor // number to an index in the name, i.e. workspace_settings_1 for screen #1 ReadWorkspaceData(WORKSPACE_DATA_LIST); diff --git a/src/servers/app/server/RootLayer.h b/src/servers/app/server/RootLayer.h index 11292db737..692f890384 100644 --- a/src/servers/app/server/RootLayer.h +++ b/src/servers/app/server/RootLayer.h @@ -33,6 +33,7 @@ #include "Layer.h" #include "FMWList.h" +#include "CursorHandler.h" class RGBColor; class Workspace; diff --git a/src/servers/app/server/ServerApp.cpp b/src/servers/app/server/ServerApp.cpp index 934ca80d90..dfd398fb4c 100644 --- a/src/servers/app/server/ServerApp.cpp +++ b/src/servers/app/server/ServerApp.cpp @@ -40,6 +40,7 @@ #include "BitmapManager.h" #include "BGet++.h" #include "CursorManager.h" + #include "Desktop.h" #include "DisplayDriver.h" #include "FontServer.h" @@ -268,10 +269,13 @@ void ServerApp::Activate(bool value) //! Sets the cursor to the application cursor, if any. void ServerApp::SetAppCursor(void) { +debugger("ServerApp::SetAppCursor() not yet available\n"); +/* if(fAppCursor) cursormanager->SetCursor(fAppCursor->ID()); else cursormanager->SetCursor(B_CURSOR_DEFAULT); +*/ } /*! @@ -754,21 +758,24 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg) case AS_SHOW_CURSOR: { STRACE(("ServerApp %s: Show Cursor\n",fSignature.String())); - cursormanager->ShowCursor(); +debugger("AS_SHOW_CURSOR: not yet available\n"); +// cursormanager->ShowCursor(); fCursorHidden=false; break; } case AS_HIDE_CURSOR: { STRACE(("ServerApp %s: Hide Cursor\n",fSignature.String())); - cursormanager->HideCursor(); +debugger("AS_HIDE_CURSOR: not yet available\n"); +// cursormanager->HideCursor(); fCursorHidden=true; break; } case AS_OBSCURE_CURSOR: { STRACE(("ServerApp %s: Obscure Cursor\n",fSignature.String())); - cursormanager->ObscureCursor(); +debugger("AS_OBSCURE_CURSOR: not yet available\n"); +// cursormanager->ObscureCursor(); break; } case AS_QUERY_CURSOR_HIDDEN: @@ -803,7 +810,8 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg) fAppCursor->SetOwningTeam(fClientTeamID); fAppCursor->SetAppSignature(fSignature.String()); cursormanager->AddCursor(fAppCursor); - cursormanager->SetCursor(fAppCursor->ID()); +debugger("AS_SET_CURSOR_DATA: not yet available\n"); +// cursormanager->SetCursor(fAppCursor->ID()); break; } case AS_SET_CURSOR_BCURSOR: @@ -822,7 +830,8 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg) if(sync) msg.Read(&replyport); - cursormanager->SetCursor(ctoken); +debugger("AS_SET_CURSOR_BCURSOR: not yet available\n"); +// cursormanager->SetCursor(ctoken); if(sync) { diff --git a/src/servers/app/server/ServerWindow.cpp b/src/servers/app/server/ServerWindow.cpp index 9b9fbcf6bf..20777d4e30 100644 --- a/src/servers/app/server/ServerWindow.cpp +++ b/src/servers/app/server/ServerWindow.cpp @@ -1012,7 +1012,8 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link) link.Read(&token); - cursormanager->SetCursor(token); +debugger("AS_LAYER_CURSOR: not yet available\n"); +// cursormanager->SetCursor(token); break; }