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
This commit is contained in:
Adi Oanca 2005-01-18 22:23:34 +00:00
parent 0aa393f411
commit e32785759f
8 changed files with 64 additions and 130 deletions

View File

@ -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();

View File

@ -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);

View File

@ -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

View File

@ -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;

View File

@ -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);

View File

@ -33,6 +33,7 @@
#include "Layer.h"
#include "FMWList.h"
#include "CursorHandler.h"
class RGBColor;
class Workspace;

View File

@ -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<int32>(&replyport);
cursormanager->SetCursor(ctoken);
debugger("AS_SET_CURSOR_BCURSOR: not yet available\n");
// cursormanager->SetCursor(ctoken);
if(sync)
{

View File

@ -1012,7 +1012,8 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
link.Read<int32>(&token);
cursormanager->SetCursor(token);
debugger("AS_LAYER_CURSOR: not yet available\n");
// cursormanager->SetCursor(token);
break;
}