Expose the connected status
* Since we won't always have a client, expose the connected status from the HWInterface to other classes. Currently only used to simulate DPMS state. * Cleanup.
This commit is contained in:
parent
599f30f93d
commit
3f551e5c43
@ -136,8 +136,6 @@ HTML5HWInterface::HTML5HWInterface(const char* target)
|
|||||||
}
|
}
|
||||||
fServer->AddHandler(handler);
|
fServer->AddHandler(handler);
|
||||||
|
|
||||||
//static const char desktop_html[] = "<html><head><title>Haiku</title></head>"
|
|
||||||
// "<body></body></html>";
|
|
||||||
handler = new(std::nothrow) WebHandler("desktop.html",
|
handler = new(std::nothrow) WebHandler("desktop.html",
|
||||||
new(std::nothrow) BMemoryIO(desktop_html, sizeof(desktop_html) - 1));
|
new(std::nothrow) BMemoryIO(desktop_html, sizeof(desktop_html) - 1));
|
||||||
if (handler == NULL) {
|
if (handler == NULL) {
|
||||||
@ -146,7 +144,6 @@ HTML5HWInterface::HTML5HWInterface(const char* target)
|
|||||||
}
|
}
|
||||||
fServer->AddHandler(handler);
|
fServer->AddHandler(handler);
|
||||||
|
|
||||||
//static const char haiku_js[] = "window.alert('plop');\n";
|
|
||||||
handler = new(std::nothrow) WebHandler("haiku.js",
|
handler = new(std::nothrow) WebHandler("haiku.js",
|
||||||
new(std::nothrow) BMemoryIO(haiku_js, sizeof(haiku_js) - 1));
|
new(std::nothrow) BMemoryIO(haiku_js, sizeof(haiku_js) - 1));
|
||||||
if (handler == NULL) {
|
if (handler == NULL) {
|
||||||
@ -497,14 +494,14 @@ HTML5HWInterface::SetDPMSMode(uint32 state)
|
|||||||
uint32
|
uint32
|
||||||
HTML5HWInterface::DPMSMode()
|
HTML5HWInterface::DPMSMode()
|
||||||
{
|
{
|
||||||
return B_UNSUPPORTED;
|
return (IsConnected() ? B_DPMS_ON : B_DPMS_SUSPEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32
|
uint32
|
||||||
HTML5HWInterface::DPMSCapabilities()
|
HTML5HWInterface::DPMSCapabilities()
|
||||||
{
|
{
|
||||||
return 0;
|
return B_DPMS_ON | B_DPMS_SUSPEND;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -526,6 +523,8 @@ void
|
|||||||
HTML5HWInterface::SetCursor(ServerCursor* cursor)
|
HTML5HWInterface::SetCursor(ServerCursor* cursor)
|
||||||
{
|
{
|
||||||
HWInterface::SetCursor(cursor);
|
HWInterface::SetCursor(cursor);
|
||||||
|
if (!IsConnected())
|
||||||
|
return;
|
||||||
CanvasMessage message(NULL, fSendBuffer);
|
CanvasMessage message(NULL, fSendBuffer);
|
||||||
message.Start(RP_SET_CURSOR);
|
message.Start(RP_SET_CURSOR);
|
||||||
message.AddCursor(Cursor().Get());
|
message.AddCursor(Cursor().Get());
|
||||||
@ -536,6 +535,8 @@ void
|
|||||||
HTML5HWInterface::SetCursorVisible(bool visible)
|
HTML5HWInterface::SetCursorVisible(bool visible)
|
||||||
{
|
{
|
||||||
HWInterface::SetCursorVisible(visible);
|
HWInterface::SetCursorVisible(visible);
|
||||||
|
if (!IsConnected())
|
||||||
|
return;
|
||||||
CanvasMessage message(NULL, fSendBuffer);
|
CanvasMessage message(NULL, fSendBuffer);
|
||||||
message.Start(RP_SET_CURSOR_VISIBLE);
|
message.Start(RP_SET_CURSOR_VISIBLE);
|
||||||
message.Add(visible);
|
message.Add(visible);
|
||||||
@ -546,6 +547,8 @@ void
|
|||||||
HTML5HWInterface::MoveCursorTo(float x, float y)
|
HTML5HWInterface::MoveCursorTo(float x, float y)
|
||||||
{
|
{
|
||||||
HWInterface::MoveCursorTo(x, y);
|
HWInterface::MoveCursorTo(x, y);
|
||||||
|
if (!IsConnected())
|
||||||
|
return;
|
||||||
CanvasMessage message(NULL, fSendBuffer);
|
CanvasMessage message(NULL, fSendBuffer);
|
||||||
message.Start(RP_MOVE_CURSOR_TO);
|
message.Start(RP_MOVE_CURSOR_TO);
|
||||||
message.Add(x);
|
message.Add(x);
|
||||||
@ -558,6 +561,8 @@ HTML5HWInterface::SetDragBitmap(const ServerBitmap* bitmap,
|
|||||||
const BPoint& offsetFromCursor)
|
const BPoint& offsetFromCursor)
|
||||||
{
|
{
|
||||||
HWInterface::SetDragBitmap(bitmap, offsetFromCursor);
|
HWInterface::SetDragBitmap(bitmap, offsetFromCursor);
|
||||||
|
if (!IsConnected())
|
||||||
|
return;
|
||||||
CanvasMessage message(NULL, fSendBuffer);
|
CanvasMessage message(NULL, fSendBuffer);
|
||||||
message.Start(RP_SET_CURSOR);
|
message.Start(RP_SET_CURSOR);
|
||||||
message.AddCursor(CursorAndDragBitmap().Get());
|
message.AddCursor(CursorAndDragBitmap().Get());
|
||||||
@ -589,6 +594,8 @@ status_t
|
|||||||
HTML5HWInterface::InvalidateRegion(BRegion& region)
|
HTML5HWInterface::InvalidateRegion(BRegion& region)
|
||||||
{
|
{
|
||||||
CanvasMessage message(NULL, fSendBuffer);
|
CanvasMessage message(NULL, fSendBuffer);
|
||||||
|
if (!IsConnected())
|
||||||
|
return B_OK;
|
||||||
message.Start(RP_INVALIDATE_REGION);
|
message.Start(RP_INVALIDATE_REGION);
|
||||||
message.AddRegion(region);
|
message.AddRegion(region);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@ -599,6 +606,8 @@ status_t
|
|||||||
HTML5HWInterface::Invalidate(const BRect& frame)
|
HTML5HWInterface::Invalidate(const BRect& frame)
|
||||||
{
|
{
|
||||||
CanvasMessage message(NULL, fSendBuffer);
|
CanvasMessage message(NULL, fSendBuffer);
|
||||||
|
if (!IsConnected())
|
||||||
|
return B_OK;
|
||||||
message.Start(RP_INVALIDATE_RECT);
|
message.Start(RP_INVALIDATE_RECT);
|
||||||
message.Add(frame);
|
message.Add(frame);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
@ -89,6 +89,8 @@ typedef bool (*CallbackFunction)(void* cookie, CanvasMessage& message);
|
|||||||
void* cookie);
|
void* cookie);
|
||||||
bool RemoveCallback(uint32 token);
|
bool RemoveCallback(uint32 token);
|
||||||
|
|
||||||
|
bool IsConnected() { return fIsConnected; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
callback_info* _FindCallback(uint32 token);
|
callback_info* _FindCallback(uint32 token);
|
||||||
static int _CallbackCompare(const uint32* key,
|
static int _CallbackCompare(const uint32* key,
|
||||||
|
Loading…
Reference in New Issue
Block a user