From 8dd37bd51b8fece135f3d07d803a023f0f15ce32 Mon Sep 17 00:00:00 2001 From: DarkWyrm Date: Mon, 20 Sep 2004 22:50:02 +0000 Subject: [PATCH] s/OpenBeOS/Haiku/ Bugfixes to graphics cases in ServerWindow Added assignment operator to GraphicsBuffer Style fixes for ServerCursor and ServerBitmap Implemented and integrated CursorHandler to clean up DisplayDriver code some Hotspot bugfix for ServerCursor(cursordata *) git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9019 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/server/AccelerantDriver.cpp | 2 +- src/servers/app/server/AccelerantDriver.h | 2 +- src/servers/app/server/Angle.cpp | 2 +- src/servers/app/server/Angle.h | 2 +- src/servers/app/server/AppServer.cpp | 2 +- src/servers/app/server/BGet++.cpp | 4 +- src/servers/app/server/BitmapDriver.cpp | 16 +- src/servers/app/server/BitmapDriver.h | 2 +- src/servers/app/server/BitmapManager.cpp | 18 +- src/servers/app/server/Clipper.cpp | 2 +- src/servers/app/server/Clipper.h | 2 +- src/servers/app/server/ColorSet.cpp | 2 +- src/servers/app/server/CursorData.cpp | 2 +- src/servers/app/server/CursorHandler.cpp | 239 +++++++++++++ src/servers/app/server/CursorHandler.h | 78 +++++ src/servers/app/server/CursorManager.cpp | 8 +- src/servers/app/server/CursorManager.h | 2 +- src/servers/app/server/Decorator.cpp | 2 +- src/servers/app/server/DefaultDecorator.cpp | 2 +- src/servers/app/server/DefaultDecorator.h | 2 +- src/servers/app/server/Desktop.cpp | 2 +- src/servers/app/server/Desktop.h | 2 +- src/servers/app/server/DirectDriver.cpp | 6 +- src/servers/app/server/DirectDriver.h | 2 +- src/servers/app/server/DisplayDriver.cpp | 350 ++++++++++++-------- src/servers/app/server/DisplaySupport.cpp | 27 ++ src/servers/app/server/FMWList.cpp | 2 +- src/servers/app/server/FMWList.h | 2 +- src/servers/app/server/FontFamily.cpp | 2 +- src/servers/app/server/FontServer.cpp | 2 +- src/servers/app/server/GraphicsBuffer.cpp | 12 +- src/servers/app/server/IPoint.cpp | 2 +- src/servers/app/server/Layer.cpp | 28 ++ src/servers/app/server/Layer.h | 2 +- src/servers/app/server/LayerData.cpp | 2 +- src/servers/app/server/PNGDump.cpp | 2 +- src/servers/app/server/PNGDump.h | 2 +- src/servers/app/server/PatternHandler.cpp | 2 +- src/servers/app/server/PicturePlayer.cpp | 2 +- src/servers/app/server/PicturePlayer.h | 2 +- src/servers/app/server/PixelRenderer.cpp | 2 +- src/servers/app/server/RGBColor.cpp | 2 +- src/servers/app/server/RectUtils.cpp | 2 +- src/servers/app/server/RootLayer.cpp | 2 +- src/servers/app/server/RootLayer.h | 2 +- src/servers/app/server/ScreenDriver.cpp | 2 +- src/servers/app/server/ScreenDriver.h | 2 +- src/servers/app/server/ServerApp.cpp | 2 +- src/servers/app/server/ServerApp.h | 2 +- src/servers/app/server/ServerBitmap.cpp | 102 +++--- src/servers/app/server/ServerCursor.cpp | 33 +- src/servers/app/server/ServerFont.cpp | 2 +- src/servers/app/server/ServerPicture.cpp | 2 +- src/servers/app/server/ServerPicture.h | 2 +- src/servers/app/server/ServerScreen.cpp | 2 +- src/servers/app/server/ServerScreen.h | 2 +- src/servers/app/server/ServerWindow.cpp | 57 ++-- src/servers/app/server/ServerWindow.h | 2 +- src/servers/app/server/SysCursor.cpp | 2 +- src/servers/app/server/SystemPalette.cpp | 2 +- src/servers/app/server/TokenHandler.cpp | 2 +- src/servers/app/server/Utils.cpp | 2 +- src/servers/app/server/Utils.h | 2 +- src/servers/app/server/ViewDriver.cpp | 28 +- src/servers/app/server/ViewDriver.h | 2 +- src/servers/app/server/WinBorder.cpp | 2 +- src/servers/app/server/WinBorder.h | 2 +- src/servers/app/server/Workspace.cpp | 4 +- src/servers/app/server/Workspace.h | 2 +- 69 files changed, 799 insertions(+), 317 deletions(-) create mode 100644 src/servers/app/server/CursorHandler.cpp create mode 100644 src/servers/app/server/CursorHandler.h diff --git a/src/servers/app/server/AccelerantDriver.cpp b/src/servers/app/server/AccelerantDriver.cpp index c5505807a8..b7e96038ef 100644 --- a/src/servers/app/server/AccelerantDriver.cpp +++ b/src/servers/app/server/AccelerantDriver.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2003, OpenBeOS +// Copyright (c) 2001-2003, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/AccelerantDriver.h b/src/servers/app/server/AccelerantDriver.h index 2c66cab4ae..52dbd3fc56 100644 --- a/src/servers/app/server/AccelerantDriver.h +++ b/src/servers/app/server/AccelerantDriver.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2003, OpenBeOS +// Copyright (c) 2001-2003, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/Angle.cpp b/src/servers/app/server/Angle.cpp index d1138ed440..1a0512ba73 100644 --- a/src/servers/app/server/Angle.cpp +++ b/src/servers/app/server/Angle.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/Angle.h b/src/servers/app/server/Angle.h index 5a7435911b..65446542d0 100644 --- a/src/servers/app/server/Angle.h +++ b/src/servers/app/server/Angle.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/AppServer.cpp b/src/servers/app/server/AppServer.cpp index b8f429d8d6..d6c55a7f60 100644 --- a/src/servers/app/server/AppServer.cpp +++ b/src/servers/app/server/AppServer.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/BGet++.cpp b/src/servers/app/server/BGet++.cpp index 220be48168..02cdfe27ba 100644 --- a/src/servers/app/server/BGet++.cpp +++ b/src/servers/app/server/BGet++.cpp @@ -1,5 +1,5 @@ /*------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), @@ -23,7 +23,7 @@ // Author: John Walker // DarkWyrm // Description: public domain BGET pool allocator converted to C++ -// Distributed with OpenBeOS under MIT license +// Distributed with Haiku under MIT license // //------------------------------------------------------------------------------*/ diff --git a/src/servers/app/server/BitmapDriver.cpp b/src/servers/app/server/BitmapDriver.cpp index 53c32e5b02..0fe00d24b3 100644 --- a/src/servers/app/server/BitmapDriver.cpp +++ b/src/servers/app/server/BitmapDriver.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), @@ -112,9 +112,9 @@ void BitmapDriver::SetTarget(ServerBitmap *target) if(target) { - _displaymode.virtual_width=target->Width(); - _displaymode.virtual_height=target->Height(); - _displaymode.space=target->ColorSpace(); + fDisplayMode.virtual_width=target->Width(); + fDisplayMode.virtual_height=target->Height(); + fDisplayMode.space=target->ColorSpace(); fGraphicsBuffer=new GraphicsBuffer((uint8*)fTarget->Bits(),fTarget->Bounds().Width(), fTarget->Bounds().Height(),fTarget->BytesPerRow()); @@ -840,7 +840,7 @@ void BitmapDriver::CopyBitmap(ServerBitmap *bitmap, const BRect &sourcerect, con return; } - if(((uint32)bitmap->ColorSpace() & 0x000F) != (_displaymode.space & 0x000F)) + if(((uint32)bitmap->ColorSpace() & 0x000F) != (fDisplayMode.space & 0x000F)) { printf("CopyBitmap returned - unequal buffer pixel depth\n"); return; @@ -881,7 +881,7 @@ void BitmapDriver::CopyBitmap(ServerBitmap *bitmap, const BRect &sourcerect, con source.bottom = work_rect.bottom; } - work_rect.Set(0,0,_displaymode.virtual_width-1,_displaymode.virtual_height-1); + work_rect.Set(0,0,fDisplayMode.virtual_width-1,fDisplayMode.virtual_height-1); if( !(work_rect.Contains(destrect)) ) { @@ -936,7 +936,7 @@ void BitmapDriver::CopyToBitmap(ServerBitmap *destbmp, const BRect &sourcerect) return; } - if(((uint32)destbmp->ColorSpace() & 0x000F) != (_displaymode.space & 0x000F)) + if(((uint32)destbmp->ColorSpace() & 0x000F) != (fDisplayMode.space & 0x000F)) { printf("CopyToBitmap returned - unequal buffer pixel depth\n"); return; @@ -970,7 +970,7 @@ void BitmapDriver::CopyToBitmap(ServerBitmap *destbmp, const BRect &sourcerect) destrect.bottom = work_rect.bottom; } - work_rect.Set(0,0,_displaymode.virtual_width-1,_displaymode.virtual_height-1); + work_rect.Set(0,0,fDisplayMode.virtual_width-1,fDisplayMode.virtual_height-1); // Is there anything at all to copy? if(!work_rect.Contains(sourcerect)) diff --git a/src/servers/app/server/BitmapDriver.h b/src/servers/app/server/BitmapDriver.h index b954ac4f6c..0693c13908 100644 --- a/src/servers/app/server/BitmapDriver.h +++ b/src/servers/app/server/BitmapDriver.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/BitmapManager.cpp b/src/servers/app/server/BitmapManager.cpp index 270bb325b5..ff9c2be7b7 100644 --- a/src/servers/app/server/BitmapManager.cpp +++ b/src/servers/app/server/BitmapManager.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), @@ -69,7 +69,7 @@ BitmapManager::~BitmapManager(void) tbmp=(ServerBitmap*)bmplist->RemoveItem(0L); if(tbmp) { - fMemPool->ReleaseBuffer(tbmp->_buffer); + fMemPool->ReleaseBuffer(tbmp->fBuffer); delete tbmp; tbmp=NULL; } @@ -105,15 +105,15 @@ ServerBitmap * BitmapManager::CreateBitmap(BRect bounds, color_space space, int3 delete bmp; return NULL; } - bmp->_area=area_for(bmpbuffer); - bmp->_buffer=bmpbuffer; - bmp->_token=tokenizer.GetToken(); - bmp->_initialized=true; + bmp->fArea=area_for(bmpbuffer); + bmp->fBuffer=bmpbuffer; + bmp->fToken=tokenizer.GetToken(); + bmp->fInitialized=true; // calculate area offset area_info ai; - get_area_info(bmp->_area,&ai); - bmp->_offset=bmpbuffer-(uint8*)ai.address; + get_area_info(bmp->fArea,&ai); + bmp->fOffset=bmpbuffer-(uint8*)ai.address; bmplist->AddItem(bmp); release_sem(lock); @@ -136,7 +136,7 @@ void BitmapManager::DeleteBitmap(ServerBitmap *bitmap) } // Server code will require a check to ensure bitmap doesn't have its own area - fMemPool->ReleaseBuffer(tbmp->_buffer); + fMemPool->ReleaseBuffer(tbmp->fBuffer); delete tbmp; release_sem(lock); diff --git a/src/servers/app/server/Clipper.cpp b/src/servers/app/server/Clipper.cpp index e30baa30ba..842eb2f5c5 100644 --- a/src/servers/app/server/Clipper.cpp +++ b/src/servers/app/server/Clipper.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2003, OpenBeOS +// Copyright (c) 2001-2003, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/Clipper.h b/src/servers/app/server/Clipper.h index b58d4c8170..1ccbb04e18 100644 --- a/src/servers/app/server/Clipper.h +++ b/src/servers/app/server/Clipper.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2003, OpenBeOS +// Copyright (c) 2001-2003, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/ColorSet.cpp b/src/servers/app/server/ColorSet.cpp index 1c0a4da108..63642f4285 100644 --- a/src/servers/app/server/ColorSet.cpp +++ b/src/servers/app/server/ColorSet.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/CursorData.cpp b/src/servers/app/server/CursorData.cpp index f706ba3b09..ad05ccf035 100644 --- a/src/servers/app/server/CursorData.cpp +++ b/src/servers/app/server/CursorData.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/CursorHandler.cpp b/src/servers/app/server/CursorHandler.cpp new file mode 100644 index 0000000000..bfe0519e60 --- /dev/null +++ b/src/servers/app/server/CursorHandler.cpp @@ -0,0 +1,239 @@ +//------------------------------------------------------------------------------ +// Copyright (c) 2001-2002, Haiku, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// +// File Name: CursorHandler.cpp +// Author: DarkWyrm +// Description: class for handling cursor display for DisplayDriver +// +//------------------------------------------------------------------------------ +#include "CursorHandler.h" +#include "DisplayDriver.h" +#include "RectUtils.h" + +CursorHandler::CursorHandler(DisplayDriver *driver) + : fDriver(driver), + fOldPosition(0,0,0,0), + fPosition(0,0,0,0), + fCursorPos(0,0), + fSavedData(NULL), + fCursor(NULL), + fHideLevel(0), + fDriverHidden(false), + fIsObscured(false), + fValidSaveData(false) +{ +} + +//! Frees any memory used for saving screen data +CursorHandler::~CursorHandler(void) +{ + delete fSavedData; +} + +/*! + \brief Tests to see if the passed rectangle intersects the cursor's current position + \param r The rectangle to test against + \return true if r intersects the cursor's current screen footprint +*/ +bool CursorHandler::IntersectsCursor(const BRect &r) +{ + return TestRectIntersection(r, fPosition); +} + +void CursorHandler::SetCursor(ServerCursor *cursor) +{ + // we may start empty, but we will never need to stay that way + if(!cursor) + return; + + Hide(); + + if(fSavedData && cursor->Bounds()!=fSavedData->Bounds()) + { + delete fSavedData; + fSavedData=NULL; + } + + if(!fSavedData) + fSavedData=new UtilityBitmap(cursor); + + fCursor=cursor; + + // We change the position rectangles to reflect the new cursor, compensating for the + // new cursor's hotspot. + fPosition=cursor->Bounds().OffsetToCopy(fCursorPos.x-fCursor->GetHotSpot().x, + fCursorPos.y-fCursor->GetHotSpot().y); + fOldPosition=fPosition; + + Show(); +} + +/*! + \brief Moves the cursor to the specified place on screen + \param pt The new cursor location + + This function fails if asked to move the cursor outside the screen boundaries +*/ +void CursorHandler::MoveTo(const BPoint &pt) +{ + if(pt.x<0 || pt.y<0 || (pt.x>fDriver->fDisplayMode.virtual_width-1) || + (pt.y>fDriver->fDisplayMode.virtual_height-1)) + return; + + fCursorPos=pt; + fDriver->CopyBitmap(fSavedData,fSavedData->Bounds(),fOldPosition,&(fDriver->fDrawData)); + fPosition.OffsetTo(fCursorPos.x-fCursor->GetHotSpot().x, + fCursorPos.y-fCursor->GetHotSpot().y); + fDriver->CopyToBitmap(fSavedData,fPosition); + + fDriver->fDrawData.draw_mode=B_OP_ALPHA; + fDriver->CopyBitmap(fCursor,fCursor->Bounds(),fPosition,&(fDriver->fDrawData)); + fDriver->fDrawData.draw_mode=B_OP_COPY; + + fDriver->Invalidate(fOldPosition); + fOldPosition=fPosition; + + fDriver->Invalidate(fPosition); +} + +//! Shows the cursor. Unlike BView, calls are not cumulative +void CursorHandler::Show(void) +{ + // This call is pretty simple -- save the area underneath the cursor and draw the thing + + if(fHideLevel==0) + return; + + fIsObscured=false; + fHideLevel--; + + if(fHideLevel>0) + return; + + fOldPosition=fPosition; + + if(!fCursor) + return; + + fValidSaveData=true; + + if(!fSavedData) + fSavedData=new UtilityBitmap(fCursor->Bounds(),(color_space)fDriver->fDisplayMode.space,0); + + fDriver->CopyToBitmap(fSavedData,fPosition); + + // Draw the data to the buffer + fDriver->fDrawData.draw_mode=B_OP_ALPHA; + fDriver->CopyBitmap(fCursor,fCursor->Bounds(),fPosition,&(fDriver->fDrawData)); + fDriver->fDrawData.draw_mode=B_OP_COPY; + fDriver->Invalidate(fPosition); +} + +//! Hides the cursor. Unlike BView, calls are not cumulative +void CursorHandler::Hide(void) +{ + fHideLevel++; + + // TODO: find out what the behavior is if a Hide is called on an obscured cursor + + // For now, we will change the state from obscured to hidden and leave it at that + if(fIsObscured) + { + fIsObscured=false; + return; + } + + if(fHideLevel>1) + return; + + if(!fCursor) + return; + + if(!fSavedData) + fSavedData=new UtilityBitmap(fCursor); + + fDriver->CopyBitmap(fSavedData,fSavedData->Bounds(),fOldPosition,&(fDriver->fDrawData)); + fDriver->Invalidate(fPosition); +} + +//! Hides the cursor until the next MoveTo call. Unlike BView, calls are not cumulative +void CursorHandler::Obscure(void) +{ + if(IsObscured()) + return; + + fIsObscured=true; + + // TODO: find out what the behavior is if an Obscure is called on a hidden cursor + + // For now, we will change the state from obscured to hidden and leave it at that + if(fHideLevel>0) + { + fHideLevel=0; + return; + } + + fDriver->CopyBitmap(fSavedData,fSavedData->Bounds(),fOldPosition,&(fDriver->fDrawData)); + fDriver->Invalidate(fPosition); +} + +void CursorHandler::DriverHide(void) +{ + if(fDriverHidden) + return; + + fDriverHidden=true; + + if(!fCursor) + return; + + if(!fSavedData) + fSavedData=new UtilityBitmap(fCursor); + + fDriver->CopyBitmap(fSavedData,fSavedData->Bounds(),fOldPosition,&(fDriver->fDrawData)); + fDriver->Invalidate(fPosition); +} + +void CursorHandler::DriverShow(void) +{ + if(!fDriverHidden) + return; + + fDriverHidden=false; + + fOldPosition=fPosition; + + if(!fCursor) + return; + + fValidSaveData=true; + + if(!fSavedData) + fSavedData=new UtilityBitmap(fCursor->Bounds(),(color_space)fDriver->fDisplayMode.space,0); + + fDriver->CopyToBitmap(fSavedData,fPosition); + + // Draw the data to the buffer + fDriver->fDrawData.draw_mode=B_OP_ALPHA; + fDriver->CopyBitmap(fCursor,fCursor->Bounds(),fPosition,&(fDriver->fDrawData)); + fDriver->fDrawData.draw_mode=B_OP_COPY; + fDriver->Invalidate(fPosition); +} diff --git a/src/servers/app/server/CursorHandler.h b/src/servers/app/server/CursorHandler.h new file mode 100644 index 0000000000..6d9c4d6557 --- /dev/null +++ b/src/servers/app/server/CursorHandler.h @@ -0,0 +1,78 @@ +//------------------------------------------------------------------------------ +// Copyright (c) 2001-2002, Haiku, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// +// File Name: CursorHandler.h +// Author: DarkWyrm +// Description: class for handling cursor display for DisplayDriver +// +//------------------------------------------------------------------------------ +#ifndef CURSORHANDLER_H +#define CURSORHANDLER_H + +#include "GraphicsBuffer.h" +#include "ServerCursor.h" +#include "ServerBitmap.h" + +class DisplayDriver; + +/*! + \class CursorHandler CursorHandler.h + \brief Object used by DisplayDriver to handle all the messiness of displaying the cursor +*/ +class CursorHandler +{ +public: + CursorHandler(DisplayDriver *driver); + ~CursorHandler(void); + + bool IntersectsCursor(const BRect &r); + + void SetCursor(ServerCursor *cursor); + ServerCursor *GetCursor(void) const { return fCursor; } + + void MoveTo(const BPoint &pt); + + void Hide(void); + void Show(void); + void Obscure(void); + bool IsHidden(void) const { return (fHideLevel>0); } + bool IsObscured(void) const { return fIsObscured; } + + void DriverHide(void); + void DriverShow(void); +private: + + DisplayDriver *fDriver; + + BRect fOldPosition; + BRect fPosition; + BPoint fCursorPos; + + UtilityBitmap *fSavedData; + ServerCursor *fCursor; + int8 fHideLevel; + + bool fDriverHidden; + bool fIsObscured; + bool fValidSaveData; +}; + +#endif diff --git a/src/servers/app/server/CursorManager.cpp b/src/servers/app/server/CursorManager.cpp index 0b24329af1..b3811e1271 100644 --- a/src/servers/app/server/CursorManager.cpp +++ b/src/servers/app/server/CursorManager.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), @@ -119,7 +119,7 @@ int32 CursorManager::AddCursor(ServerCursor *sc) Lock(); fCursorList->AddItem(sc); int32 value=fTokenizer.GetToken(); - sc->_token=value; + sc->fToken=value; Unlock(); return value; @@ -139,7 +139,7 @@ void CursorManager::DeleteCursor(int32 token) for(int32 i=0; iCountItems();i++) { temp=(ServerCursor*)fCursorList->ItemAt(i); - if(temp && temp->_token==token) + if(temp && temp->fToken==token) { fCursorList->RemoveItem(i); delete temp; @@ -607,7 +607,7 @@ ServerCursor *CursorManager::FindCursor(int32 token) for(int32 i=0; iCountItems();i++) { temp=(ServerCursor*)fCursorList->ItemAt(i); - if(temp && temp->_token==token) + if(temp && temp->fToken==token) return temp; } return NULL; diff --git a/src/servers/app/server/CursorManager.h b/src/servers/app/server/CursorManager.h index ff29db7f87..0cab4a4cfb 100644 --- a/src/servers/app/server/CursorManager.h +++ b/src/servers/app/server/CursorManager.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/Decorator.cpp b/src/servers/app/server/Decorator.cpp index 3055cf9df1..004ebc470d 100644 --- a/src/servers/app/server/Decorator.cpp +++ b/src/servers/app/server/Decorator.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/DefaultDecorator.cpp b/src/servers/app/server/DefaultDecorator.cpp index f59c42f6e1..981563410c 100644 --- a/src/servers/app/server/DefaultDecorator.cpp +++ b/src/servers/app/server/DefaultDecorator.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/DefaultDecorator.h b/src/servers/app/server/DefaultDecorator.h index b80b9eeeca..78281cc0d5 100644 --- a/src/servers/app/server/DefaultDecorator.h +++ b/src/servers/app/server/DefaultDecorator.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/Desktop.cpp b/src/servers/app/server/Desktop.cpp index 721620ad92..86741b8ef4 100644 --- a/src/servers/app/server/Desktop.cpp +++ b/src/servers/app/server/Desktop.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/Desktop.h b/src/servers/app/server/Desktop.h index 29c9b818cb..c8a67654d3 100644 --- a/src/servers/app/server/Desktop.h +++ b/src/servers/app/server/Desktop.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/DirectDriver.cpp b/src/servers/app/server/DirectDriver.cpp index 65596dc313..ea1ca60fee 100644 --- a/src/servers/app/server/DirectDriver.cpp +++ b/src/servers/app/server/DirectDriver.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), @@ -625,7 +625,7 @@ void DirectDriver::CopyToBitmap(ServerBitmap *destbmp, const BRect &sourcerect) destrect.bottom = work_rect.bottom; } - work_rect.Set(0,0,_displaymode.virtual_width-1,_displaymode.virtual_height-1); + work_rect.Set(0,0,fDisplayMode.virtual_width-1,fDisplayMode.virtual_height-1); if(!work_rect.Contains(sourcerect)) return; @@ -912,7 +912,7 @@ void DDView::MessageReceived(BMessage *msg) } DDWindow::DDWindow(uint16 width, uint16 height, color_space space, DirectDriver *owner) -: BDirectWindow(BRect(0,0,width-1,height-1), "OpenBeOS App Server",B_TITLED_WINDOW, +: BDirectWindow(BRect(0,0,width-1,height-1), "Haiku, Inc. App Server",B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_NOT_MOVABLE) { AddChild(new DDView(Bounds())); diff --git a/src/servers/app/server/DirectDriver.h b/src/servers/app/server/DirectDriver.h index b5723bf7ca..85bd87f093 100644 --- a/src/servers/app/server/DirectDriver.h +++ b/src/servers/app/server/DirectDriver.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/DisplayDriver.cpp b/src/servers/app/server/DisplayDriver.cpp index bf1900a58e..64bf9596e5 100644 --- a/src/servers/app/server/DisplayDriver.cpp +++ b/src/servers/app/server/DisplayDriver.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), @@ -32,6 +32,7 @@ #include #include "DisplayDriver.h" #include "RectUtils.h" +#include "Utils.h" #include "ServerCursor.h" // TODO: Remove remnants of old API. Inplement all functions. Bounds checking needs to be @@ -50,12 +51,13 @@ DisplayDriver::DisplayDriver(void) { _locker=new BLocker(); - _is_cursor_hidden=false; - _is_cursor_obscured=false; - _cursor=NULL; - _cursorsave=NULL; - _dpms_caps=B_DPMS_ON; - _dpms_state=B_DPMS_ON; +// _is_cursor_hidden=false; +// _is_cursor_obscured=false; +// _cursor=NULL; +// _cursorsave=NULL; + fCursorHandler=new CursorHandler(this); + fDPMSCaps=B_DPMS_ON; + fDPMSState=B_DPMS_ON; } @@ -67,6 +69,7 @@ DisplayDriver::DisplayDriver(void) DisplayDriver::~DisplayDriver(void) { delete _locker; + delete fCursorHandler; } /*! @@ -104,7 +107,11 @@ void DisplayDriver::CopyBits(const BRect &src, const BRect &dest, const DrawData return; Lock(); + + if(fCursorHandler->IntersectsCursor(dest)) + fCursorHandler->DriverHide(); Blit(src,dest,d); + fCursorHandler->DriverShow(); Unlock(); } @@ -143,6 +150,9 @@ void DisplayDriver::DrawBitmap(BRegion *region, ServerBitmap *bitmap, const BRec return; } + if(fCursorHandler->IntersectsCursor(dest)) + fCursorHandler->DriverHide(); + uint8 colorspace_size = (bitmap->BitsPerPixel() + 7) / 8; int32 count = region->CountRects(); @@ -252,6 +262,7 @@ void DisplayDriver::DrawBitmap(BRegion *region, ServerBitmap *bitmap, const BRec } } + fCursorHandler->DriverShow(); ReleaseBuffer(); Unlock(); Invalidate(destrect); @@ -439,7 +450,10 @@ void DisplayDriver::DrawString(const char *string, const int32 &length, const BP return; Lock(); - + + // TODO: Test for cursor intersection in DisplayDriver::DrawString + fCursorHandler->DriverHide(); + BPoint point(pt); point.y--; // because of Be's backward compatibility hack @@ -579,7 +593,10 @@ void DisplayDriver::DrawString(const char *string, const int32 &length, const BP r.right=MAX(point.x,pen.x>>6); r.top=point.y-face->height; r.bottom=point.y+face->height; - + + fCursorHandler->DriverShow(); + Invalidate(r); + FT_Done_Face(face); Unlock(); @@ -676,9 +693,6 @@ void DisplayDriver::BlitMono2RGB32(FT_Bitmap *src, const BPoint &pt, const DrawD destindex+=destinc; } ReleaseBuffer(); - - // TODO: test to see if Invalidate calls should be made in DisplayDriver::BlitMono2RGB32 - Invalidate(BRect(pt.x, pt.y, pt.x + srcwidth, pt.y + srcheight)); } void DisplayDriver::BlitGray2RGB32(FT_Bitmap *src, const BPoint &pt, const DrawData *d) @@ -800,8 +814,6 @@ void DisplayDriver::BlitGray2RGB32(FT_Bitmap *src, const BPoint &pt, const DrawD destindex+=destinc; } ReleaseBuffer(); - // TODO: test to see if Invalidate calls should be made in DisplayDriver::BlitGray2RGB32 - Invalidate(BRect(pt.x, pt.y, pt.x + srcwidth, pt.y + srcheight)); } bool DisplayDriver::AcquireBuffer(FBBitmap *bmp) @@ -826,6 +838,9 @@ void DisplayDriver::Invalidate(const BRect &r) */ void DisplayDriver::FillArc(const BRect &r, const float &angle, const float &span, const RGBColor &color) { + if(fCursorHandler->IntersectsCursor(r)) + fCursorHandler->DriverHide(); + float xc = (r.left+r.right)/2; float yc = (r.top+r.bottom)/2; float rx = r.Width()/2; @@ -1173,6 +1188,7 @@ void DisplayDriver::FillArc(const BRect &r, const float &angle, const float &spa } } } + fCursorHandler->DriverShow(); Invalidate(r); Unlock(); } @@ -1186,6 +1202,9 @@ 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) { + if(fCursorHandler->IntersectsCursor(r)) + fCursorHandler->DriverHide(); + float xc = (r.left+r.right)/2; float yc = (r.top+r.bottom)/2; float rx = r.Width()/2; @@ -1537,6 +1556,7 @@ void DisplayDriver::FillArc(const BRect &r, const float &angle, const float &spa } } } + fCursorHandler->DriverShow(); Invalidate(r); Unlock(); } @@ -1546,8 +1566,13 @@ void DisplayDriver::FillBezier(BPoint *pts, const RGBColor &color) Lock(); BezierCurve curve(pts); + + if(fCursorHandler->IntersectsCursor(curve.Frame())) + fCursorHandler->DriverHide(); + FillPolygon(curve.GetPointArray(), curve.points.CountItems(), curve.Frame(), color); - + + fCursorHandler->DriverShow(); Unlock(); } @@ -1562,8 +1587,13 @@ void DisplayDriver::FillBezier(BPoint *pts, const DrawData *d) Lock(); BezierCurve curve(pts); + + if(fCursorHandler->IntersectsCursor(curve.Frame())) + fCursorHandler->DriverHide(); + FillPolygon(curve.GetPointArray(), curve.points.CountItems(), curve.Frame(), d); - + + fCursorHandler->DriverShow(); Unlock(); } @@ -1590,6 +1620,9 @@ void DisplayDriver::FillEllipse(const BRect &r, const RGBColor &color) Lock(); + if(fCursorHandler->IntersectsCursor(r)) + 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); @@ -1628,6 +1661,8 @@ 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); } + fCursorHandler->DriverShow(); + Invalidate(r); Unlock(); } @@ -1655,6 +1690,9 @@ void DisplayDriver::FillEllipse(const BRect &r, const DrawData *d) Lock(); + if(fCursorHandler->IntersectsCursor(r)) + fCursorHandler->DriverHide(); + data = *d; data.pensize = 1; @@ -1696,6 +1734,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); } + fCursorHandler->DriverShow(); Invalidate(r); Unlock(); } @@ -1721,6 +1760,9 @@ void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, const BRect &bound Lock(); + if(fCursorHandler->IntersectsCursor(bounds)) + fCursorHandler->DriverHide(); + BPoint *currentPoint, *nextPoint; BPoint tempNextPoint; BPoint tempCurrentPoint; @@ -1819,7 +1861,7 @@ void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, const BRect &bound } if (segmentArray[i].MinY() == segmentArray[i].MaxY()) { - if ( (segmentArray[i].MinX() < _displaymode.virtual_width) && + if ( (segmentArray[i].MinX() < fDisplayMode.virtual_width) && (segmentArray[i].MaxX() >= 0) ) StrokeSolidLine(ROUND(segmentArray[i].MinX()), y, ROUND(segmentArray[i].MaxX()), y, color); @@ -1827,7 +1869,7 @@ void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, const BRect &bound } else { - if ( (segmentArray[i+1].GetX(y) < _displaymode.virtual_width) && + if ( (segmentArray[i+1].GetX(y) < fDisplayMode.virtual_width) && (segmentArray[i].GetX(y) >= 0) ) StrokeSolidLine(ROUND(segmentArray[i].GetX(y)), y, ROUND(segmentArray[i+1].GetX(y)), y, color); @@ -1837,6 +1879,7 @@ void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, const BRect &bound } delete[] segmentArray; + fCursorHandler->DriverShow(); Invalidate(bounds); Unlock(); @@ -1863,6 +1906,9 @@ void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, const BRect &bound Lock(); + if(fCursorHandler->IntersectsCursor(bounds)) + fCursorHandler->DriverHide(); + BPoint *currentPoint, *nextPoint; BPoint tempNextPoint; BPoint tempCurrentPoint; @@ -1963,7 +2009,7 @@ void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, const BRect &bound } if (segmentArray[i].MinY() == segmentArray[i].MaxY()) { - if ( (segmentArray[i].MinX() < _displaymode.virtual_width) && + if ( (segmentArray[i].MinX() < fDisplayMode.virtual_width) && (segmentArray[i].MaxX() >= 0) ) StrokePatternLine(ROUND(segmentArray[i].MinX()), y, ROUND(segmentArray[i].MaxX()), y, d); @@ -1971,7 +2017,7 @@ void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, const BRect &bound } else { - if ( (segmentArray[i+1].GetX(y) < _displaymode.virtual_width) && + if ( (segmentArray[i+1].GetX(y) < fDisplayMode.virtual_width) && (segmentArray[i].GetX(y) >= 0) ) StrokePatternLine(ROUND(segmentArray[i].GetX(y)), y, ROUND(segmentArray[i+1].GetX(y)), y, d); @@ -2050,6 +2096,7 @@ void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, const BRect &bound } } delete[] segmentArray; + fCursorHandler->DriverShow(); Invalidate(bounds); Unlock(); } @@ -2062,7 +2109,13 @@ void DisplayDriver::FillPolygon(BPoint *ptlist, int32 numpts, const BRect &bound void DisplayDriver::FillRect(const BRect &r, const RGBColor &color) { Lock(); + if(fCursorHandler->IntersectsCursor(r)) + { + debugger(""); + fCursorHandler->DriverHide(); + } FillSolidRect(r,color); + fCursorHandler->DriverShow(); Unlock(); } @@ -2079,6 +2132,8 @@ void DisplayDriver::FillRect(const BRect &r, const DrawData *d) return; Lock(); + if(fCursorHandler->IntersectsCursor(r)) + fCursorHandler->DriverHide(); if ( d->clipReg ) { if ( d->clipReg->Intersects(r) ) @@ -2093,6 +2148,7 @@ void DisplayDriver::FillRect(const BRect &r, const DrawData *d) } else FillPatternRect(r,d); + fCursorHandler->DriverShow(); Invalidate(r); Unlock(); } @@ -2106,11 +2162,16 @@ void DisplayDriver::FillRegion(BRegion& r, const RGBColor &color) { Lock(); + if(fCursorHandler->IntersectsCursor(r.Frame())) + fCursorHandler->DriverHide(); + int numRects; numRects = r.CountRects(); for(int32 i=0; iDriverShow(); Invalidate(r.Frame()); Unlock(); } @@ -2129,6 +2190,9 @@ void DisplayDriver::FillRegion(BRegion& r, const DrawData *d) Lock(); + if(fCursorHandler->IntersectsCursor(r.Frame())) + fCursorHandler->DriverHide(); + int numRects; if ( d->clipReg ) @@ -2148,6 +2212,7 @@ void DisplayDriver::FillRegion(BRegion& r, const DrawData *d) for(int32 i=0; iDriverShow(); Invalidate(r.Frame()); Unlock(); } @@ -2160,6 +2225,8 @@ void DisplayDriver::FillRoundRect(const BRect &r, const float &xrad, const float Lock(); + if(fCursorHandler->IntersectsCursor(r)) + fCursorHandler->DriverHide(); for (i=0; i<=(int)yrad; i++) { arc_x = xrad*sqrt(1-i*i/yrad2); @@ -2167,6 +2234,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); } FillSolidRect(BRect(r.left,r.top+yrad,r.right,r.bottom-yrad),color); + fCursorHandler->DriverShow(); Invalidate(r); Unlock(); } @@ -2186,6 +2254,9 @@ void DisplayDriver::FillRoundRect(const BRect &r, const float &xrad, const float Lock(); + if(fCursorHandler->IntersectsCursor(r)) + fCursorHandler->DriverHide(); + if ( d->clipReg ) { int numRects, rectIndex; @@ -2227,6 +2298,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); + fCursorHandler->DriverShow(); Invalidate(r); Unlock(); } @@ -2244,6 +2316,9 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const RGBColo return; Lock(); + if(fCursorHandler->IntersectsCursor(bounds)) + fCursorHandler->DriverHide(); + BPoint first, second, third; // Sort points according to their y values and x values (y is primary) @@ -2329,6 +2404,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const RGBColo for(i=(int32)second.y; i<=third.y; i++) StrokeSolidLine(ROUND(lineC.GetX(i)), i, ROUND(lineB.GetX(i)), i, color); + fCursorHandler->DriverShow(); Invalidate(bounds); Unlock(); @@ -2346,6 +2422,9 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const DrawDat Lock(); + if(fCursorHandler->IntersectsCursor(bounds)) + fCursorHandler->DriverHide(); + if ( d->clipReg ) { // For now, cop out and use FillPolygon @@ -2440,6 +2519,7 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const DrawDat StrokePatternLine(ROUND(lineC.GetX(i)), i, ROUND(lineB.GetX(i)), i, d); } + fCursorHandler->DriverShow(); Invalidate(bounds); Unlock(); @@ -2455,20 +2535,8 @@ void DisplayDriver::FillTriangle(BPoint *pts, const BRect &bounds, const DrawDat */ void DisplayDriver::HideCursor(void) { - Lock(); - - if(_is_cursor_hidden) - { - Unlock(); - return; - } - - _is_cursor_hidden=true; - - if(_cursorsave) - CopyBitmap(_cursorsave,_cursorsave->Bounds(),cursorframe, &_drawdata); - + fCursorHandler->Hide(); Unlock(); } @@ -2480,9 +2548,7 @@ void DisplayDriver::HideCursor(void) bool DisplayDriver::IsCursorHidden(void) { Lock(); - - bool value=(_is_cursor_hidden || _is_cursor_obscured); - + bool value=fCursorHandler->IsHidden(); Unlock(); return value; @@ -2499,38 +2565,7 @@ bool DisplayDriver::IsCursorHidden(void) void DisplayDriver::MoveCursorTo(const float &x, const float &y) { Lock(); - - if(cursorframe.left==x && cursorframe.top==y) - { - Unlock(); - return; - } - - if(_is_cursor_obscured) - _is_cursor_obscured=false; - - oldcursorframe=cursorframe; - cursorframe.OffsetTo(x,y); - - if(_is_cursor_hidden) - { - Unlock(); - return; - } - - if(!_cursorsave) - _cursorsave=new UtilityBitmap(_cursor->Bounds(),(color_space)_displaymode.space,0); - - _drawdata.draw_mode=B_OP_COPY; - CopyBitmap(_cursorsave,_cursor->Bounds(),saveframe,&_drawdata); - - CopyToBitmap(_cursorsave,cursorframe); - saveframe=cursorframe; - - _drawdata.draw_mode=B_OP_ALPHA; - CopyBitmap(_cursor,_cursor->Bounds(),cursorframe,&_drawdata); - _drawdata.draw_mode=B_OP_COPY; - + fCursorHandler->MoveTo(BPoint(x,y)); Unlock(); } @@ -2552,22 +2587,8 @@ void DisplayDriver::InvertRect(const BRect &r) */ void DisplayDriver::ShowCursor(void) { - if(!_cursor) - { - printf("ERROR: Call to ShowCursor and driver has no defined cursor\n"); - return; - } - Lock(); - - _is_cursor_hidden=false; - _is_cursor_obscured=false; - - CopyToBitmap(_cursorsave,cursorframe); - saveframe=cursorframe; - - CopyBitmap(_cursor,_cursor->Bounds(),cursorframe,&_drawdata); - + fCursorHandler->Show(); Unlock(); } @@ -2582,18 +2603,7 @@ void DisplayDriver::ShowCursor(void) void DisplayDriver::ObscureCursor(void) { Lock(); - - if(_is_cursor_obscured) - { - Unlock(); - return; - } - - _is_cursor_obscured=true; - - if(_cursorsave) - CopyBitmap(_cursorsave,_cursorsave->Bounds(),cursorframe, &_drawdata); - + fCursorHandler->Obscure(); Unlock(); } @@ -2609,36 +2619,7 @@ void DisplayDriver::ObscureCursor(void) void DisplayDriver::SetCursor(ServerCursor *cursor) { Lock(); - - bool visible=false; - - if(!_is_cursor_hidden && !_is_cursor_obscured) - visible=true; - - if(_cursor) - { - // We need to restore the stuff because the cursor very well may not be the same size - if(visible) - CopyBitmap(_cursorsave,_cursorsave->Bounds(),cursorframe, &_drawdata); - delete _cursor; - } - _cursor=new ServerCursor(cursor); - - if(visible) - _cursorsave=new UtilityBitmap((ServerBitmap*)cursor); - - // TODO: make this take the hotspot into account -- too tired to bother right now... - saveframe=_cursor->Bounds().OffsetToCopy(cursorframe.LeftTop()); - cursorframe=saveframe; - - if(visible) - { - CopyToBitmap(_cursorsave, cursorframe); - _drawdata.draw_mode=B_OP_ALPHA; - CopyBitmap(_cursor, _cursor->Bounds(), cursorframe, &_drawdata); - _drawdata.draw_mode=B_OP_COPY; - } - + fCursorHandler->SetCursor(cursor); Unlock(); } @@ -2673,6 +2654,9 @@ void DisplayDriver::StrokeArc(const BRect &r, const float &angle, const float &s Lock(); + if(fCursorHandler->IntersectsCursor(r)) + fCursorHandler->DriverHide(); + // Watch out for bozos giving us whacko spans if ( (span >= 360) || (span <= -360) ) { @@ -2801,6 +2785,7 @@ void DisplayDriver::StrokeArc(const BRect &r, const float &angle, const float &s (shortspan && (startQuad == 4) && (x >= startx) && (x <= endx)) ) StrokePoint(BPoint(xc+x,yc+y),color); } + fCursorHandler->DriverShow(); Invalidate(r); Unlock(); } @@ -2836,6 +2821,9 @@ void DisplayDriver::StrokeArc(const BRect &r, const float &angle, const float &s Lock(); + if(fCursorHandler->IntersectsCursor(r)) + fCursorHandler->DriverHide(); + // Watch out for bozos giving us whacko spans if ( (span >= 360) || (span <= -360) ) { @@ -2964,6 +2952,7 @@ void DisplayDriver::StrokeArc(const BRect &r, const float &angle, const float &s (shortspan && (startQuad == 4) && (x >= startx) && (x <= endx)) ) StrokePoint(BPoint(xc+x,yc+y),d); } + fCursorHandler->DriverShow(); Invalidate(r); Unlock(); } @@ -2980,9 +2969,14 @@ void DisplayDriver::StrokeBezier(BPoint *pts, const RGBColor &color) Lock(); BezierCurve curve(pts); + if(fCursorHandler->IntersectsCursor(curve.Frame())) + fCursorHandler->DriverHide(); + numLines = curve.points.CountItems()-1; for (i=0; iDriverShow(); Invalidate(curve.Frame()); Unlock(); } @@ -2998,10 +2992,15 @@ void DisplayDriver::StrokeBezier(BPoint *pts, const DrawData *d) Lock(); BezierCurve curve(pts); - + + if(fCursorHandler->IntersectsCursor(curve.Frame())) + fCursorHandler->DriverHide(); + numLines = curve.points.CountItems()-1; for (i=0; iDriverShow(); Invalidate(curve.Frame()); Unlock(); } @@ -3030,6 +3029,9 @@ void DisplayDriver::StrokeEllipse(const BRect &r, const RGBColor &color) Lock(); + if(fCursorHandler->IntersectsCursor(r)) + fCursorHandler->DriverHide(); + p = ROUND (Ry2 - (Rx2 * ry) + (.25 * Rx2)); while (px < py) { @@ -3073,6 +3075,8 @@ 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(); Invalidate(r); Unlock(); } @@ -3101,6 +3105,9 @@ void DisplayDriver::StrokeEllipse(const BRect &r, const DrawData *d) Lock(); + if(fCursorHandler->IntersectsCursor(r)) + fCursorHandler->DriverHide(); + p = ROUND (Ry2 - (Rx2 * ry) + (.25 * Rx2)); while (px < py) { @@ -3144,6 +3151,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); } + fCursorHandler->DriverShow(); Invalidate(r); Unlock(); } @@ -3157,7 +3165,11 @@ void DisplayDriver::StrokeEllipse(const BRect &r, const DrawData *d) void DisplayDriver::StrokeLine(const BPoint &start, const BPoint &end, const RGBColor &color) { Lock(); + if(fCursorHandler->IntersectsCursor(BRect(start,end))) + fCursorHandler->DriverHide(); StrokeSolidLine(ROUND(start.x),ROUND(start.y),ROUND(end.x),ROUND(end.y),color); + + fCursorHandler->DriverShow(); Invalidate(BRect(start,end)); Unlock(); } @@ -3171,6 +3183,10 @@ void DisplayDriver::StrokeLine(const BPoint &start, const BPoint &end, const RGB void DisplayDriver::StrokeLine(const BPoint &start, const BPoint &end, const DrawData *d) { Lock(); + + if(fCursorHandler->IntersectsCursor(BRect(start,end))) + fCursorHandler->DriverHide(); + if ( d->pensize == 1 ) { if ( d->clipReg ) @@ -3266,6 +3282,7 @@ void DisplayDriver::StrokeLine(const BPoint &start, const BPoint &end, const Dra FillPolygon(corners,4,BRect(start,end),d); } } + fCursorHandler->DriverShow(); Invalidate(BRect(start,end)); Unlock(); } @@ -3278,6 +3295,8 @@ void DisplayDriver::StrokeLine(const BPoint &start, const BPoint &end, const Dra */ void DisplayDriver::StrokeLine(const BPoint &start, const BPoint &end, DisplayDriver* driver, SetPixelFuncType setPixel) { + // TODO: What's this particular StrokeLine call for? + int x1 = ROUND(start.x); int y1 = ROUND(start.y); int x2 = ROUND(end.x); @@ -3324,10 +3343,15 @@ void DisplayDriver::StrokePolygon(BPoint *ptlist, int32 numpts, const BRect &bou return; Lock(); + if(fCursorHandler->IntersectsCursor(bounds)) + fCursorHandler->DriverHide(); + for(int32 i=0; i<(numpts-1); i++) StrokeLine(ptlist[i],ptlist[i+1],color); if(is_closed) StrokeLine(ptlist[numpts-1],ptlist[0],color); + + fCursorHandler->DriverShow(); Invalidate(bounds); Unlock(); } @@ -3344,10 +3368,15 @@ void DisplayDriver::StrokePolygon(BPoint *ptlist, int32 numpts, const BRect &bou return; Lock(); + if(fCursorHandler->IntersectsCursor(bounds)) + fCursorHandler->DriverHide(); + for(int32 i=0; i<(numpts-1); i++) StrokeLine(ptlist[i],ptlist[i+1],d); if(is_closed) StrokeLine(ptlist[numpts-1],ptlist[0],d); + + fCursorHandler->DriverShow(); Invalidate(bounds); Unlock(); } @@ -3361,7 +3390,12 @@ void DisplayDriver::StrokePolygon(BPoint *ptlist, int32 numpts, const BRect &bou void DisplayDriver::StrokeRect(const BRect &r, const RGBColor &color) { Lock(); + + if(fCursorHandler->IntersectsCursor(r)) + fCursorHandler->DriverHide(); StrokeSolidRect(r,color); + + fCursorHandler->DriverShow(); Invalidate(r); Unlock(); } @@ -3369,10 +3403,14 @@ void DisplayDriver::StrokeRect(const BRect &r, const RGBColor &color) void DisplayDriver::StrokeRect(const BRect &r, const DrawData *d) { Lock(); + if(fCursorHandler->IntersectsCursor(r)) + fCursorHandler->DriverHide(); StrokeLine(r.LeftTop(),r.RightTop(),d); StrokeLine(r.LeftTop(),r.LeftBottom(),d); StrokeLine(r.RightTop(),r.RightBottom(),d); StrokeLine(r.LeftBottom(),r.RightBottom(),d); + + fCursorHandler->DriverShow(); Invalidate(r); Unlock(); } @@ -3388,8 +3426,13 @@ void DisplayDriver::StrokeRegion(BRegion& r, const RGBColor &color) { Lock(); + if(fCursorHandler->IntersectsCursor(r.Frame())) + fCursorHandler->DriverHide(); + for(int32 i=0; iDriverShow(); Invalidate(r.Frame()); Unlock(); } @@ -3397,9 +3440,14 @@ void DisplayDriver::StrokeRegion(BRegion& r, const RGBColor &color) void DisplayDriver::StrokeRegion(BRegion& r, const DrawData *d) { Lock(); - + + if(fCursorHandler->IntersectsCursor(r.Frame())) + fCursorHandler->DriverHide(); + for(int32 i=0; iDriverShow(); Invalidate(r.Frame()); Unlock(); } @@ -3420,6 +3468,9 @@ void DisplayDriver::StrokeRoundRect(const BRect &r, const float &xrad, const flo bBottom = vBottom - yrad; Lock(); + if(fCursorHandler->IntersectsCursor(r)) + fCursorHandler->DriverHide(); + StrokeArc(BRect(bRight, r.top, r.right, bTop), 0, 90, color); StrokeLine(BPoint(hRight, r.top), BPoint(hLeft, r.top), color); @@ -3431,6 +3482,8 @@ void DisplayDriver::StrokeRoundRect(const BRect &r, const float &xrad, const flo StrokeArc(BRect(bRight,bBottom,r.right,r.bottom), 270, 90, color); StrokeLine(BPoint(r.right, vBottom), BPoint(r.right, vTop), color); + + fCursorHandler->DriverShow(); Invalidate(r); Unlock(); } @@ -3458,6 +3511,10 @@ void DisplayDriver::StrokeRoundRect(const BRect &r, const float &xrad, const flo bBottom = vBottom - yrad; Lock(); + + if(fCursorHandler->IntersectsCursor(r)) + fCursorHandler->DriverHide(); + StrokeArc(BRect(bRight, r.top, r.right, bTop), 0, 90, d); StrokeLine(BPoint(hRight, r.top), BPoint(hLeft, r.top), d); @@ -3469,6 +3526,8 @@ void DisplayDriver::StrokeRoundRect(const BRect &r, const float &xrad, const flo StrokeArc(BRect(bRight,bBottom,r.right,r.bottom), 270, 90, d); StrokeLine(BPoint(r.right, vBottom), BPoint(r.right, vTop), d); + + fCursorHandler->DriverShow(); Invalidate(r); Unlock(); } @@ -3488,9 +3547,14 @@ void DisplayDriver::StrokeShape(const BRect &bounds, const int32 &opcount, const void DisplayDriver::StrokeTriangle(BPoint *pts, const BRect &bounds, const RGBColor &color) { Lock(); + if(fCursorHandler->IntersectsCursor(bounds)) + fCursorHandler->DriverHide(); + StrokeLine(pts[0],pts[1],color); StrokeLine(pts[1],pts[2],color); StrokeLine(pts[2],pts[0],color); + + fCursorHandler->DriverShow(); Invalidate(bounds); Unlock(); } @@ -3498,9 +3562,14 @@ void DisplayDriver::StrokeTriangle(BPoint *pts, const BRect &bounds, const RGBCo void DisplayDriver::StrokeTriangle(BPoint *pts, const BRect &bounds, const DrawData *d) { Lock(); + if(fCursorHandler->IntersectsCursor(bounds)) + fCursorHandler->DriverHide(); + StrokeLine(pts[0],pts[1],d); StrokeLine(pts[1],pts[2],d); StrokeLine(pts[2],pts[0],d); + + fCursorHandler->DriverShow(); Invalidate(bounds); Unlock(); } @@ -3519,6 +3588,11 @@ void DisplayDriver::StrokeLineArray(BPoint *pts, const int32 &numlines, const Dr Lock(); + BRect invalid=CalculatePolygonBounds(pts,numlines*2); + + if(fCursorHandler->IntersectsCursor(invalid)) + fCursorHandler->DriverHide(); + data = *d; for (i=0; iDriverShow(); + Unlock(); } @@ -3552,7 +3626,7 @@ void DisplayDriver::GetMode(display_mode *mode) return; Lock(); - *mode=_displaymode; + *mode=fDisplayMode; Unlock(); } @@ -3813,7 +3887,11 @@ void DisplayDriver::GetTruncatedStrings(const char **instrings,const int32 &stri */ bool DisplayDriver::IsCursorObscured(bool state) { - return _is_cursor_obscured; + Lock(); + bool value=fCursorHandler->IsObscured(); + Unlock(); + + return value; } // Protected Internal Functions @@ -3866,7 +3944,7 @@ status_t DisplayDriver::SetDPMSMode(const uint32 &state) */ uint32 DisplayDriver::DPMSMode(void) const { - return _dpms_state; + return fDPMSState; } /*! @@ -3878,7 +3956,7 @@ uint32 DisplayDriver::DPMSMode(void) const */ uint32 DisplayDriver::DPMSCapabilities(void) const { - return _dpms_caps; + return fDPMSCaps; } /*! @@ -3994,7 +4072,11 @@ status_t DisplayDriver::WaitForRetrace(bigtime_t timeout) */ ServerCursor *DisplayDriver::_GetCursor(void) { - return _cursor; + Lock(); + ServerCursor *c=fCursorHandler->GetCursor(); + Unlock(); + + return c; } /*! diff --git a/src/servers/app/server/DisplaySupport.cpp b/src/servers/app/server/DisplaySupport.cpp index 49f2176af8..e947ae0d80 100644 --- a/src/servers/app/server/DisplaySupport.cpp +++ b/src/servers/app/server/DisplaySupport.cpp @@ -1,3 +1,30 @@ +//------------------------------------------------------------------------------ +// Copyright (c) 2001-2002, Haiku, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// +// File Name: DisplaySupport.cpp +// Author: DarkWyrm +// Gabe Yoder +// Description: Support classes for the DisplayDriver class +// +//------------------------------------------------------------------------------ #include "DisplaySupport.h" BezierCurve::BezierCurve(BPoint* pts) diff --git a/src/servers/app/server/FMWList.cpp b/src/servers/app/server/FMWList.cpp index b3f189de6e..780181b932 100644 --- a/src/servers/app/server/FMWList.cpp +++ b/src/servers/app/server/FMWList.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/FMWList.h b/src/servers/app/server/FMWList.h index 9dd6d4d57d..67dc936038 100644 --- a/src/servers/app/server/FMWList.h +++ b/src/servers/app/server/FMWList.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/FontFamily.cpp b/src/servers/app/server/FontFamily.cpp index 4097fb042a..f7c902424e 100644 --- a/src/servers/app/server/FontFamily.cpp +++ b/src/servers/app/server/FontFamily.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/FontServer.cpp b/src/servers/app/server/FontServer.cpp index 1737533e35..c1fa241966 100644 --- a/src/servers/app/server/FontServer.cpp +++ b/src/servers/app/server/FontServer.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/GraphicsBuffer.cpp b/src/servers/app/server/GraphicsBuffer.cpp index b15dc486ba..4c5ed71a04 100644 --- a/src/servers/app/server/GraphicsBuffer.cpp +++ b/src/servers/app/server/GraphicsBuffer.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), @@ -39,6 +39,11 @@ GraphicsBuffer::GraphicsBuffer(uint8 *buffer, uint32 width, uint32 height, uint3 SetTo(buffer, width, height, rowbytes); } +GraphicsBuffer::GraphicsBuffer(const GraphicsBuffer &buffer) +{ + SetTo(buffer.fBuffer, buffer.fWidth, buffer.fHeight, buffer.fBytesPerRow); +} + GraphicsBuffer::~GraphicsBuffer() { delete [] fRowList; @@ -85,3 +90,8 @@ void GraphicsBuffer::Unset(void) } +GraphicsBuffer &GraphicsBuffer::operator=(const GraphicsBuffer &buffer) +{ + SetTo(buffer.fBuffer, buffer.fWidth, buffer.fHeight, buffer.fBytesPerRow); + return *this; +} diff --git a/src/servers/app/server/IPoint.cpp b/src/servers/app/server/IPoint.cpp index 543177d143..c362a3b192 100644 --- a/src/servers/app/server/IPoint.cpp +++ b/src/servers/app/server/IPoint.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/Layer.cpp b/src/servers/app/server/Layer.cpp index e3751ce7ea..94649cdb39 100644 --- a/src/servers/app/server/Layer.cpp +++ b/src/servers/app/server/Layer.cpp @@ -1,3 +1,31 @@ +//------------------------------------------------------------------------------ +// Copyright (c) 2001-2002, Haiku, Inc. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the "Software"), +// to deal in the Software without restriction, including without limitation +// the rights to use, copy, modify, merge, publish, distribute, sublicense, +// and/or sell copies of the Software, and to permit persons to whom the +// Software is furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +// DEALINGS IN THE SOFTWARE. +// +// File Name: Layer.cpp +// Author: DarkWyrm +// Adi Oanca +// Description: Class used for rendering to the frame buffer. One layer per +// view on screen and also for window decorators +// +//------------------------------------------------------------------------------ #include #include #include diff --git a/src/servers/app/server/Layer.h b/src/servers/app/server/Layer.h index 2416e9dc19..e1912aef15 100644 --- a/src/servers/app/server/Layer.h +++ b/src/servers/app/server/Layer.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/LayerData.cpp b/src/servers/app/server/LayerData.cpp index 452a5be8fd..c1d09266d5 100644 --- a/src/servers/app/server/LayerData.cpp +++ b/src/servers/app/server/LayerData.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/PNGDump.cpp b/src/servers/app/server/PNGDump.cpp index 51ed7aa724..dc035fba1b 100644 --- a/src/servers/app/server/PNGDump.cpp +++ b/src/servers/app/server/PNGDump.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/PNGDump.h b/src/servers/app/server/PNGDump.h index abfc736276..e34ff2b77f 100644 --- a/src/servers/app/server/PNGDump.h +++ b/src/servers/app/server/PNGDump.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/PatternHandler.cpp b/src/servers/app/server/PatternHandler.cpp index 5f0b7620fd..a99015c5c9 100644 --- a/src/servers/app/server/PatternHandler.cpp +++ b/src/servers/app/server/PatternHandler.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/PicturePlayer.cpp b/src/servers/app/server/PicturePlayer.cpp index cf30308e47..ef5ac45d0d 100644 --- a/src/servers/app/server/PicturePlayer.cpp +++ b/src/servers/app/server/PicturePlayer.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/PicturePlayer.h b/src/servers/app/server/PicturePlayer.h index 0a0ed08faf..985c563167 100644 --- a/src/servers/app/server/PicturePlayer.h +++ b/src/servers/app/server/PicturePlayer.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/PixelRenderer.cpp b/src/servers/app/server/PixelRenderer.cpp index 2a2a5d3631..0bda6afa55 100644 --- a/src/servers/app/server/PixelRenderer.cpp +++ b/src/servers/app/server/PixelRenderer.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/RGBColor.cpp b/src/servers/app/server/RGBColor.cpp index 0878a2e6d2..9413373237 100644 --- a/src/servers/app/server/RGBColor.cpp +++ b/src/servers/app/server/RGBColor.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/RectUtils.cpp b/src/servers/app/server/RectUtils.cpp index 6d7a88d0fb..9d14ce866e 100644 --- a/src/servers/app/server/RectUtils.cpp +++ b/src/servers/app/server/RectUtils.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/RootLayer.cpp b/src/servers/app/server/RootLayer.cpp index 151bcc40ca..8c47cf1fa2 100644 --- a/src/servers/app/server/RootLayer.cpp +++ b/src/servers/app/server/RootLayer.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2003, OpenBeOS +// Copyright (c) 2001-2003, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/RootLayer.h b/src/servers/app/server/RootLayer.h index bfcae80cf3..79e588b418 100644 --- a/src/servers/app/server/RootLayer.h +++ b/src/servers/app/server/RootLayer.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2003, OpenBeOS +// Copyright (c) 2001-2003, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/ScreenDriver.cpp b/src/servers/app/server/ScreenDriver.cpp index e85eb05a91..edae805885 100644 --- a/src/servers/app/server/ScreenDriver.cpp +++ b/src/servers/app/server/ScreenDriver.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/ScreenDriver.h b/src/servers/app/server/ScreenDriver.h index 671305521e..040d37d6c9 100644 --- a/src/servers/app/server/ScreenDriver.h +++ b/src/servers/app/server/ScreenDriver.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/ServerApp.cpp b/src/servers/app/server/ServerApp.cpp index d017a6f32e..3fdafcb9f5 100644 --- a/src/servers/app/server/ServerApp.cpp +++ b/src/servers/app/server/ServerApp.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/ServerApp.h b/src/servers/app/server/ServerApp.h index 3a8130c68a..c6f6b637db 100644 --- a/src/servers/app/server/ServerApp.h +++ b/src/servers/app/server/ServerApp.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/ServerBitmap.cpp b/src/servers/app/server/ServerBitmap.cpp index 28a7d7f1e5..ebeed96819 100644 --- a/src/servers/app/server/ServerBitmap.cpp +++ b/src/servers/app/server/ServerBitmap.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), @@ -39,16 +39,16 @@ ServerBitmap::ServerBitmap(BRect rect,color_space space, int32 flags, int32 bytesperline, screen_id screen) { - _initialized=false; + fInitialized=false; // WARNING: '1' is added to the width and height. Same is done in FBBitmap // subclass, so if you modify here make sure to do the same under FBBitmap::SetSize(...) - _width=rect.IntegerWidth()+1; - _height=rect.IntegerHeight()+1; - _space=space; - _area=B_ERROR; - _buffer=NULL; - _flags=flags; + fWidth=rect.IntegerWidth()+1; + fHeight=rect.IntegerHeight()+1; + fSpace=space; + fArea=B_ERROR; + fBuffer=NULL; + fFlags=flags; _HandleSpace(space, bytesperline); } @@ -56,27 +56,27 @@ ServerBitmap::ServerBitmap(BRect rect,color_space space, int32 flags, //! Copy constructor does not copy the buffer. ServerBitmap::ServerBitmap(const ServerBitmap *bmp) { - _initialized=false; - _area=B_ERROR; - _buffer=NULL; + fInitialized=false; + fArea=B_ERROR; + fBuffer=NULL; if(bmp) { - _width=bmp->_width; - _height=bmp->_height; - _bytesperrow=bmp->_bytesperrow; - _space=bmp->_space; - _flags=bmp->_flags; - _bpp=bmp->_bpp; + fWidth=bmp->fWidth; + fHeight=bmp->fHeight; + fBytesPerRow=bmp->fBytesPerRow; + fSpace=bmp->fSpace; + fFlags=bmp->fFlags; + fBitsPerPixel=bmp->fBitsPerPixel; } else { - _width=0; - _height=0; - _bytesperrow=0; - _space=B_NO_COLOR_SPACE; - _flags=0; - _bpp=0; + fWidth=0; + fHeight=0; + fBytesPerRow=0; + fSpace=B_NO_COLOR_SPACE; + fFlags=0; + fBitsPerPixel=0; } } @@ -93,7 +93,7 @@ ServerBitmap::~ServerBitmap(void) */ uint32 ServerBitmap::BitsLength(void) const { - return (uint32)(_bytesperrow*_height); + return (uint32)(fBytesPerRow*fHeight); } /*! @@ -104,9 +104,9 @@ uint32 ServerBitmap::BitsLength(void) const */ void ServerBitmap::_AllocateBuffer(void) { - if(_buffer!=NULL) - delete _buffer; - _buffer=new uint8[BitsLength()]; + if(fBuffer!=NULL) + delete fBuffer; + fBuffer=new uint8[BitsLength()]; } /*! @@ -116,10 +116,10 @@ void ServerBitmap::_AllocateBuffer(void) */ void ServerBitmap::_FreeBuffer(void) { - if(_buffer!=NULL) + if(fBuffer!=NULL) { - delete _buffer; - _buffer=NULL; + delete fBuffer; + fBuffer=NULL; } } @@ -165,11 +165,11 @@ void ServerBitmap::_HandleSpace(color_space space, int32 bytesperline) case B_HLS24: case B_CMY24: { - if(bytesperline<(_width*4)) - _bytesperrow=_width*4; + if(bytesperline<(fWidth*4)) + fBytesPerRow=fWidth*4; else - _bytesperrow=bytesperline; - _bpp=32; + fBytesPerRow=bytesperline; + fBitsPerPixel=32; break; } // Calculate size and dword-align @@ -177,8 +177,8 @@ void ServerBitmap::_HandleSpace(color_space space, int32 bytesperline) // 1-bit case B_GRAY1: { - int32 numbytes=_width>>3; - if((_width % 8) != 0) + int32 numbytes=fWidth>>3; + if((fWidth % 8) != 0) numbytes++; if(bytesperline_buffer) - memcpy(_buffer, cursor->_buffer, BitsLength()); - _hotspot=cursor->_hotspot; + if(cursor->fBuffer) + memcpy(fBuffer, cursor->fBuffer, BitsLength()); + fHotSpot=cursor->fHotSpot; } } @@ -133,11 +134,11 @@ ServerCursor::~ServerCursor(void) */ void ServerCursor::SetHotSpot(BPoint pt) { - _hotspot=pt; - _hotspot.ConstrainTo(Bounds()); + fHotSpot=pt; + fHotSpot.ConstrainTo(Bounds()); } void ServerCursor::SetAppSignature(const char *signature) { - _app_signature.SetTo( (signature)?signature:"" ); + fAppSignature.SetTo( (signature)?signature:"" ); } diff --git a/src/servers/app/server/ServerFont.cpp b/src/servers/app/server/ServerFont.cpp index 7d10bc7fec..38836813bf 100644 --- a/src/servers/app/server/ServerFont.cpp +++ b/src/servers/app/server/ServerFont.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/ServerPicture.cpp b/src/servers/app/server/ServerPicture.cpp index e0bc22b3d5..0bb8df3a74 100644 --- a/src/servers/app/server/ServerPicture.cpp +++ b/src/servers/app/server/ServerPicture.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/ServerPicture.h b/src/servers/app/server/ServerPicture.h index dc85f69de7..67054362e7 100644 --- a/src/servers/app/server/ServerPicture.h +++ b/src/servers/app/server/ServerPicture.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/ServerScreen.cpp b/src/servers/app/server/ServerScreen.cpp index 388e7c3f94..0ab732f623 100644 --- a/src/servers/app/server/ServerScreen.cpp +++ b/src/servers/app/server/ServerScreen.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/ServerScreen.h b/src/servers/app/server/ServerScreen.h index 2ef31db0ae..a8e30cf7fe 100644 --- a/src/servers/app/server/ServerScreen.h +++ b/src/servers/app/server/ServerScreen.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/ServerWindow.cpp b/src/servers/app/server/ServerWindow.cpp index 8d20c5cb59..6bcc6f38f4 100644 --- a/src/servers/app/server/ServerWindow.cpp +++ b/src/servers/app/server/ServerWindow.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), @@ -29,6 +29,7 @@ #include #include #include +#include #include // for B_XXXXX_MOUSE_BUTTON defines #include #include @@ -50,7 +51,7 @@ #include "CursorManager.h" #include "Workspace.h" -#define DEBUG_SERVERWINDOW +//#define DEBUG_SERVERWINDOW //#define DEBUG_SERVERWINDOW_MOUSE //#define DEBUG_SERVERWINDOW_KEYBOARD @@ -1891,10 +1892,11 @@ void ServerWindow::DispatchMessage(int32 code) pointlist=new BPoint[pointcount]; + fSession->Read(pointlist, sizeof(BPoint)*pointcount); + for(int32 i=0; iConvertToTop(pointlist[i]); - // TODO: modify DisplayDriver::StrokePolygon to utilize a boundary BRect desktop->GetDisplayDriver()->StrokePolygon(pointlist,pointcount,polyframe, cl->fLayerData,isclosed); @@ -1905,12 +1907,10 @@ void ServerWindow::DispatchMessage(int32 code) case AS_FILL_POLYGON: { BRect polyframe; - bool isclosed; int32 pointcount; BPoint *pointlist; fSession->Read(&polyframe); - fSession->Read(&isclosed); fSession->Read(&pointcount); pointlist=new BPoint[pointcount]; @@ -1920,8 +1920,7 @@ void ServerWindow::DispatchMessage(int32 code) for(int32 i=0; iConvertToTop(pointlist[i]); - // TODO: modify DisplayDriver::FillPolygon to utilize a boundary BRect - desktop->GetDisplayDriver()->StrokePolygon(pointlist,pointcount,polyframe,cl->fLayerData); + desktop->GetDisplayDriver()->FillPolygon(pointlist,pointcount,polyframe,cl->fLayerData); delete [] pointlist; @@ -1984,7 +1983,6 @@ void ServerWindow::DispatchMessage(int32 code) } case AS_FILL_REGION: { - // TODO: Implement AS_FILL_REGION int32 rectcount; BRect *rectlist; @@ -1998,7 +1996,7 @@ void ServerWindow::DispatchMessage(int32 code) // in repeatedly calling FillRect(), this is definitely in need of optimization. At // least it works for now. :) for(int32 i=0; iGetDisplayDriver()->FillRect(cl->ConvertToTop(cl->ConvertToTop(rectlist[i])),cl->fLayerData); + desktop->GetDisplayDriver()->FillRect(cl->ConvertToTop(rectlist[i]),cl->fLayerData); delete [] rectlist; @@ -2012,34 +2010,53 @@ void ServerWindow::DispatchMessage(int32 code) // TODO: Implement AS_STROKE_LINEARRAY break; } - case AS_MOVEPENBY: + case AS_DRAW_STRING: { - // TODO: Implement AS_MOVEPENBY + char *string; + int32 length; + BPoint location; + escapement_delta delta; + + fSession->Read(&location); + fSession->Read(&delta); + fSession->ReadString(&string); + + if(cl && cl->fLayerData) + desktop->GetDisplayDriver()->DrawString(string,length,cl->ConvertToTop(location), + cl->fLayerData); + + free(string); break; } case AS_MOVEPENTO: { - // TODO: Implement AS_MOVEPENTO + float x,y; + + fSession->Read(&x); + fSession->Read(&y); + if(cl && cl->fLayerData) + cl->fLayerData->penlocation.Set(x,y); + break; } case AS_SETPENSIZE: { - // TODO: Implement AS_SETPENSIZE - break; - } - case AS_DRAW_STRING: - { - // TODO: Implement AS_DRAW_STRING + float size; + + fSession->Read(&size); + if(cl && cl->fLayerData) + cl->fLayerData->pensize=size; + break; } case AS_SET_FONT: { - // TODO: Implement AS_SET_FONT + // TODO: Implement AS_SET_FONT? break; } case AS_SET_FONT_SIZE: { - // TODO: Implement AS_SET_FONT_SIZE + // TODO: Implement AS_SET_FONT_SIZE? break; } default: diff --git a/src/servers/app/server/ServerWindow.h b/src/servers/app/server/ServerWindow.h index 7c664d1434..56d2ce744a 100644 --- a/src/servers/app/server/ServerWindow.h +++ b/src/servers/app/server/ServerWindow.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/SysCursor.cpp b/src/servers/app/server/SysCursor.cpp index 272d32e937..affe74529d 100644 --- a/src/servers/app/server/SysCursor.cpp +++ b/src/servers/app/server/SysCursor.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/SystemPalette.cpp b/src/servers/app/server/SystemPalette.cpp index 56ac37fce8..785d50f9da 100644 --- a/src/servers/app/server/SystemPalette.cpp +++ b/src/servers/app/server/SystemPalette.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/TokenHandler.cpp b/src/servers/app/server/TokenHandler.cpp index 577769d256..0b7d52a611 100644 --- a/src/servers/app/server/TokenHandler.cpp +++ b/src/servers/app/server/TokenHandler.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/Utils.cpp b/src/servers/app/server/Utils.cpp index 81b449cec0..9c1b72db71 100644 --- a/src/servers/app/server/Utils.cpp +++ b/src/servers/app/server/Utils.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/Utils.h b/src/servers/app/server/Utils.h index c14b4d571e..974e1ff543 100644 --- a/src/servers/app/server/Utils.h +++ b/src/servers/app/server/Utils.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/ViewDriver.cpp b/src/servers/app/server/ViewDriver.cpp index f42fff452c..7ebd4cb095 100644 --- a/src/servers/app/server/ViewDriver.cpp +++ b/src/servers/app/server/ViewDriver.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), @@ -244,7 +244,7 @@ void VDView::MessageReceived(BMessage *msg) } VDWindow::VDWindow(BRect frame) - : BWindow(frame, "OpenBeOS App Server", B_TITLED_WINDOW, + : BWindow(frame, "Haiku App Server", B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_NOT_RESIZABLE) { view=new VDView(Bounds()); @@ -466,11 +466,11 @@ void VDWindow::WindowActivated(bool active) ViewDriver::ViewDriver(void) { - _displaymode.virtual_width=640; - _displaymode.virtual_height=480; - _displaymode.space=B_RGBA32; + fDisplayMode.virtual_width=640; + fDisplayMode.virtual_height=480; + fDisplayMode.space=B_RGBA32; - screenwin=new VDWindow(BRect(0,0,_displaymode.virtual_width-1,_displaymode.virtual_height-1).OffsetToCopy(offset)); + screenwin=new VDWindow(BRect(0,0,fDisplayMode.virtual_width-1,fDisplayMode.virtual_height-1).OffsetToCopy(offset)); framebuffer=screenwin->view->viewbmp; serverlink=screenwin->view->serverlink; hide_cursor=0; @@ -527,9 +527,9 @@ void ViewDriver::SetMode(const display_mode &mode) if(!is_initialized) return; - if (_displaymode.virtual_width==mode.virtual_width && - _displaymode.virtual_height==mode.virtual_height && - _displaymode.space==mode.space) + if (fDisplayMode.virtual_width==mode.virtual_width && + fDisplayMode.virtual_height==mode.virtual_height && + fDisplayMode.space==mode.space) { return; } @@ -930,8 +930,8 @@ status_t ViewDriver::GetDeviceInfo(accelerant_device_info *info) // a software-only driver, but we'll have some fun, anyway. info->version=100; - sprintf(info->name,"OpenBeOS ViewDriver"); - sprintf(info->chipset,"OpenBeOS Chipset"); + sprintf(info->name,"Haiku, Inc. ViewDriver"); + sprintf(info->chipset,"Haiku, Inc. Chipset"); sprintf(info->serial_no,"3.14159265358979323846"); info->memory=134217728; // 128 MB, not that we really have that much. :) info->dac_speed=0xFFFFFFFF; // *heh* @@ -1083,7 +1083,7 @@ void ViewDriver::CopyToBitmap(ServerBitmap *destbmp, const BRect &sourcerect) return; } - if(((uint32)destbmp->ColorSpace() & 0x000F) != (_displaymode.space & 0x000F)) + if(((uint32)destbmp->ColorSpace() & 0x000F) != (fDisplayMode.space & 0x000F)) { printf("CopyToBitmap returned - unequal buffer pixel depth\n"); return; @@ -1117,7 +1117,7 @@ void ViewDriver::CopyToBitmap(ServerBitmap *destbmp, const BRect &sourcerect) destrect.bottom = work_rect.bottom; } - work_rect.Set(0,0,_displaymode.virtual_width-1,_displaymode.virtual_height-1); + work_rect.Set(0,0,fDisplayMode.virtual_width-1,fDisplayMode.virtual_height-1); if(!work_rect.Contains(sourcerect)) return; @@ -1211,6 +1211,6 @@ void ViewDriver::Invalidate(const BRect &r) return; screenwin->Lock(); - screenwin->view->Invalidate(); + screenwin->view->Draw(r); screenwin->Unlock(); } diff --git a/src/servers/app/server/ViewDriver.h b/src/servers/app/server/ViewDriver.h index 05c4fe430f..9e27517b74 100644 --- a/src/servers/app/server/ViewDriver.h +++ b/src/servers/app/server/ViewDriver.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/WinBorder.cpp b/src/servers/app/server/WinBorder.cpp index e616cc54cc..d120790679 100644 --- a/src/servers/app/server/WinBorder.cpp +++ b/src/servers/app/server/WinBorder.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/WinBorder.h b/src/servers/app/server/WinBorder.h index d9d30fb0fc..32290b593e 100644 --- a/src/servers/app/server/WinBorder.h +++ b/src/servers/app/server/WinBorder.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), diff --git a/src/servers/app/server/Workspace.cpp b/src/servers/app/server/Workspace.cpp index 7eb26f0158..0c1621e7be 100644 --- a/src/servers/app/server/Workspace.cpp +++ b/src/servers/app/server/Workspace.cpp @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), @@ -1525,4 +1525,4 @@ void Workspace::RemoveItem(ListData *item) fCurrentItem = NULL; } -//---------------------------------------------------------------------------------- \ No newline at end of file +//---------------------------------------------------------------------------------- diff --git a/src/servers/app/server/Workspace.h b/src/servers/app/server/Workspace.h index 648981500a..967a29a31c 100644 --- a/src/servers/app/server/Workspace.h +++ b/src/servers/app/server/Workspace.h @@ -1,5 +1,5 @@ //------------------------------------------------------------------------------ -// Copyright (c) 2001-2002, OpenBeOS +// Copyright (c) 2001-2002, Haiku, Inc. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"),