fixed a bug in ViewDriver which caused it to not send mouse wheel messages

Added a method to CursorHandler to get the mouse position
Mouse messages are now sent to the client window


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9814 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
DarkWyrm 2004-11-06 20:04:39 +00:00
parent e09fd76fe6
commit b5602a834c
4 changed files with 233 additions and 196 deletions

View File

@ -49,6 +49,7 @@ public:
ServerCursor *GetCursor(void) const { return fCursor; } ServerCursor *GetCursor(void) const { return fCursor; }
void MoveTo(const BPoint &pt); void MoveTo(const BPoint &pt);
BPoint GetPosition(void) const { return fPosition.LeftTop(); }
void Hide(void); void Hide(void);
void Show(void); void Show(void);

View File

@ -318,8 +318,7 @@ void Desktop::MouseEventHandler(int32 code, BPortLink& msg)
WinBorder *target=NULL; WinBorder *target=NULL;
RootLayer *rl=NULL; RootLayer *rl=NULL;
Workspace *ws=NULL Workspace *ws=NULL;
;
rl = ActiveRootLayer(); rl = ActiveRootLayer();
ws = rl->ActiveWorkspace(); ws = rl->ActiveWorkspace();
target = rl->WinBorderAt(evt.where); target = rl->WinBorderAt(evt.where);
@ -336,6 +335,13 @@ void Desktop::MouseEventHandler(int32 code, BPortLink& msg)
WinBorder *activeFocus=NULL; WinBorder *activeFocus=NULL;
BRegion invalidRegion; BRegion invalidRegion;
BMessage downmsg(B_MOUSE_DOWN);
downmsg.AddInt64("when",evt.when);
downmsg.AddPoint("where",evt.where);
downmsg.AddInt32("modifiers",evt.modifiers);
downmsg.AddInt32("buttons",evt.buttons);
downmsg.AddInt32("clicks",evt.clicks);
if (target!=ws->FrontLayer()) if (target!=ws->FrontLayer())
{ {
ws->BringToFrontANormalWindow(target); ws->BringToFrontANormalWindow(target);
@ -369,11 +375,12 @@ void Desktop::MouseEventHandler(int32 code, BPortLink& msg)
} }
fMouseTarget = target; fMouseTarget = target;
STRACE(("2Target: %s\n", target->GetName())); STRACE(("2Target: %s\n", target->GetName()));
STRACE(("2Front: %s\n", ws->FrontLayer()->GetName())); STRACE(("2Front: %s\n", ws->FrontLayer()->GetName()));
STRACE(("2Focus: %s\n", ws->FocusLayer()->GetName())); STRACE(("2Focus: %s\n", ws->FocusLayer()->GetName()));
fMouseTarget->Window()->SendMessageToClient(&downmsg);
activeFocus->Window()->Unlock(); activeFocus->Window()->Unlock();
} }
else // target == ws->FrontLayer() else // target == ws->FrontLayer()
@ -383,6 +390,7 @@ void Desktop::MouseEventHandler(int32 code, BPortLink& msg)
{ {
target->Window()->Lock(); target->Window()->Lock();
target->MouseDown(evt, true); target->MouseDown(evt, true);
target->Window()->SendMessageToClient(&downmsg);
target->Window()->Unlock(); target->Window()->Unlock();
} }
else else
@ -415,7 +423,8 @@ void Desktop::MouseEventHandler(int32 code, BPortLink& msg)
} }
} }
fMouseTarget = target; fMouseTarget = target;
fMouseTarget->Window()->SendMessageToClient(&downmsg);
activeFocus->Window()->Unlock(); activeFocus->Window()->Unlock();
} }
} }
@ -443,24 +452,25 @@ void Desktop::MouseEventHandler(int32 code, BPortLink& msg)
msg.Read<float>(&evt.where.y); msg.Read<float>(&evt.where.y);
msg.Read<int32>(&evt.modifiers); msg.Read<int32>(&evt.modifiers);
if (fMouseTarget) if (!fMouseTarget)
{ {
fMouseTarget->Window()->Lock(); WinBorder *target = ActiveRootLayer()->WinBorderAt(BPoint(evt.where.x, evt.where.y));
fMouseTarget->MouseUp(evt); if(!target)
fMouseTarget->Window()->Unlock(); break;
fMouseTarget=target;
}
fMouseTarget = NULL; fMouseTarget->Window()->Lock();
} fMouseTarget->MouseUp(evt);
else
{
WinBorder *target = ActiveRootLayer()->WinBorderAt(evt.where);
if(target){
target->Window()->Lock();
target->MouseUp(evt);
target->Window()->Unlock();
}
}
BMessage upmsg(B_MOUSE_UP);
upmsg.AddInt64("when",evt.when);
upmsg.AddPoint("where",evt.where);
upmsg.AddInt32("modifiers",evt.modifiers);
fMouseTarget->Window()->SendMessageToClient(&upmsg);
fMouseTarget->Window()->Unlock();
STRACE(("MOUSE UP: at (%f, %f)\n", evt.where.x, evt.where.y)); STRACE(("MOUSE UP: at (%f, %f)\n", evt.where.x, evt.where.y));
break; break;
@ -480,43 +490,59 @@ void Desktop::MouseEventHandler(int32 code, BPortLink& msg)
msg.Read<float>(&evt.where.y); msg.Read<float>(&evt.where.y);
msg.Read<int32>(&evt.buttons); msg.Read<int32>(&evt.buttons);
if (fMouseTarget) fActiveScreen->DDriver()->MoveCursorTo(evt.where.x, evt.where.y);
{
fActiveScreen->DDriver()->HideCursor(); if (!fMouseTarget)
fActiveScreen->DDriver()->MoveCursorTo(evt.where.x, evt.where.y);
fMouseTarget->Window()->Lock();
fMouseTarget->MouseMoved(evt);
fMouseTarget->Window()->Unlock();
fActiveScreen->DDriver()->ShowCursor();
}
else
{ {
WinBorder *target = ActiveRootLayer()->WinBorderAt(BPoint(evt.where.x, evt.where.y)); WinBorder *target = ActiveRootLayer()->WinBorderAt(BPoint(evt.where.x, evt.where.y));
if(target){ if(!target)
target->Window()->Lock(); break;
target->MouseMoved(evt); fMouseTarget=target;
target->Window()->Unlock();
}
fActiveScreen->DDriver()->MoveCursorTo(evt.where.x, evt.where.y);
} }
fMouseTarget->Window()->Lock();
fMouseTarget->MouseMoved(evt);
BMessage movemsg(B_MOUSE_MOVED);
movemsg.AddInt64("when",evt.when);
movemsg.AddPoint("where",evt.where);
movemsg.AddInt32("buttons",evt.buttons);
fMouseTarget->Window()->SendMessageToClient(&movemsg);
fMouseTarget->Window()->Unlock();
break; break;
} }
case B_MOUSE_WHEEL_CHANGED: case B_MOUSE_WHEEL_CHANGED:
{ {
// FEATURE: This is a tentative change: mouse wheel messages are always sent to the window
// under the cursor. It's pretty stupid to send it to the active window unless a particular
// view has locked focus via SetMouseEventMask
PointerEvent evt; PointerEvent evt;
evt.code = B_MOUSE_WHEEL_CHANGED; evt.code = B_MOUSE_WHEEL_CHANGED;
msg.Read<int64>(&evt.when); msg.Read<int64>(&evt.when);
msg.Read<float>(&evt.where.x);
msg.Read<float>(&evt.where.y);
msg.Read<float>(&evt.wheel_delta_x); msg.Read<float>(&evt.wheel_delta_x);
msg.Read<float>(&evt.wheel_delta_y); msg.Read<float>(&evt.wheel_delta_y);
msg.Read<int32>(&evt.modifiers);
BMessage wheelmsg(B_MOUSE_WHEEL_CHANGED);
// TODO: B_MOUSE_WHEEL_CHANGED - Pass this on to the client ServerWindow wheelmsg.AddInt64("when",evt.when);
wheelmsg.AddFloat("be:wheel_delta_x",evt.wheel_delta_x);
wheelmsg.AddFloat("be:wheel_delta_y",evt.wheel_delta_y);
if(!fMouseTarget)
{
fMouseTarget = ActiveRootLayer()->WinBorderAt(GetDisplayDriver()->GetCursorPosition());
// We do nothing because there ain't a window to receive the message
if(!fMouseTarget)
break;
}
fMouseTarget->Window()->Lock();
fMouseTarget->Window()->SendMessageToClient(&wheelmsg);
fMouseTarget->Window()->Unlock();
break; break;
} }
default: default:

View File

@ -47,7 +47,8 @@ static Blitter blitter;
Subclasses should follow DisplayDriver's lead and use this function mostly Subclasses should follow DisplayDriver's lead and use this function mostly
for initializing data members. for initializing data members.
*/ */
DisplayDriver::DisplayDriver(void) DisplayDriver::DisplayDriver(void) :
fCursorHandler(this)
{ {
_locker=new BLocker(); _locker=new BLocker();
@ -55,7 +56,6 @@ DisplayDriver::DisplayDriver(void)
// _is_cursor_obscured=false; // _is_cursor_obscured=false;
// _cursor=NULL; // _cursor=NULL;
// _cursorsave=NULL; // _cursorsave=NULL;
fCursorHandler=new CursorHandler(this);
fDPMSCaps=B_DPMS_ON; fDPMSCaps=B_DPMS_ON;
fDPMSState=B_DPMS_ON; fDPMSState=B_DPMS_ON;
} }
@ -69,7 +69,6 @@ DisplayDriver::DisplayDriver(void)
DisplayDriver::~DisplayDriver(void) DisplayDriver::~DisplayDriver(void)
{ {
delete _locker; delete _locker;
delete fCursorHandler;
} }
/*! /*!
@ -108,10 +107,10 @@ void DisplayDriver::CopyBits(const BRect &src, const BRect &dest, const DrawData
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(dest)) if(fCursorHandler.IntersectsCursor(dest))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
Blit(src,dest,d); Blit(src,dest,d);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Unlock(); Unlock();
} }
@ -150,8 +149,8 @@ void DisplayDriver::DrawBitmap(BRegion *region, ServerBitmap *bitmap, const BRec
return; return;
} }
if(fCursorHandler->IntersectsCursor(dest)) if(fCursorHandler.IntersectsCursor(dest))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
uint8 colorspace_size = (bitmap->BitsPerPixel() + 7) / 8; uint8 colorspace_size = (bitmap->BitsPerPixel() + 7) / 8;
@ -262,7 +261,7 @@ void DisplayDriver::DrawBitmap(BRegion *region, ServerBitmap *bitmap, const BRec
} }
} }
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
ReleaseBuffer(); ReleaseBuffer();
Unlock(); Unlock();
Invalidate(destrect); Invalidate(destrect);
@ -310,7 +309,7 @@ void DisplayDriver::CopyRegionList(BList* list, BList* pList, int32 rCount, BReg
return; return;
} }
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
uint32 bytesPerPixel = bmp->BytesPerRow() / bmp->Bounds().IntegerWidth(); uint32 bytesPerPixel = bmp->BytesPerRow() / bmp->Bounds().IntegerWidth();
@ -419,7 +418,7 @@ void DisplayDriver::CopyRegionList(BList* list, BList* pList, int32 rCount, BReg
} }
rectList.MakeEmpty(); rectList.MakeEmpty();
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
BRect inval(bmp->Bounds()); BRect inval(bmp->Bounds());
ReleaseBuffer(); ReleaseBuffer();
@ -464,8 +463,8 @@ void DisplayDriver::DrawString(const char *string, const int32 &length, const BP
BRect intersection(pt.x,pt.x,pt.y,pt.y); BRect intersection(pt.x,pt.x,pt.y,pt.y);
intersection.top-=d->font.Size()*1.5; intersection.top-=d->font.Size()*1.5;
intersection.right+=d->font.Size()*1.5*length; intersection.right+=d->font.Size()*1.5*length;
if(fCursorHandler->IntersectsCursor(intersection)) if(fCursorHandler.IntersectsCursor(intersection))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
BPoint point(pt); BPoint point(pt);
@ -607,7 +606,7 @@ void DisplayDriver::DrawString(const char *string, const int32 &length, const BP
r.top=point.y-face->height; r.top=point.y-face->height;
r.bottom=point.y+face->height; r.bottom=point.y+face->height;
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(r); Invalidate(r);
// Update the caller's pen position // Update the caller's pen position
@ -855,8 +854,8 @@ void DisplayDriver::Invalidate(const BRect &r)
*/ */
void DisplayDriver::FillArc(const BRect &r, const float &angle, const float &span, const RGBColor &color) void DisplayDriver::FillArc(const BRect &r, const float &angle, const float &span, const RGBColor &color)
{ {
if(fCursorHandler->IntersectsCursor(r)) if(fCursorHandler.IntersectsCursor(r))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
float xc = (r.left+r.right)/2; float xc = (r.left+r.right)/2;
float yc = (r.top+r.bottom)/2; float yc = (r.top+r.bottom)/2;
@ -882,7 +881,7 @@ void DisplayDriver::FillArc(const BRect &r, const float &angle, const float &spa
if ( (span >= 360) || (span <= -360) ) if ( (span >= 360) || (span <= -360) )
{ {
FillEllipse(r,color); FillEllipse(r,color);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
return; return;
} }
@ -1206,7 +1205,7 @@ void DisplayDriver::FillArc(const BRect &r, const float &angle, const float &spa
} }
} }
} }
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(r); Invalidate(r);
Unlock(); Unlock();
} }
@ -1220,8 +1219,8 @@ void DisplayDriver::FillArc(const BRect &r, const float &angle, const float &spa
*/ */
void DisplayDriver::FillArc(const BRect &r, const float &angle, const float &span, const DrawData *d) void DisplayDriver::FillArc(const BRect &r, const float &angle, const float &span, const DrawData *d)
{ {
if(fCursorHandler->IntersectsCursor(r)) if(fCursorHandler.IntersectsCursor(r))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
float xc = (r.left+r.right)/2; float xc = (r.left+r.right)/2;
float yc = (r.top+r.bottom)/2; float yc = (r.top+r.bottom)/2;
@ -1248,7 +1247,7 @@ void DisplayDriver::FillArc(const BRect &r, const float &angle, const float &spa
if ( (span >= 360) || (span <= -360) ) if ( (span >= 360) || (span <= -360) )
{ {
FillEllipse(r,d); FillEllipse(r,d);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
return; return;
} }
@ -1575,7 +1574,7 @@ void DisplayDriver::FillArc(const BRect &r, const float &angle, const float &spa
} }
} }
} }
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(r); Invalidate(r);
Unlock(); Unlock();
} }
@ -1586,12 +1585,12 @@ void DisplayDriver::FillBezier(BPoint *pts, const RGBColor &color)
BezierCurve curve(pts); BezierCurve curve(pts);
if(fCursorHandler->IntersectsCursor(curve.Frame())) if(fCursorHandler.IntersectsCursor(curve.Frame()))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
FillPolygon(curve.GetPointArray(), curve.points.CountItems(), curve.Frame(), color); FillPolygon(curve.GetPointArray(), curve.points.CountItems(), curve.Frame(), color);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Unlock(); Unlock();
} }
@ -1607,12 +1606,12 @@ void DisplayDriver::FillBezier(BPoint *pts, const DrawData *d)
BezierCurve curve(pts); BezierCurve curve(pts);
if(fCursorHandler->IntersectsCursor(curve.Frame())) if(fCursorHandler.IntersectsCursor(curve.Frame()))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
FillPolygon(curve.GetPointArray(), curve.points.CountItems(), curve.Frame(), d); FillPolygon(curve.GetPointArray(), curve.points.CountItems(), curve.Frame(), d);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Unlock(); Unlock();
} }
@ -1639,8 +1638,8 @@ void DisplayDriver::FillEllipse(const BRect &r, const RGBColor &color)
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(r)) if(fCursorHandler.IntersectsCursor(r))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
StrokeSolidLine(ROUND(xc),ROUND(yc-y),ROUND(xc),ROUND(yc-y),color); StrokeSolidLine(ROUND(xc),ROUND(yc-y),ROUND(xc),ROUND(yc-y),color);
StrokeSolidLine(ROUND(xc),ROUND(yc+y),ROUND(xc),ROUND(yc+y),color); StrokeSolidLine(ROUND(xc),ROUND(yc+y),ROUND(xc),ROUND(yc+y),color);
@ -1680,7 +1679,7 @@ void DisplayDriver::FillEllipse(const BRect &r, const RGBColor &color)
StrokeSolidLine(ROUND(xc-x),ROUND(yc-y),ROUND(xc+x),ROUND(yc-y),color); StrokeSolidLine(ROUND(xc-x),ROUND(yc-y),ROUND(xc+x),ROUND(yc-y),color);
StrokeSolidLine(ROUND(xc-x),ROUND(yc+y),ROUND(xc+x),ROUND(yc+y),color); StrokeSolidLine(ROUND(xc-x),ROUND(yc+y),ROUND(xc+x),ROUND(yc+y),color);
} }
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(r); Invalidate(r);
Unlock(); Unlock();
} }
@ -1709,8 +1708,8 @@ void DisplayDriver::FillEllipse(const BRect &r, const DrawData *d)
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(r)) if(fCursorHandler.IntersectsCursor(r))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
data = *d; data = *d;
data.pensize = 1; data.pensize = 1;
@ -1753,7 +1752,7 @@ void DisplayDriver::FillEllipse(const BRect &r, const DrawData *d)
StrokeLine(BPoint(xc-x,yc-y),BPoint(xc+x,yc-y),&data); StrokeLine(BPoint(xc-x,yc-y),BPoint(xc+x,yc-y),&data);
StrokeLine(BPoint(xc-x,yc+y),BPoint(xc+x,yc+y),&data); StrokeLine(BPoint(xc-x,yc+y),BPoint(xc+x,yc+y),&data);
} }
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(r); Invalidate(r);
Unlock(); Unlock();
} }
@ -1779,8 +1778,8 @@ void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, const BRect &bound
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(bounds)) if(fCursorHandler.IntersectsCursor(bounds))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
BPoint *currentPoint, *nextPoint; BPoint *currentPoint, *nextPoint;
BPoint tempNextPoint; BPoint tempNextPoint;
@ -1898,7 +1897,7 @@ void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, const BRect &bound
} }
delete[] segmentArray; delete[] segmentArray;
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(bounds); Invalidate(bounds);
Unlock(); Unlock();
@ -1925,8 +1924,8 @@ void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, const BRect &bound
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(bounds)) if(fCursorHandler.IntersectsCursor(bounds))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
BPoint *currentPoint, *nextPoint; BPoint *currentPoint, *nextPoint;
BPoint tempNextPoint; BPoint tempNextPoint;
@ -1951,7 +1950,7 @@ void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, const BRect &bound
{ {
printf("ERROR: Insufficient memory allocated to segment array\n"); printf("ERROR: Insufficient memory allocated to segment array\n");
delete[] segmentArray; delete[] segmentArray;
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Unlock(); Unlock();
return; return;
} }
@ -2116,7 +2115,7 @@ void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, const BRect &bound
} }
} }
delete[] segmentArray; delete[] segmentArray;
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(bounds); Invalidate(bounds);
Unlock(); Unlock();
} }
@ -2129,11 +2128,11 @@ void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, const BRect &bound
void DisplayDriver::FillRect(const BRect &r, const RGBColor &color) void DisplayDriver::FillRect(const BRect &r, const RGBColor &color)
{ {
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(r)) if(fCursorHandler.IntersectsCursor(r))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
FillSolidRect(r,color); FillSolidRect(r,color);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Unlock(); Unlock();
} }
@ -2150,8 +2149,8 @@ void DisplayDriver::FillRect(const BRect &r, const DrawData *d)
return; return;
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(r)) if(fCursorHandler.IntersectsCursor(r))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
if ( d->clipReg ) if ( d->clipReg )
{ {
if ( d->clipReg->Intersects(r) ) if ( d->clipReg->Intersects(r) )
@ -2166,7 +2165,7 @@ void DisplayDriver::FillRect(const BRect &r, const DrawData *d)
} }
else else
FillPatternRect(r,d); FillPatternRect(r,d);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(r); Invalidate(r);
Unlock(); Unlock();
} }
@ -2180,8 +2179,8 @@ void DisplayDriver::FillRegion(BRegion& r, const RGBColor &color)
{ {
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(r.Frame())) if(fCursorHandler.IntersectsCursor(r.Frame()))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
int numRects; int numRects;
@ -2189,7 +2188,7 @@ void DisplayDriver::FillRegion(BRegion& r, const RGBColor &color)
for(int32 i=0; i<numRects;i++) for(int32 i=0; i<numRects;i++)
FillSolidRect(r.RectAt(i),color); FillSolidRect(r.RectAt(i),color);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(r.Frame()); Invalidate(r.Frame());
Unlock(); Unlock();
} }
@ -2208,8 +2207,8 @@ void DisplayDriver::FillRegion(BRegion& r, const DrawData *d)
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(r.Frame())) if(fCursorHandler.IntersectsCursor(r.Frame()))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
int numRects; int numRects;
@ -2230,7 +2229,7 @@ void DisplayDriver::FillRegion(BRegion& r, const DrawData *d)
for(int32 i=0; i<numRects;i++) for(int32 i=0; i<numRects;i++)
FillPatternRect(r.RectAt(i),d); FillPatternRect(r.RectAt(i),d);
} }
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(r.Frame()); Invalidate(r.Frame());
Unlock(); Unlock();
} }
@ -2243,8 +2242,8 @@ void DisplayDriver::FillRoundRect(const BRect &r, const float &xrad, const float
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(r)) if(fCursorHandler.IntersectsCursor(r))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
for (i=0; i<=(int)yrad; i++) for (i=0; i<=(int)yrad; i++)
{ {
arc_x = xrad*sqrt(1-i*i/yrad2); arc_x = xrad*sqrt(1-i*i/yrad2);
@ -2252,7 +2251,7 @@ void DisplayDriver::FillRoundRect(const BRect &r, const float &xrad, const float
StrokeSolidLine(ROUND(r.left+xrad-arc_x), ROUND(r.bottom-yrad+i), ROUND(r.right-xrad+arc_x), ROUND(r.bottom-yrad+i),color); StrokeSolidLine(ROUND(r.left+xrad-arc_x), ROUND(r.bottom-yrad+i), ROUND(r.right-xrad+arc_x), ROUND(r.bottom-yrad+i),color);
} }
FillSolidRect(BRect(r.left,r.top+yrad,r.right,r.bottom-yrad),color); FillSolidRect(BRect(r.left,r.top+yrad,r.right,r.bottom-yrad),color);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(r); Invalidate(r);
Unlock(); Unlock();
} }
@ -2272,8 +2271,8 @@ void DisplayDriver::FillRoundRect(const BRect &r, const float &xrad, const float
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(r)) if(fCursorHandler.IntersectsCursor(r))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
if ( d->clipReg ) if ( d->clipReg )
{ {
@ -2316,7 +2315,7 @@ void DisplayDriver::FillRoundRect(const BRect &r, const float &xrad, const float
} }
} }
FillPatternRect(BRect(r.left,r.top+yrad,r.right,r.bottom-yrad),d); FillPatternRect(BRect(r.left,r.top+yrad,r.right,r.bottom-yrad),d);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(r); Invalidate(r);
Unlock(); Unlock();
} }
@ -2334,8 +2333,8 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const RGBColo
return; return;
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(bounds)) if(fCursorHandler.IntersectsCursor(bounds))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
BPoint first, second, third; BPoint first, second, third;
@ -2382,7 +2381,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const RGBColo
start.x=MIN(first.x,MIN(second.x,third.x)); start.x=MIN(first.x,MIN(second.x,third.x));
end.x=MAX(first.x,MAX(second.x,third.x)); end.x=MAX(first.x,MAX(second.x,third.x));
StrokeSolidLine(ROUND(start.x), ROUND(start.y), ROUND(end.x), ROUND(start.y), color); StrokeSolidLine(ROUND(start.x), ROUND(start.y), ROUND(end.x), ROUND(start.y), color);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
return; return;
} }
@ -2397,7 +2396,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const RGBColo
StrokeSolidLine(ROUND(first.x), ROUND(first.y), ROUND(second.x), ROUND(first.y), color); StrokeSolidLine(ROUND(first.x), ROUND(first.y), ROUND(second.x), ROUND(first.y), color);
for(i=(int32)first.y+1; i<=third.y; i++) for(i=(int32)first.y+1; i<=third.y; i++)
StrokeSolidLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, color); StrokeSolidLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, color);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
return; return;
} }
@ -2410,7 +2409,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const RGBColo
StrokeSolidLine(ROUND(second.x), ROUND(second.y), ROUND(third.x), ROUND(second.y), color); StrokeSolidLine(ROUND(second.x), ROUND(second.y), ROUND(third.x), ROUND(second.y), color);
for(i=(int32)first.y; i<third.y; i++) for(i=(int32)first.y; i<third.y; i++)
StrokeSolidLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, color); StrokeSolidLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, color);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
return; return;
} }
@ -2425,7 +2424,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const RGBColo
for(i=(int32)second.y; i<=third.y; i++) for(i=(int32)second.y; i<=third.y; i++)
StrokeSolidLine(ROUND(lineC.GetX(i)), i, ROUND(lineB.GetX(i)), i, color); StrokeSolidLine(ROUND(lineC.GetX(i)), i, ROUND(lineB.GetX(i)), i, color);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(bounds); Invalidate(bounds);
Unlock(); Unlock();
@ -2443,15 +2442,15 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const DrawDat
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(bounds)) if(fCursorHandler.IntersectsCursor(bounds))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
if ( d->clipReg ) if ( d->clipReg )
{ {
// For now, cop out and use FillPolygon // For now, cop out and use FillPolygon
// Need to investigate if Triangle specific code would save processing time // Need to investigate if Triangle specific code would save processing time
FillPolygon(pts,3,bounds,d); FillPolygon(pts,3,bounds,d);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
} }
else else
{ {
@ -2500,7 +2499,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const DrawDat
start.x=MIN(first.x,MIN(second.x,third.x)); start.x=MIN(first.x,MIN(second.x,third.x));
end.x=MAX(first.x,MAX(second.x,third.x)); end.x=MAX(first.x,MAX(second.x,third.x));
StrokePatternLine(ROUND(start.x), ROUND(start.y), ROUND(end.x), ROUND(start.y), d); StrokePatternLine(ROUND(start.x), ROUND(start.y), ROUND(end.x), ROUND(start.y), d);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
return; return;
} }
@ -2515,7 +2514,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const DrawDat
StrokePatternLine(ROUND(first.x), ROUND(first.y), ROUND(second.x), ROUND(first.y), d); StrokePatternLine(ROUND(first.x), ROUND(first.y), ROUND(second.x), ROUND(first.y), d);
for(i=(int32)first.y+1; i<=third.y; i++) for(i=(int32)first.y+1; i<=third.y; i++)
StrokePatternLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, d); StrokePatternLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, d);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
return; return;
} }
@ -2528,7 +2527,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const DrawDat
StrokePatternLine(ROUND(second.x), ROUND(second.y), ROUND(third.x), ROUND(second.y), d); StrokePatternLine(ROUND(second.x), ROUND(second.y), ROUND(third.x), ROUND(second.y), d);
for(i=(int32)first.y; i<third.y; i++) for(i=(int32)first.y; i<third.y; i++)
StrokePatternLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, d); StrokePatternLine(ROUND(lineA.GetX(i)), i, ROUND(lineB.GetX(i)), i, d);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
return; return;
} }
@ -2544,7 +2543,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const DrawDat
StrokePatternLine(ROUND(lineC.GetX(i)), i, ROUND(lineB.GetX(i)), i, d); StrokePatternLine(ROUND(lineC.GetX(i)), i, ROUND(lineB.GetX(i)), i, d);
} }
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(bounds); Invalidate(bounds);
Unlock(); Unlock();
@ -2561,7 +2560,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const DrawDat
void DisplayDriver::HideCursor(void) void DisplayDriver::HideCursor(void)
{ {
Lock(); Lock();
fCursorHandler->Hide(); fCursorHandler.Hide();
Unlock(); Unlock();
} }
@ -2573,7 +2572,7 @@ void DisplayDriver::HideCursor(void)
bool DisplayDriver::IsCursorHidden(void) bool DisplayDriver::IsCursorHidden(void)
{ {
Lock(); Lock();
bool value=fCursorHandler->IsHidden(); bool value=fCursorHandler.IsHidden();
Unlock(); Unlock();
return value; return value;
@ -2590,7 +2589,7 @@ bool DisplayDriver::IsCursorHidden(void)
void DisplayDriver::MoveCursorTo(const float &x, const float &y) void DisplayDriver::MoveCursorTo(const float &x, const float &y)
{ {
Lock(); Lock();
fCursorHandler->MoveTo(BPoint(x,y)); fCursorHandler.MoveTo(BPoint(x,y));
Unlock(); Unlock();
} }
@ -2602,6 +2601,17 @@ void DisplayDriver::InvertRect(const BRect &r)
{ {
} }
//! Returns the cursor's current position
BPoint DisplayDriver::GetCursorPosition(void)
{
Lock();
BPoint value=fCursorHandler.GetPosition();
Unlock();
return value;
}
/*! /*!
\brief Shows the cursor. \brief Shows the cursor.
@ -2613,7 +2623,7 @@ void DisplayDriver::InvertRect(const BRect &r)
void DisplayDriver::ShowCursor(void) void DisplayDriver::ShowCursor(void)
{ {
Lock(); Lock();
fCursorHandler->Show(); fCursorHandler.Show();
Unlock(); Unlock();
} }
@ -2628,7 +2638,7 @@ void DisplayDriver::ShowCursor(void)
void DisplayDriver::ObscureCursor(void) void DisplayDriver::ObscureCursor(void)
{ {
Lock(); Lock();
fCursorHandler->Obscure(); fCursorHandler.Obscure();
Unlock(); Unlock();
} }
@ -2644,7 +2654,7 @@ void DisplayDriver::ObscureCursor(void)
void DisplayDriver::SetCursor(ServerCursor *cursor) void DisplayDriver::SetCursor(ServerCursor *cursor)
{ {
Lock(); Lock();
fCursorHandler->SetCursor(cursor); fCursorHandler.SetCursor(cursor);
Unlock(); Unlock();
} }
@ -2679,14 +2689,14 @@ void DisplayDriver::StrokeArc(const BRect &r, const float &angle, const float &s
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(r)) if(fCursorHandler.IntersectsCursor(r))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
// Watch out for bozos giving us whacko spans // Watch out for bozos giving us whacko spans
if ( (span >= 360) || (span <= -360) ) if ( (span >= 360) || (span <= -360) )
{ {
StrokeEllipse(r,color); StrokeEllipse(r,color);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
return; return;
} }
@ -2811,7 +2821,7 @@ void DisplayDriver::StrokeArc(const BRect &r, const float &angle, const float &s
(shortspan && (startQuad == 4) && (x >= startx) && (x <= endx)) ) (shortspan && (startQuad == 4) && (x >= startx) && (x <= endx)) )
StrokePoint(BPoint(xc+x,yc+y),color); StrokePoint(BPoint(xc+x,yc+y),color);
} }
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(r); Invalidate(r);
Unlock(); Unlock();
} }
@ -2847,14 +2857,14 @@ void DisplayDriver::StrokeArc(const BRect &r, const float &angle, const float &s
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(r)) if(fCursorHandler.IntersectsCursor(r))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
// Watch out for bozos giving us whacko spans // Watch out for bozos giving us whacko spans
if ( (span >= 360) || (span <= -360) ) if ( (span >= 360) || (span <= -360) )
{ {
StrokeEllipse(r,d); StrokeEllipse(r,d);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
return; return;
} }
@ -2979,7 +2989,7 @@ void DisplayDriver::StrokeArc(const BRect &r, const float &angle, const float &s
(shortspan && (startQuad == 4) && (x >= startx) && (x <= endx)) ) (shortspan && (startQuad == 4) && (x >= startx) && (x <= endx)) )
StrokePoint(BPoint(xc+x,yc+y),d); StrokePoint(BPoint(xc+x,yc+y),d);
} }
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(r); Invalidate(r);
Unlock(); Unlock();
} }
@ -2996,14 +3006,14 @@ void DisplayDriver::StrokeBezier(BPoint *pts, const RGBColor &color)
Lock(); Lock();
BezierCurve curve(pts); BezierCurve curve(pts);
if(fCursorHandler->IntersectsCursor(curve.Frame())) if(fCursorHandler.IntersectsCursor(curve.Frame()))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
numLines = curve.points.CountItems()-1; numLines = curve.points.CountItems()-1;
for (i=0; i<numLines; i++) for (i=0; i<numLines; i++)
StrokeLine(*((BPoint*)curve.points.ItemAt(i)),*((BPoint*)curve.points.ItemAt(i+1)),color); StrokeLine(*((BPoint*)curve.points.ItemAt(i)),*((BPoint*)curve.points.ItemAt(i+1)),color);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(curve.Frame()); Invalidate(curve.Frame());
Unlock(); Unlock();
} }
@ -3020,14 +3030,14 @@ void DisplayDriver::StrokeBezier(BPoint *pts, const DrawData *d)
Lock(); Lock();
BezierCurve curve(pts); BezierCurve curve(pts);
if(fCursorHandler->IntersectsCursor(curve.Frame())) if(fCursorHandler.IntersectsCursor(curve.Frame()))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
numLines = curve.points.CountItems()-1; numLines = curve.points.CountItems()-1;
for (i=0; i<numLines; i++) for (i=0; i<numLines; i++)
StrokeLine(*((BPoint*)curve.points.ItemAt(i)),*((BPoint*)curve.points.ItemAt(i+1)),d); StrokeLine(*((BPoint*)curve.points.ItemAt(i)),*((BPoint*)curve.points.ItemAt(i+1)),d);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(curve.Frame()); Invalidate(curve.Frame());
Unlock(); Unlock();
} }
@ -3056,8 +3066,8 @@ void DisplayDriver::StrokeEllipse(const BRect &r, const RGBColor &color)
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(r)) if(fCursorHandler.IntersectsCursor(r))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
p = ROUND (Ry2 - (Rx2 * ry) + (.25 * Rx2)); p = ROUND (Ry2 - (Rx2 * ry) + (.25 * Rx2));
while (px < py) while (px < py)
@ -3103,7 +3113,7 @@ void DisplayDriver::StrokeEllipse(const BRect &r, const RGBColor &color)
StrokeLine(BPoint(xc+lastx,yc+lasty),BPoint(xc+x,yc+y),color); StrokeLine(BPoint(xc+lastx,yc+lasty),BPoint(xc+x,yc+y),color);
} }
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(r); Invalidate(r);
Unlock(); Unlock();
} }
@ -3132,8 +3142,8 @@ void DisplayDriver::StrokeEllipse(const BRect &r, const DrawData *d)
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(r)) if(fCursorHandler.IntersectsCursor(r))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
p = ROUND (Ry2 - (Rx2 * ry) + (.25 * Rx2)); p = ROUND (Ry2 - (Rx2 * ry) + (.25 * Rx2));
while (px < py) while (px < py)
@ -3178,7 +3188,7 @@ void DisplayDriver::StrokeEllipse(const BRect &r, const DrawData *d)
StrokeLine(BPoint(xc-lastx,yc+lasty),BPoint(xc-x,yc+y),d); StrokeLine(BPoint(xc-lastx,yc+lasty),BPoint(xc-x,yc+y),d);
StrokeLine(BPoint(xc+lastx,yc+lasty),BPoint(xc+x,yc+y),d); StrokeLine(BPoint(xc+lastx,yc+lasty),BPoint(xc+x,yc+y),d);
} }
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(r); Invalidate(r);
Unlock(); Unlock();
} }
@ -3192,11 +3202,11 @@ void DisplayDriver::StrokeEllipse(const BRect &r, const DrawData *d)
void DisplayDriver::StrokeLine(const BPoint &start, const BPoint &end, const RGBColor &color) void DisplayDriver::StrokeLine(const BPoint &start, const BPoint &end, const RGBColor &color)
{ {
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(BRect(start,end))) if(fCursorHandler.IntersectsCursor(BRect(start,end)))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
StrokeSolidLine(ROUND(start.x),ROUND(start.y),ROUND(end.x),ROUND(end.y),color); StrokeSolidLine(ROUND(start.x),ROUND(start.y),ROUND(end.x),ROUND(end.y),color);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(BRect(start,end)); Invalidate(BRect(start,end));
Unlock(); Unlock();
} }
@ -3211,8 +3221,8 @@ void DisplayDriver::StrokeLine(const BPoint &start, const BPoint &end, const Dra
{ {
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(BRect(start,end))) if(fCursorHandler.IntersectsCursor(BRect(start,end)))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
if ( d->pensize == 1 ) if ( d->pensize == 1 )
{ {
@ -3309,7 +3319,7 @@ void DisplayDriver::StrokeLine(const BPoint &start, const BPoint &end, const Dra
FillPolygon(corners,4,BRect(start,end),d); FillPolygon(corners,4,BRect(start,end),d);
} }
} }
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(BRect(start,end)); Invalidate(BRect(start,end));
Unlock(); Unlock();
} }
@ -3370,15 +3380,15 @@ void DisplayDriver::StrokePolygon(BPoint *ptlist, int32 numpts, const BRect &bou
return; return;
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(bounds)) if(fCursorHandler.IntersectsCursor(bounds))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
for(int32 i=0; i<(numpts-1); i++) for(int32 i=0; i<(numpts-1); i++)
StrokeLine(ptlist[i],ptlist[i+1],color); StrokeLine(ptlist[i],ptlist[i+1],color);
if(is_closed) if(is_closed)
StrokeLine(ptlist[numpts-1],ptlist[0],color); StrokeLine(ptlist[numpts-1],ptlist[0],color);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(bounds); Invalidate(bounds);
Unlock(); Unlock();
} }
@ -3395,15 +3405,15 @@ void DisplayDriver::StrokePolygon(BPoint *ptlist, int32 numpts, const BRect &bou
return; return;
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(bounds)) if(fCursorHandler.IntersectsCursor(bounds))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
for(int32 i=0; i<(numpts-1); i++) for(int32 i=0; i<(numpts-1); i++)
StrokeLine(ptlist[i],ptlist[i+1],d); StrokeLine(ptlist[i],ptlist[i+1],d);
if(is_closed) if(is_closed)
StrokeLine(ptlist[numpts-1],ptlist[0],d); StrokeLine(ptlist[numpts-1],ptlist[0],d);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(bounds); Invalidate(bounds);
Unlock(); Unlock();
} }
@ -3418,11 +3428,11 @@ void DisplayDriver::StrokeRect(const BRect &r, const RGBColor &color)
{ {
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(r)) if(fCursorHandler.IntersectsCursor(r))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
StrokeSolidRect(r,color); StrokeSolidRect(r,color);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(r); Invalidate(r);
Unlock(); Unlock();
} }
@ -3430,14 +3440,14 @@ void DisplayDriver::StrokeRect(const BRect &r, const RGBColor &color)
void DisplayDriver::StrokeRect(const BRect &r, const DrawData *d) void DisplayDriver::StrokeRect(const BRect &r, const DrawData *d)
{ {
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(r)) if(fCursorHandler.IntersectsCursor(r))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
StrokeLine(r.LeftTop(),r.RightTop(),d); StrokeLine(r.LeftTop(),r.RightTop(),d);
StrokeLine(r.LeftTop(),r.LeftBottom(),d); StrokeLine(r.LeftTop(),r.LeftBottom(),d);
StrokeLine(r.RightTop(),r.RightBottom(),d); StrokeLine(r.RightTop(),r.RightBottom(),d);
StrokeLine(r.LeftBottom(),r.RightBottom(),d); StrokeLine(r.LeftBottom(),r.RightBottom(),d);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(r); Invalidate(r);
Unlock(); Unlock();
} }
@ -3453,13 +3463,13 @@ void DisplayDriver::StrokeRegion(BRegion& r, const RGBColor &color)
{ {
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(r.Frame())) if(fCursorHandler.IntersectsCursor(r.Frame()))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
for(int32 i=0; i<r.CountRects();i++) for(int32 i=0; i<r.CountRects();i++)
StrokeRect(r.RectAt(i),color); StrokeRect(r.RectAt(i),color);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(r.Frame()); Invalidate(r.Frame());
Unlock(); Unlock();
} }
@ -3468,13 +3478,13 @@ void DisplayDriver::StrokeRegion(BRegion& r, const DrawData *d)
{ {
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(r.Frame())) if(fCursorHandler.IntersectsCursor(r.Frame()))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
for(int32 i=0; i<r.CountRects();i++) for(int32 i=0; i<r.CountRects();i++)
StrokeRect(r.RectAt(i),d); StrokeRect(r.RectAt(i),d);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(r.Frame()); Invalidate(r.Frame());
Unlock(); Unlock();
} }
@ -3495,8 +3505,8 @@ void DisplayDriver::StrokeRoundRect(const BRect &r, const float &xrad, const flo
bBottom = vBottom - yrad; bBottom = vBottom - yrad;
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(r)) if(fCursorHandler.IntersectsCursor(r))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
StrokeArc(BRect(bRight, r.top, r.right, bTop), 0, 90, color); StrokeArc(BRect(bRight, r.top, r.right, bTop), 0, 90, color);
StrokeLine(BPoint(hRight, r.top), BPoint(hLeft, r.top), color); StrokeLine(BPoint(hRight, r.top), BPoint(hLeft, r.top), color);
@ -3510,7 +3520,7 @@ void DisplayDriver::StrokeRoundRect(const BRect &r, const float &xrad, const flo
StrokeArc(BRect(bRight,bBottom,r.right,r.bottom), 270, 90, color); StrokeArc(BRect(bRight,bBottom,r.right,r.bottom), 270, 90, color);
StrokeLine(BPoint(r.right, vBottom), BPoint(r.right, vTop), color); StrokeLine(BPoint(r.right, vBottom), BPoint(r.right, vTop), color);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(r); Invalidate(r);
Unlock(); Unlock();
} }
@ -3539,8 +3549,8 @@ void DisplayDriver::StrokeRoundRect(const BRect &r, const float &xrad, const flo
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(r)) if(fCursorHandler.IntersectsCursor(r))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
StrokeArc(BRect(bRight, r.top, r.right, bTop), 0, 90, d); StrokeArc(BRect(bRight, r.top, r.right, bTop), 0, 90, d);
StrokeLine(BPoint(hRight, r.top), BPoint(hLeft, r.top), d); StrokeLine(BPoint(hRight, r.top), BPoint(hLeft, r.top), d);
@ -3554,7 +3564,7 @@ void DisplayDriver::StrokeRoundRect(const BRect &r, const float &xrad, const flo
StrokeArc(BRect(bRight,bBottom,r.right,r.bottom), 270, 90, d); StrokeArc(BRect(bRight,bBottom,r.right,r.bottom), 270, 90, d);
StrokeLine(BPoint(r.right, vBottom), BPoint(r.right, vTop), d); StrokeLine(BPoint(r.right, vBottom), BPoint(r.right, vTop), d);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(r); Invalidate(r);
Unlock(); Unlock();
} }
@ -3574,14 +3584,14 @@ void DisplayDriver::StrokeShape(const BRect &bounds, const int32 &opcount, const
void DisplayDriver::StrokeTriangle(BPoint *pts, const BRect &bounds, const RGBColor &color) void DisplayDriver::StrokeTriangle(BPoint *pts, const BRect &bounds, const RGBColor &color)
{ {
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(bounds)) if(fCursorHandler.IntersectsCursor(bounds))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
StrokeLine(pts[0],pts[1],color); StrokeLine(pts[0],pts[1],color);
StrokeLine(pts[1],pts[2],color); StrokeLine(pts[1],pts[2],color);
StrokeLine(pts[2],pts[0],color); StrokeLine(pts[2],pts[0],color);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(bounds); Invalidate(bounds);
Unlock(); Unlock();
} }
@ -3589,14 +3599,14 @@ void DisplayDriver::StrokeTriangle(BPoint *pts, const BRect &bounds, const RGBCo
void DisplayDriver::StrokeTriangle(BPoint *pts, const BRect &bounds, const DrawData *d) void DisplayDriver::StrokeTriangle(BPoint *pts, const BRect &bounds, const DrawData *d)
{ {
Lock(); Lock();
if(fCursorHandler->IntersectsCursor(bounds)) if(fCursorHandler.IntersectsCursor(bounds))
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
StrokeLine(pts[0],pts[1],d); StrokeLine(pts[0],pts[1],d);
StrokeLine(pts[1],pts[2],d); StrokeLine(pts[1],pts[2],d);
StrokeLine(pts[2],pts[0],d); StrokeLine(pts[2],pts[0],d);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Invalidate(bounds); Invalidate(bounds);
Unlock(); Unlock();
} }
@ -3618,7 +3628,7 @@ void DisplayDriver::StrokeLineArray(const int32 &numlines, const LineArrayData *
Lock(); Lock();
fCursorHandler->DriverHide(); fCursorHandler.DriverHide();
drawdata = *d; drawdata = *d;
@ -3653,7 +3663,7 @@ void DisplayDriver::StrokeLineArray(const int32 &numlines, const LineArrayData *
Invalidate(r); Invalidate(r);
fCursorHandler->DriverShow(); fCursorHandler.DriverShow();
Unlock(); Unlock();
} }
@ -3941,7 +3951,7 @@ void DisplayDriver::GetTruncatedStrings(const char **instrings,const int32 &stri
bool DisplayDriver::IsCursorObscured(bool state) bool DisplayDriver::IsCursorObscured(bool state)
{ {
Lock(); Lock();
bool value=fCursorHandler->IsObscured(); bool value=fCursorHandler.IsObscured();
Unlock(); Unlock();
return value; return value;
@ -4126,7 +4136,7 @@ status_t DisplayDriver::WaitForRetrace(bigtime_t timeout)
ServerCursor *DisplayDriver::_GetCursor(void) ServerCursor *DisplayDriver::_GetCursor(void)
{ {
Lock(); Lock();
ServerCursor *c=fCursorHandler->GetCursor(); ServerCursor *c=fCursorHandler.GetCursor();
Unlock(); Unlock();
return c; return c;

View File

@ -222,21 +222,6 @@ void VDView::MessageReceived(BMessage *msg)
{ {
switch(msg->what) switch(msg->what)
{ {
#ifdef ENABLE_INPUT_SERVER_EMULATION
case B_MOUSE_WHEEL_CHANGED:
{
float x,y;
msg->FindFloat("be:wheel_delta_x",&x);
msg->FindFloat("be:wheel_delta_y",&y);
int64 time=real_time_clock();
serverlink->StartMessage(B_MOUSE_WHEEL_CHANGED);
serverlink->Attach(&time,sizeof(int64));
serverlink->Attach(x);
serverlink->Attach(y);
serverlink->Flush();
break;
}
#endif
default: default:
BView::MessageReceived(msg); BView::MessageReceived(msg);
break; break;
@ -259,6 +244,21 @@ void VDWindow::MessageReceived(BMessage *msg)
{ {
switch(msg->what) switch(msg->what)
{ {
#ifdef ENABLE_INPUT_SERVER_EMULATION
case B_MOUSE_WHEEL_CHANGED:
{
float x,y;
msg->FindFloat("be:wheel_delta_x",&x);
msg->FindFloat("be:wheel_delta_y",&y);
int64 time=real_time_clock();
view->serverlink->StartMessage(B_MOUSE_WHEEL_CHANGED);
view->serverlink->Attach(&time,sizeof(int64));
view->serverlink->Attach(x);
view->serverlink->Attach(y);
view->serverlink->Flush();
break;
}
#endif
case B_KEY_DOWN: case B_KEY_DOWN:
{ {
// Attached Data: // Attached Data: