xref: /haiku/headers/os/game/WindowScreen.h (revision e8faedae5770a87aacd3af0f1035501c437bbbb4)
1 /*
2  *  Copyright 2020, Haiku, Inc. All Rights Reserved.
3  *  Distributed under the terms of the MIT License.
4  */
5 #ifndef	_WINDOW_SCREEN_H
6 #define	_WINDOW_SCREEN_H
7 
8 
9 #include <Accelerant.h>
10 #include <GraphicsCard.h>
11 #include <OS.h>
12 #include <SupportDefs.h>
13 #include <Window.h>
14 #include <kernel/image.h>
15 
16 
17 void set_mouse_position(int32 x, int32 y);
18 
19 enum {
20 	B_ENABLE_VIEW_DRAWING	= 0x0001,
21 	B_ENABLE_DEBUGGER		= 0x0002
22 };
23 
24 class BWindowScreen : public BWindow {
25 public:
26 						BWindowScreen(const char* title, uint32 space,
27 							status_t* _error, bool debugMode = false);
28 	        			BWindowScreen(const char* title, uint32 space,
29 	        				uint32 attributes, status_t* _error);
30 	virtual				~BWindowScreen();
31 
32 	virtual	void		Quit();
33 	virtual	void		ScreenConnected(bool active);
34     		void		Disconnect();
35 
36 	virtual	void		WindowActivated(bool active);
37 	virtual	void		WorkspaceActivated(int32 workspace, bool active);
38 	virtual	void		ScreenChanged(BRect screenSize, color_space depth);
39 
40 	virtual	void		Hide();
41 	virtual	void		Show();
42 
43 			void		SetColorList(rgb_color* list, int32 firstIndex = 0,
44 							int32 lastIndex = 255);
45 			status_t	SetSpace(uint32 space);
46 
47 			bool		CanControlFrameBuffer();
48 			status_t	SetFrameBuffer(int32 width, int32 height);
49 			status_t	MoveDisplayArea(int32 x, int32 y);
50 	rgb_color*			ColorList();
51 	frame_buffer_info*	FrameBufferInfo();
52 	graphics_card_hook	CardHookAt(int32 index);
53 	graphics_card_info*	CardInfo();
54 			void		RegisterThread(thread_id thread);
55 	virtual	void		SuspensionHook(bool active);
56 			void		Suspend(char* label);
57 
58 private:
59 	virtual status_t	Perform(perform_code d, void* arg);
60 	virtual	void		_ReservedWindowScreen1();
61 	virtual	void		_ReservedWindowScreen2();
62 	virtual	void		_ReservedWindowScreen3();
63 	virtual	void		_ReservedWindowScreen4();
64 			status_t	_InitData(uint32 space, uint32 attributes);
65 			void		_DisposeData();
66 			status_t	_LockScreen(bool lock);
67 			status_t	_Activate();
68 			status_t	_Deactivate();
69 			status_t	_SetupAccelerantHooks();
70 			void		_ResetAccelerantHooks();
71 			status_t	_GetCardInfo();
72 			void		_Suspend();
73 			void		_Resume();
74 			status_t	_GetModeFromSpace(uint32 space, display_mode* mode);
75 			status_t	_InitClone();
76 			status_t	_AssertDisplayMode(display_mode* mode);
77 
78 private:
79 			uint16		_reserved0;
80 			bool		_reserved1;
81 			bool		fWorkState;
82 			bool		fWindowState;
83 			bool		fActivateState;
84 			int32		fLockState;
85 			int32		fWorkspaceIndex;
86 
87 	display_mode*		fOriginalDisplayMode;
88 	display_mode*		fDisplayMode;
89 			sem_id		fDebugSem;
90 			image_id	fAddonImage;
91 			uint32		fAttributes;
92 
93 			rgb_color	fPalette[256];
94 
95 	graphics_card_info	fCardInfo;
96 	frame_buffer_info	fFrameBufferInfo;
97 
98 			char*		fDebugFrameBuffer;
99 			bool		fDebugState;
100 			bool		fDebugFirst;
101 			int32		fDebugWorkspace;
102 			int32		fDebugThreadCount;
103 			thread_id*	fDebugThreads;
104 			uint32		fModeCount;
105 	display_mode*		fModeList;
106 
107 	GetAccelerantHook	fGetAccelerantHook;
108 	wait_engine_idle	fWaitEngineIdle;
109 
110 			uint32		_reserved[163];
111 };
112 
113 #endif