2005-11-14 14:01:02 +03:00
|
|
|
/*
|
2009-08-20 21:52:32 +04:00
|
|
|
* Copyright 2002-2009, Haiku Inc.
|
2005-11-14 14:01:02 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Authors:
|
|
|
|
* Stefano Ceccherini (burton666@libero.it)
|
|
|
|
* Axel Dörfler, axeld@pinc-software.de
|
|
|
|
*/
|
|
|
|
#ifndef _PRIVATE_SCREEN_H_
|
|
|
|
#define _PRIVATE_SCREEN_H_
|
|
|
|
|
|
|
|
|
|
|
|
#include <Accelerant.h>
|
|
|
|
#include <GraphicsDefs.h>
|
2005-11-14 17:36:12 +03:00
|
|
|
#include <ObjectList.h>
|
|
|
|
#include <Rect.h>
|
2005-11-14 14:01:02 +03:00
|
|
|
|
2009-08-20 21:52:32 +04:00
|
|
|
|
2005-11-14 14:01:02 +03:00
|
|
|
struct color_map;
|
|
|
|
class BBitmap;
|
|
|
|
class BApplication;
|
|
|
|
class BWindow;
|
|
|
|
|
|
|
|
|
2009-08-21 13:20:25 +04:00
|
|
|
#define B_CURRENT_WORKSPACE_INDEX (~0L)
|
|
|
|
|
|
|
|
|
2007-10-15 15:41:47 +04:00
|
|
|
namespace BPrivate {
|
|
|
|
|
2005-11-14 14:01:02 +03:00
|
|
|
class BPrivateScreen {
|
2009-08-20 21:52:32 +04:00
|
|
|
public:
|
2005-11-14 14:01:02 +03:00
|
|
|
// Constructor and destructor are private. Use the static methods
|
2009-08-20 21:52:32 +04:00
|
|
|
// Get() and Put() instead.
|
|
|
|
|
|
|
|
static BPrivateScreen* Get(BWindow* window);
|
|
|
|
static BPrivateScreen* Get(int32 id);
|
|
|
|
static void Put(BPrivateScreen* screen);
|
|
|
|
|
|
|
|
static BPrivateScreen* GetNext(BPrivateScreen* screen);
|
|
|
|
|
|
|
|
bool IsValid() const;
|
|
|
|
color_space ColorSpace();
|
|
|
|
BRect Frame();
|
|
|
|
int32 ID() const { return fID; }
|
|
|
|
status_t GetNextID(int32& id);
|
|
|
|
|
|
|
|
status_t WaitForRetrace(bigtime_t timeout);
|
|
|
|
|
|
|
|
uint8 IndexForColor(uint8 red, uint8 green,
|
|
|
|
uint8 blue, uint8 alpha);
|
|
|
|
rgb_color ColorForIndex(const uint8 index);
|
|
|
|
uint8 InvertIndex(uint8 index);
|
|
|
|
|
|
|
|
const color_map* ColorMap();
|
|
|
|
|
|
|
|
status_t GetBitmap(BBitmap** bitmap, bool drawCursor,
|
|
|
|
BRect* bounds);
|
|
|
|
status_t ReadBitmap(BBitmap* bitmap, bool drawCursor,
|
|
|
|
BRect* bounds);
|
|
|
|
|
|
|
|
rgb_color DesktopColor(uint32 index);
|
|
|
|
void SetDesktopColor(rgb_color, uint32, bool);
|
|
|
|
|
|
|
|
status_t ProposeMode(display_mode* target,
|
|
|
|
const display_mode* low,
|
|
|
|
const display_mode* high);
|
|
|
|
|
|
|
|
status_t GetModeList(display_mode** _modeList,
|
|
|
|
uint32* _count);
|
|
|
|
status_t GetMode(uint32 workspace, display_mode* mode);
|
|
|
|
status_t SetMode(uint32 workspace, display_mode* mode,
|
|
|
|
bool makeDefault);
|
|
|
|
|
|
|
|
status_t GetDeviceInfo(accelerant_device_info* info);
|
|
|
|
status_t GetMonitorInfo(monitor_info* info);
|
|
|
|
status_t GetPixelClockLimits(display_mode* mode,
|
|
|
|
uint32* _low, uint32* _high);
|
|
|
|
status_t GetTimingConstraints(
|
|
|
|
display_timing_constraints* constraints);
|
|
|
|
|
|
|
|
status_t SetDPMS(uint32 dpmsState);
|
|
|
|
uint32 DPMSState();
|
|
|
|
uint32 DPMSCapabilites();
|
|
|
|
|
|
|
|
void* BaseAddress();
|
|
|
|
uint32 BytesPerRow();
|
|
|
|
|
|
|
|
private:
|
|
|
|
friend class BObjectList<BPrivateScreen>;
|
|
|
|
|
|
|
|
BPrivateScreen(int32 id);
|
|
|
|
~BPrivateScreen();
|
|
|
|
|
2009-08-21 13:20:25 +04:00
|
|
|
void _Acquire();
|
|
|
|
bool _Release();
|
2009-08-20 21:52:32 +04:00
|
|
|
|
|
|
|
sem_id _RetraceSemaphore();
|
|
|
|
status_t _GetFrameBufferConfig(
|
|
|
|
frame_buffer_config& config);
|
|
|
|
|
|
|
|
static BPrivateScreen* _Get(int32 id, bool check);
|
|
|
|
static bool _IsValid(int32 id);
|
|
|
|
|
|
|
|
private:
|
|
|
|
int32 fID;
|
2009-08-21 13:20:25 +04:00
|
|
|
int32 fReferenceCount;
|
2009-08-20 21:52:32 +04:00
|
|
|
color_map* fColorMap;
|
|
|
|
sem_id fRetraceSem;
|
|
|
|
bool fRetraceSemValid;
|
|
|
|
bool fOwnsColorMap;
|
|
|
|
BRect fFrame;
|
|
|
|
bigtime_t fLastUpdate;
|
2005-11-14 14:01:02 +03:00
|
|
|
};
|
|
|
|
|
2007-10-15 15:41:47 +04:00
|
|
|
} // namespace BPrivate
|
|
|
|
|
2005-11-14 14:01:02 +03:00
|
|
|
#endif // _PRIVATE_SCREEN_H_
|