* the app_server now uses a global token space - this should later be changed to
have different token spaces depending on the scope of its objects. * removed TokenHandler - we're now using BTokenSpace instead. * removed unused IPoint.cpp - if we ever need it again, it can still easily be resurrected from the dead. * some cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14925 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -8,44 +8,31 @@
|
|||||||
#ifndef BITMAP_MANAGER_H_
|
#ifndef BITMAP_MANAGER_H_
|
||||||
#define BITMAP_MANAGER_H_
|
#define BITMAP_MANAGER_H_
|
||||||
|
|
||||||
|
|
||||||
#include <GraphicsDefs.h>
|
#include <GraphicsDefs.h>
|
||||||
#include <List.h>
|
#include <List.h>
|
||||||
|
#include <Locker.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
#include <Rect.h>
|
#include <Rect.h>
|
||||||
#include <Locker.h>
|
|
||||||
|
|
||||||
#include "BGet++.h"
|
#include "BGet++.h"
|
||||||
#include "TokenHandler.h"
|
|
||||||
|
|
||||||
class ServerBitmap;
|
class ServerBitmap;
|
||||||
|
|
||||||
/*!
|
|
||||||
\class BitmapManager BitmapManager.h
|
|
||||||
\brief Handler for BBitmap allocation
|
|
||||||
|
|
||||||
Whenever a ServerBitmap associated with a client-side BBitmap needs to be
|
|
||||||
created or destroyed, the BitmapManager needs to handle it. It takes care of
|
|
||||||
all memory management related to them.
|
|
||||||
|
|
||||||
NOTE: The allocator used is not thread-safe, it is currently protected
|
|
||||||
by the BitmapManager lock.
|
|
||||||
*/
|
|
||||||
class BitmapManager {
|
class BitmapManager {
|
||||||
public:
|
public:
|
||||||
BitmapManager();
|
BitmapManager();
|
||||||
virtual ~BitmapManager();
|
virtual ~BitmapManager();
|
||||||
|
|
||||||
ServerBitmap *CreateBitmap( BRect bounds,
|
ServerBitmap* CreateBitmap(BRect bounds, color_space space,
|
||||||
color_space space,
|
int32 flags, int32 bytesPerRow = -1,
|
||||||
int32 flags,
|
screen_id screen = B_MAIN_SCREEN_ID);
|
||||||
int32 bytesPerRow = -1,
|
|
||||||
screen_id screen = B_MAIN_SCREEN_ID);
|
|
||||||
void DeleteBitmap(ServerBitmap* bitmap);
|
void DeleteBitmap(ServerBitmap* bitmap);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BList fBitmapList;
|
BList fBitmapList;
|
||||||
int8 *fBuffer;
|
int8* fBuffer;
|
||||||
TokenHandler fTokenizer;
|
|
||||||
BLocker fLock;
|
BLocker fLock;
|
||||||
AreaPool fMemPool;
|
AreaPool fMemPool;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,60 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// 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"),
|
|
||||||
// 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: TokenHandler.h
|
|
||||||
// Author: DarkWyrm <[email protected]>
|
|
||||||
// Description: Class to provide tokens with excluded values possible.
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
#ifndef TOKENHANDLER_H_
|
|
||||||
#define TOKENHANDLER_H_
|
|
||||||
|
|
||||||
#include <OS.h>
|
|
||||||
#include <List.h>
|
|
||||||
#include <Locker.h>
|
|
||||||
|
|
||||||
// Local Defines ---------------------------------------------------------------
|
|
||||||
#define B_PREFERRED_TOKEN -2 /* A little bird told me about this one */
|
|
||||||
#define B_NULL_TOKEN -1
|
|
||||||
#define B_ANY_TOKEN 0
|
|
||||||
#define B_HANDLER_TOKEN 1
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\class TokenHandler TokenHandler.h
|
|
||||||
\brief Class to provide tokens with excluded values possible.
|
|
||||||
*/
|
|
||||||
class TokenHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
TokenHandler(void);
|
|
||||||
~TokenHandler(void);
|
|
||||||
int32 GetToken(void);
|
|
||||||
void ExcludeValue(int32 value);
|
|
||||||
void Reset(void);
|
|
||||||
void ResetExcludes(void);
|
|
||||||
bool IsExclude(int32 value);
|
|
||||||
private:
|
|
||||||
int32 _index;
|
|
||||||
BLocker _lock;
|
|
||||||
BList *_excludes;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@@ -8,19 +8,8 @@
|
|||||||
* Stephan Aßmus <[email protected]>
|
* Stephan Aßmus <[email protected]>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include <Accelerant.h>
|
#include "AppServer.h"
|
||||||
#include <AppDefs.h>
|
|
||||||
#include <Directory.h>
|
|
||||||
#include <Entry.h>
|
|
||||||
#include <File.h>
|
|
||||||
#include <Message.h>
|
|
||||||
#include <Path.h>
|
|
||||||
#include <PortLink.h>
|
|
||||||
#include <StopWatch.h>
|
|
||||||
#include <RosterPrivate.h>
|
|
||||||
#include <Autolock.h>
|
|
||||||
|
|
||||||
#include "BitmapManager.h"
|
#include "BitmapManager.h"
|
||||||
#include "ColorSet.h"
|
#include "ColorSet.h"
|
||||||
@@ -30,10 +19,9 @@
|
|||||||
#include "Desktop.h"
|
#include "Desktop.h"
|
||||||
#include "FontManager.h"
|
#include "FontManager.h"
|
||||||
#include "HWInterface.h"
|
#include "HWInterface.h"
|
||||||
#include "RegistrarDefs.h"
|
|
||||||
#include "RGBColor.h"
|
|
||||||
#include "Layer.h"
|
#include "Layer.h"
|
||||||
#include "WinBorder.h"
|
#include "RGBColor.h"
|
||||||
|
#include "RegistrarDefs.h"
|
||||||
#include "RootLayer.h"
|
#include "RootLayer.h"
|
||||||
#include "ScreenManager.h"
|
#include "ScreenManager.h"
|
||||||
#include "ServerApp.h"
|
#include "ServerApp.h"
|
||||||
@@ -43,8 +31,21 @@
|
|||||||
#include "ServerWindow.h"
|
#include "ServerWindow.h"
|
||||||
#include "SystemPalette.h"
|
#include "SystemPalette.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
#include "WinBorder.h"
|
||||||
|
|
||||||
#include "AppServer.h"
|
#include <Accelerant.h>
|
||||||
|
#include <AppDefs.h>
|
||||||
|
#include <Autolock.h>
|
||||||
|
#include <Directory.h>
|
||||||
|
#include <Entry.h>
|
||||||
|
#include <File.h>
|
||||||
|
#include <Message.h>
|
||||||
|
#include <Path.h>
|
||||||
|
#include <PortLink.h>
|
||||||
|
#include <RosterPrivate.h>
|
||||||
|
#include <StopWatch.h>
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
//#define DEBUG_KEYHANDLING
|
//#define DEBUG_KEYHANDLING
|
||||||
//#define DEBUG_SERVER
|
//#define DEBUG_SERVER
|
||||||
@@ -67,10 +68,12 @@
|
|||||||
// Globals
|
// Globals
|
||||||
port_id gAppServerPort;
|
port_id gAppServerPort;
|
||||||
static AppServer *sAppServer;
|
static AppServer *sAppServer;
|
||||||
|
BTokenSpace gTokenSpace;
|
||||||
|
|
||||||
//! System-wide GUI color object
|
//! System-wide GUI color object
|
||||||
ColorSet gGUIColorSet;
|
ColorSet gGUIColorSet;
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Constructor
|
\brief Constructor
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
*
|
*
|
||||||
* Author: DarkWyrm <[email protected]>
|
* Author: DarkWyrm <[email protected]>
|
||||||
*/
|
*/
|
||||||
|
#ifndef APP_SERVER_H
|
||||||
|
#define APP_SERVER_H
|
||||||
|
|
||||||
#ifndef _HAIKU_APP_SERVER_H_
|
|
||||||
#define _HAIKU_APP_SERVER_H_
|
|
||||||
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
#include <Locker.h>
|
#include <Locker.h>
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <ObjectList.h>
|
#include <ObjectList.h>
|
||||||
|
#include <TokenSpace.h>
|
||||||
|
|
||||||
#include "ServerConfig.h"
|
#include "ServerConfig.h"
|
||||||
#include "MessageLooper.h"
|
#include "MessageLooper.h"
|
||||||
@@ -24,18 +25,12 @@ class BitmapManager;
|
|||||||
class ColorSet;
|
class ColorSet;
|
||||||
class Desktop;
|
class Desktop;
|
||||||
|
|
||||||
|
using BPrivate::BTokenSpace;
|
||||||
|
|
||||||
namespace BPrivate {
|
namespace BPrivate {
|
||||||
class PortLink;
|
class PortLink;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
|
||||||
\class AppServer AppServer.h
|
|
||||||
\brief main manager object for the app_server
|
|
||||||
|
|
||||||
File for the main app_server thread. This particular thread monitors for
|
|
||||||
application start and quit messages. It also starts the housekeeping threads
|
|
||||||
and initializes most of the server's globals.
|
|
||||||
*/
|
|
||||||
|
|
||||||
class AppServer : public MessageLooper {
|
class AppServer : public MessageLooper {
|
||||||
public:
|
public:
|
||||||
@@ -77,4 +72,4 @@ extern BitmapManager *gBitmapManager;
|
|||||||
extern ColorSet gGUIColorSet;
|
extern ColorSet gGUIColorSet;
|
||||||
extern port_id gAppServerPort;
|
extern port_id gAppServerPort;
|
||||||
|
|
||||||
#endif /* _HAIKU_APP_SERVER_H_ */
|
#endif /* APP_SERVER_H */
|
||||||
|
|||||||
@@ -8,6 +8,10 @@
|
|||||||
|
|
||||||
/** Handler for allocating and freeing area memory for BBitmaps
|
/** Handler for allocating and freeing area memory for BBitmaps
|
||||||
* on the server side. Utilizes the BGET pool allocator.
|
* on the server side. Utilizes the BGET pool allocator.
|
||||||
|
*
|
||||||
|
* Whenever a ServerBitmap associated with a client-side BBitmap needs to be
|
||||||
|
* created or destroyed, the BitmapManager needs to handle it. It takes care of
|
||||||
|
* all memory management related to them.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@@ -17,28 +21,31 @@
|
|||||||
|
|
||||||
#include <Autolock.h>
|
#include <Autolock.h>
|
||||||
|
|
||||||
#include "ServerBitmap.h"
|
|
||||||
#include "BitmapManager.h"
|
#include "BitmapManager.h"
|
||||||
|
#include "ServerBitmap.h"
|
||||||
|
#include "ServerTokenSpace.h"
|
||||||
|
|
||||||
using std::nothrow;
|
using std::nothrow;
|
||||||
|
|
||||||
|
|
||||||
//! The bitmap allocator for the server. Memory is allocated/freed by the AppServer class
|
//! The bitmap allocator for the server. Memory is allocated/freed by the AppServer class
|
||||||
BitmapManager *gBitmapManager = NULL;
|
BitmapManager *gBitmapManager = NULL;
|
||||||
|
|
||||||
//! Number of bytes to allocate to each area used for bitmap storage
|
//! Number of bytes to allocate to each area used for bitmap storage
|
||||||
#define BITMAP_AREA_SIZE B_PAGE_SIZE * 2
|
#define BITMAP_AREA_SIZE B_PAGE_SIZE * 2
|
||||||
|
|
||||||
|
|
||||||
//! Sets up stuff to be ready to allocate space for bitmaps
|
//! Sets up stuff to be ready to allocate space for bitmaps
|
||||||
BitmapManager::BitmapManager()
|
BitmapManager::BitmapManager()
|
||||||
:
|
:
|
||||||
fBitmapList(1024),
|
fBitmapList(1024),
|
||||||
fBuffer(NULL),
|
fBuffer(NULL),
|
||||||
fTokenizer(),
|
|
||||||
fLock("BitmapManager Lock"),
|
fLock("BitmapManager Lock"),
|
||||||
fMemPool("bitmap pool", BITMAP_AREA_SIZE)
|
fMemPool("bitmap pool", BITMAP_AREA_SIZE)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Deallocates everything associated with the manager
|
//! Deallocates everything associated with the manager
|
||||||
BitmapManager::~BitmapManager()
|
BitmapManager::~BitmapManager()
|
||||||
{
|
{
|
||||||
@@ -51,6 +58,7 @@ BitmapManager::~BitmapManager()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Allocates a new ServerBitmap.
|
\brief Allocates a new ServerBitmap.
|
||||||
\param bounds Size of the bitmap
|
\param bounds Size of the bitmap
|
||||||
@@ -80,7 +88,7 @@ BitmapManager::CreateBitmap(BRect bounds, color_space space, int32 flags,
|
|||||||
if (buffer && fBitmapList.AddItem(bitmap)) {
|
if (buffer && fBitmapList.AddItem(bitmap)) {
|
||||||
bitmap->fArea = area_for(buffer);
|
bitmap->fArea = area_for(buffer);
|
||||||
bitmap->fBuffer = buffer;
|
bitmap->fBuffer = buffer;
|
||||||
bitmap->fToken = fTokenizer.GetToken();
|
bitmap->fToken = gTokenSpace.NewToken(kBitmapToken, bitmap);
|
||||||
bitmap->fInitialized = true;
|
bitmap->fInitialized = true;
|
||||||
|
|
||||||
// calculate area offset
|
// calculate area offset
|
||||||
@@ -97,6 +105,7 @@ BitmapManager::CreateBitmap(BRect bounds, color_space space, int32 flags,
|
|||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\brief Deletes a ServerBitmap.
|
\brief Deletes a ServerBitmap.
|
||||||
\param bitmap The bitmap to delete
|
\param bitmap The bitmap to delete
|
||||||
|
|||||||
@@ -1,46 +1,32 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright (c) 2001-2005, Haiku, Inc.
|
* Copyright 2001-2005, Haiku.
|
||||||
//
|
* Distributed under the terms of the MIT License.
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
*
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
* Authors:
|
||||||
// to deal in the Software without restriction, including without limitation
|
* DarkWyrm <[email protected]>
|
||||||
// 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:
|
/** Handles the system's cursor infrastructure */
|
||||||
//
|
|
||||||
// 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: CursorManager.cpp
|
|
||||||
// Author: DarkWyrm <[email protected]>
|
|
||||||
// Description: Handles the system's cursor infrastructure
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
#include <Directory.h>
|
#include <Directory.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
|
|
||||||
#include "CursorData.h"
|
#include "CursorData.h"
|
||||||
#include "CursorManager.h"
|
#include "CursorManager.h"
|
||||||
|
#include "HaikuSystemCursor.h"
|
||||||
#include "ServerCursor.h"
|
#include "ServerCursor.h"
|
||||||
#include "ServerConfig.h"
|
#include "ServerConfig.h"
|
||||||
#include "HaikuSystemCursor.h"
|
#include "ServerTokenSpace.h"
|
||||||
|
|
||||||
|
|
||||||
//! Initializes the CursorManager
|
//! Initializes the CursorManager
|
||||||
CursorManager::CursorManager()
|
CursorManager::CursorManager()
|
||||||
: BLocker("CursorManager")
|
: BLocker("CursorManager")
|
||||||
{
|
{
|
||||||
// Error code for AddCursor
|
|
||||||
fTokenizer.ExcludeValue(B_ERROR);
|
|
||||||
|
|
||||||
// Set system cursors to "unassigned"
|
// Set system cursors to "unassigned"
|
||||||
// ToDo: decide about default cursor
|
// ToDo: decide about default cursor
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
fDefaultCursor = new ServerCursor(kHaikuCursorBits, kHaikuCursorWidth,
|
fDefaultCursor = new ServerCursor(kHaikuCursorBits, kHaikuCursorWidth,
|
||||||
kHaikuCursorHeight, kHaikuCursorFormat);
|
kHaikuCursorHeight, kHaikuCursorFormat);
|
||||||
@@ -100,7 +86,7 @@ CursorManager::~CursorManager()
|
|||||||
\return The token assigned to the cursor or B_ERROR if sc is NULL
|
\return The token assigned to the cursor or B_ERROR if sc is NULL
|
||||||
*/
|
*/
|
||||||
int32
|
int32
|
||||||
CursorManager::AddCursor(ServerCursor *cursor)
|
CursorManager::AddCursor(ServerCursor* cursor)
|
||||||
{
|
{
|
||||||
if (!cursor)
|
if (!cursor)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
@@ -108,7 +94,7 @@ CursorManager::AddCursor(ServerCursor *cursor)
|
|||||||
Lock();
|
Lock();
|
||||||
|
|
||||||
fCursorList.AddItem(cursor);
|
fCursorList.AddItem(cursor);
|
||||||
int32 token = fTokenizer.GetToken();
|
int32 token = fTokenSpace.NewToken(B_SERVER_TOKEN, cursor);
|
||||||
cursor->fToken = token;
|
cursor->fToken = token;
|
||||||
|
|
||||||
Unlock();
|
Unlock();
|
||||||
@@ -347,77 +333,50 @@ CursorManager::ChangeCursor(cursor_which which, int32 token)
|
|||||||
// Do the assignment
|
// Do the assignment
|
||||||
switch (which) {
|
switch (which) {
|
||||||
case B_CURSOR_DEFAULT:
|
case B_CURSOR_DEFAULT:
|
||||||
{
|
delete fDefaultCursor;
|
||||||
if (fDefaultCursor)
|
|
||||||
delete fDefaultCursor;
|
|
||||||
|
|
||||||
fDefaultCursor = cursor;
|
fDefaultCursor = cursor;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case B_CURSOR_TEXT:
|
|
||||||
{
|
|
||||||
if(fTextCursor)
|
|
||||||
delete fTextCursor;
|
|
||||||
|
|
||||||
|
case B_CURSOR_TEXT:
|
||||||
|
delete fTextCursor;
|
||||||
fTextCursor = cursor;
|
fTextCursor = cursor;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case B_CURSOR_MOVE:
|
|
||||||
{
|
|
||||||
if(fMoveCursor)
|
|
||||||
delete fMoveCursor;
|
|
||||||
|
|
||||||
|
case B_CURSOR_MOVE:
|
||||||
|
delete fMoveCursor;
|
||||||
fMoveCursor = cursor;
|
fMoveCursor = cursor;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case B_CURSOR_DRAG:
|
|
||||||
{
|
|
||||||
if(fDragCursor)
|
|
||||||
delete fDragCursor;
|
|
||||||
|
|
||||||
|
case B_CURSOR_DRAG:
|
||||||
|
delete fDragCursor;
|
||||||
fDragCursor = cursor;
|
fDragCursor = cursor;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case B_CURSOR_RESIZE:
|
|
||||||
{
|
|
||||||
if(fResizeCursor)
|
|
||||||
delete fResizeCursor;
|
|
||||||
|
|
||||||
|
case B_CURSOR_RESIZE:
|
||||||
|
delete fResizeCursor;
|
||||||
fResizeCursor = cursor;
|
fResizeCursor = cursor;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case B_CURSOR_RESIZE_NWSE:
|
|
||||||
{
|
|
||||||
if(fNWSECursor)
|
|
||||||
delete fNWSECursor;
|
|
||||||
|
|
||||||
|
case B_CURSOR_RESIZE_NWSE:
|
||||||
|
delete fNWSECursor;
|
||||||
fNWSECursor = cursor;
|
fNWSECursor = cursor;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case B_CURSOR_RESIZE_NESW:
|
|
||||||
{
|
|
||||||
if(fNESWCursor)
|
|
||||||
delete fNESWCursor;
|
|
||||||
|
|
||||||
|
case B_CURSOR_RESIZE_NESW:
|
||||||
|
delete fNESWCursor;
|
||||||
fNESWCursor = cursor;
|
fNESWCursor = cursor;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case B_CURSOR_RESIZE_NS:
|
|
||||||
{
|
|
||||||
if(fNSCursor)
|
|
||||||
delete fNSCursor;
|
|
||||||
|
|
||||||
|
case B_CURSOR_RESIZE_NS:
|
||||||
|
delete fNSCursor;
|
||||||
fNSCursor = cursor;
|
fNSCursor = cursor;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case B_CURSOR_RESIZE_EW:
|
|
||||||
{
|
|
||||||
if(fEWCursor)
|
|
||||||
delete fEWCursor;
|
|
||||||
|
|
||||||
|
case B_CURSOR_RESIZE_EW:
|
||||||
|
delete fEWCursor;
|
||||||
fEWCursor = cursor;
|
fEWCursor = cursor;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
Unlock();
|
Unlock();
|
||||||
return;
|
return;
|
||||||
@@ -439,11 +398,9 @@ CursorManager::ChangeCursor(cursor_which which, int32 token)
|
|||||||
ServerCursor *
|
ServerCursor *
|
||||||
CursorManager::FindCursor(int32 token)
|
CursorManager::FindCursor(int32 token)
|
||||||
{
|
{
|
||||||
for (int32 i = 0; i < fCursorList.CountItems(); i++) {
|
ServerCursor* cursor;
|
||||||
ServerCursor *cursor = (ServerCursor *)fCursorList.ItemAt(i);
|
if (gTokenSpace.GetToken(token, kCursorToken, (void**)&cursor) == B_OK)
|
||||||
if (cursor && cursor->fToken == token)
|
return cursor;
|
||||||
return cursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,39 +1,25 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright (c) 2001-2002, Haiku, Inc.
|
* Copyright 2001-2005, Haiku.
|
||||||
//
|
* Distributed under the terms of the MIT License.
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
*
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
* Authors:
|
||||||
// to deal in the Software without restriction, including without limitation
|
* DarkWyrm <[email protected]>
|
||||||
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
*/
|
||||||
// and/or sell copies of the Software, and to permit persons to whom the
|
#ifndef CURSOR_MANAGER_H
|
||||||
// Software is furnished to do so, subject to the following conditions:
|
#define CURSOR_MANAGER_H
|
||||||
//
|
|
||||||
// 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: CursorManager.h
|
|
||||||
// Author: DarkWyrm <[email protected]>
|
|
||||||
// Description: Handles the system's cursor infrastructure
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
#ifndef CURSORMANAGER_H_
|
|
||||||
#define CURSORMANAGER_H_
|
|
||||||
|
|
||||||
#include <List.h>
|
#include <List.h>
|
||||||
#include <Locker.h>
|
#include <Locker.h>
|
||||||
#include "CursorSet.h"
|
|
||||||
#include "TokenHandler.h"
|
|
||||||
|
|
||||||
|
#include <TokenSpace.h>
|
||||||
|
|
||||||
|
#include "CursorSet.h"
|
||||||
|
|
||||||
|
using BPrivate::BTokenSpace;
|
||||||
class ServerCursor;
|
class ServerCursor;
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\class CursorManager CursorManager.h
|
\class CursorManager CursorManager.h
|
||||||
\brief Handles almost all cursor management functions for the system
|
\brief Handles almost all cursor management functions for the system
|
||||||
@@ -43,22 +29,24 @@ class ServerCursor;
|
|||||||
of an application's cursors whenever an application closes.
|
of an application's cursors whenever an application closes.
|
||||||
*/
|
*/
|
||||||
class CursorManager : public BLocker {
|
class CursorManager : public BLocker {
|
||||||
public:
|
public:
|
||||||
CursorManager();
|
CursorManager();
|
||||||
~CursorManager();
|
virtual ~CursorManager();
|
||||||
int32 AddCursor(ServerCursor *sc);
|
|
||||||
|
int32 AddCursor(ServerCursor* cursor);
|
||||||
void DeleteCursor(int32 token);
|
void DeleteCursor(int32 token);
|
||||||
void RemoveAppCursors(team_id team);
|
void RemoveAppCursors(team_id team);
|
||||||
void SetCursorSet(const char *path);
|
|
||||||
ServerCursor *GetCursor(cursor_which which);
|
void SetCursorSet(const char* path);
|
||||||
|
ServerCursor* GetCursor(cursor_which which);
|
||||||
cursor_which GetCursorWhich();
|
cursor_which GetCursorWhich();
|
||||||
void ChangeCursor(cursor_which which, int32 token);
|
void ChangeCursor(cursor_which which, int32 token);
|
||||||
void SetDefaults();
|
void SetDefaults();
|
||||||
ServerCursor *FindCursor(int32 token);
|
ServerCursor* FindCursor(int32 token);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BList fCursorList;
|
BList fCursorList;
|
||||||
TokenHandler fTokenizer;
|
BTokenSpace fTokenSpace;
|
||||||
|
|
||||||
// System cursor members
|
// System cursor members
|
||||||
ServerCursor *fDefaultCursor,
|
ServerCursor *fDefaultCursor,
|
||||||
@@ -73,4 +61,4 @@ private:
|
|||||||
cursor_which fCurrentWhich;
|
cursor_which fCurrentWhich;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif /* CURSOR_MANAGER_H */
|
||||||
|
|||||||
@@ -1,115 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// 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: IPoint.h
|
|
||||||
// Author: DarkWyrm <[email protected]>
|
|
||||||
// Based on BPoint code by Frans Van Nispen
|
|
||||||
// Description: Integer BPoint class
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
#include "IPoint.h"
|
|
||||||
#include <math.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <Rect.h>
|
|
||||||
|
|
||||||
void IPoint::ConstrainTo(BRect r)
|
|
||||||
{
|
|
||||||
x = (int32)max_c(min_c(x, r.right), r.left);
|
|
||||||
y = (int32)max_c(min_c(y, r.bottom), r.top);
|
|
||||||
}
|
|
||||||
|
|
||||||
void IPoint::PrintToStream() const
|
|
||||||
{
|
|
||||||
printf("IPoint(x:%ld, y:%ld)\n", x, y);
|
|
||||||
}
|
|
||||||
|
|
||||||
IPoint IPoint::operator+(const IPoint &p) const
|
|
||||||
{
|
|
||||||
return IPoint(x + p.x, y + p.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
IPoint IPoint::operator+(const BPoint &p) const
|
|
||||||
{
|
|
||||||
return IPoint(x + (int32)p.x, y + (int32)p.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
IPoint IPoint::operator-(const IPoint &p) const
|
|
||||||
{
|
|
||||||
return IPoint(x - p.x, y - p.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
IPoint IPoint::operator-(const BPoint &p) const
|
|
||||||
{
|
|
||||||
return IPoint(x - (int32)p.x, y - (int32)p.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
IPoint &IPoint::operator+=(const IPoint &p)
|
|
||||||
{
|
|
||||||
x += p.x;
|
|
||||||
y += p.y;
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
IPoint &IPoint::operator+=(const BPoint &p)
|
|
||||||
{
|
|
||||||
x += (int32)p.x;
|
|
||||||
y += (int32)p.y;
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
IPoint &IPoint::operator-=(const IPoint &p)
|
|
||||||
{
|
|
||||||
x -= p.x;
|
|
||||||
y -= p.y;
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
IPoint &IPoint::operator-=(const BPoint &p)
|
|
||||||
{
|
|
||||||
x -= (int32)p.x;
|
|
||||||
y -= (int32)p.y;
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IPoint::operator!=(const IPoint &p) const
|
|
||||||
{
|
|
||||||
return x != p.x || y != p.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IPoint::operator!=(const BPoint &p) const
|
|
||||||
{
|
|
||||||
return x != (int32)p.x || y != (int32)p.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IPoint::operator==(const IPoint &p) const
|
|
||||||
{
|
|
||||||
return x == p.x && y == p.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IPoint::operator==(const BPoint &p) const
|
|
||||||
{
|
|
||||||
return x == (int32)p.x && y == (int32)p.y;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@@ -48,7 +48,6 @@ Server app_server :
|
|||||||
ServerWindow.cpp
|
ServerWindow.cpp
|
||||||
SubWindowList.cpp
|
SubWindowList.cpp
|
||||||
SystemPalette.cpp
|
SystemPalette.cpp
|
||||||
TokenHandler.cpp
|
|
||||||
Utils.cpp
|
Utils.cpp
|
||||||
VirtualScreen.cpp
|
VirtualScreen.cpp
|
||||||
WinBorder.cpp
|
WinBorder.cpp
|
||||||
|
|||||||
@@ -50,6 +50,7 @@
|
|||||||
#include "ServerCursor.h"
|
#include "ServerCursor.h"
|
||||||
#include "ServerPicture.h"
|
#include "ServerPicture.h"
|
||||||
#include "ServerScreen.h"
|
#include "ServerScreen.h"
|
||||||
|
#include "ServerTokenSpace.h"
|
||||||
#include "ServerWindow.h"
|
#include "ServerWindow.h"
|
||||||
#include "SystemPalette.h"
|
#include "SystemPalette.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
@@ -2404,13 +2405,11 @@ ServerApp::CountBitmaps() const
|
|||||||
ServerBitmap*
|
ServerBitmap*
|
||||||
ServerApp::FindBitmap(int32 token) const
|
ServerApp::FindBitmap(int32 token) const
|
||||||
{
|
{
|
||||||
int32 count = fBitmapList.CountItems();
|
// TODO: we need to make sure the bitmap is ours?!
|
||||||
for (int32 i = 0; i < count; i++) {
|
ServerBitmap* bitmap;
|
||||||
ServerBitmap* bitmap = (ServerBitmap*)fBitmapList.ItemAt(i);
|
if (gTokenSpace.GetToken(token, kBitmapToken, (void**)&bitmap) == B_OK)
|
||||||
if (bitmap && bitmap->Token() == token)
|
return bitmap;
|
||||||
return bitmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2425,12 +2424,11 @@ ServerApp::CountPictures() const
|
|||||||
ServerPicture *
|
ServerPicture *
|
||||||
ServerApp::FindPicture(int32 token) const
|
ServerApp::FindPicture(int32 token) const
|
||||||
{
|
{
|
||||||
for (int32 i = 0; i < fPictureList.CountItems(); i++) {
|
// TODO: we need to make sure the picture is ours?!
|
||||||
ServerPicture *picture = static_cast<ServerPicture *>(fPictureList.ItemAt(i));
|
ServerPicture* picture;
|
||||||
if (picture && picture->GetToken() == token)
|
if (gTokenSpace.GetToken(token, kPictureToken, (void**)&picture) == B_OK)
|
||||||
return picture;
|
return picture;
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,48 +1,28 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright (c) 2001-2002, Haiku, Inc.
|
* Copyright 2001-2005, Haiku, Inc.
|
||||||
//
|
* Distributed under the terms of the MIT License.
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
*
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
* Authors:
|
||||||
// to deal in the Software without restriction, including without limitation
|
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||||
// 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:
|
/** Server-side counterpart to BPicture */
|
||||||
//
|
|
||||||
// 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: ServerPicture.cpp
|
|
||||||
// Author: DarkWyrm <[email protected]>
|
|
||||||
// Description: Server-side counterpart to BPicture
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
#include "TokenHandler.h"
|
|
||||||
#include "ServerPicture.h"
|
#include "ServerPicture.h"
|
||||||
|
#include "ServerTokenSpace.h"
|
||||||
|
|
||||||
TokenHandler picture_token_handler;
|
|
||||||
|
|
||||||
ServerPicture::ServerPicture(void)
|
ServerPicture::ServerPicture()
|
||||||
{
|
{
|
||||||
_token=picture_token_handler.GetToken();
|
fToken = gTokenSpace.NewToken(B_SERVER_TOKEN, this);
|
||||||
|
|
||||||
_initialized=false;
|
|
||||||
|
|
||||||
int8 *ptr;
|
int8 *ptr;
|
||||||
_area=create_area("ServerPicture",(void**)&ptr,B_ANY_ADDRESS,B_PAGE_SIZE,
|
fArea = create_area("ServerPicture", (void**)&ptr, B_ANY_ADDRESS,
|
||||||
B_NO_LOCK,B_READ_AREA | B_WRITE_AREA);
|
B_PAGE_SIZE, B_NO_LOCK,B_READ_AREA | B_WRITE_AREA);
|
||||||
|
|
||||||
if(_area!=B_BAD_VALUE && _area!=B_NO_MEMORY && _area!=B_ERROR)
|
|
||||||
_initialized=true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerPicture::~ServerPicture(void)
|
|
||||||
|
ServerPicture::~ServerPicture()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,51 +1,32 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright (c) 2001-2002, Haiku, Inc.
|
* Copyright 2001-2005, Haiku, Inc.
|
||||||
//
|
* Distributed under the terms of the MIT License.
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
*
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
* Authors:
|
||||||
// to deal in the Software without restriction, including without limitation
|
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||||
// 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: ServerPicture.cpp
|
|
||||||
// Author: DarkWyrm <[email protected]>
|
|
||||||
// Description: Server-side counterpart to BPicture
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
#ifndef SERVER_PICTURE_H
|
#ifndef SERVER_PICTURE_H
|
||||||
#define SERVER_PICTURE_H
|
#define SERVER_PICTURE_H
|
||||||
|
|
||||||
|
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
|
|
||||||
class AreaLink;
|
class AreaLink;
|
||||||
|
|
||||||
class ServerPicture
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ServerPicture(void);
|
|
||||||
~ServerPicture(void);
|
|
||||||
|
|
||||||
bool InitCheck(void) { return _initialized; }
|
class ServerPicture {
|
||||||
area_id Area(void) { return _area; }
|
public:
|
||||||
int32 GetToken(void) { return _token; }
|
ServerPicture();
|
||||||
private:
|
~ServerPicture();
|
||||||
|
|
||||||
AreaLink *arealink;
|
status_t InitCheck() const { return fArea >= B_OK ? B_OK : fArea; }
|
||||||
bool _initialized;
|
area_id Area() const { return fArea; }
|
||||||
area_id _area;
|
int32 Token() const { return fToken; }
|
||||||
int32 _token;
|
|
||||||
|
private:
|
||||||
|
AreaLink* fAreaLink;
|
||||||
|
area_id fArea;
|
||||||
|
int32 fToken;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif /* SERVER_PICTURE_H */
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2005, Haiku, Inc.
|
||||||
|
* Distributed under the terms of the MIT License.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Axel Dörfler, axeld@pinc-software.de
|
||||||
|
*/
|
||||||
|
#ifndef SERVER_TOKEN_SPACE_H
|
||||||
|
#define SERVER_TOKEN_SPACE_H
|
||||||
|
|
||||||
|
|
||||||
|
#include <TokenSpace.h>
|
||||||
|
|
||||||
|
|
||||||
|
using BPrivate::BTokenSpace;
|
||||||
|
|
||||||
|
const int32 kCursorToken = 3;
|
||||||
|
const int32 kBitmapToken = 4;
|
||||||
|
const int32 kPictureToken = 5;
|
||||||
|
|
||||||
|
|
||||||
|
extern BTokenSpace gTokenSpace;
|
||||||
|
|
||||||
|
#endif /* SERVER_TOKEN_SPACE_H */
|
||||||
@@ -50,7 +50,6 @@
|
|||||||
#include "ServerBitmap.h"
|
#include "ServerBitmap.h"
|
||||||
#include "ServerPicture.h"
|
#include "ServerPicture.h"
|
||||||
#include "ServerProtocol.h"
|
#include "ServerProtocol.h"
|
||||||
#include "TokenHandler.h"
|
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "WinBorder.h"
|
#include "WinBorder.h"
|
||||||
#include "Workspace.h"
|
#include "Workspace.h"
|
||||||
|
|||||||
@@ -1,122 +0,0 @@
|
|||||||
//------------------------------------------------------------------------------
|
|
||||||
// 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: TokenHandler.cpp
|
|
||||||
// Author: DarkWyrm <[email protected]>
|
|
||||||
// Description: Class to provide tokens with excluded values possible.
|
|
||||||
//
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
#include "TokenHandler.h"
|
|
||||||
|
|
||||||
//! Does setup
|
|
||||||
TokenHandler::TokenHandler(void)
|
|
||||||
{
|
|
||||||
_index=-1;
|
|
||||||
_excludes=new BList(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Undoes the setup from the constructor
|
|
||||||
TokenHandler::~TokenHandler(void)
|
|
||||||
{
|
|
||||||
ResetExcludes();
|
|
||||||
delete _excludes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\brief Returns a unique token
|
|
||||||
\return A unique token
|
|
||||||
|
|
||||||
If a value is excluded the next higher non-excluded value is returned.
|
|
||||||
*/
|
|
||||||
int32 TokenHandler::GetToken(void)
|
|
||||||
{
|
|
||||||
int32 value;
|
|
||||||
|
|
||||||
_lock.Lock();
|
|
||||||
|
|
||||||
_index++;
|
|
||||||
while(IsExclude(_index))
|
|
||||||
_index++;
|
|
||||||
value=_index;
|
|
||||||
_lock.Unlock();
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\brief Excludes a value from being returned as a token.
|
|
||||||
|
|
||||||
This is quite useful for excluding values like B_ERROR and such.
|
|
||||||
*/
|
|
||||||
void TokenHandler::ExcludeValue(int32 value)
|
|
||||||
{
|
|
||||||
_lock.Lock();
|
|
||||||
|
|
||||||
if(!IsExclude(value))
|
|
||||||
_excludes->AddItem(new int32(value));
|
|
||||||
_lock.Unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Resets the token index
|
|
||||||
void TokenHandler::Reset(void)
|
|
||||||
{
|
|
||||||
_lock.Lock();
|
|
||||||
_index=-1;
|
|
||||||
_lock.Unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
//! Empties object of all assigned excluded values
|
|
||||||
void TokenHandler::ResetExcludes(void)
|
|
||||||
{
|
|
||||||
_lock.Lock();
|
|
||||||
int32 *temp;
|
|
||||||
for(int32 i=0; i<_excludes->CountItems();i++)
|
|
||||||
{
|
|
||||||
temp=(int32*)_excludes->ItemAt(i);
|
|
||||||
if(temp)
|
|
||||||
delete temp;
|
|
||||||
}
|
|
||||||
_excludes->MakeEmpty();
|
|
||||||
_lock.Unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\brief Determines whether a value is excluded
|
|
||||||
\param value The value to be checked
|
|
||||||
\return True if the value is excluded from being a token, false if not.
|
|
||||||
*/
|
|
||||||
bool TokenHandler::IsExclude(int32 value)
|
|
||||||
{
|
|
||||||
bool match=false;
|
|
||||||
int32 *temp;
|
|
||||||
|
|
||||||
_lock.Lock();
|
|
||||||
for(int32 i=0;i<_excludes->CountItems();i++)
|
|
||||||
{
|
|
||||||
temp=(int32*)_excludes->ItemAt(i);
|
|
||||||
if(temp && *temp==value)
|
|
||||||
{
|
|
||||||
match=true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_lock.Unlock();
|
|
||||||
return match;
|
|
||||||
}
|
|
||||||
@@ -26,7 +26,6 @@
|
|||||||
#include "RootLayer.h"
|
#include "RootLayer.h"
|
||||||
#include "ServerApp.h"
|
#include "ServerApp.h"
|
||||||
#include "ServerWindow.h"
|
#include "ServerWindow.h"
|
||||||
#include "TokenHandler.h"
|
|
||||||
#include "WinBorder.h"
|
#include "WinBorder.h"
|
||||||
#include "Workspace.h"
|
#include "Workspace.h"
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ SharedLibrary libhwinterfaceimpl.so :
|
|||||||
SharedLibrary libhaikuappserver.so :
|
SharedLibrary libhaikuappserver.so :
|
||||||
Angle.cpp
|
Angle.cpp
|
||||||
BGet++.cpp
|
BGet++.cpp
|
||||||
BitmapManager.cpp
|
|
||||||
ColorSet.cpp
|
ColorSet.cpp
|
||||||
CursorData.cpp
|
CursorData.cpp
|
||||||
CursorSet.cpp
|
CursorSet.cpp
|
||||||
@@ -57,14 +56,12 @@ SharedLibrary libhaikuappserver.so :
|
|||||||
DrawState.cpp
|
DrawState.cpp
|
||||||
FontFamily.cpp
|
FontFamily.cpp
|
||||||
HashTable.cpp
|
HashTable.cpp
|
||||||
IPoint.cpp
|
|
||||||
RGBColor.cpp
|
RGBColor.cpp
|
||||||
ServerBitmap.cpp
|
ServerBitmap.cpp
|
||||||
ServerCursor.cpp
|
ServerCursor.cpp
|
||||||
ServerFont.cpp
|
ServerFont.cpp
|
||||||
FontManager.cpp
|
FontManager.cpp
|
||||||
SystemPalette.cpp
|
SystemPalette.cpp
|
||||||
TokenHandler.cpp
|
|
||||||
Utils.cpp
|
Utils.cpp
|
||||||
|
|
||||||
# drawing
|
# drawing
|
||||||
@@ -82,12 +79,12 @@ Server haiku_app_server :
|
|||||||
Decorator.cpp
|
Decorator.cpp
|
||||||
DebugInfoManager.cpp
|
DebugInfoManager.cpp
|
||||||
SubWindowList.cpp
|
SubWindowList.cpp
|
||||||
#PicturePlayer.cpp
|
|
||||||
PNGDump.cpp
|
PNGDump.cpp
|
||||||
RAMLinkMsgReader.cpp
|
RAMLinkMsgReader.cpp
|
||||||
MessageLooper.cpp
|
MessageLooper.cpp
|
||||||
|
|
||||||
# Manager Classes
|
# Manager Classes
|
||||||
|
BitmapManager.cpp
|
||||||
CursorManager.cpp
|
CursorManager.cpp
|
||||||
DecorManager.cpp
|
DecorManager.cpp
|
||||||
ScreenManager.cpp
|
ScreenManager.cpp
|
||||||
|
|||||||
@@ -11,3 +11,8 @@ Application BitmapDrawing :
|
|||||||
: be
|
: be
|
||||||
;
|
;
|
||||||
|
|
||||||
|
if ( $(TARGET_PLATFORM) = libbe_test ) {
|
||||||
|
HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : BitmapDrawing
|
||||||
|
: tests!apps ;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user