more cleanups. I'll probably end up rewriting the etire header
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15673 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -56,35 +56,36 @@ enum {
|
|||||||
|
|
||||||
class BWindowScreen : public BWindow {
|
class BWindowScreen : public BWindow {
|
||||||
public:
|
public:
|
||||||
BWindowScreen(const char *title,
|
BWindowScreen(const char *title, uint32 space, status_t *error,
|
||||||
uint32 space,
|
bool debug_enable = false);
|
||||||
status_t *error,
|
BWindowScreen(const char *title, uint32 space, uint32 attributes,
|
||||||
bool debug_enable = false);
|
status_t *error);
|
||||||
BWindowScreen(const char *title,
|
virtual ~BWindowScreen();
|
||||||
uint32 space,
|
|
||||||
uint32 attributes,
|
|
||||||
status_t *error);
|
|
||||||
virtual ~BWindowScreen();
|
|
||||||
virtual void Quit(void);
|
|
||||||
virtual void ScreenConnected(bool active);
|
|
||||||
void Disconnect();
|
|
||||||
virtual void WindowActivated(bool active);
|
|
||||||
virtual void WorkspaceActivated(int32 ws, bool state);
|
|
||||||
virtual void ScreenChanged(BRect screen_size, color_space depth);
|
|
||||||
virtual void Hide();
|
|
||||||
virtual void Show();
|
|
||||||
void SetColorList(rgb_color *list,int32 first_index = 0,int32 last_index = 255);
|
|
||||||
status_t SetSpace(uint32 space);
|
|
||||||
bool CanControlFrameBuffer();
|
|
||||||
status_t SetFrameBuffer(int32 width, int32 height);
|
|
||||||
status_t MoveDisplayArea(int32 x, int32 y);
|
|
||||||
|
|
||||||
void *IOBase(); // Not supported anymore. It always returns NULL
|
virtual void Quit();
|
||||||
|
virtual void ScreenConnected(bool active);
|
||||||
|
void Disconnect();
|
||||||
|
|
||||||
|
virtual void WindowActivated(bool active);
|
||||||
|
virtual void WorkspaceActivated(int32 ws, bool state);
|
||||||
|
virtual void ScreenChanged(BRect screen_size, color_space depth);
|
||||||
|
|
||||||
|
virtual void Hide();
|
||||||
|
virtual void Show();
|
||||||
|
|
||||||
|
void SetColorList(rgb_color *list,int32 first_index = 0,int32 last_index = 255);
|
||||||
|
status_t SetSpace(uint32 space);
|
||||||
|
|
||||||
|
bool CanControlFrameBuffer();
|
||||||
|
status_t SetFrameBuffer(int32 width, int32 height);
|
||||||
|
status_t MoveDisplayArea(int32 x, int32 y);
|
||||||
|
|
||||||
|
void *IOBase(); // Not supported anymore. It always returns NULL
|
||||||
|
|
||||||
rgb_color *ColorList();
|
rgb_color *ColorList();
|
||||||
frame_buffer_info *FrameBufferInfo();
|
frame_buffer_info *FrameBufferInfo();
|
||||||
graphics_card_hook CardHookAt(int32 index);
|
graphics_card_hook CardHookAt(int32 index);
|
||||||
graphics_card_info *CardInfo();
|
graphics_card_info *CardInfo();
|
||||||
|
|
||||||
/******************************* Debugger API Notice ********************************
|
/******************************* Debugger API Notice ********************************
|
||||||
Those three calls, and the debug_enable flag in the constructor, have been added to
|
Those three calls, and the debug_enable flag in the constructor, have been added to
|
||||||
@@ -134,16 +135,16 @@ virtual void Show();
|
|||||||
The Debug API will not be support after the Preview Release (replaced by the debug
|
The Debug API will not be support after the Preview Release (replaced by the debug
|
||||||
API in the new WindowScreen class).
|
API in the new WindowScreen class).
|
||||||
***************************************************************************************/
|
***************************************************************************************/
|
||||||
void RegisterThread(thread_id id);
|
void RegisterThread(thread_id id);
|
||||||
virtual void SuspensionHook(bool active);
|
virtual void SuspensionHook(bool active);
|
||||||
void Suspend(char *label);
|
void Suspend(char *label);
|
||||||
|
|
||||||
|
|
||||||
virtual status_t Perform(perform_code d, void *arg);
|
virtual status_t Perform(perform_code d, void *arg);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
typedef BWindow inherited;
|
typedef BWindow inherited;
|
||||||
|
|
||||||
virtual void _ReservedWindowScreen1();
|
virtual void _ReservedWindowScreen1();
|
||||||
virtual void _ReservedWindowScreen2();
|
virtual void _ReservedWindowScreen2();
|
||||||
@@ -156,14 +157,13 @@ virtual void _ReservedWindowScreen4();
|
|||||||
|
|
||||||
char _unused;
|
char _unused;
|
||||||
char space_mode;
|
char space_mode;
|
||||||
void *io_buffer;
|
bool direct_enable;
|
||||||
bool direct_enable;
|
|
||||||
bool fWorkState;
|
bool fWorkState;
|
||||||
bool fWindowState;
|
bool fWindowState;
|
||||||
bool fActivateState;
|
bool fActivateState;
|
||||||
int32 fLockState;
|
int32 fLockState;
|
||||||
int32 fScreenIndex;
|
int32 fScreenIndex;
|
||||||
int32 memory_area, io_area;
|
|
||||||
display_mode *fOldDisplayMode;
|
display_mode *fOldDisplayMode;
|
||||||
display_mode *fDisplayMode;
|
display_mode *fDisplayMode;
|
||||||
uint32 space0;
|
uint32 space0;
|
||||||
@@ -172,8 +172,9 @@ virtual void _ReservedWindowScreen4();
|
|||||||
image_id fAddonImage;
|
image_id fAddonImage;
|
||||||
|
|
||||||
rgb_color fColorList[256];
|
rgb_color fColorList[256];
|
||||||
GetAccelerantHook m_gah;
|
GetAccelerantHook fGetAccelerantHook;
|
||||||
graphics_card_info fCardInfo;
|
graphics_card_info fCardInfo;
|
||||||
|
|
||||||
graphics_card_hook hooks[B_HOOK_COUNT];
|
graphics_card_hook hooks[B_HOOK_COUNT];
|
||||||
_direct_screen_info_ info;
|
_direct_screen_info_ info;
|
||||||
frame_buffer_info fFrameBufferInfo;
|
frame_buffer_info fFrameBufferInfo;
|
||||||
@@ -188,7 +189,8 @@ virtual void _ReservedWindowScreen4();
|
|||||||
uint32 fAttributes;
|
uint32 fAttributes;
|
||||||
uint32 fModeCount;
|
uint32 fModeCount;
|
||||||
display_mode *fModeList;
|
display_mode *fModeList;
|
||||||
engine_token *et;
|
|
||||||
|
engine_token *fEngineToken;
|
||||||
wait_engine_idle m_wei;
|
wait_engine_idle m_wei;
|
||||||
acquire_engine m_ae;
|
acquire_engine m_ae;
|
||||||
release_engine m_re;
|
release_engine m_re;
|
||||||
@@ -197,13 +199,12 @@ virtual void _ReservedWindowScreen4();
|
|||||||
screen_to_screen_transparent_blit trans_blit_rect;
|
screen_to_screen_transparent_blit trans_blit_rect;
|
||||||
screen_to_screen_scaled_filtered_blit scaled_filtered_blit_rect;
|
screen_to_screen_scaled_filtered_blit scaled_filtered_blit_rect;
|
||||||
|
|
||||||
uint32 _reserved_[21];
|
uint32 _reserved_[24];
|
||||||
|
|
||||||
static BRect CalcFrame(int32 index, int32 space, display_mode *dmode);
|
static BRect CalcFrame(int32 index, int32 space, display_mode *dmode);
|
||||||
status_t SetFullscreen(bool enable);
|
|
||||||
status_t InitData(uint32 space, uint32 attributes);
|
status_t InitData(uint32 space, uint32 attributes);
|
||||||
status_t SetActiveState(int32 state);
|
status_t SetActiveState(int32 state);
|
||||||
status_t SetLockState(int32 state);
|
status_t SetupAccelerantHooks(bool enable);
|
||||||
status_t GetCardInfo();
|
status_t GetCardInfo();
|
||||||
void Suspend();
|
void Suspend();
|
||||||
void Resume();
|
void Resume();
|
||||||
|
|||||||
+112
-158
@@ -21,7 +21,6 @@
|
|||||||
#include <InputServerTypes.h> // For IS_SET_MOUSE_POSITION
|
#include <InputServerTypes.h> // For IS_SET_MOUSE_POSITION
|
||||||
#include <WindowPrivate.h>
|
#include <WindowPrivate.h>
|
||||||
|
|
||||||
|
|
||||||
#include <AppServerLink.h>
|
#include <AppServerLink.h>
|
||||||
#include <ServerProtocol.h>
|
#include <ServerProtocol.h>
|
||||||
|
|
||||||
@@ -36,22 +35,23 @@ using BPrivate::AppServerLink;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
static graphics_card_info card_info_global;
|
// Acceleration hooks pointers
|
||||||
fill_rectangle fill_rect_global;
|
static fill_rectangle sFillRectHook;
|
||||||
screen_to_screen_blit blit_rect_global;
|
static screen_to_screen_blit sBlitRectHook;
|
||||||
screen_to_screen_transparent_blit trans_blit_rect_global;
|
static screen_to_screen_transparent_blit sTransparentBlitHook;
|
||||||
screen_to_screen_scaled_filtered_blit scaled_filtered_blit_rect_global;
|
static screen_to_screen_scaled_filtered_blit sScaledFilteredBlitHook;
|
||||||
wait_engine_idle wait_idle_global;
|
static wait_engine_idle sWaitIdleHook;
|
||||||
engine_token *et_global;
|
static acquire_engine sAcquireEngineHook;
|
||||||
acquire_engine acquire_engine_global;
|
static release_engine sReleaseEngineHook;
|
||||||
release_engine release_engine_global;
|
|
||||||
|
static engine_token *sEngineToken;
|
||||||
|
|
||||||
|
|
||||||
// Helper methods which translates the pre r5 graphics methods to r5 ones
|
// Helper methods which translates the pre r5 graphics methods to r5 ones
|
||||||
static int32
|
static int32
|
||||||
card_sync()
|
card_sync()
|
||||||
{
|
{
|
||||||
wait_idle_global();
|
sWaitIdleHook();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -67,9 +67,9 @@ blit(int32 sx, int32 sy, int32 dx, int32 dy, int32 width, int32 height)
|
|||||||
param.width = width;
|
param.width = width;
|
||||||
param.height = height;
|
param.height = height;
|
||||||
|
|
||||||
acquire_engine_global(B_2D_ACCELERATION, 0xff, NULL, &et_global);
|
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken);
|
||||||
blit_rect_global(et_global, ¶m, 1);
|
sBlitRectHook(sEngineToken, ¶m, 1);
|
||||||
release_engine_global(et_global, NULL);
|
sReleaseEngineHook(sEngineToken, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -88,9 +88,9 @@ transparent_blit(int32 sx, int32 sy, int32 dx, int32 dy,
|
|||||||
param.width = width;
|
param.width = width;
|
||||||
param.height = height;
|
param.height = height;
|
||||||
|
|
||||||
acquire_engine_global(B_2D_ACCELERATION, 0xff, 0, &et_global);
|
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, 0, &sEngineToken);
|
||||||
trans_blit_rect_global(et_global, transparent_color, ¶m, 1);
|
sTransparentBlitHook(sEngineToken, transparent_color, ¶m, 1);
|
||||||
release_engine_global(et_global, 0);
|
sReleaseEngineHook(sEngineToken, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@@ -108,9 +108,9 @@ scaled_filtered_blit(int32 sx, int32 sy, int32 sw, int32 sh, int32 dx, int32 dy,
|
|||||||
param.dest_width = dw;
|
param.dest_width = dw;
|
||||||
param.dest_height = dh;
|
param.dest_height = dh;
|
||||||
|
|
||||||
acquire_engine_global(B_2D_ACCELERATION, 0xff, NULL, &et_global);
|
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken);
|
||||||
scaled_filtered_blit_rect_global(et_global, ¶m, 1);
|
sScaledFilteredBlitHook(sEngineToken, ¶m, 1);
|
||||||
release_engine_global(et_global, NULL);
|
sReleaseEngineHook(sEngineToken, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,9 +124,9 @@ draw_rect_8(int32 sx, int32 sy, int32 sw, int32 sh, uint8 color_index)
|
|||||||
param.right = sw;
|
param.right = sw;
|
||||||
param.bottom = sh;
|
param.bottom = sh;
|
||||||
|
|
||||||
acquire_engine_global(B_2D_ACCELERATION, 0xff, NULL, &et_global);
|
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken);
|
||||||
fill_rect_global(et_global, color_index, ¶m, 1);
|
sFillRectHook(sEngineToken, color_index, ¶m, 1);
|
||||||
release_engine_global(et_global, NULL);
|
sReleaseEngineHook(sEngineToken, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,9 +140,9 @@ draw_rect_16(int32 sx, int32 sy, int32 sw, int32 sh, uint16 color)
|
|||||||
param.right = sw;
|
param.right = sw;
|
||||||
param.bottom = sh;
|
param.bottom = sh;
|
||||||
|
|
||||||
acquire_engine_global(B_2D_ACCELERATION, 0xff, NULL, &et_global);
|
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken);
|
||||||
fill_rect_global(et_global, color, ¶m, 1);
|
sFillRectHook(sEngineToken, color, ¶m, 1);
|
||||||
release_engine_global(et_global, NULL);
|
sReleaseEngineHook(sEngineToken, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -156,9 +156,9 @@ draw_rect_32(int32 sx, int32 sy, int32 sw, int32 sh, uint32 color)
|
|||||||
param.right = sw;
|
param.right = sw;
|
||||||
param.bottom = sh;
|
param.bottom = sh;
|
||||||
|
|
||||||
acquire_engine_global(B_2D_ACCELERATION, 0xff, NULL, &et_global);
|
sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken);
|
||||||
fill_rect_global(et_global, color, ¶m, 1);
|
sFillRectHook(sEngineToken, color, ¶m, 1);
|
||||||
release_engine_global(et_global, NULL);
|
sReleaseEngineHook(sEngineToken, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,11 +285,10 @@ set_mouse_position(int32 x, int32 y)
|
|||||||
|
|
||||||
|
|
||||||
BWindowScreen::BWindowScreen(const char *title, uint32 space,
|
BWindowScreen::BWindowScreen(const char *title, uint32 space,
|
||||||
status_t *error, bool debug_enable)
|
status_t *error, bool debug_enable)
|
||||||
: BWindow(BScreen().Frame(), title, B_TITLED_WINDOW,
|
: BWindow(BScreen().Frame(), title, B_TITLED_WINDOW,
|
||||||
kWindowScreenFlag | B_NOT_MINIMIZABLE | B_NOT_CLOSABLE
|
kWindowScreenFlag | B_NOT_MINIMIZABLE | B_NOT_CLOSABLE
|
||||||
| B_NOT_ZOOMABLE | B_NOT_MOVABLE | B_NOT_RESIZABLE,
|
| B_NOT_ZOOMABLE | B_NOT_MOVABLE | B_NOT_RESIZABLE, B_CURRENT_WORKSPACE)
|
||||||
B_CURRENT_WORKSPACE)
|
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
uint32 attributes = 0;
|
uint32 attributes = 0;
|
||||||
@@ -303,11 +302,10 @@ BWindowScreen::BWindowScreen(const char *title, uint32 space,
|
|||||||
|
|
||||||
|
|
||||||
BWindowScreen::BWindowScreen(const char *title, uint32 space,
|
BWindowScreen::BWindowScreen(const char *title, uint32 space,
|
||||||
uint32 attributes, status_t *error)
|
uint32 attributes, status_t *error)
|
||||||
: BWindow(BScreen().Frame(), title, B_TITLED_WINDOW,
|
: BWindow(BScreen().Frame(), title, B_TITLED_WINDOW,
|
||||||
kWindowScreenFlag | B_NOT_MINIMIZABLE | B_NOT_CLOSABLE
|
kWindowScreenFlag | B_NOT_MINIMIZABLE | B_NOT_CLOSABLE
|
||||||
| B_NOT_ZOOMABLE | B_NOT_MOVABLE | B_NOT_RESIZABLE,
|
| B_NOT_ZOOMABLE | B_NOT_MOVABLE | B_NOT_RESIZABLE, B_CURRENT_WORKSPACE)
|
||||||
B_CURRENT_WORKSPACE)
|
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
status_t status = InitData(space, attributes);
|
status_t status = InitData(space, attributes);
|
||||||
@@ -323,8 +321,6 @@ BWindowScreen::~BWindowScreen()
|
|||||||
if (fAddonImage >= 0)
|
if (fAddonImage >= 0)
|
||||||
unload_add_on(fAddonImage);
|
unload_add_on(fAddonImage);
|
||||||
|
|
||||||
SetFullscreen(false);
|
|
||||||
|
|
||||||
delete_sem(fActivateSem);
|
delete_sem(fActivateSem);
|
||||||
delete_sem(fDebugSem);
|
delete_sem(fDebugSem);
|
||||||
|
|
||||||
@@ -404,12 +400,7 @@ void
|
|||||||
BWindowScreen::Hide()
|
BWindowScreen::Hide()
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
if (fLockState == 1) {
|
Disconnect();
|
||||||
if (fDebugState)
|
|
||||||
fDebugFirst = true;
|
|
||||||
SetActiveState(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
BWindow::Hide();
|
BWindow::Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -439,7 +430,7 @@ BWindowScreen::SetColorList(rgb_color *list, int32 first_index, int32 last_index
|
|||||||
} else {
|
} else {
|
||||||
uint32 colorCount = last_index - first_index + 1;
|
uint32 colorCount = last_index - first_index + 1;
|
||||||
if (fAddonImage >= 0) {
|
if (fAddonImage >= 0) {
|
||||||
set_indexed_colors sic = (set_indexed_colors)m_gah(B_SET_INDEXED_COLORS, NULL);
|
set_indexed_colors sic = (set_indexed_colors)fGetAccelerantHook(B_SET_INDEXED_COLORS, NULL);
|
||||||
if (sic != NULL)
|
if (sic != NULL)
|
||||||
sic(colorCount, first_index, (uint8 *)fColorList, 0);
|
sic(colorCount, first_index, (uint8 *)fColorList, 0);
|
||||||
}
|
}
|
||||||
@@ -493,9 +484,6 @@ BWindowScreen::SetFrameBuffer(int32 width, int32 height)
|
|||||||
|
|
||||||
BScreen screen(this);
|
BScreen screen(this);
|
||||||
status_t status = screen.ProposeMode(&mode, &lowMode, &highMode);
|
status_t status = screen.ProposeMode(&mode, &lowMode, &highMode);
|
||||||
|
|
||||||
// If the mode is supported, change the workspace
|
|
||||||
// to that mode.
|
|
||||||
if (status == B_OK)
|
if (status == B_OK)
|
||||||
status = AssertDisplayMode(&mode);
|
status = AssertDisplayMode(&mode);
|
||||||
|
|
||||||
@@ -553,36 +541,21 @@ BWindowScreen::CardHookAt(int32 index)
|
|||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 5: // 8 bit fill rect
|
case 5: // 8 bit fill rect
|
||||||
hook = (graphics_card_hook)m_gah(B_FILL_RECTANGLE, 0);
|
|
||||||
fill_rect = (fill_rectangle)hook;
|
|
||||||
fill_rect_global = fill_rect;
|
|
||||||
hook = (graphics_card_hook)draw_rect_8;
|
hook = (graphics_card_hook)draw_rect_8;
|
||||||
break;
|
break;
|
||||||
case 6: // 32 bit fill rect
|
case 6: // 32 bit fill rect
|
||||||
hook = (graphics_card_hook)m_gah(B_FILL_RECTANGLE, 0);
|
|
||||||
fill_rect = (fill_rectangle)hook;
|
|
||||||
fill_rect_global = fill_rect;
|
|
||||||
hook = (graphics_card_hook)draw_rect_32;
|
hook = (graphics_card_hook)draw_rect_32;
|
||||||
break;
|
break;
|
||||||
case 7: // screen to screen blit
|
case 7: // screen to screen blit
|
||||||
hook = (graphics_card_hook)m_gah(B_SCREEN_TO_SCREEN_BLIT, 0);
|
|
||||||
blit_rect = (screen_to_screen_blit)hook;
|
|
||||||
blit_rect_global = blit_rect;
|
|
||||||
hook = (graphics_card_hook)blit;
|
hook = (graphics_card_hook)blit;
|
||||||
break;
|
break;
|
||||||
case 8: // screen to screen scaled filtered blit
|
case 8: // screen to screen scaled filtered blit
|
||||||
hook = (graphics_card_hook)m_gah(B_SCREEN_TO_SCREEN_SCALED_FILTERED_BLIT, 0);
|
|
||||||
scaled_filtered_blit_rect = (screen_to_screen_scaled_filtered_blit)hook;
|
|
||||||
scaled_filtered_blit_rect_global = scaled_filtered_blit_rect;
|
|
||||||
hook = (graphics_card_hook)scaled_filtered_blit;
|
hook = (graphics_card_hook)scaled_filtered_blit;
|
||||||
break;
|
break;
|
||||||
case 10: // sync aka wait for graphics card idle
|
case 10: // sync aka wait for graphics card idle
|
||||||
hook = (graphics_card_hook)card_sync;
|
hook = (graphics_card_hook)card_sync;
|
||||||
break;
|
break;
|
||||||
case 13: // 16 bit fill rect
|
case 13: // 16 bit fill rect
|
||||||
hook = (graphics_card_hook)m_gah(B_FILL_RECTANGLE, 0);
|
|
||||||
fill_rect = (fill_rectangle)hook;
|
|
||||||
fill_rect_global = fill_rect;
|
|
||||||
hook = (graphics_card_hook)draw_rect_16;
|
hook = (graphics_card_hook)draw_rect_16;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -677,17 +650,6 @@ BWindowScreen::CalcFrame(int32 index, int32 space, display_mode *dmode)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
|
||||||
BWindowScreen::SetFullscreen(bool enable)
|
|
||||||
{
|
|
||||||
status_t status = B_ERROR;
|
|
||||||
|
|
||||||
// TODO: Set fullscreen
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BWindowScreen::InitData(uint32 space, uint32 attributes)
|
BWindowScreen::InitData(uint32 space, uint32 attributes)
|
||||||
{
|
{
|
||||||
@@ -699,32 +661,24 @@ BWindowScreen::InitData(uint32 space, uint32 attributes)
|
|||||||
fDebugFirst = true;
|
fDebugFirst = true;
|
||||||
|
|
||||||
fAttributes = attributes;
|
fAttributes = attributes;
|
||||||
fScreenIndex = current_workspace();
|
fScreenIndex = fDebugWorkspace = current_workspace();
|
||||||
fLockState = 0;
|
fLockState = 0;
|
||||||
fAddonImage = -1;
|
fAddonImage = -1;
|
||||||
fWindowState = 0;
|
fWindowState = 0;
|
||||||
fDebugWorkspace = 0;
|
|
||||||
|
|
||||||
BScreen screen(this);
|
BScreen screen(this);
|
||||||
status_t status = screen.GetModeList(&fModeList, &fModeCount);
|
status_t status = screen.GetModeList(&fModeList, &fModeCount);
|
||||||
if (status < B_OK) {
|
if (status < B_OK)
|
||||||
printf("BScreen::GetModeList() returned %s\n", strerror(status));
|
|
||||||
return status;
|
return status;
|
||||||
}
|
|
||||||
|
|
||||||
display_mode newMode;
|
display_mode newMode;
|
||||||
status = GetModeFromSpace(space, &newMode);
|
status = GetModeFromSpace(space, &newMode);
|
||||||
if (status < B_OK) {
|
if (status < B_OK)
|
||||||
printf("GetModeFromSpace() returned %s\n", strerror(status));
|
|
||||||
return status;
|
return status;
|
||||||
}
|
|
||||||
|
|
||||||
space_mode = 1;
|
space_mode = 1;
|
||||||
space0 = 0;
|
space0 = 0;
|
||||||
|
|
||||||
SetWorkspaces(B_CURRENT_WORKSPACE);
|
|
||||||
SetFullscreen(true);
|
|
||||||
|
|
||||||
memcpy(fColorList, screen.ColorMap()->color_list, 256);
|
memcpy(fColorList, screen.ColorMap()->color_list, 256);
|
||||||
|
|
||||||
status = GetCardInfo();
|
status = GetCardInfo();
|
||||||
@@ -753,37 +707,38 @@ BWindowScreen::SetActiveState(int32 state)
|
|||||||
status_t status = B_ERROR;
|
status_t status = B_ERROR;
|
||||||
if (state == 1) {
|
if (state == 1) {
|
||||||
be_app->HideCursor();
|
be_app->HideCursor();
|
||||||
if (be_app->IsCursorHidden() && (status = SetLockState(1)) == B_OK) {
|
status = AssertDisplayMode(fDisplayMode);
|
||||||
status = AssertDisplayMode(fDisplayMode);
|
if (status == B_OK && (status = SetupAccelerantHooks(true)) == B_OK) {
|
||||||
if (status == B_OK) {
|
if (!fActivateState) {
|
||||||
if (!fActivateState) {
|
while (acquire_sem(fActivateSem) == B_INTERRUPTED)
|
||||||
while (acquire_sem(fActivateSem) == B_INTERRUPTED)
|
;
|
||||||
;
|
}
|
||||||
}
|
|
||||||
SetColorList(fColorList);
|
SetColorList(fColorList);
|
||||||
if (fDebugState && !fDebugFirst) {
|
if (fDebugState && !fDebugFirst) {
|
||||||
SuspensionHook(true);
|
SuspensionHook(true);
|
||||||
Resume();
|
Resume();
|
||||||
} else {
|
} else {
|
||||||
fDebugFirst = true;
|
fDebugFirst = true;
|
||||||
ScreenConnected(true);
|
ScreenConnected(true);
|
||||||
}
|
}
|
||||||
if (status == B_OK)
|
|
||||||
return status;
|
if (status == B_OK)
|
||||||
|
return status;
|
||||||
|
|
||||||
|
} else
|
||||||
|
SetupAccelerantHooks(false);
|
||||||
|
|
||||||
} else
|
be_app->ShowCursor();
|
||||||
SetLockState(0);
|
|
||||||
|
|
||||||
be_app->ShowCursor();
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
|
AssertDisplayMode(fOldDisplayMode);
|
||||||
if (fDebugState && !fDebugFirst) {
|
if (fDebugState && !fDebugFirst) {
|
||||||
Suspend();
|
Suspend();
|
||||||
SuspensionHook(false);
|
SuspensionHook(false);
|
||||||
} else
|
} else
|
||||||
ScreenConnected(false);
|
ScreenConnected(false);
|
||||||
|
|
||||||
status = SetLockState(0);
|
status = SetupAccelerantHooks(false);
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
be_app->ShowCursor();
|
be_app->ShowCursor();
|
||||||
if (fActivateState) {
|
if (fActivateState) {
|
||||||
@@ -792,55 +747,56 @@ BWindowScreen::SetActiveState(int32 state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("SetActiveState() returning %s\n", strerror(status));
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BWindowScreen::SetLockState(int32 state)
|
BWindowScreen::SetupAccelerantHooks(bool enable)
|
||||||
{
|
{
|
||||||
CALLED();
|
CALLED();
|
||||||
if (fAddonImage >= 0 && state == 1) {
|
if (fAddonImage >= 0) {
|
||||||
m_wei();
|
m_wei();
|
||||||
fill_rect_global = NULL;
|
sFillRectHook = NULL;
|
||||||
blit_rect_global = NULL;
|
sBlitRectHook = NULL;
|
||||||
trans_blit_rect_global = NULL;
|
sTransparentBlitHook = NULL;
|
||||||
scaled_filtered_blit_rect_global = NULL;
|
sScaledFilteredBlitHook = NULL;
|
||||||
wait_idle_global = NULL;
|
sWaitIdleHook = NULL;
|
||||||
et_global = NULL;
|
sEngineToken = NULL;
|
||||||
acquire_engine_global = NULL;
|
sAcquireEngineHook = NULL;
|
||||||
release_engine_global = NULL;
|
sReleaseEngineHook = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t status = B_OK;
|
if (enable)
|
||||||
|
fLockState = 1;
|
||||||
// TODO: Set lock state (whatever it means)
|
else
|
||||||
|
fLockState = 0;
|
||||||
|
|
||||||
if (status == B_OK) {
|
status_t status = B_OK;
|
||||||
fLockState = state;
|
if (enable) {
|
||||||
if (state == 1) {
|
if (fAddonImage < 0) {
|
||||||
if (fAddonImage < 0) {
|
status = InitClone();
|
||||||
status = InitClone();
|
|
||||||
if (status == B_OK) {
|
|
||||||
m_wei = (wait_engine_idle)m_gah(B_WAIT_ENGINE_IDLE, NULL);
|
|
||||||
m_re = (release_engine)m_gah(B_RELEASE_ENGINE, NULL);
|
|
||||||
m_ae = (acquire_engine)m_gah(B_ACQUIRE_ENGINE, NULL);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
fill_rect_global = fill_rect;
|
m_wei = (wait_engine_idle)fGetAccelerantHook(B_WAIT_ENGINE_IDLE, fDisplayMode);
|
||||||
blit_rect_global = blit_rect;
|
m_re = (release_engine)fGetAccelerantHook(B_RELEASE_ENGINE, fDisplayMode);
|
||||||
trans_blit_rect_global = trans_blit_rect;
|
m_ae = (acquire_engine)fGetAccelerantHook(B_ACQUIRE_ENGINE, fDisplayMode);
|
||||||
scaled_filtered_blit_rect_global = scaled_filtered_blit_rect;
|
fill_rect = (fill_rectangle)fGetAccelerantHook(B_FILL_RECTANGLE, fDisplayMode);
|
||||||
wait_idle_global = m_wei;
|
blit_rect = (screen_to_screen_blit)fGetAccelerantHook(B_SCREEN_TO_SCREEN_BLIT, fDisplayMode);
|
||||||
et_global = et;
|
trans_blit_rect = (screen_to_screen_transparent_blit)fGetAccelerantHook(B_SCREEN_TO_SCREEN_TRANSPARENT_BLIT, fDisplayMode);
|
||||||
acquire_engine_global = m_ae;
|
scaled_filtered_blit_rect = (screen_to_screen_scaled_filtered_blit)fGetAccelerantHook(B_SCREEN_TO_SCREEN_SCALED_FILTERED_BLIT, fDisplayMode);
|
||||||
release_engine_global = m_re;
|
|
||||||
m_wei();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (status == B_OK) {
|
||||||
|
sFillRectHook = fill_rect;
|
||||||
|
sBlitRectHook = blit_rect;
|
||||||
|
sTransparentBlitHook = trans_blit_rect;
|
||||||
|
sScaledFilteredBlitHook = scaled_filtered_blit_rect;
|
||||||
|
sWaitIdleHook = m_wei;
|
||||||
|
sAcquireEngineHook = m_ae;
|
||||||
|
sReleaseEngineHook = m_re;
|
||||||
|
m_wei();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
@@ -854,7 +810,6 @@ BWindowScreen::GetCardInfo()
|
|||||||
|
|
||||||
BScreen screen(this);
|
BScreen screen(this);
|
||||||
display_mode mode;
|
display_mode mode;
|
||||||
|
|
||||||
status_t status = screen.GetMode(&mode);
|
status_t status = screen.GetMode(&mode);
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
return status;
|
return status;
|
||||||
@@ -876,7 +831,7 @@ BWindowScreen::GetCardInfo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
fCardInfo.version = 2;
|
fCardInfo.version = 2;
|
||||||
fCardInfo.id = 0;
|
fCardInfo.id = screen.ID().id;
|
||||||
fCardInfo.bits_per_pixel = bitsPerPixel;
|
fCardInfo.bits_per_pixel = bitsPerPixel;
|
||||||
fCardInfo.width = mode.virtual_width;
|
fCardInfo.width = mode.virtual_width;
|
||||||
fCardInfo.height = mode.virtual_height;
|
fCardInfo.height = mode.virtual_height;
|
||||||
@@ -893,7 +848,6 @@ BWindowScreen::GetCardInfo()
|
|||||||
if (mode.flags & B_PARALLEL_ACCESS)
|
if (mode.flags & B_PARALLEL_ACCESS)
|
||||||
fCardInfo.flags |= B_PARALLEL_BUFFER_ACCESS;
|
fCardInfo.flags |= B_PARALLEL_BUFFER_ACCESS;
|
||||||
|
|
||||||
frame_buffer_config config;
|
|
||||||
AppServerLink link;
|
AppServerLink link;
|
||||||
link.StartMessage(AS_GET_FRAME_BUFFER_CONFIG);
|
link.StartMessage(AS_GET_FRAME_BUFFER_CONFIG);
|
||||||
link.Attach<screen_id>(screen.ID());
|
link.Attach<screen_id>(screen.ID());
|
||||||
@@ -902,14 +856,12 @@ BWindowScreen::GetCardInfo()
|
|||||||
if (link.FlushWithReply(result) < B_OK || result < B_OK)
|
if (link.FlushWithReply(result) < B_OK || result < B_OK)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
frame_buffer_config config;
|
||||||
link.Read<frame_buffer_config>(&config);
|
link.Read<frame_buffer_config>(&config);
|
||||||
|
|
||||||
fCardInfo.id = screen.ID().id;
|
|
||||||
fCardInfo.frame_buffer = config.frame_buffer;
|
fCardInfo.frame_buffer = config.frame_buffer;
|
||||||
fCardInfo.bytes_per_row = config.bytes_per_row;
|
fCardInfo.bytes_per_row = config.bytes_per_row;
|
||||||
|
|
||||||
memcpy(&card_info_global, &fCardInfo, sizeof(graphics_card_info));
|
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1005,7 +957,7 @@ BWindowScreen::InitClone()
|
|||||||
}
|
}
|
||||||
|
|
||||||
status = get_image_symbol(fAddonImage, B_ACCELERANT_ENTRY_POINT,
|
status = get_image_symbol(fAddonImage, B_ACCELERANT_ENTRY_POINT,
|
||||||
B_SYMBOL_TYPE_ANY, (void **)&m_gah);
|
B_SYMBOL_TYPE_TEXT, (void **)&fGetAccelerantHook);
|
||||||
if (status < B_OK) {
|
if (status < B_OK) {
|
||||||
printf("InitClone: cannot get accelerant entry point\n");
|
printf("InitClone: cannot get accelerant entry point\n");
|
||||||
unload_add_on(fAddonImage);
|
unload_add_on(fAddonImage);
|
||||||
@@ -1013,7 +965,7 @@ BWindowScreen::InitClone()
|
|||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
clone_accelerant clone = (clone_accelerant)m_gah(B_CLONE_ACCELERANT, 0);
|
clone_accelerant clone = (clone_accelerant)fGetAccelerantHook(B_CLONE_ACCELERANT, 0);
|
||||||
if (clone == NULL) {
|
if (clone == NULL) {
|
||||||
printf("InitClone: cannot get clone hook\n");
|
printf("InitClone: cannot get clone hook\n");
|
||||||
unload_add_on(fAddonImage);
|
unload_add_on(fAddonImage);
|
||||||
@@ -1043,18 +995,20 @@ BWindowScreen::InitClone()
|
|||||||
status_t
|
status_t
|
||||||
BWindowScreen::AssertDisplayMode(display_mode *dmode)
|
BWindowScreen::AssertDisplayMode(display_mode *dmode)
|
||||||
{
|
{
|
||||||
|
CALLED();
|
||||||
|
|
||||||
status_t status = B_ERROR;
|
status_t status = B_ERROR;
|
||||||
|
if (dmode->virtual_width != fDisplayMode->virtual_width
|
||||||
display_mode mode = *dmode;
|
|| dmode->virtual_height != fDisplayMode->virtual_height
|
||||||
mode.flags |= B_SCROLL;
|
|| dmode->space != fDisplayMode->space) {
|
||||||
|
status = BScreen(this).SetMode(dmode);
|
||||||
// TODO: Assert display mode: negotiation with app server
|
if (status < B_OK)
|
||||||
status = BScreen(this).SetMode(&mode);
|
return status;
|
||||||
if (status == B_OK) {
|
|
||||||
memcpy(fDisplayMode, dmode, sizeof(display_mode));
|
memcpy(fDisplayMode, dmode, sizeof(display_mode));
|
||||||
space_mode = 1;
|
space_mode = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
status = GetCardInfo();
|
status = GetCardInfo();
|
||||||
if (status < B_OK)
|
if (status < B_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|||||||
Reference in New Issue
Block a user