2bb2e9b06SClemens Zeidler * Copyright 2001-2011, Haiku, Inc.
3550d6a53SDarkWyrm * Distributed under the terms of the MIT license.
4550d6a53SDarkWyrm *
52c184b20SAxel Dörfler * Authors:
62c184b20SAxel Dörfler *		DarkWyrm <bpmagic@columbus.rr.com>
72c184b20SAxel Dörfler *		Adi Oanca <adioanca@gmail.com>
82c184b20SAxel Dörfler *		Stephan A��mus <superstippi@gmx.de>
9926e63c8SBrecht Machiels *		Axel D��rfler <axeld@pinc-software.de>
10926e63c8SBrecht Machiels *		Brecht Machiels <brecht@mos6581.org>
11369b4ff1SClemens Zeidler *		Clemens Zeidler <haiku@clemens-zeidler.de>
12550d6a53SDarkWyrm */
13953d895eSAxel Dörfler#ifndef WINDOW_H
14953d895eSAxel Dörfler#define WINDOW_H
164b813bf2SAxel Dörfler
1739c9925fSStephan Aßmus#include "RegionPool.h"
18e83820edSAxel Dörfler#include "ServerWindow.h"
19953d895eSAxel Dörfler#include "View.h"
20e83820edSAxel Dörfler#include "WindowList.h"
214b813bf2SAxel Dörfler
2248ccf5abSAxel Dörfler#include <ObjectList.h>
23bb2e9b06SClemens Zeidler#include <Referenceable.h>
24e83820edSAxel Dörfler#include <Region.h>
254b813bf2SAxel Dörfler#include <String.h>
264b813bf2SAxel Dörfler
27bb2e9b06SClemens Zeidler
28bb2e9b06SClemens Zeidlerclass Window;
29bb2e9b06SClemens Zeidler
30bb2e9b06SClemens Zeidler
31bb2e9b06SClemens Zeidlertypedef	BObjectList<Window>	StackWindows;
32bb2e9b06SClemens Zeidler
33bb2e9b06SClemens Zeidler
34bb2e9b06SClemens Zeidlerclass WindowStack : public BReferenceable {
35bb2e9b06SClemens Zeidlerpublic:
36bb2e9b06SClemens Zeidler								WindowStack(::Decorator* decorator);
37bb2e9b06SClemens Zeidler								~WindowStack();
38bb2e9b06SClemens Zeidler
39bb2e9b06SClemens Zeidler			void				SetDecorator(::Decorator* decorator);
40bb2e9b06SClemens Zeidler			::Decorator*		Decorator();
41bb2e9b06SClemens Zeidler
42bb2e9b06SClemens Zeidler	const	StackWindows&		WindowList() const { return fWindowList; }
43bb2e9b06SClemens Zeidler	const	StackWindows&		LayerOrder() const { return fWindowLayerOrder; }
44bb2e9b06SClemens Zeidler
45bb2e9b06SClemens Zeidler			Window*				TopLayerWindow() const;
46bb2e9b06SClemens Zeidler
47bb2e9b06SClemens Zeidler			int32				CountWindows();
48bb2e9b06SClemens Zeidler			Window*				WindowAt(int32 index);
49bb2e9b06SClemens Zeidler			bool				AddWindow(Window* window,
50bb2e9b06SClemens Zeidler									int32 position = -1);
51bb2e9b06SClemens Zeidler			bool				RemoveWindow(Window* window);
52bb2e9b06SClemens Zeidler
53bb2e9b06SClemens Zeidler			bool				MoveToTopLayer(Window* window);
54bb2e9b06SClemens Zeidler			bool				Move(int32 from, int32 to);
55bb2e9b06SClemens Zeidlerprivate:
56bb2e9b06SClemens Zeidler			::Decorator*		fDecorator;
57bb2e9b06SClemens Zeidler
58bb2e9b06SClemens Zeidler			StackWindows		fWindowList;
59bb2e9b06SClemens Zeidler			StackWindows		fWindowLayerOrder;
60bb2e9b06SClemens Zeidler};
61bb2e9b06SClemens Zeidler
62bb2e9b06SClemens Zeidler
63bb160ab5SStephan Aßmusnamespace BPrivate {
64bb160ab5SStephan Aßmus	class PortLink;
65bb160ab5SStephan Aßmus};
66e438905aSAdi Oanca
67427788e0SIngo Weinholdclass ClickTarget;
68e83820edSAxel Dörflerclass ClientLooper;
692a4228b5SDarkWyrmclass Decorator;
70a68bab12SAdi Oancaclass Desktop;
71e83820edSAxel Dörflerclass DrawingEngine;
72e83820edSAxel Dörflerclass EventDispatcher;
73fe7f167dSAxel Dörflerclass Screen;
74177ecc46SClemens Zeidlerclass WindowBehaviour;
75953d895eSAxel Dörflerclass WorkspacesView;
76e83820edSAxel Dörfler
77e83820edSAxel Dörfler// TODO: move this into a proper place
78e83820edSAxel Dörfler#define AS_REDRAW 'rdrw'
79e83820edSAxel Dörfler
80dd98ed8dSStephan Aßmusenum {
81dd98ed8dSStephan Aßmus	UPDATE_REQUEST		= 0x01,
82dd98ed8dSStephan Aßmus	UPDATE_EXPOSE		= 0x02,
83dd98ed8dSStephan Aßmus};
84dd98ed8dSStephan Aßmus
8523e00a25SAxel Dörfler
86953d895eSAxel Dörflerclass Window {
872c184b20SAxel Dörflerpublic:
88953d895eSAxel Dörfler								Window(const BRect& frame, const char *name,
89953d895eSAxel Dörfler									window_look look, window_feel feel,
90953d895eSAxel Dörfler									uint32 flags, uint32 workspaces,
91953d895eSAxel Dörfler									::ServerWindow* window,
92953d895eSAxel Dörfler									DrawingEngine* drawingEngine);
93953d895eSAxel Dörfler	virtual						~Window();
9485096c8aSAxel Dörfler
95582b3d5aSStephan Aßmus			status_t			InitCheck() const;
96582b3d5aSStephan Aßmus
97e83820edSAxel Dörfler			BRect				Frame() const { return fFrame; }
98e83820edSAxel Dörfler			const char*			Title() const { return fTitle.String(); }
99e83820edSAxel Dörfler
100e83820edSAxel Dörfler			window_anchor&		Anchor(int32 index);
101953d895eSAxel Dörfler			Window*				NextWindow(int32 index) const;
102953d895eSAxel Dörfler			Window*				PreviousWindow(int32 index) const;
103e83820edSAxel Dörfler
104e83820edSAxel Dörfler			::Desktop*			Desktop() const { return fDesktop; }
105bb2e9b06SClemens Zeidler			::Decorator*		Decorator() const;
106e83820edSAxel Dörfler			::ServerWindow*		ServerWindow() const { return fWindow; }
107ea5c7202SAxel Dörfler			::EventTarget&		EventTarget() const
108ea5c7202SAxel Dörfler									{ return fWindow->EventTarget(); }
109e83820edSAxel Dörfler
110b6ba2290SClemens Zeidler			bool				ReloadDecor();
111bb86786aSClemens Zeidler
11278ca6157SAxel Dörfler			void				SetScreen(const ::Screen* screen);
11378ca6157SAxel Dörfler			const ::Screen*		Screen() const;
114fe7f167dSAxel Dörfler
115e83820edSAxel Dörfler			// setting and getting the "hard" clipping, you need to have
116e83820edSAxel Dörfler			// WriteLock()ed the clipping!
117e83820edSAxel Dörfler			void				SetClipping(BRegion* stillAvailableOnScreen);
118e83820edSAxel Dörfler			// you need to have ReadLock()ed the clipping!
119e83820edSAxel Dörfler	inline	BRegion&			VisibleRegion() { return fVisibleRegion; }
120e83820edSAxel Dörfler			BRegion&			VisibleContentRegion();
121e83820edSAxel Dörfler
122e83820edSAxel Dörfler			// TODO: not protected by a lock, but noone should need this anyways
123953d895eSAxel Dörfler			// make private? when used inside Window, it has the ReadLock()
124e83820edSAxel Dörfler			void				GetFullRegion(BRegion* region);
125e83820edSAxel Dörfler			void				GetBorderRegion(BRegion* region);
126e83820edSAxel Dörfler			void				GetContentRegion(BRegion* region);
127e83820edSAxel Dörfler
128bb2e9b06SClemens Zeidler			void				MoveBy(int32 x, int32 y, bool moveStack = true);
129ea5c7202SAxel Dörfler			void				ResizeBy(int32 x, int32 y,
130bb2e9b06SClemens Zeidler									BRegion* dirtyRegion,
131bb2e9b06SClemens Zeidler									bool resizeStack = true);
132e83820edSAxel Dörfler
133953d895eSAxel Dörfler			void				ScrollViewBy(View* view, int32 dx, int32 dy);
134e83820edSAxel Dörfler
135437b1927SAxel Dörfler			void				SetTopView(View* topView);
136437b1927SAxel Dörfler			View*				TopView() const { return fTopView; }
137953d895eSAxel Dörfler			View*				ViewAt(const BPoint& where);
13885096c8aSAxel Dörfler
139e83820edSAxel Dörfler	virtual	bool				IsOffscreenWindow() const { return false; }
140359c905cSStephan Aßmus
141ea5c7202SAxel Dörfler			void				GetEffectiveDrawingRegion(View* view,
142ea5c7202SAxel Dörfler									BRegion& region);
143437b1927SAxel Dörfler			bool				DrawingRegionChanged(View* view) const;
144359c905cSStephan Aßmus
145e83820edSAxel Dörfler			// generic version, used by the Desktop
146e83820edSAxel Dörfler			void				ProcessDirtyRegion(BRegion& regionOnScreen);
147e83820edSAxel Dörfler			void				RedrawDirtyRegion();
148359c905cSStephan Aßmus
149e83820edSAxel Dörfler			// can be used from inside classes that don't
150e83820edSAxel Dörfler			// need to know about Desktop (first version uses Desktop)
151e83820edSAxel Dörfler			void				MarkDirty(BRegion& regionOnScreen);
152f5643345SStephan Aßmus			// these versions do not use the Desktop
153e83820edSAxel Dörfler			void				MarkContentDirty(BRegion& regionOnScreen);
154f5643345SStephan Aßmus			void				MarkContentDirtyAsync(BRegion& regionOnScreen);
155e83820edSAxel Dörfler			// shortcut for invalidating just one view
156437b1927SAxel Dörfler			void				InvalidateView(View* view, BRegion& viewRegion);
1572c8cfe2dSAdi Oanca
158e83820edSAxel Dörfler			void				DisableUpdateRequests();
159d755e1c0SStephan Aßmus			void				EnableUpdateRequests();
160e603410bSAdi Oanca
161bb160ab5SStephan Aßmus			void				BeginUpdate(BPrivate::PortLink& link);
162e83820edSAxel Dörfler			void				EndUpdate();
163bee1ec1eSStephan Aßmus			bool				InUpdate() const
164bee1ec1eSStephan Aßmus									{ return fInUpdate; }
16595994777SAdi Oanca
166e83820edSAxel Dörfler			bool				NeedsUpdate() const
167e83820edSAxel Dörfler									{ return fUpdateRequested; }
169e83820edSAxel Dörfler			DrawingEngine*		GetDrawingEngine() const
170e83820edSAxel Dörfler									{ return fDrawingEngine; }
17128d42d6eSAdi Oanca
17239c9925fSStephan Aßmus			// managing a region pool
17339c9925fSStephan Aßmus			::RegionPool*		RegionPool()
17439c9925fSStephan Aßmus									{ return &fRegionPool; }
17539c9925fSStephan Aßmus	inline	BRegion*			GetRegion()
17639c9925fSStephan Aßmus									{ return fRegionPool.GetRegion(); }
17739c9925fSStephan Aßmus	inline	BRegion*			GetRegion(const BRegion& copy)
17839c9925fSStephan Aßmus									{ return fRegionPool.GetRegion(copy); }
17939c9925fSStephan Aßmus	inline	void				RecycleRegion(BRegion* region)
18039c9925fSStephan Aßmus									{ fRegionPool.Recycle(region); }
18139c9925fSStephan Aßmus
182e83820edSAxel Dörfler			void				CopyContents(BRegion* region,
183953d895eSAxel Dörfler									int32 xOffset, int32 yOffset);
18428d42d6eSAdi Oanca
185ea5c7202SAxel Dörfler			void				MouseDown(BMessage* message, BPoint where,
186427788e0SIngo Weinhold									const ClickTarget& lastClickTarget,
187427788e0SIngo Weinhold									int32& clickCount,
188427788e0SIngo Weinhold									ClickTarget& _clickTarget);
189ea5c7202SAxel Dörfler			void				MouseUp(BMessage* message, BPoint where,
190ea5c7202SAxel Dörfler									int32* _viewToken);
191ea5c7202SAxel Dörfler			void				MouseMoved(BMessage* message, BPoint where,
192c6906c28SAxel Dörfler									int32* _viewToken, bool isLatestMouseMoved,
193c6906c28SAxel Dörfler									bool isFake);
19433691ce0SAdi Oanca
19576107eebSIngo Weinhold			void				ModifiersChanged(int32 modifiers);
19676107eebSIngo Weinhold
197e83820edSAxel Dörfler			// some hooks to inform the client window
198e83820edSAxel Dörfler			// TODO: move this to ServerWindow maybe?
199e83820edSAxel Dörfler			void				WorkspaceActivated(int32 index, bool active);
200ea5c7202SAxel Dörfler			void				WorkspacesChanged(uint32 oldWorkspaces,
201ea5c7202SAxel Dörfler									uint32 newWorkspaces);
202e83820edSAxel Dörfler			void				Activated(bool active);
20399b9d5acSStephan Aßmus
204e83820edSAxel Dörfler			// changing some properties
205939fb407SStephan Aßmus			void				SetTitle(const char* name, BRegion& dirty);
206e83820edSAxel Dörfler
207e83820edSAxel Dörfler			void				SetFocus(bool focus);
208f89b4c9aSAxel Dörfler			bool				IsFocus() const { return fIsFocus; }
209f89b4c9aSAxel Dörfler
210e83820edSAxel Dörfler			void				SetHidden(bool hidden);
211e83820edSAxel Dörfler	inline	bool				IsHidden() const { return fHidden; }
212165177a1SAdi Oanca
21396cabf58SRyan Leavengood			void				SetShowLevel(int32 showLevel);
21496cabf58SRyan Leavengood	inline	int32				ShowLevel() const { return fShowLevel; }
21596cabf58SRyan Leavengood
216995ab7b3SAxel Dörfler			void				SetMinimized(bool minimized);
217995ab7b3SAxel Dörfler	inline	bool				IsMinimized() const { return fMinimized; }
218995ab7b3SAxel Dörfler
219e83820edSAxel Dörfler			void				SetCurrentWorkspace(int32 index)
220e83820edSAxel Dörfler									{ fCurrentWorkspace = index; }
221177ecc46SClemens Zeidler			int32				CurrentWorkspace() const
222177ecc46SClemens Zeidler									{ return fCurrentWorkspace; }
223e83820edSAxel Dörfler			bool				IsVisible() const;
224e83820edSAxel Dörfler
225177ecc46SClemens Zeidler			bool				IsDragging() const;
226177ecc46SClemens Zeidler			bool				IsResizing() const;
227f025cd8bSAxel Dörfler
228e83820edSAxel Dörfler			void				SetSizeLimits(int32 minWidth, int32 maxWidth,
229e83820edSAxel Dörfler									int32 minHeight, int32 maxHeight);
230e83820edSAxel Dörfler
231e83820edSAxel Dörfler			void				GetSizeLimits(int32* minWidth, int32* maxWidth,
232e83820edSAxel Dörfler									int32* minHeight, int32* maxHeight) const;
233e83820edSAxel Dörfler
234e83820edSAxel Dörfler								// 0.0 -> left .... 1.0 -> right
235bb2e9b06SClemens Zeidler			bool				SetTabLocation(float location, bool isShifting,
236bb2e9b06SClemens Zeidler									BRegion& dirty);
237e83820edSAxel Dörfler			float				TabLocation() const;
238e83820edSAxel Dörfler
239b30e9021SStephan Aßmus			bool				SetDecoratorSettings(const BMessage& settings,
24085d512edSPhilippe Houdoin													 BRegion& dirty);
241b30e9021SStephan Aßmus			bool				GetDecoratorSettings(BMessage* settings);
242b30e9021SStephan Aßmus
243e83820edSAxel Dörfler			void				HighlightDecorator(bool active);
244a631158aSAxel Dörfler
2450a3f410fSAxel Dörfler			void				FontsChanged(BRegion* updateRegion);
2467f9368caSlooncraz			void				ColorsChanged(BRegion* updateRegion);
2470a3f410fSAxel Dörfler
248ea5c7202SAxel Dörfler			void				SetLook(window_look look,
249ea5c7202SAxel Dörfler									BRegion* updateRegion);
25057be2866SAxel Dörfler			void				SetFeel(window_feel feel);
251e83820edSAxel Dörfler			void				SetFlags(uint32 flags, BRegion* updateRegion);
252e83820edSAxel Dörfler
253e83820edSAxel Dörfler			window_look			Look() const { return fLook; }
254e83820edSAxel Dörfler			window_feel			Feel() const { return fFeel; }
255e83820edSAxel Dörfler			uint32				Flags() const { return fFlags; }
25657be2866SAxel Dörfler
257e83820edSAxel Dörfler			// window manager stuff
258a631158aSAxel Dörfler			uint32				Workspaces() const { return fWorkspaces; }
25927adb969SAxel Dörfler			void				SetWorkspaces(uint32 workspaces)
26027adb969SAxel Dörfler									{ fWorkspaces = workspaces; }
26134227d2cSAxel Dörfler			bool				InWorkspace(int32 index) const;
26227adb969SAxel Dörfler
26327adb969SAxel Dörfler			bool				SupportsFront();
264d7c2c050SAdi Oanca
265fc21e33eSAxel Dörfler			bool				IsModal() const;
266fc21e33eSAxel Dörfler			bool				IsFloating() const;
267e83820edSAxel Dörfler			bool				IsNormal() const;
268e438905aSAdi Oanca
269cc4612feSAxel Dörfler			bool				HasModal() const;
270cc4612feSAxel Dörfler
271953d895eSAxel Dörfler			Window*				Frontmost(Window* first = NULL,
272953d895eSAxel Dörfler									int32 workspace = -1);
273953d895eSAxel Dörfler			Window*				Backmost(Window* first = NULL,
274953d895eSAxel Dörfler									int32 workspace = -1);
27548ccf5abSAxel Dörfler
276953d895eSAxel Dörfler			bool				AddToSubset(Window* window);
277953d895eSAxel Dörfler			void				RemoveFromSubset(Window* window);
278953d895eSAxel Dörfler			bool				HasInSubset(const Window* window) const;
279953d895eSAxel Dörfler			bool				SameSubset(Window* window);
28034227d2cSAxel Dörfler			uint32				SubsetWorkspaces() const;
281bd2509c5SAxel Dörfler			bool				InSubsetWorkspace(int32 index) const;
282359c905cSStephan Aßmus
2832c184b20SAxel Dörfler			bool				HasWorkspacesViews() const
2842c184b20SAxel Dörfler									{ return fWorkspacesViewCount != 0; }
2852c184b20SAxel Dörfler			void				AddWorkspacesView()
2862c184b20SAxel Dörfler									{ fWorkspacesViewCount++; }
2872c184b20SAxel Dörfler			void				RemoveWorkspacesView()
2882c184b20SAxel Dörfler									{ fWorkspacesViewCount--; }
2892c184b20SAxel Dörfler			void				FindWorkspacesViews(
290953d895eSAxel Dörfler									BObjectList<WorkspacesView>& list) const;
2912c184b20SAxel Dörfler
29278ca6157SAxel Dörfler	static	bool				IsValidLook(window_look look);
29378ca6157SAxel Dörfler	static	bool				IsValidFeel(window_feel feel);
29478ca6157SAxel Dörfler	static	bool				IsModalFeel(window_feel feel);
29578ca6157SAxel Dörfler	static	bool				IsFloatingFeel(window_feel feel);
296fc21e33eSAxel Dörfler
29778ca6157SAxel Dörfler	static	uint32				ValidWindowFlags();
29878ca6157SAxel Dörfler	static	uint32				ValidWindowFlags(window_feel feel);
299aecd5eefSAxel Dörfler
300bb2e9b06SClemens Zeidler			// Window stack methods.
301bb2e9b06SClemens Zeidler			WindowStack*		GetWindowStack();
302bb2e9b06SClemens Zeidler
303bb2e9b06SClemens Zeidler			bool				DetachFromWindowStack(
304bb2e9b06SClemens Zeidler									bool ownStackNeeded = true);
305bb2e9b06SClemens Zeidler			bool				AddWindowToStack(Window* window);
306bb2e9b06SClemens Zeidler			Window*				StackedWindowAt(const BPoint& where);
307bb2e9b06SClemens Zeidler			Window*				TopLayerStackWindow();
308bb2e9b06SClemens Zeidler
309bb2e9b06SClemens Zeidler			int32				PositionInStack() const;
310bb2e9b06SClemens Zeidler			bool				MoveToTopStackLayer();
311bb2e9b06SClemens Zeidler			bool				MoveToStackPosition(int32 index,
312bb2e9b06SClemens Zeidler									bool isMoving);
3132c184b20SAxel Dörflerprotected:
314953d895eSAxel Dörfler			void				_ShiftPartOfRegion(BRegion* region,
315953d895eSAxel Dörfler									BRegion* regionToShift, int32 xOffset,
316953d895eSAxel Dörfler									int32 yOffset);
317e83820edSAxel Dörfler
318e83820edSAxel Dörfler			// different types of drawing
319ce8ae4d8SStephan Aßmus			void				_TriggerContentRedraw(BRegion& dirty);
320e83820edSAxel Dörfler			void				_DrawBorder();
321e83820edSAxel Dörfler
322e83820edSAxel Dörfler			// handling update sessions
323ea5c7202SAxel Dörfler			void				_TransferToUpdateSession(
324ea5c7202SAxel Dörfler									BRegion* contentDirtyRegion);
325e83820edSAxel Dörfler			void				_SendUpdateMessage();
326e83820edSAxel Dörfler
327e83820edSAxel Dörfler			void				_UpdateContentRegion();
328e83820edSAxel Dörfler
329e83820edSAxel Dörfler			void				_ObeySizeLimits();
330159fdf20SAxel Dörfler			void				_PropagatePosition();
331e83820edSAxel Dörfler
332bd2509c5SAxel Dörfler			BString				fTitle;
333e83820edSAxel Dörfler			// TODO: no fp rects anywhere
334e83820edSAxel Dörfler			BRect				fFrame;
33578ca6157SAxel Dörfler			const ::Screen*		fScreen;
336e83820edSAxel Dörfler
337159fdf20SAxel Dörfler			window_anchor		fAnchor[kListCount];
338e83820edSAxel Dörfler
339e83820edSAxel Dörfler			// the visible region is only recalculated from the
340e83820edSAxel Dörfler			// Desktop thread, when using it, Desktop::ReadLockClipping()
341e83820edSAxel Dörfler			// has to be called
342bd2509c5SAxel Dörfler
343e83820edSAxel Dörfler			BRegion				fVisibleRegion;
344e83820edSAxel Dörfler			BRegion				fVisibleContentRegion;
345e83820edSAxel Dörfler			// our part of the "global" dirty region
346e83820edSAxel Dörfler			// it is calculated from the desktop thread,
347e83820edSAxel Dörfler			// but we can write to it when we read locked
348e83820edSAxel Dörfler			// the clipping, since it is local and the desktop
349e83820edSAxel Dörfler			// thread is blocked
350e83820edSAxel Dörfler			BRegion				fDirtyRegion;
351dd98ed8dSStephan Aßmus			uint32				fDirtyCause;
352e83820edSAxel Dörfler
353e83820edSAxel Dörfler			// caching local regions
354e83820edSAxel Dörfler			BRegion				fContentRegion;
355e83820edSAxel Dörfler			BRegion				fEffectiveDrawingRegion;
356c1770641SStephan Aßmus
357c1770641SStephan Aßmus			bool				fVisibleContentRegionValid : 1;
358c1770641SStephan Aßmus			bool				fContentRegionValid : 1;
359c1770641SStephan Aßmus			bool				fEffectiveDrawingRegionValid : 1;
360f89b4c9aSAxel Dörfler
36139c9925fSStephan Aßmus			::RegionPool		fRegionPool;
36239c9925fSStephan Aßmus
363953d895eSAxel Dörfler			BObjectList<Window> fSubsets;
36448ccf5abSAxel Dörfler
365177ecc46SClemens Zeidler			WindowBehaviour*	fWindowBehaviour;
366437b1927SAxel Dörfler			View*				fTopView;
367e83820edSAxel Dörfler			::ServerWindow*		fWindow;
368e83820edSAxel Dörfler			DrawingEngine*		fDrawingEngine;
369e83820edSAxel Dörfler			::Desktop*			fDesktop;
37099b9d5acSStephan Aßmus
371e83820edSAxel Dörfler			// The synchronization, which client drawing commands
372e83820edSAxel Dörfler			// belong to the redraw of which dirty region is handled
373e83820edSAxel Dörfler			// through an UpdateSession. When the client has
374e83820edSAxel Dörfler			// been informed that it should redraw stuff, then
375e83820edSAxel Dörfler			// this is the current update session. All new
376e83820edSAxel Dörfler			// redraw requests from the Desktop will go
377e83820edSAxel Dörfler			// into the pending update session.
378e83820edSAxel Dörfler	class UpdateSession {
3792c184b20SAxel Dörfler	public:
380e83820edSAxel Dörfler									UpdateSession();
381e83820edSAxel Dörfler		virtual						~UpdateSession();
382bd2509c5SAxel Dörfler
383e83820edSAxel Dörfler				void				Include(BRegion* additionalDirty);
384e83820edSAxel Dörfler				void				Exclude(BRegion* dirtyInNextSession);
385bd2509c5SAxel Dörfler
386e83820edSAxel Dörfler		inline	BRegion&			DirtyRegion()
387e83820edSAxel Dörfler										{ return fDirtyRegion; }
388bd2509c5SAxel Dörfler
389e83820edSAxel Dörfler				void				MoveBy(int32 x, int32 y);
390bd2509c5SAxel Dörfler
391e83820edSAxel Dörfler				void				SetUsed(bool used);
392e83820edSAxel Dörfler		inline	bool				IsUsed() const
393e83820edSAxel Dörfler										{ return fInUse; }
394dd98ed8dSStephan Aßmus
395dd98ed8dSStephan Aßmus				void				AddCause(uint8 cause);
396dd98ed8dSStephan Aßmus		inline	bool				IsExpose() const
397dd98ed8dSStephan Aßmus										{ return fCause & UPDATE_EXPOSE; }
398dd98ed8dSStephan Aßmus		inline	bool				IsRequest() const
399dd98ed8dSStephan Aßmus										{ return fCause & UPDATE_REQUEST; }
400bd2509c5SAxel Dörfler
4012c184b20SAxel Dörfler	private:
402e83820edSAxel Dörfler				BRegion				fDirtyRegion;
403e83820edSAxel Dörfler				bool				fInUse;
404dd98ed8dSStephan Aßmus				uint8				fCause;
405e83820edSAxel Dörfler	};
406e83820edSAxel Dörfler
407052ae287SStephan Aßmus			UpdateSession		fUpdateSessions[2];
408052ae287SStephan Aßmus			UpdateSession*		fCurrentUpdateSession;
409052ae287SStephan Aßmus			UpdateSession*		fPendingUpdateSession;
410e83820edSAxel Dörfler			// these two flags are supposed to ensure a sane
411e83820edSAxel Dörfler			// and consistent update session
412f7e1df75SStephan Aßmus			bool				fUpdateRequested : 1;
413f7e1df75SStephan Aßmus			bool				fInUpdate : 1;
414d755e1c0SStephan Aßmus			bool				fUpdatesEnabled : 1;
415e83820edSAxel Dörfler
416f7e1df75SStephan Aßmus			bool				fHidden : 1;
41796cabf58SRyan Leavengood			int32				fShowLevel;
418f7e1df75SStephan Aßmus			bool				fMinimized : 1;
419f7e1df75SStephan Aßmus			bool				fIsFocus : 1;
4200cb3fddaSAdi Oanca
42185096c8aSAxel Dörfler			window_look			fLook;
42285096c8aSAxel Dörfler			window_feel			fFeel;
423159fdf20SAxel Dörfler			uint32				fOriginalFlags;
424e83820edSAxel Dörfler			uint32				fFlags;
425d7c2c050SAdi Oanca			uint32				fWorkspaces;
426e83820edSAxel Dörfler			int32				fCurrentWorkspace;
427e83820edSAxel Dörfler
428e83820edSAxel Dörfler			int32				fMinWidth;
429e83820edSAxel Dörfler			int32				fMaxWidth;
430e83820edSAxel Dörfler			int32				fMinHeight;
431e83820edSAxel Dörfler			int32				fMaxHeight;
4322c184b20SAxel Dörfler
4332c184b20SAxel Dörfler			int32				fWorkspacesViewCount;
434b46615c5SStephan Aßmus
435b46615c5SStephan Aßmus		friend class DecorManager;
436bb2e9b06SClemens Zeidler
437bb2e9b06SClemens Zeidlerprivate:
438bb2e9b06SClemens Zeidler			WindowStack*		_InitWindowStack();
439bb2e9b06SClemens Zeidler
440bb2e9b06SClemens Zeidler			BReference<WindowStack>		fCurrentStack;
443bb2e9b06SClemens Zeidler
444953d895eSAxel Dörfler#endif // WINDOW_H