10 #define SHOW_GLOBAL_DIRTY_REGION 0
11 #define SHOW_WINDOW_CONTENT_DIRTY_REGION 0
13 #define MULTI_LOCKER 1
16 # include "MultiLocker.h"
27 MSG_ADD_WINDOW
= 'addw',
30 MSG_MARK_CLEAN
= 'mcln',
35 class Desktop
: public BLooper
{
37 Desktop(DrawView
* drawView
,
38 DrawingEngine
* engine
);
41 // functions for the DrawView
42 void MouseDown(BPoint where
, uint32 buttons
,
44 void MouseUp(BPoint where
);
45 void MouseMoved(BPoint where
, uint32 code
,
46 const BMessage
* dragMessage
);
48 virtual void MessageReceived(BMessage
* message
);
50 void SetMasterClipping(BRegion
* clipping
);
51 void SetOffset(int32 x
, int32 y
);
53 bool AddWindow(WindowLayer
* window
);
54 bool RemoveWindow(WindowLayer
* window
);
55 int32
IndexOf(WindowLayer
* window
) const;
56 int32
CountWindows() const;
57 bool HasWindow(WindowLayer
* window
) const;
59 WindowLayer
* WindowAt(int32 index
) const;
60 WindowLayer
* WindowAtFast(int32 index
) const;
61 WindowLayer
* WindowAt(const BPoint
& where
) const;
62 WindowLayer
* TopWindow() const;
63 WindowLayer
* BottomWindow() const;
65 // doing something with the windows
66 void MoveWindowBy(WindowLayer
* window
, int32 x
, int32 y
);
67 void ResizeWindowBy(WindowLayer
* window
, int32 x
, int32 y
);
69 void ShowWindow(WindowLayer
* window
);
70 void HideWindow(WindowLayer
* window
);
71 void SetWindowHidden(WindowLayer
* window
, bool hidden
);
73 void BringToFront(WindowLayer
* window
);
74 void SendToBack(WindowLayer
* window
);
76 void SetFocusWindow(WindowLayer
* window
);
79 bool ReadLockClipping() { return fClippingLock
.ReadLock(); }
80 void ReadUnlockClipping() { fClippingLock
.ReadUnlock(); }
82 bool LockClipping() { return fClippingLock
.WriteLock(); }
83 void UnlockClipping() { fClippingLock
.WriteUnlock(); }
85 bool ReadLockClipping() { return fClippingLock
.Lock(); }
86 void ReadUnlockClipping() { fClippingLock
.Unlock(); }
88 bool LockClipping() { return fClippingLock
.Lock(); }
89 void UnlockClipping() { fClippingLock
.Unlock(); }
92 void MarkDirty(BRegion
* region
);
94 DrawingEngine
* GetDrawingEngine() const
95 { return fDrawingEngine
; }
97 BRegion
& BackgroundRegion()
98 { return fBackgroundRegion
; }
100 void WindowDied(WindowLayer
* window
);
103 void _RebuildClippingForAllWindows(BRegion
* stillAvailableOnScreen
);
104 void _TriggerWindowRedrawing(BRegion
* newDirtyRegion
);
105 void _SetBackground(BRegion
* background
);
108 BPoint fLastMousePos
;
109 WindowLayer
* fClickedWindow
;
110 ViewLayer
* fScrollingView
;
112 bigtime_t fClickTime
;
116 MultiLocker fClippingLock
;
118 BLocker fClippingLock
;
120 BRegion fBackgroundRegion
;
122 BRegion fMasterClipping
;
127 DrawingEngine
* fDrawingEngine
;
131 bool fFocusFollowsMouse
;
132 WindowLayer
* fFocusWindow
;