2 * Copyright 2001-2008 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Stefano Ceccherini <stefano.ceccherini@gmail.com>
8 #ifndef _DIRECT_WINDOW_H
9 #define _DIRECT_WINDOW_H
16 enum direct_buffer_state
{
17 B_DIRECT_MODE_MASK
= 15,
23 B_CLIPPING_MODIFIED
= 16,
24 B_BUFFER_RESIZED
= 32,
30 enum direct_driver_state
{
31 B_DRIVER_CHANGED
= 0x0001,
32 B_MODE_CHANGED
= 0x0002
37 direct_buffer_state buffer_state
;
38 direct_driver_state driver_state
;
42 uint32 bits_per_pixel
;
43 color_space pixel_format
;
45 buffer_orientation orientation
;
49 uint32 clip_list_count
;
50 clipping_rect window_bounds
;
51 clipping_rect clip_bounds
;
52 clipping_rect clip_list
[1];
56 class BDirectWindow
: public BWindow
{
58 BDirectWindow(BRect frame
, const char* title
,
59 window_type type
, uint32 flags
,
60 uint32 workspace
= B_CURRENT_WORKSPACE
);
61 BDirectWindow(BRect frame
, const char* title
,
62 window_look look
, window_feel feel
,
64 uint32 workspace
= B_CURRENT_WORKSPACE
);
65 virtual ~BDirectWindow();
67 static BArchivable
* Instantiate(BMessage
* data
);
68 virtual status_t
Archive(BMessage
* data
,
69 bool deep
= true) const;
72 virtual void DispatchMessage(BMessage
* message
,
74 virtual void MessageReceived(BMessage
* message
);
75 virtual void FrameMoved(BPoint newPosition
);
76 virtual void WorkspacesChanged(uint32 oldWorkspaces
,
77 uint32 newWorkspaces
);
78 virtual void WorkspaceActivated(int32 workspaceIndex
,
80 virtual void FrameResized(float newWidth
, float newHeight
);
81 virtual void Minimize(bool minimize
);
82 virtual void Zoom(BPoint recPosition
, float recWidth
,
84 virtual void ScreenChanged(BRect screenFrame
,
86 virtual void MenusBeginning();
87 virtual void MenusEnded();
88 virtual void WindowActivated(bool state
);
91 virtual BHandler
* ResolveSpecifier(BMessage
* message
,
92 int32 index
, BMessage
* specifier
,
93 int32 what
, const char* property
);
94 virtual status_t
GetSupportedSuites(BMessage
* data
);
95 virtual status_t
Perform(perform_code code
, void* arg
);
98 virtual void task_looper();
99 virtual BMessage
* ConvertToMessage(void* raw
, int32 code
);
102 virtual void DirectConnected(direct_buffer_info
* info
);
103 status_t
GetClippingRegion(BRegion
* region
,
104 BPoint
* origin
= NULL
) const;
105 status_t
SetFullScreen(bool enable
);
106 bool IsFullScreen() const;
108 static bool SupportsWindowMode(
109 screen_id id
= B_MAIN_SCREEN_ID
);
112 typedef BWindow inherited
;
114 virtual void _ReservedDirectWindow1();
115 virtual void _ReservedDirectWindow2();
116 virtual void _ReservedDirectWindow3();
117 virtual void _ReservedDirectWindow4();
120 BDirectWindow(BDirectWindow
& other
);
121 BDirectWindow
& operator=(BDirectWindow
& other
);
123 static int32
_daemon_thread(void* arg
);
124 int32
_DirectDaemon();
125 bool _LockDirect() const;
126 void _UnlockDirect() const;
132 bool fConnectionEnable
;
135 bool fInDirectConnect
;
139 uint32 fDirectLockCount
;
140 thread_id fDirectLockOwner
;
141 char* fDirectLockStack
;
144 sem_id fDisableSemAck
;
147 uint32 fInfoAreaSize
;
151 area_id fClonedClippingArea
;
152 area_id fSourceClippingArea
;
153 thread_id fDirectDaemonId
;
154 direct_buffer_info
* fBufferDesc
;
156 uint32 _more_reserved_
[17];
160 #endif // _DIRECT_WINDOW_H