* Started a naive implementation of BView::SetViewCursor() server-side - doesn't
work though, as HWInterface can only draw B_RGB32 cursors... * More build fixes for libbe_test target - it defines __HAIKU__ as well, now git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16211 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2005, Haiku.
|
* Copyright 2001-2006, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -171,7 +171,7 @@ ServerApp::~ServerApp()
|
|||||||
// time, but killing it might have desastrous effects
|
// time, but killing it might have desastrous effects
|
||||||
if (MessageLooper::WaitForQuit(deathSemaphore, 3000000) != B_OK) {
|
if (MessageLooper::WaitForQuit(deathSemaphore, 3000000) != B_OK) {
|
||||||
// This really shouldn't happen, as it shows we're buggy
|
// This really shouldn't happen, as it shows we're buggy
|
||||||
#if __HAIKU__
|
#ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST
|
||||||
syslog(LOG_ERR, "ServerApp %s: ServerWindow doesn't respond!\n",
|
syslog(LOG_ERR, "ServerApp %s: ServerWindow doesn't respond!\n",
|
||||||
Signature());
|
Signature());
|
||||||
#else
|
#else
|
||||||
@@ -289,17 +289,16 @@ ServerApp::Activate(bool value)
|
|||||||
|
|
||||||
fIsActive = value;
|
fIsActive = value;
|
||||||
|
|
||||||
if (fIsActive) {
|
if (fIsActive)
|
||||||
SetAppCursor();
|
SetCursor();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//! Sets the cursor to the application cursor, if any.
|
//! Sets the cursor to the application cursor, if any.
|
||||||
void
|
void
|
||||||
ServerApp::SetAppCursor()
|
ServerApp::SetCursor()
|
||||||
{
|
{
|
||||||
// TODO: look into custom cursors...
|
// TODO: custom cursors cannot be drawn by the HWInterface right now (wrong bitmap format)
|
||||||
// if (fAppCursor)
|
// if (fAppCursor)
|
||||||
// fDesktop->HWInterface()->SetCursor(fAppCursor);
|
// fDesktop->HWInterface()->SetCursor(fAppCursor);
|
||||||
|
|
||||||
@@ -310,7 +309,7 @@ ServerApp::SetAppCursor()
|
|||||||
void
|
void
|
||||||
ServerApp::_GetLooperName(char* name, size_t length)
|
ServerApp::_GetLooperName(char* name, size_t length)
|
||||||
{
|
{
|
||||||
#ifdef __HAIKU__
|
#ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST
|
||||||
strlcpy(name, Signature(), length);
|
strlcpy(name, Signature(), length);
|
||||||
#else
|
#else
|
||||||
strncpy(name, Signature(), length);
|
strncpy(name, Signature(), length);
|
||||||
@@ -891,10 +890,10 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: SetCursor via cursor data\n", Signature()));
|
STRACE(("ServerApp %s: SetCursor via cursor data\n", Signature()));
|
||||||
// Attached data: 68 bytes of fAppCursor data
|
// Attached data: 68 bytes of fAppCursor data
|
||||||
|
|
||||||
int8 cdata[68];
|
int8 cursorData[68];
|
||||||
link.Read(cdata, 68);
|
link.Read(cursorData, 68);
|
||||||
|
|
||||||
// Because we don't want an overaccumulation of these particular
|
// Because we don't want an overaccumulation of these particular
|
||||||
// cursors, we will delete them if there is an existing one. It would
|
// cursors, we will delete them if there is an existing one. It would
|
||||||
// otherwise be easy to crash the server by calling SetCursor a
|
// otherwise be easy to crash the server by calling SetCursor a
|
||||||
@@ -902,7 +901,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
if (fAppCursor)
|
if (fAppCursor)
|
||||||
fDesktop->GetCursorManager().DeleteCursor(fAppCursor->ID());
|
fDesktop->GetCursorManager().DeleteCursor(fAppCursor->ID());
|
||||||
|
|
||||||
fAppCursor = new ServerCursor(cdata);
|
fAppCursor = new ServerCursor(cursorData);
|
||||||
fAppCursor->SetOwningTeam(fClientTeam);
|
fAppCursor->SetOwningTeam(fClientTeam);
|
||||||
fAppCursor->SetAppSignature(Signature());
|
fAppCursor->SetAppSignature(Signature());
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2005, Haiku.
|
* Copyright 2001-2006, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -9,8 +9,8 @@
|
|||||||
* Stefano Ceccherini ([email protected])
|
* Stefano Ceccherini ([email protected])
|
||||||
* Axel Dörfler, [email protected]
|
* Axel Dörfler, [email protected]
|
||||||
*/
|
*/
|
||||||
#ifndef _SERVERAPP_H_
|
#ifndef SERVER_APP_H
|
||||||
#define _SERVERAPP_H_
|
#define SERVER_APP_H
|
||||||
|
|
||||||
|
|
||||||
#include "MessageLooper.h"
|
#include "MessageLooper.h"
|
||||||
@@ -61,7 +61,8 @@ class ServerApp : public MessageLooper {
|
|||||||
|
|
||||||
void SendMessageToClient(BMessage* message) const;
|
void SendMessageToClient(BMessage* message) const;
|
||||||
|
|
||||||
void SetAppCursor();
|
void SetCursor();
|
||||||
|
ServerCursor* Cursor() const { return fAppCursor; }
|
||||||
|
|
||||||
team_id ClientTeam() const;
|
team_id ClientTeam() const;
|
||||||
const char* Signature() const { return fSignature.String(); }
|
const char* Signature() const { return fSignature.String(); }
|
||||||
@@ -104,9 +105,9 @@ class ServerApp : public MessageLooper {
|
|||||||
// To send a BMessage to the client
|
// To send a BMessage to the client
|
||||||
// (port + token)
|
// (port + token)
|
||||||
|
|
||||||
Desktop* fDesktop;
|
Desktop* fDesktop;
|
||||||
BString fSignature;
|
BString fSignature;
|
||||||
team_id fClientTeam;
|
team_id fClientTeam;
|
||||||
|
|
||||||
mutable BLocker fWindowListLock;
|
mutable BLocker fWindowListLock;
|
||||||
BObjectList<ServerWindow> fWindowList;
|
BObjectList<ServerWindow> fWindowList;
|
||||||
@@ -130,4 +131,4 @@ class ServerApp : public MessageLooper {
|
|||||||
AreaPool fSharedMem;
|
AreaPool fSharedMem;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _SERVERAPP_H_
|
#endif // SERVER_APP_H
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2005, Haiku, Inc.
|
* Copyright (c) 2001-2006, Haiku, Inc.
|
||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -165,7 +165,7 @@ Screen::_FindMode(uint16 width, uint16 height, uint32 colorspace,
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if __HAIKU__
|
#ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST
|
||||||
int32 index = _FindMode(dm, count, width, height, colorspace, frequency);
|
int32 index = _FindMode(dm, count, width, height, colorspace, frequency);
|
||||||
if (index < 0) {
|
if (index < 0) {
|
||||||
fprintf(stderr, "mode not found (%d, %d, %f) -> ignoring frequency and using B_CMAP8!\n", width, height, frequency);
|
fprintf(stderr, "mode not found (%d, %d, %f) -> ignoring frequency and using B_CMAP8!\n", width, height, frequency);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2005, Haiku.
|
* Copyright 2001-2006, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -1246,13 +1246,14 @@ ServerWindow::_DispatchViewMessage(int32 code,
|
|||||||
case AS_LAYER_CURSOR:
|
case AS_LAYER_CURSOR:
|
||||||
{
|
{
|
||||||
DTRACE(("ServerWindow %s: Message AS_LAYER_CURSOR: ViewLayer: %s - NOT IMPLEMENTED\n", Title(), fCurrentLayer->Name()));
|
DTRACE(("ServerWindow %s: Message AS_LAYER_CURSOR: ViewLayer: %s - NOT IMPLEMENTED\n", Title(), fCurrentLayer->Name()));
|
||||||
int32 token;
|
int32 token = -1;
|
||||||
|
|
||||||
link.Read<int32>(&token);
|
link.Read<int32>(&token);
|
||||||
|
|
||||||
// TODO: implement; I think each ViewLayer should have a member pointing
|
// TODO: this badly needs reference counting
|
||||||
// to this requested cursor.
|
ServerCursor* cursor = fDesktop->GetCursorManager().FindCursor(token);
|
||||||
|
fCurrentLayer->SetCursor(cursor);
|
||||||
|
|
||||||
|
// TODO: if fCurrentLayer is the view under the cursor, the appearance should change immediately!
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_LAYER_SET_FLAGS:
|
case AS_LAYER_SET_FLAGS:
|
||||||
@@ -1260,7 +1261,7 @@ ServerWindow::_DispatchViewMessage(int32 code,
|
|||||||
uint32 flags;
|
uint32 flags;
|
||||||
link.Read<uint32>(&flags);
|
link.Read<uint32>(&flags);
|
||||||
fCurrentLayer->SetFlags(flags);
|
fCurrentLayer->SetFlags(flags);
|
||||||
|
|
||||||
STRACE(("ServerWindow %s: Message AS_LAYER_SET_FLAGS: ViewLayer: %s\n", Title(), fCurrentLayer->Name()));
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_FLAGS: ViewLayer: %s\n", Title(), fCurrentLayer->Name()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -2402,7 +2403,7 @@ ServerWindow::_MessageLooper()
|
|||||||
if (code >= 0 && code < AS_LAST_CODE) {
|
if (code >= 0 && code < AS_LAST_CODE) {
|
||||||
diff = system_time() - start;
|
diff = system_time() - start;
|
||||||
atomic_add(&sMessageProfile[code].count, 1);
|
atomic_add(&sMessageProfile[code].count, 1);
|
||||||
#ifdef __HAIKU__
|
#ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST
|
||||||
atomic_add64(&sMessageProfile[code].time, diff);
|
atomic_add64(&sMessageProfile[code].time, diff);
|
||||||
#else
|
#else
|
||||||
sMessageProfile[code].time += diff;
|
sMessageProfile[code].time += diff;
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2005, Haiku, Inc.
|
* Copyright (c) 2001-2006, Haiku, Inc.
|
||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||||
* Adi Oanca <adioanca@gmail.com>
|
* Adi Oanca <adioanca@gmail.com>
|
||||||
|
* Axel Dörfler, axeld@pinc-software.de
|
||||||
* Stephan Aßmus <superstippi@gmx.de>
|
* Stephan Aßmus <superstippi@gmx.de>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -61,7 +62,8 @@ ViewLayer::ViewLayer(BRect frame, const char* name,
|
|||||||
fPreviousSibling(NULL),
|
fPreviousSibling(NULL),
|
||||||
fNextSibling(NULL),
|
fNextSibling(NULL),
|
||||||
fLastChild(NULL),
|
fLastChild(NULL),
|
||||||
|
|
||||||
|
fCursor(NULL),
|
||||||
fPicture(NULL),
|
fPicture(NULL),
|
||||||
|
|
||||||
fLocalClipping(Bounds()),
|
fLocalClipping(Bounds()),
|
||||||
@@ -876,6 +878,13 @@ ViewLayer::SetEventMask(uint32 eventMask, uint32 options)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
ViewLayer::SetCursor(ServerCursor *cursor)
|
||||||
|
{
|
||||||
|
fCursor = cursor;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
ViewLayer::SetPicture(ServerPicture *picture)
|
ViewLayer::SetPicture(ServerPicture *picture)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001-2005, Haiku, Inc.
|
* Copyright (c) 2001-2006, Haiku, Inc.
|
||||||
* Distributed under the terms of the MIT license.
|
* Distributed under the terms of the MIT license.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* DarkWyrm <bpmagic@columbus.rr.com>
|
* DarkWyrm <bpmagic@columbus.rr.com>
|
||||||
* Adi Oanca <adioanca@gmail.com>
|
* Adi Oanca <adioanca@gmail.com>
|
||||||
|
* Axel Dörfler, axeld@pinc-software.de
|
||||||
* Stephan Aßmus <superstippi@gmx.de>
|
* Stephan Aßmus <superstippi@gmx.de>
|
||||||
*/
|
*/
|
||||||
#ifndef VIEW_LAYER_H
|
#ifndef VIEW_LAYER_H
|
||||||
@@ -23,6 +24,7 @@ class DrawState;
|
|||||||
class DrawingEngine;
|
class DrawingEngine;
|
||||||
class WindowLayer;
|
class WindowLayer;
|
||||||
class ServerBitmap;
|
class ServerBitmap;
|
||||||
|
class ServerCursor;
|
||||||
class ServerPicture;
|
class ServerPicture;
|
||||||
|
|
||||||
class ViewLayer {
|
class ViewLayer {
|
||||||
@@ -147,8 +149,11 @@ class ViewLayer {
|
|||||||
uint32 EventOptions() const
|
uint32 EventOptions() const
|
||||||
{ return fEventOptions; }
|
{ return fEventOptions; }
|
||||||
|
|
||||||
void SetPicture(ServerPicture *picture);
|
ServerCursor* Cursor() const { return fCursor; }
|
||||||
ServerPicture *Picture() const;
|
void SetCursor(ServerCursor* cursor);
|
||||||
|
|
||||||
|
ServerPicture* Picture() const;
|
||||||
|
void SetPicture(ServerPicture* picture);
|
||||||
|
|
||||||
// for background clearing
|
// for background clearing
|
||||||
virtual void Draw(DrawingEngine* drawingEngine,
|
virtual void Draw(DrawingEngine* drawingEngine,
|
||||||
@@ -221,7 +226,9 @@ class ViewLayer {
|
|||||||
ViewLayer* fNextSibling;
|
ViewLayer* fNextSibling;
|
||||||
ViewLayer* fLastChild;
|
ViewLayer* fLastChild;
|
||||||
|
|
||||||
ServerPicture *fPicture;
|
ServerCursor* fCursor;
|
||||||
|
ServerPicture* fPicture;
|
||||||
|
|
||||||
// clipping
|
// clipping
|
||||||
BRegion fLocalClipping;
|
BRegion fLocalClipping;
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,7 @@
|
|||||||
#include "DecorManager.h"
|
#include "DecorManager.h"
|
||||||
#include "Desktop.h"
|
#include "Desktop.h"
|
||||||
#include "DrawingEngine.h"
|
#include "DrawingEngine.h"
|
||||||
|
#include "HWInterface.h"
|
||||||
#include "MessagePrivate.h"
|
#include "MessagePrivate.h"
|
||||||
#include "PortLink.h"
|
#include "PortLink.h"
|
||||||
#include "ServerApp.h"
|
#include "ServerApp.h"
|
||||||
@@ -909,7 +910,8 @@ void
|
|||||||
WindowLayer::MouseMoved(BMessage *msg, BPoint where, int32* _viewToken,
|
WindowLayer::MouseMoved(BMessage *msg, BPoint where, int32* _viewToken,
|
||||||
bool isLatestMouseMoved)
|
bool isLatestMouseMoved)
|
||||||
{
|
{
|
||||||
if (ViewLayer* view = ViewAt(where))
|
ViewLayer* view = ViewAt(where);
|
||||||
|
if (view != NULL)
|
||||||
*_viewToken = view->Token();
|
*_viewToken = view->Token();
|
||||||
|
|
||||||
// ignore pointer history
|
// ignore pointer history
|
||||||
@@ -978,6 +980,22 @@ WindowLayer::MouseMoved(BMessage *msg, BPoint where, int32* _viewToken,
|
|||||||
DesktopSettings desktopSettings(fDesktop);
|
DesktopSettings desktopSettings(fDesktop);
|
||||||
if (desktopSettings.MouseMode() != B_NORMAL_MOUSE && !IsFocus() && !(Flags() & B_AVOID_FOCUS))
|
if (desktopSettings.MouseMode() != B_NORMAL_MOUSE && !IsFocus() && !(Flags() & B_AVOID_FOCUS))
|
||||||
fDesktop->SetFocusWindow(this);
|
fDesktop->SetFocusWindow(this);
|
||||||
|
|
||||||
|
// mouse cursor
|
||||||
|
|
||||||
|
if (IsFocus()) {
|
||||||
|
// TODO: there is more for real cursor support, ie. if a window is closed,
|
||||||
|
// new app cursor shouldn't override view cursor, ...
|
||||||
|
ServerCursor* currentCursor = fDesktop->HWInterface()->Cursor();
|
||||||
|
ServerCursor* cursor = ServerWindow()->App()->Cursor();
|
||||||
|
if (view != NULL && view->Cursor() != NULL)
|
||||||
|
cursor = view->Cursor();
|
||||||
|
|
||||||
|
if (cursor != currentCursor) {
|
||||||
|
// TODO: custom cursors cannot be drawn by the HWInterface right now (wrong bitmap format)
|
||||||
|
// fDesktop->HWInterface()->SetCursor(cursor);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2005, Haiku.
|
* Copyright 2001-2006, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -45,7 +45,7 @@ using std::nothrow;
|
|||||||
|
|
||||||
|
|
||||||
// This call updates the frame buffer used by the on-screen KDL
|
// This call updates the frame buffer used by the on-screen KDL
|
||||||
#ifdef __HAIKU__
|
#ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST
|
||||||
extern "C" status_t _kern_frame_buffer_update(void *baseAddress,
|
extern "C" status_t _kern_frame_buffer_update(void *baseAddress,
|
||||||
int32 width, int32 height,
|
int32 width, int32 height,
|
||||||
int32 depth, int32 bytesPerRow);
|
int32 depth, int32 bytesPerRow);
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright 2005, Haiku, Inc. All rights reserved.
|
* Copyright 2005-2006, Haiku.
|
||||||
// Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
//
|
*
|
||||||
// Author: Stephan Aßmus, <[email protected]>
|
* Authors:
|
||||||
//------------------------------------------------------------------------------
|
* Stephan Aßmus <superstippi@gmx.de>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
//------------------------------------------------------------------------------
|
/*
|
||||||
// Copyright 2005, Haiku, Inc. All rights reserved.
|
* Copyright 2005-2006, Haiku.
|
||||||
// Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
//
|
*
|
||||||
// Author: Stephan Aßmus, <[email protected]>
|
* Authors:
|
||||||
//------------------------------------------------------------------------------
|
* Stephan Aßmus <superstippi@gmx.de>
|
||||||
|
*/
|
||||||
#ifndef HW_INTERFACE_H
|
#ifndef HW_INTERFACE_H
|
||||||
#define HW_INTERFACE_H
|
#define HW_INTERFACE_H
|
||||||
|
|
||||||
|
|
||||||
#include <Accelerant.h>
|
#include <Accelerant.h>
|
||||||
#include <GraphicsCard.h>
|
#include <GraphicsCard.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
@@ -76,6 +77,7 @@ class HWInterface : public MultiLocker {
|
|||||||
virtual void InvertRegion(/*const*/ BRegion& region) {}
|
virtual void InvertRegion(/*const*/ BRegion& region) {}
|
||||||
|
|
||||||
// cursor handling (these do their own Read/Write locking)
|
// cursor handling (these do their own Read/Write locking)
|
||||||
|
ServerCursor* Cursor() const { return fCursor; }
|
||||||
virtual void SetCursor(ServerCursor* cursor);
|
virtual void SetCursor(ServerCursor* cursor);
|
||||||
virtual void SetCursorVisible(bool visible);
|
virtual void SetCursorVisible(bool visible);
|
||||||
bool IsCursorVisible();
|
bool IsCursorVisible();
|
||||||
|
|||||||
Reference in New Issue
Block a user