1a817d6adSAxel Dörfler /*
20eed9183SAxel Dörfler * Copyright 2002-2009, Haiku Inc.
3a817d6adSAxel Dörfler * Distributed under the terms of the MIT License.
4a817d6adSAxel Dörfler *
5a817d6adSAxel Dörfler * Authors:
6a817d6adSAxel Dörfler * Stefano Ceccherini (burton666@libero.it)
7a817d6adSAxel Dörfler * Axel Dörfler, axeld@pinc-software.de
8a817d6adSAxel Dörfler */
9a817d6adSAxel Dörfler
100eed9183SAxel Dörfler
110eed9183SAxel Dörfler /*! BPrivateScreen is the class which does the real work for
1257a6c095SAxel Dörfler the proxy class BScreen (it interacts with the app_server).
13a817d6adSAxel Dörfler */
14a817d6adSAxel Dörfler
15a817d6adSAxel Dörfler
16f7e005ebSAxel Dörfler #include <PrivateScreen.h>
17466871ccSAxel Dörfler
18c2784486SAxel Dörfler #include <new>
1917f68169SIngo Weinhold #include <pthread.h>
20c2784486SAxel Dörfler #include <stdlib.h>
21c2784486SAxel Dörfler
2257a6c095SAxel Dörfler #include <Application.h>
23a817d6adSAxel Dörfler #include <Autolock.h>
2416046321SStefano Ceccherini #include <Bitmap.h>
258eae8b05SStefano Ceccherini #include <Locker.h>
26b66d7537SAxel Dörfler #include <ObjectList.h>
27624df6c6SStefano Ceccherini #include <Window.h>
28314a1024SStefano Ceccherini
2917f68169SIngo Weinhold #include <AutoLocker.h>
3017f68169SIngo Weinhold
31f7e005ebSAxel Dörfler #include <AppMisc.h>
32f7e005ebSAxel Dörfler #include <AppServerLink.h>
33f7e005ebSAxel Dörfler #include <ServerProtocol.h>
34f7e005ebSAxel Dörfler
35624df6c6SStefano Ceccherini
36c2784486SAxel Dörfler using namespace BPrivate;
37624df6c6SStefano Ceccherini
38aadbd94eSAxel Dörfler
3917f68169SIngo Weinhold namespace {
408eae8b05SStefano Ceccherini
4117f68169SIngo Weinhold struct Screens {
4217f68169SIngo Weinhold BObjectList<BPrivateScreen> list;
4317f68169SIngo Weinhold
Screens__anon3c02a1cd0111::Screens4417f68169SIngo Weinhold Screens()
4517f68169SIngo Weinhold :
4617f68169SIngo Weinhold list(2, true),
4717f68169SIngo Weinhold fLock("screen list")
4817f68169SIngo Weinhold {
4917f68169SIngo Weinhold }
5017f68169SIngo Weinhold
Lock__anon3c02a1cd0111::Screens5117f68169SIngo Weinhold bool Lock()
5217f68169SIngo Weinhold {
5317f68169SIngo Weinhold return fLock.Lock();
5417f68169SIngo Weinhold }
5517f68169SIngo Weinhold
Unlock__anon3c02a1cd0111::Screens5617f68169SIngo Weinhold void Unlock()
5717f68169SIngo Weinhold {
5817f68169SIngo Weinhold fLock.Unlock();
5917f68169SIngo Weinhold }
6017f68169SIngo Weinhold
Default__anon3c02a1cd0111::Screens6117f68169SIngo Weinhold static Screens* Default()
6217f68169SIngo Weinhold {
6317f68169SIngo Weinhold if (sDefaultInstance == NULL)
6417f68169SIngo Weinhold pthread_once(&sDefaultInitOnce, &_InitSingleton);
6517f68169SIngo Weinhold
6617f68169SIngo Weinhold return sDefaultInstance;
6717f68169SIngo Weinhold }
6817f68169SIngo Weinhold
6917f68169SIngo Weinhold private:
_InitSingleton__anon3c02a1cd0111::Screens7017f68169SIngo Weinhold static void _InitSingleton()
7117f68169SIngo Weinhold {
7217f68169SIngo Weinhold sDefaultInstance = new Screens;
7317f68169SIngo Weinhold }
7417f68169SIngo Weinhold
7517f68169SIngo Weinhold private:
7617f68169SIngo Weinhold BLocker fLock;
7717f68169SIngo Weinhold
7817f68169SIngo Weinhold static pthread_once_t sDefaultInitOnce;
7917f68169SIngo Weinhold static Screens* sDefaultInstance;
8017f68169SIngo Weinhold };
8117f68169SIngo Weinhold
8217f68169SIngo Weinhold pthread_once_t Screens::sDefaultInitOnce = PTHREAD_ONCE_INIT;
8317f68169SIngo Weinhold Screens* Screens::sDefaultInstance = NULL;
8417f68169SIngo Weinhold
8517f68169SIngo Weinhold } // unnamed namespace
86624df6c6SStefano Ceccherini
87624df6c6SStefano Ceccherini
88624df6c6SStefano Ceccherini BPrivateScreen*
Get(BWindow * window)89b66d7537SAxel Dörfler BPrivateScreen::Get(BWindow* window)
90624df6c6SStefano Ceccherini {
910eed9183SAxel Dörfler int32 id = B_MAIN_SCREEN_ID.id;
92d9525baaSAxel Dörfler
93d9525baaSAxel Dörfler if (window != NULL) {
94d9525baaSAxel Dörfler BPrivate::AppServerLink link;
95d9525baaSAxel Dörfler link.StartMessage(AS_GET_SCREEN_ID_FROM_WINDOW);
96d9525baaSAxel Dörfler link.Attach<int32>(_get_object_token_(window));
97d9525baaSAxel Dörfler
98d9525baaSAxel Dörfler status_t status;
99d9525baaSAxel Dörfler if (link.FlushWithReply(status) == B_OK && status == B_OK)
1000eed9183SAxel Dörfler link.Read<int32>(&id);
101d9525baaSAxel Dörfler }
102d9525baaSAxel Dörfler
103b66d7537SAxel Dörfler return _Get(id, false);
104624df6c6SStefano Ceccherini }
105624df6c6SStefano Ceccherini
106624df6c6SStefano Ceccherini
107624df6c6SStefano Ceccherini BPrivateScreen*
Get(int32 id)1080eed9183SAxel Dörfler BPrivateScreen::Get(int32 id)
109b66d7537SAxel Dörfler {
110b66d7537SAxel Dörfler return _Get(id, true);
111b66d7537SAxel Dörfler }
112b66d7537SAxel Dörfler
113b66d7537SAxel Dörfler
114b66d7537SAxel Dörfler BPrivateScreen*
_Get(int32 id,bool check)1150eed9183SAxel Dörfler BPrivateScreen::_Get(int32 id, bool check)
116624df6c6SStefano Ceccherini {
11757a6c095SAxel Dörfler // Nothing works without an app_server connection
11857a6c095SAxel Dörfler if (be_app == NULL)
11957a6c095SAxel Dörfler return NULL;
12057a6c095SAxel Dörfler
12117f68169SIngo Weinhold Screens* screens = Screens::Default();
12217f68169SIngo Weinhold AutoLocker<Screens> locker(screens);
1238eae8b05SStefano Ceccherini
124b66d7537SAxel Dörfler // search for the screen ID
125b66d7537SAxel Dörfler
12617f68169SIngo Weinhold for (int32 i = screens->list.CountItems(); i-- > 0;) {
12717f68169SIngo Weinhold BPrivateScreen* screen = screens->list.ItemAt(i);
128b66d7537SAxel Dörfler
1290eed9183SAxel Dörfler if (screen->ID() == id) {
130b66d7537SAxel Dörfler screen->_Acquire();
131b66d7537SAxel Dörfler return screen;
132b66d7537SAxel Dörfler }
1338eae8b05SStefano Ceccherini }
1348eae8b05SStefano Ceccherini
135b66d7537SAxel Dörfler if (check) {
136b66d7537SAxel Dörfler // check if ID is valid
137b66d7537SAxel Dörfler if (!_IsValid(id))
138b66d7537SAxel Dörfler return NULL;
139b66d7537SAxel Dörfler }
140b66d7537SAxel Dörfler
141b66d7537SAxel Dörfler // we need to allocate a new one
142b66d7537SAxel Dörfler
143b66d7537SAxel Dörfler BPrivateScreen* screen = new (std::nothrow) BPrivateScreen(id);
144b66d7537SAxel Dörfler if (screen == NULL)
145b66d7537SAxel Dörfler return NULL;
146b66d7537SAxel Dörfler
14717f68169SIngo Weinhold screens->list.AddItem(screen);
148b66d7537SAxel Dörfler return screen;
149624df6c6SStefano Ceccherini }
150624df6c6SStefano Ceccherini
151624df6c6SStefano Ceccherini
152624df6c6SStefano Ceccherini void
Put(BPrivateScreen * screen)153b66d7537SAxel Dörfler BPrivateScreen::Put(BPrivateScreen* screen)
154624df6c6SStefano Ceccherini {
155b66d7537SAxel Dörfler if (screen == NULL)
156b66d7537SAxel Dörfler return;
157b66d7537SAxel Dörfler
15817f68169SIngo Weinhold Screens* screens = Screens::Default();
15917f68169SIngo Weinhold AutoLocker<Screens> locker(screens);
160b66d7537SAxel Dörfler
161b66d7537SAxel Dörfler if (screen->_Release()) {
1620eed9183SAxel Dörfler if (screen->ID() != B_MAIN_SCREEN_ID.id) {
163b66d7537SAxel Dörfler // we always keep the main screen object around - it will
164b66d7537SAxel Dörfler // never go away, even if you disconnect all monitors.
16517f68169SIngo Weinhold screens->list.RemoveItem(screen);
166b66d7537SAxel Dörfler }
167b66d7537SAxel Dörfler }
168624df6c6SStefano Ceccherini }
169624df6c6SStefano Ceccherini
170624df6c6SStefano Ceccherini
171b66d7537SAxel Dörfler BPrivateScreen*
GetNext(BPrivateScreen * screen)172b66d7537SAxel Dörfler BPrivateScreen::GetNext(BPrivateScreen* screen)
173624df6c6SStefano Ceccherini {
17417f68169SIngo Weinhold Screens* screens = Screens::Default();
17517f68169SIngo Weinhold AutoLocker<Screens> locker(screens);
176b66d7537SAxel Dörfler
1770eed9183SAxel Dörfler int32 id;
178b66d7537SAxel Dörfler status_t status = screen->GetNextID(id);
1790eed9183SAxel Dörfler if (status != B_OK)
180b66d7537SAxel Dörfler return NULL;
181b66d7537SAxel Dörfler
182b66d7537SAxel Dörfler BPrivateScreen* nextScreen = Get(id);
183b66d7537SAxel Dörfler if (nextScreen == NULL)
184b66d7537SAxel Dörfler return NULL;
185b66d7537SAxel Dörfler
186b66d7537SAxel Dörfler Put(screen);
187b66d7537SAxel Dörfler return nextScreen;
188624df6c6SStefano Ceccherini }
189624df6c6SStefano Ceccherini
190624df6c6SStefano Ceccherini
191b66d7537SAxel Dörfler bool
_IsValid(int32 id)1920eed9183SAxel Dörfler BPrivateScreen::_IsValid(int32 id)
193b66d7537SAxel Dörfler {
194b66d7537SAxel Dörfler BPrivate::AppServerLink link;
195b66d7537SAxel Dörfler link.StartMessage(AS_VALID_SCREEN_ID);
1960eed9183SAxel Dörfler link.Attach<int32>(id);
197b66d7537SAxel Dörfler
198b66d7537SAxel Dörfler status_t status;
199b66d7537SAxel Dörfler if (link.FlushWithReply(status) != B_OK || status < B_OK)
200b66d7537SAxel Dörfler return false;
201b66d7537SAxel Dörfler
202b66d7537SAxel Dörfler return true;
203b66d7537SAxel Dörfler }
204b66d7537SAxel Dörfler
205b66d7537SAxel Dörfler
206b66d7537SAxel Dörfler // #pragma mark -
207b66d7537SAxel Dörfler
208b66d7537SAxel Dörfler
209624df6c6SStefano Ceccherini color_space
ColorSpace()210624df6c6SStefano Ceccherini BPrivateScreen::ColorSpace()
211624df6c6SStefano Ceccherini {
212624df6c6SStefano Ceccherini display_mode mode;
213aadbd94eSAxel Dörfler if (GetMode(B_CURRENT_WORKSPACE_INDEX, &mode) == B_OK)
214624df6c6SStefano Ceccherini return (color_space)mode.space;
215624df6c6SStefano Ceccherini
216624df6c6SStefano Ceccherini return B_NO_COLOR_SPACE;
217624df6c6SStefano Ceccherini }
218624df6c6SStefano Ceccherini
219624df6c6SStefano Ceccherini
220624df6c6SStefano Ceccherini BRect
Frame()221624df6c6SStefano Ceccherini BPrivateScreen::Frame()
222624df6c6SStefano Ceccherini {
223aadbd94eSAxel Dörfler if (system_time() > fLastUpdate + 10000) {
224aadbd94eSAxel Dörfler // invalidate the settings after 10 msecs
225e18224cdSAxel Dörfler BPrivate::AppServerLink link;
226e18224cdSAxel Dörfler link.StartMessage(AS_GET_SCREEN_FRAME);
227e18224cdSAxel Dörfler link.Attach<int32>(ID());
228e18224cdSAxel Dörfler link.Attach<uint32>(B_CURRENT_WORKSPACE_INDEX);
229e18224cdSAxel Dörfler
230e18224cdSAxel Dörfler status_t status = B_ERROR;
231e18224cdSAxel Dörfler if (link.FlushWithReply(status) == B_OK && status == B_OK) {
232e18224cdSAxel Dörfler link.Read<BRect>(&fFrame);
233b66d7537SAxel Dörfler fLastUpdate = system_time();
234b66d7537SAxel Dörfler }
235b66d7537SAxel Dörfler }
236b66d7537SAxel Dörfler
237b66d7537SAxel Dörfler return fFrame;
238624df6c6SStefano Ceccherini }
239624df6c6SStefano Ceccherini
240624df6c6SStefano Ceccherini
241b66d7537SAxel Dörfler bool
IsValid() const242b66d7537SAxel Dörfler BPrivateScreen::IsValid() const
243624df6c6SStefano Ceccherini {
244b66d7537SAxel Dörfler return BPrivateScreen::_IsValid(ID());
245b66d7537SAxel Dörfler }
246b66d7537SAxel Dörfler
247b66d7537SAxel Dörfler
248b66d7537SAxel Dörfler status_t
GetNextID(int32 & id)2490eed9183SAxel Dörfler BPrivateScreen::GetNextID(int32& id)
250b66d7537SAxel Dörfler {
251b66d7537SAxel Dörfler BPrivate::AppServerLink link;
252b66d7537SAxel Dörfler link.StartMessage(AS_GET_NEXT_SCREEN_ID);
2530eed9183SAxel Dörfler link.Attach<int32>(ID());
254b66d7537SAxel Dörfler
255b66d7537SAxel Dörfler status_t status;
256b66d7537SAxel Dörfler if (link.FlushWithReply(status) == B_OK && status == B_OK) {
2570eed9183SAxel Dörfler link.Read<int32>(&id);
258b66d7537SAxel Dörfler return B_OK;
259b66d7537SAxel Dörfler }
260b66d7537SAxel Dörfler
261b66d7537SAxel Dörfler return status;
262624df6c6SStefano Ceccherini }
263624df6c6SStefano Ceccherini
264624df6c6SStefano Ceccherini
265624df6c6SStefano Ceccherini status_t
WaitForRetrace(bigtime_t timeout)266624df6c6SStefano Ceccherini BPrivateScreen::WaitForRetrace(bigtime_t timeout)
267624df6c6SStefano Ceccherini {
268624df6c6SStefano Ceccherini // Get the retrace semaphore if it's the first time
269624df6c6SStefano Ceccherini // we are called. Cache the value then.
2705ec797a7SStephan Aßmus if (!fRetraceSemValid)
271a817d6adSAxel Dörfler fRetraceSem = _RetraceSemaphore();
272624df6c6SStefano Ceccherini
2735ec797a7SStephan Aßmus if (fRetraceSem < 0) {
2745ec797a7SStephan Aßmus // syncing to retrace is not supported by the accelerant
2755ec797a7SStephan Aßmus return fRetraceSem;
2765ec797a7SStephan Aßmus }
2775ec797a7SStephan Aßmus
2785ec797a7SStephan Aßmus status_t status;
279624df6c6SStefano Ceccherini do {
280624df6c6SStefano Ceccherini status = acquire_sem_etc(fRetraceSem, 1, B_RELATIVE_TIMEOUT, timeout);
281624df6c6SStefano Ceccherini } while (status == B_INTERRUPTED);
282624df6c6SStefano Ceccherini
283624df6c6SStefano Ceccherini return status;
284624df6c6SStefano Ceccherini }
285624df6c6SStefano Ceccherini
286624df6c6SStefano Ceccherini
287624df6c6SStefano Ceccherini uint8
IndexForColor(uint8 red,uint8 green,uint8 blue,uint8 alpha)288624df6c6SStefano Ceccherini BPrivateScreen::IndexForColor(uint8 red, uint8 green, uint8 blue, uint8 alpha)
289624df6c6SStefano Ceccherini {
290624df6c6SStefano Ceccherini // Looks like this check is necessary
291a817d6adSAxel Dörfler if (red == B_TRANSPARENT_COLOR.red
292a817d6adSAxel Dörfler && green == B_TRANSPARENT_COLOR.green
293a817d6adSAxel Dörfler && blue == B_TRANSPARENT_COLOR.blue
294a817d6adSAxel Dörfler && alpha == B_TRANSPARENT_COLOR.alpha)
295624df6c6SStefano Ceccherini return B_TRANSPARENT_8_BIT;
296624df6c6SStefano Ceccherini
2970ef40c5eSMichael Lotz uint16 index = ((red & 0xf8) << 7) | ((green & 0xf8) << 2) | (blue >> 3);
298a817d6adSAxel Dörfler if (ColorMap())
2992ed35bc8SStefano Ceccherini return fColorMap->index_map[index];
300624df6c6SStefano Ceccherini
301624df6c6SStefano Ceccherini return 0;
302624df6c6SStefano Ceccherini }
303624df6c6SStefano Ceccherini
304624df6c6SStefano Ceccherini
305624df6c6SStefano Ceccherini rgb_color
ColorForIndex(const uint8 index)306624df6c6SStefano Ceccherini BPrivateScreen::ColorForIndex(const uint8 index)
307624df6c6SStefano Ceccherini {
308a817d6adSAxel Dörfler if (ColorMap())
309624df6c6SStefano Ceccherini return fColorMap->color_list[index];
310624df6c6SStefano Ceccherini
311624df6c6SStefano Ceccherini return rgb_color();
312624df6c6SStefano Ceccherini }
313624df6c6SStefano Ceccherini
314624df6c6SStefano Ceccherini
315624df6c6SStefano Ceccherini uint8
InvertIndex(uint8 index)316624df6c6SStefano Ceccherini BPrivateScreen::InvertIndex(uint8 index)
317624df6c6SStefano Ceccherini {
318a817d6adSAxel Dörfler if (ColorMap())
319624df6c6SStefano Ceccherini return fColorMap->inversion_map[index];
320624df6c6SStefano Ceccherini
321624df6c6SStefano Ceccherini return 0;
322624df6c6SStefano Ceccherini }
323624df6c6SStefano Ceccherini
324624df6c6SStefano Ceccherini
325624df6c6SStefano Ceccherini const color_map*
ColorMap()326624df6c6SStefano Ceccherini BPrivateScreen::ColorMap()
327624df6c6SStefano Ceccherini {
328a817d6adSAxel Dörfler if (fColorMap == NULL) {
32917f68169SIngo Weinhold Screens* screens = Screens::Default();
33017f68169SIngo Weinhold AutoLocker<Screens> locker(screens);
331a817d6adSAxel Dörfler
332a817d6adSAxel Dörfler if (fColorMap != NULL) {
333a817d6adSAxel Dörfler // someone could have been faster than us
334a817d6adSAxel Dörfler return fColorMap;
335a817d6adSAxel Dörfler }
336a817d6adSAxel Dörfler
337a817d6adSAxel Dörfler // TODO: BeOS R5 here gets the colormap pointer
338a817d6adSAxel Dörfler // (with BApplication::ro_offset_to_ptr() ?)
339a817d6adSAxel Dörfler // which is contained in a shared area created by the server.
340a817d6adSAxel Dörfler BPrivate::AppServerLink link;
341a817d6adSAxel Dörfler link.StartMessage(AS_SCREEN_GET_COLORMAP);
3420eed9183SAxel Dörfler link.Attach<int32>(ID());
343a817d6adSAxel Dörfler
344a817d6adSAxel Dörfler status_t status;
345a817d6adSAxel Dörfler if (link.FlushWithReply(status) == B_OK && status == B_OK) {
346a817d6adSAxel Dörfler fColorMap = (color_map*)malloc(sizeof(color_map));
347a817d6adSAxel Dörfler fOwnsColorMap = true;
348a817d6adSAxel Dörfler link.Read<color_map>(fColorMap);
349a817d6adSAxel Dörfler }
350a817d6adSAxel Dörfler }
351a817d6adSAxel Dörfler
352624df6c6SStefano Ceccherini return fColorMap;
353624df6c6SStefano Ceccherini }
354624df6c6SStefano Ceccherini
355624df6c6SStefano Ceccherini
356624df6c6SStefano Ceccherini status_t
GetBitmap(BBitmap ** _bitmap,bool drawCursor,BRect * bounds)357466871ccSAxel Dörfler BPrivateScreen::GetBitmap(BBitmap**_bitmap, bool drawCursor, BRect* bounds)
358624df6c6SStefano Ceccherini {
359466871ccSAxel Dörfler if (_bitmap == NULL)
36016046321SStefano Ceccherini return B_BAD_VALUE;
36116046321SStefano Ceccherini
362a817d6adSAxel Dörfler BRect rect;
363a817d6adSAxel Dörfler if (bounds != NULL)
364a817d6adSAxel Dörfler rect = *bounds;
365a817d6adSAxel Dörfler else
366a817d6adSAxel Dörfler rect = Frame();
367a817d6adSAxel Dörfler
368a817d6adSAxel Dörfler BBitmap* bitmap = new (std::nothrow) BBitmap(rect, ColorSpace());
369466871ccSAxel Dörfler if (bitmap == NULL)
370466871ccSAxel Dörfler return B_NO_MEMORY;
371466871ccSAxel Dörfler
372466871ccSAxel Dörfler status_t status = bitmap->InitCheck();
373466871ccSAxel Dörfler if (status == B_OK)
374a817d6adSAxel Dörfler status = ReadBitmap(bitmap, drawCursor, &rect);
375466871ccSAxel Dörfler if (status != B_OK) {
376466871ccSAxel Dörfler delete bitmap;
377466871ccSAxel Dörfler return status;
378466871ccSAxel Dörfler }
379466871ccSAxel Dörfler
380466871ccSAxel Dörfler *_bitmap = bitmap;
381466871ccSAxel Dörfler return B_OK;
382624df6c6SStefano Ceccherini }
383624df6c6SStefano Ceccherini
384624df6c6SStefano Ceccherini
385624df6c6SStefano Ceccherini status_t
ReadBitmap(BBitmap * bitmap,bool drawCursor,BRect * bounds)386a817d6adSAxel Dörfler BPrivateScreen::ReadBitmap(BBitmap* bitmap, bool drawCursor, BRect* bounds)
387624df6c6SStefano Ceccherini {
38816046321SStefano Ceccherini if (bitmap == NULL)
38916046321SStefano Ceccherini return B_BAD_VALUE;
39016046321SStefano Ceccherini
39116046321SStefano Ceccherini BRect rect;
392a817d6adSAxel Dörfler if (bounds != NULL)
393a817d6adSAxel Dörfler rect = *bounds;
39416046321SStefano Ceccherini else
39516046321SStefano Ceccherini rect = Frame();
39616046321SStefano Ceccherini
39716046321SStefano Ceccherini BPrivate::AppServerLink link;
39816046321SStefano Ceccherini link.StartMessage(AS_READ_BITMAP);
3999a44fdc9SAxel Dörfler link.Attach<int32>(bitmap->_ServerToken());
40016046321SStefano Ceccherini link.Attach<bool>(drawCursor);
40116046321SStefano Ceccherini link.Attach<BRect>(rect);
40216046321SStefano Ceccherini
403a817d6adSAxel Dörfler status_t status = B_ERROR;
404a817d6adSAxel Dörfler if (link.FlushWithReply(status) < B_OK || status != B_OK)
405a817d6adSAxel Dörfler return status;
40616046321SStefano Ceccherini
40716046321SStefano Ceccherini return B_OK;
408624df6c6SStefano Ceccherini }
409624df6c6SStefano Ceccherini
410624df6c6SStefano Ceccherini
411624df6c6SStefano Ceccherini rgb_color
DesktopColor(uint32 workspace)41239ffb980SStefano Ceccherini BPrivateScreen::DesktopColor(uint32 workspace)
413624df6c6SStefano Ceccherini {
4143ba7d6f3SAxel Dörfler rgb_color color = { 51, 102, 152, 255 };
415dd10337fSAxel Dörfler BPrivate::AppServerLink link;
4163ba7d6f3SAxel Dörfler
4173ba7d6f3SAxel Dörfler link.StartMessage(AS_GET_DESKTOP_COLOR);
4183f319b33SMichael Lotz link.Attach<uint32>(workspace);
4193ba7d6f3SAxel Dörfler
4203ba7d6f3SAxel Dörfler int32 code;
421dd10337fSAxel Dörfler if (link.FlushWithReply(code) == B_OK
422a817d6adSAxel Dörfler && code == B_OK)
4233ba7d6f3SAxel Dörfler link.Read<rgb_color>(&color);
4243ba7d6f3SAxel Dörfler
42539ffb980SStefano Ceccherini return color;
426624df6c6SStefano Ceccherini }
427624df6c6SStefano Ceccherini
428624df6c6SStefano Ceccherini
429624df6c6SStefano Ceccherini void
SetDesktopColor(rgb_color color,uint32 workspace,bool makeDefault)430a817d6adSAxel Dörfler BPrivateScreen::SetDesktopColor(rgb_color color, uint32 workspace,
431a817d6adSAxel Dörfler bool makeDefault)
432624df6c6SStefano Ceccherini {
433dd10337fSAxel Dörfler BPrivate::AppServerLink link;
4343ba7d6f3SAxel Dörfler
4353ba7d6f3SAxel Dörfler link.StartMessage(AS_SET_DESKTOP_COLOR);
43639ffb980SStefano Ceccherini link.Attach<rgb_color>(color);
4378f9ab4d1SAxel Dörfler link.Attach<uint32>(workspace);
43839ffb980SStefano Ceccherini link.Attach<bool>(makeDefault);
43939ffb980SStefano Ceccherini link.Flush();
440624df6c6SStefano Ceccherini }
441624df6c6SStefano Ceccherini
442624df6c6SStefano Ceccherini
443624df6c6SStefano Ceccherini status_t
ProposeMode(display_mode * target,const display_mode * low,const display_mode * high)444c6418981SStefano Ceccherini BPrivateScreen::ProposeMode(display_mode* target,
445c6418981SStefano Ceccherini const display_mode* low, const display_mode* high)
446624df6c6SStefano Ceccherini {
447c6418981SStefano Ceccherini // We can't return B_BAD_VALUE here, because it's used to indicate
448c6418981SStefano Ceccherini // that the mode returned is supported, but it doesn't fall
449c6418981SStefano Ceccherini // within the limit (see ProposeMode() documentation)
450c6418981SStefano Ceccherini if (target == NULL || low == NULL || high == NULL)
451624df6c6SStefano Ceccherini return B_ERROR;
452c6418981SStefano Ceccherini
453c6418981SStefano Ceccherini BPrivate::AppServerLink link;
454c6418981SStefano Ceccherini link.StartMessage(AS_PROPOSE_MODE);
4550eed9183SAxel Dörfler link.Attach<int32>(ID());
456583f6c3eSStefano Ceccherini link.Attach<display_mode>(*target);
457583f6c3eSStefano Ceccherini link.Attach<display_mode>(*low);
458583f6c3eSStefano Ceccherini link.Attach<display_mode>(*high);
459583f6c3eSStefano Ceccherini
460c6418981SStefano Ceccherini status_t status = B_ERROR;
461a817d6adSAxel Dörfler if (link.FlushWithReply(status) == B_OK && status == B_OK) {
462c6418981SStefano Ceccherini link.Read<display_mode>(target);
463a817d6adSAxel Dörfler
464a817d6adSAxel Dörfler bool withinLimits;
465a817d6adSAxel Dörfler link.Read<bool>(&withinLimits);
466a817d6adSAxel Dörfler if (!withinLimits)
467a817d6adSAxel Dörfler status = B_BAD_VALUE;
468c6418981SStefano Ceccherini }
469c6418981SStefano Ceccherini
470c6418981SStefano Ceccherini return status;
471624df6c6SStefano Ceccherini }
472624df6c6SStefano Ceccherini
473624df6c6SStefano Ceccherini
474624df6c6SStefano Ceccherini status_t
GetModeList(display_mode ** _modeList,uint32 * _count)475a817d6adSAxel Dörfler BPrivateScreen::GetModeList(display_mode** _modeList, uint32* _count)
476624df6c6SStefano Ceccherini {
477a817d6adSAxel Dörfler if (_modeList == NULL || _count == NULL)
47810c5dab8SStefano Ceccherini return B_BAD_VALUE;
47910c5dab8SStefano Ceccherini
48010c5dab8SStefano Ceccherini BPrivate::AppServerLink link;
48110c5dab8SStefano Ceccherini link.StartMessage(AS_GET_MODE_LIST);
4820eed9183SAxel Dörfler link.Attach<int32>(ID());
483a817d6adSAxel Dörfler
484a817d6adSAxel Dörfler status_t status = B_ERROR;
485a817d6adSAxel Dörfler if (link.FlushWithReply(status) == B_OK && status == B_OK) {
48606740743SAxel Dörfler uint32 count;
48706740743SAxel Dörfler if (link.Read<uint32>(&count) < B_OK)
48806740743SAxel Dörfler return B_ERROR;
48906740743SAxel Dörfler
490a817d6adSAxel Dörfler // TODO: this could get too big for the link
49106740743SAxel Dörfler int32 size = count * sizeof(display_mode);
49206740743SAxel Dörfler display_mode* modeList = (display_mode *)malloc(size);
49306740743SAxel Dörfler if (modeList == NULL)
494a817d6adSAxel Dörfler return B_NO_MEMORY;
495a817d6adSAxel Dörfler
49606740743SAxel Dörfler if (link.Read(modeList, size) < B_OK) {
49706740743SAxel Dörfler free(modeList);
49806740743SAxel Dörfler return B_ERROR;
49906740743SAxel Dörfler }
50006740743SAxel Dörfler
50106740743SAxel Dörfler *_modeList = modeList;
50206740743SAxel Dörfler *_count = count;
50310c5dab8SStefano Ceccherini }
50410c5dab8SStefano Ceccherini
50510c5dab8SStefano Ceccherini return status;
506624df6c6SStefano Ceccherini }
507624df6c6SStefano Ceccherini
508624df6c6SStefano Ceccherini
509624df6c6SStefano Ceccherini status_t
GetMode(uint32 workspace,display_mode * mode)510624df6c6SStefano Ceccherini BPrivateScreen::GetMode(uint32 workspace, display_mode *mode)
511624df6c6SStefano Ceccherini {
512314a1024SStefano Ceccherini if (mode == NULL)
513314a1024SStefano Ceccherini return B_BAD_VALUE;
514314a1024SStefano Ceccherini
515dd10337fSAxel Dörfler BPrivate::AppServerLink link;
51634c39bf0SStefano Ceccherini link.StartMessage(AS_SCREEN_GET_MODE);
5170eed9183SAxel Dörfler link.Attach<int32>(ID());
51839ffb980SStefano Ceccherini link.Attach<uint32>(workspace);
519fca6492fSStefano Ceccherini
52034c39bf0SStefano Ceccherini status_t status = B_ERROR;
521a817d6adSAxel Dörfler if (link.FlushWithReply(status) != B_OK
522a817d6adSAxel Dörfler || status != B_OK)
52339ffb980SStefano Ceccherini return status;
524a817d6adSAxel Dörfler
525a817d6adSAxel Dörfler link.Read<display_mode>(mode);
526a817d6adSAxel Dörfler return B_OK;
527624df6c6SStefano Ceccherini }
528624df6c6SStefano Ceccherini
529624df6c6SStefano Ceccherini
530624df6c6SStefano Ceccherini status_t
SetMode(uint32 workspace,display_mode * mode,bool makeDefault)531624df6c6SStefano Ceccherini BPrivateScreen::SetMode(uint32 workspace, display_mode *mode, bool makeDefault)
532624df6c6SStefano Ceccherini {
533314a1024SStefano Ceccherini if (mode == NULL)
534314a1024SStefano Ceccherini return B_BAD_VALUE;
535314a1024SStefano Ceccherini
536dd10337fSAxel Dörfler BPrivate::AppServerLink link;
537314a1024SStefano Ceccherini link.StartMessage(AS_SCREEN_SET_MODE);
5380eed9183SAxel Dörfler link.Attach<int32>(ID());
53939ffb980SStefano Ceccherini link.Attach<uint32>(workspace);
54039ffb980SStefano Ceccherini link.Attach<display_mode>(*mode);
54139ffb980SStefano Ceccherini link.Attach<bool>(makeDefault);
542314a1024SStefano Ceccherini
543314a1024SStefano Ceccherini status_t status = B_ERROR;
544a817d6adSAxel Dörfler link.FlushWithReply(status);
545314a1024SStefano Ceccherini
54639ffb980SStefano Ceccherini return status;
547624df6c6SStefano Ceccherini }
548624df6c6SStefano Ceccherini
549624df6c6SStefano Ceccherini
550624df6c6SStefano Ceccherini status_t
GetDeviceInfo(accelerant_device_info * info)551624df6c6SStefano Ceccherini BPrivateScreen::GetDeviceInfo(accelerant_device_info *info)
552624df6c6SStefano Ceccherini {
553c6418981SStefano Ceccherini if (info == NULL)
554c6418981SStefano Ceccherini return B_BAD_VALUE;
555c6418981SStefano Ceccherini
556c6418981SStefano Ceccherini BPrivate::AppServerLink link;
557c6418981SStefano Ceccherini link.StartMessage(AS_GET_ACCELERANT_INFO);
5580eed9183SAxel Dörfler link.Attach<int32>(ID());
559a817d6adSAxel Dörfler
560a817d6adSAxel Dörfler status_t status = B_ERROR;
561a817d6adSAxel Dörfler if (link.FlushWithReply(status) == B_OK && status == B_OK) {
562c6418981SStefano Ceccherini link.Read<accelerant_device_info>(info);
563c6418981SStefano Ceccherini return B_OK;
564c6418981SStefano Ceccherini }
565c6418981SStefano Ceccherini
566a817d6adSAxel Dörfler return status;
567624df6c6SStefano Ceccherini }
568624df6c6SStefano Ceccherini
569624df6c6SStefano Ceccherini
570624df6c6SStefano Ceccherini status_t
GetMonitorInfo(monitor_info * info)571c2784486SAxel Dörfler BPrivateScreen::GetMonitorInfo(monitor_info* info)
572c2784486SAxel Dörfler {
573c2784486SAxel Dörfler if (info == NULL)
574c2784486SAxel Dörfler return B_BAD_VALUE;
575c2784486SAxel Dörfler
576c2784486SAxel Dörfler BPrivate::AppServerLink link;
577c2784486SAxel Dörfler link.StartMessage(AS_GET_MONITOR_INFO);
5780eed9183SAxel Dörfler link.Attach<int32>(ID());
579c2784486SAxel Dörfler
580c2784486SAxel Dörfler status_t status = B_ERROR;
581c2784486SAxel Dörfler if (link.FlushWithReply(status) == B_OK && status == B_OK) {
582c2784486SAxel Dörfler link.Read<monitor_info>(info);
583c2784486SAxel Dörfler return B_OK;
584c2784486SAxel Dörfler }
585c2784486SAxel Dörfler
586c2784486SAxel Dörfler return status;
587c2784486SAxel Dörfler }
588c2784486SAxel Dörfler
589c2784486SAxel Dörfler
590c2784486SAxel Dörfler status_t
GetPixelClockLimits(display_mode * mode,uint32 * low,uint32 * high)591624df6c6SStefano Ceccherini BPrivateScreen::GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high)
592624df6c6SStefano Ceccherini {
59375de27f8SStefano Ceccherini if (mode == NULL || low == NULL || high == NULL)
59475de27f8SStefano Ceccherini return B_BAD_VALUE;
59575de27f8SStefano Ceccherini
59675de27f8SStefano Ceccherini BPrivate::AppServerLink link;
59775de27f8SStefano Ceccherini link.StartMessage(AS_GET_PIXEL_CLOCK_LIMITS);
5980eed9183SAxel Dörfler link.Attach<int32>(ID());
59975de27f8SStefano Ceccherini link.Attach<display_mode>(*mode);
60075de27f8SStefano Ceccherini
601a817d6adSAxel Dörfler status_t status;
602a817d6adSAxel Dörfler if (link.FlushWithReply(status) == B_OK && status == B_OK) {
60375de27f8SStefano Ceccherini link.Read<uint32>(low);
60475de27f8SStefano Ceccherini link.Read<uint32>(high);
60575de27f8SStefano Ceccherini return B_OK;
60675de27f8SStefano Ceccherini }
60775de27f8SStefano Ceccherini
608a817d6adSAxel Dörfler return status;
609624df6c6SStefano Ceccherini }
610624df6c6SStefano Ceccherini
611624df6c6SStefano Ceccherini
612624df6c6SStefano Ceccherini status_t
GetTimingConstraints(display_timing_constraints * constraints)613a817d6adSAxel Dörfler BPrivateScreen::GetTimingConstraints(display_timing_constraints *constraints)
614624df6c6SStefano Ceccherini {
615a817d6adSAxel Dörfler if (constraints == NULL)
61655b222b0SStefano Ceccherini return B_BAD_VALUE;
61755b222b0SStefano Ceccherini
61875de27f8SStefano Ceccherini BPrivate::AppServerLink link;
61975de27f8SStefano Ceccherini link.StartMessage(AS_GET_TIMING_CONSTRAINTS);
6200eed9183SAxel Dörfler link.Attach<int32>(ID());
62175de27f8SStefano Ceccherini
622a817d6adSAxel Dörfler status_t status = B_ERROR;
623a817d6adSAxel Dörfler if (link.FlushWithReply(status) == B_OK && status == B_OK) {
624a817d6adSAxel Dörfler link.Read<display_timing_constraints>(constraints);
62575de27f8SStefano Ceccherini return B_OK;
62675de27f8SStefano Ceccherini }
62775de27f8SStefano Ceccherini
628a817d6adSAxel Dörfler return status;
629624df6c6SStefano Ceccherini }
630624df6c6SStefano Ceccherini
631624df6c6SStefano Ceccherini
632624df6c6SStefano Ceccherini status_t
SetDPMS(uint32 dpmsState)633624df6c6SStefano Ceccherini BPrivateScreen::SetDPMS(uint32 dpmsState)
634624df6c6SStefano Ceccherini {
635dd10337fSAxel Dörfler BPrivate::AppServerLink link;
63655b222b0SStefano Ceccherini link.StartMessage(AS_SET_DPMS);
6370eed9183SAxel Dörfler link.Attach<int32>(ID());
63839ffb980SStefano Ceccherini link.Attach<uint32>(dpmsState);
63955b222b0SStefano Ceccherini
640a817d6adSAxel Dörfler status_t status = B_ERROR;
641a817d6adSAxel Dörfler link.FlushWithReply(status);
642a817d6adSAxel Dörfler
643a817d6adSAxel Dörfler return status;
644624df6c6SStefano Ceccherini }
645624df6c6SStefano Ceccherini
646624df6c6SStefano Ceccherini
647624df6c6SStefano Ceccherini uint32
DPMSState()648624df6c6SStefano Ceccherini BPrivateScreen::DPMSState()
649624df6c6SStefano Ceccherini {
65039ffb980SStefano Ceccherini uint32 state = 0;
65155b222b0SStefano Ceccherini
652dd10337fSAxel Dörfler BPrivate::AppServerLink link;
65355b222b0SStefano Ceccherini link.StartMessage(AS_GET_DPMS_STATE);
6540eed9183SAxel Dörfler link.Attach<int32>(ID());
655a817d6adSAxel Dörfler
656a817d6adSAxel Dörfler status_t status;
657a817d6adSAxel Dörfler if (link.FlushWithReply(status) == B_OK && status == B_OK)
65855b222b0SStefano Ceccherini link.Read<uint32>(&state);
65955b222b0SStefano Ceccherini
66039ffb980SStefano Ceccherini return state;
661624df6c6SStefano Ceccherini }
662624df6c6SStefano Ceccherini
663624df6c6SStefano Ceccherini
664624df6c6SStefano Ceccherini uint32
DPMSCapabilites()665624df6c6SStefano Ceccherini BPrivateScreen::DPMSCapabilites()
666624df6c6SStefano Ceccherini {
66739ffb980SStefano Ceccherini uint32 capabilities = 0;
66855b222b0SStefano Ceccherini
669dd10337fSAxel Dörfler BPrivate::AppServerLink link;
67055b222b0SStefano Ceccherini link.StartMessage(AS_GET_DPMS_CAPABILITIES);
6710eed9183SAxel Dörfler link.Attach<int32>(ID());
672a817d6adSAxel Dörfler
673a817d6adSAxel Dörfler status_t status;
674a817d6adSAxel Dörfler if (link.FlushWithReply(status) == B_OK && status == B_OK)
67555b222b0SStefano Ceccherini link.Read<uint32>(&capabilities);
67655b222b0SStefano Ceccherini
67739ffb980SStefano Ceccherini return capabilities;
678624df6c6SStefano Ceccherini }
679624df6c6SStefano Ceccherini
680624df6c6SStefano Ceccherini
681*3a2b67b5SAdrien Destugues status_t
GetBrightness(float * brightness)682*3a2b67b5SAdrien Destugues BPrivateScreen::GetBrightness(float* brightness)
683*3a2b67b5SAdrien Destugues {
684*3a2b67b5SAdrien Destugues if (brightness == NULL)
685*3a2b67b5SAdrien Destugues return B_BAD_VALUE;
686*3a2b67b5SAdrien Destugues
687*3a2b67b5SAdrien Destugues BPrivate::AppServerLink link;
688*3a2b67b5SAdrien Destugues link.StartMessage(AS_SCREEN_GET_BRIGHTNESS);
689*3a2b67b5SAdrien Destugues link.Attach<int32>(ID());
690*3a2b67b5SAdrien Destugues
691*3a2b67b5SAdrien Destugues status_t status;
692*3a2b67b5SAdrien Destugues if (link.FlushWithReply(status) == B_OK && status == B_OK)
693*3a2b67b5SAdrien Destugues link.Read<float>(brightness);
694*3a2b67b5SAdrien Destugues
695*3a2b67b5SAdrien Destugues return status;
696*3a2b67b5SAdrien Destugues }
697*3a2b67b5SAdrien Destugues
698*3a2b67b5SAdrien Destugues
699*3a2b67b5SAdrien Destugues status_t
SetBrightness(float brightness)700*3a2b67b5SAdrien Destugues BPrivateScreen::SetBrightness(float brightness)
701*3a2b67b5SAdrien Destugues {
702*3a2b67b5SAdrien Destugues BPrivate::AppServerLink link;
703*3a2b67b5SAdrien Destugues link.StartMessage(AS_SCREEN_SET_BRIGHTNESS);
704*3a2b67b5SAdrien Destugues link.Attach<int32>(ID());
705*3a2b67b5SAdrien Destugues link.Attach<float>(brightness);
706*3a2b67b5SAdrien Destugues
707*3a2b67b5SAdrien Destugues status_t status = B_ERROR;
708*3a2b67b5SAdrien Destugues link.FlushWithReply(status);
709*3a2b67b5SAdrien Destugues
710*3a2b67b5SAdrien Destugues return status;
711*3a2b67b5SAdrien Destugues }
712*3a2b67b5SAdrien Destugues
713*3a2b67b5SAdrien Destugues
714624df6c6SStefano Ceccherini void *
BaseAddress()715624df6c6SStefano Ceccherini BPrivateScreen::BaseAddress()
716624df6c6SStefano Ceccherini {
717b66d7537SAxel Dörfler frame_buffer_config config;
718b66d7537SAxel Dörfler if (_GetFrameBufferConfig(config) != B_OK)
719624df6c6SStefano Ceccherini return NULL;
720b66d7537SAxel Dörfler
721b66d7537SAxel Dörfler return config.frame_buffer;
722624df6c6SStefano Ceccherini }
723624df6c6SStefano Ceccherini
724624df6c6SStefano Ceccherini
725624df6c6SStefano Ceccherini uint32
BytesPerRow()726624df6c6SStefano Ceccherini BPrivateScreen::BytesPerRow()
727624df6c6SStefano Ceccherini {
728b66d7537SAxel Dörfler frame_buffer_config config;
729b66d7537SAxel Dörfler if (_GetFrameBufferConfig(config) != B_OK)
730624df6c6SStefano Ceccherini return 0;
731624df6c6SStefano Ceccherini
732b66d7537SAxel Dörfler return config.bytes_per_row;
733624df6c6SStefano Ceccherini }
734624df6c6SStefano Ceccherini
735624df6c6SStefano Ceccherini
736a817d6adSAxel Dörfler // #pragma mark - private methods
73775de27f8SStefano Ceccherini
738a817d6adSAxel Dörfler
739aadbd94eSAxel Dörfler void
_Acquire()740aadbd94eSAxel Dörfler BPrivateScreen::_Acquire()
741aadbd94eSAxel Dörfler {
742aadbd94eSAxel Dörfler fReferenceCount++;
743aadbd94eSAxel Dörfler
744aadbd94eSAxel Dörfler fLastUpdate = 0;
745aadbd94eSAxel Dörfler // force an update for the new BScreen object
746aadbd94eSAxel Dörfler }
747aadbd94eSAxel Dörfler
748aadbd94eSAxel Dörfler
749aadbd94eSAxel Dörfler bool
_Release()750aadbd94eSAxel Dörfler BPrivateScreen::_Release()
751aadbd94eSAxel Dörfler {
752aadbd94eSAxel Dörfler return --fReferenceCount == 0;
753aadbd94eSAxel Dörfler }
754aadbd94eSAxel Dörfler
755aadbd94eSAxel Dörfler
756a817d6adSAxel Dörfler sem_id
_RetraceSemaphore()757a817d6adSAxel Dörfler BPrivateScreen::_RetraceSemaphore()
758a817d6adSAxel Dörfler {
75975de27f8SStefano Ceccherini BPrivate::AppServerLink link;
76075de27f8SStefano Ceccherini link.StartMessage(AS_GET_RETRACE_SEMAPHORE);
7610eed9183SAxel Dörfler link.Attach<int32>(ID());
762a817d6adSAxel Dörfler
763a817d6adSAxel Dörfler sem_id id = B_BAD_SEM_ID;
7645ec797a7SStephan Aßmus status_t status = B_ERROR;
7655ec797a7SStephan Aßmus if (link.FlushWithReply(status) == B_OK && status == B_OK) {
7665ec797a7SStephan Aßmus link.Read<sem_id>(&id);
7675ec797a7SStephan Aßmus fRetraceSemValid = true;
7685ec797a7SStephan Aßmus }
76975de27f8SStefano Ceccherini
77075de27f8SStefano Ceccherini return id;
77175de27f8SStefano Ceccherini }
77275de27f8SStefano Ceccherini
77375de27f8SStefano Ceccherini
774b66d7537SAxel Dörfler status_t
_GetFrameBufferConfig(frame_buffer_config & config)775b66d7537SAxel Dörfler BPrivateScreen::_GetFrameBufferConfig(frame_buffer_config& config)
776b66d7537SAxel Dörfler {
777b66d7537SAxel Dörfler BPrivate::AppServerLink link;
778b66d7537SAxel Dörfler link.StartMessage(AS_GET_FRAME_BUFFER_CONFIG);
7790eed9183SAxel Dörfler link.Attach<int32>(ID());
780b66d7537SAxel Dörfler
781b66d7537SAxel Dörfler status_t status = B_ERROR;
782b66d7537SAxel Dörfler if (link.FlushWithReply(status) == B_OK && status == B_OK) {
783b66d7537SAxel Dörfler link.Read<frame_buffer_config>(&config);
784b66d7537SAxel Dörfler return B_OK;
785b66d7537SAxel Dörfler }
786b66d7537SAxel Dörfler
787b66d7537SAxel Dörfler return status;
788b66d7537SAxel Dörfler }
789b66d7537SAxel Dörfler
790b66d7537SAxel Dörfler
BPrivateScreen(int32 id)7910eed9183SAxel Dörfler BPrivateScreen::BPrivateScreen(int32 id)
792624df6c6SStefano Ceccherini :
793b66d7537SAxel Dörfler fID(id),
794aadbd94eSAxel Dörfler fReferenceCount(0),
795624df6c6SStefano Ceccherini fColorMap(NULL),
796624df6c6SStefano Ceccherini fRetraceSem(-1),
7975ec797a7SStephan Aßmus fRetraceSemValid(false),
798b66d7537SAxel Dörfler fOwnsColorMap(false),
799b66d7537SAxel Dörfler fFrame(0, 0, 0, 0),
800b66d7537SAxel Dörfler fLastUpdate(0)
801624df6c6SStefano Ceccherini {
802624df6c6SStefano Ceccherini }
803624df6c6SStefano Ceccherini
804624df6c6SStefano Ceccherini
~BPrivateScreen()805624df6c6SStefano Ceccherini BPrivateScreen::~BPrivateScreen()
806624df6c6SStefano Ceccherini {
807624df6c6SStefano Ceccherini if (fOwnsColorMap)
808624df6c6SStefano Ceccherini free(fColorMap);
809624df6c6SStefano Ceccherini }
810