* 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:
Axel Dörfler 2006-02-02 20:19:29 +00:00
parent f7969f54fb
commit ff3abf4d6f
10 changed files with 91 additions and 52 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2001-2005, Haiku.
* Copyright 2001-2006, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
@ -171,7 +171,7 @@ ServerApp::~ServerApp()
// time, but killing it might have desastrous effects
if (MessageLooper::WaitForQuit(deathSemaphore, 3000000) != B_OK) {
// 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",
Signature());
#else
@ -289,17 +289,16 @@ ServerApp::Activate(bool value)
fIsActive = value;
if (fIsActive) {
SetAppCursor();
}
if (fIsActive)
SetCursor();
}
//! Sets the cursor to the application cursor, if any.
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)
// fDesktop->HWInterface()->SetCursor(fAppCursor);
@ -310,7 +309,7 @@ ServerApp::SetAppCursor()
void
ServerApp::_GetLooperName(char* name, size_t length)
{
#ifdef __HAIKU__
#ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST
strlcpy(name, Signature(), length);
#else
strncpy(name, Signature(), length);
@ -891,10 +890,10 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
{
STRACE(("ServerApp %s: SetCursor via cursor data\n", Signature()));
// Attached data: 68 bytes of fAppCursor data
int8 cdata[68];
link.Read(cdata, 68);
int8 cursorData[68];
link.Read(cursorData, 68);
// Because we don't want an overaccumulation of these particular
// cursors, we will delete them if there is an existing one. It would
// otherwise be easy to crash the server by calling SetCursor a
@ -902,7 +901,7 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
if (fAppCursor)
fDesktop->GetCursorManager().DeleteCursor(fAppCursor->ID());
fAppCursor = new ServerCursor(cdata);
fAppCursor = new ServerCursor(cursorData);
fAppCursor->SetOwningTeam(fClientTeam);
fAppCursor->SetAppSignature(Signature());

View File

@ -1,5 +1,5 @@
/*
* Copyright 2001-2005, Haiku.
* Copyright 2001-2006, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
@ -9,8 +9,8 @@
* Stefano Ceccherini (burton666@libero.it)
* Axel Dörfler, axeld@pinc-software.de
*/
#ifndef _SERVERAPP_H_
#define _SERVERAPP_H_
#ifndef SERVER_APP_H
#define SERVER_APP_H
#include "MessageLooper.h"
@ -61,7 +61,8 @@ class ServerApp : public MessageLooper {
void SendMessageToClient(BMessage* message) const;
void SetAppCursor();
void SetCursor();
ServerCursor* Cursor() const { return fAppCursor; }
team_id ClientTeam() const;
const char* Signature() const { return fSignature.String(); }
@ -104,9 +105,9 @@ class ServerApp : public MessageLooper {
// To send a BMessage to the client
// (port + token)
Desktop* fDesktop;
BString fSignature;
team_id fClientTeam;
Desktop* fDesktop;
BString fSignature;
team_id fClientTeam;
mutable BLocker fWindowListLock;
BObjectList<ServerWindow> fWindowList;
@ -130,4 +131,4 @@ class ServerApp : public MessageLooper {
AreaPool fSharedMem;
};
#endif // _SERVERAPP_H_
#endif // SERVER_APP_H

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001-2005, Haiku, Inc.
* Copyright (c) 2001-2006, Haiku, Inc.
* Distributed under the terms of the MIT license.
*
* Authors:
@ -165,7 +165,7 @@ Screen::_FindMode(uint16 width, uint16 height, uint32 colorspace,
return err;
}
#if __HAIKU__
#ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST
int32 index = _FindMode(dm, count, width, height, colorspace, frequency);
if (index < 0) {
fprintf(stderr, "mode not found (%d, %d, %f) -> ignoring frequency and using B_CMAP8!\n", width, height, frequency);

View File

@ -1,5 +1,5 @@
/*
* Copyright 2001-2005, Haiku.
* Copyright 2001-2006, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
@ -1246,13 +1246,14 @@ ServerWindow::_DispatchViewMessage(int32 code,
case AS_LAYER_CURSOR:
{
DTRACE(("ServerWindow %s: Message AS_LAYER_CURSOR: ViewLayer: %s - NOT IMPLEMENTED\n", Title(), fCurrentLayer->Name()));
int32 token;
int32 token = -1;
link.Read<int32>(&token);
// TODO: implement; I think each ViewLayer should have a member pointing
// to this requested cursor.
// TODO: this badly needs reference counting
ServerCursor* cursor = fDesktop->GetCursorManager().FindCursor(token);
fCurrentLayer->SetCursor(cursor);
// TODO: if fCurrentLayer is the view under the cursor, the appearance should change immediately!
break;
}
case AS_LAYER_SET_FLAGS:
@ -1260,7 +1261,7 @@ ServerWindow::_DispatchViewMessage(int32 code,
uint32 flags;
link.Read<uint32>(&flags);
fCurrentLayer->SetFlags(flags);
STRACE(("ServerWindow %s: Message AS_LAYER_SET_FLAGS: ViewLayer: %s\n", Title(), fCurrentLayer->Name()));
break;
}
@ -2402,7 +2403,7 @@ ServerWindow::_MessageLooper()
if (code >= 0 && code < AS_LAST_CODE) {
diff = system_time() - start;
atomic_add(&sMessageProfile[code].count, 1);
#ifdef __HAIKU__
#ifndef HAIKU_TARGET_PLATFORM_LIBBE_TEST
atomic_add64(&sMessageProfile[code].time, diff);
#else
sMessageProfile[code].time += diff;

View File

@ -1,10 +1,11 @@
/*
* Copyright (c) 2001-2005, Haiku, Inc.
* Copyright (c) 2001-2006, Haiku, Inc.
* Distributed under the terms of the MIT license.
*
* Authors:
* DarkWyrm <bpmagic@columbus.rr.com>
* Adi Oanca <adioanca@gmail.com>
* Axel Dörfler, axeld@pinc-software.de
* Stephan Aßmus <superstippi@gmx.de>
*/
@ -61,7 +62,8 @@ ViewLayer::ViewLayer(BRect frame, const char* name,
fPreviousSibling(NULL),
fNextSibling(NULL),
fLastChild(NULL),
fCursor(NULL),
fPicture(NULL),
fLocalClipping(Bounds()),
@ -876,6 +878,13 @@ ViewLayer::SetEventMask(uint32 eventMask, uint32 options)
}
void
ViewLayer::SetCursor(ServerCursor *cursor)
{
fCursor = cursor;
}
void
ViewLayer::SetPicture(ServerPicture *picture)
{

View File

@ -1,10 +1,11 @@
/*
* Copyright (c) 2001-2005, Haiku, Inc.
* Copyright (c) 2001-2006, Haiku, Inc.
* Distributed under the terms of the MIT license.
*
* Authors:
* DarkWyrm <bpmagic@columbus.rr.com>
* Adi Oanca <adioanca@gmail.com>
* Axel Dörfler, axeld@pinc-software.de
* Stephan Aßmus <superstippi@gmx.de>
*/
#ifndef VIEW_LAYER_H
@ -23,6 +24,7 @@ class DrawState;
class DrawingEngine;
class WindowLayer;
class ServerBitmap;
class ServerCursor;
class ServerPicture;
class ViewLayer {
@ -147,8 +149,11 @@ class ViewLayer {
uint32 EventOptions() const
{ return fEventOptions; }
void SetPicture(ServerPicture *picture);
ServerPicture *Picture() const;
ServerCursor* Cursor() const { return fCursor; }
void SetCursor(ServerCursor* cursor);
ServerPicture* Picture() const;
void SetPicture(ServerPicture* picture);
// for background clearing
virtual void Draw(DrawingEngine* drawingEngine,
@ -221,7 +226,9 @@ class ViewLayer {
ViewLayer* fNextSibling;
ViewLayer* fLastChild;
ServerPicture *fPicture;
ServerCursor* fCursor;
ServerPicture* fPicture;
// clipping
BRegion fLocalClipping;

View File

@ -17,6 +17,7 @@
#include "DecorManager.h"
#include "Desktop.h"
#include "DrawingEngine.h"
#include "HWInterface.h"
#include "MessagePrivate.h"
#include "PortLink.h"
#include "ServerApp.h"
@ -909,7 +910,8 @@ void
WindowLayer::MouseMoved(BMessage *msg, BPoint where, int32* _viewToken,
bool isLatestMouseMoved)
{
if (ViewLayer* view = ViewAt(where))
ViewLayer* view = ViewAt(where);
if (view != NULL)
*_viewToken = view->Token();
// ignore pointer history
@ -978,6 +980,22 @@ WindowLayer::MouseMoved(BMessage *msg, BPoint where, int32* _viewToken,
DesktopSettings desktopSettings(fDesktop);
if (desktopSettings.MouseMode() != B_NORMAL_MOUSE && !IsFocus() && !(Flags() & B_AVOID_FOCUS))
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);
}
}
}

View File

@ -1,5 +1,5 @@
/*
* Copyright 2001-2005, Haiku.
* Copyright 2001-2006, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
@ -45,7 +45,7 @@ using std::nothrow;
// 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,
int32 width, int32 height,
int32 depth, int32 bytesPerRow);

View File

@ -1,9 +1,11 @@
//------------------------------------------------------------------------------
// Copyright 2005, Haiku, Inc. All rights reserved.
// Distributed under the terms of the MIT License.
//
// Author: Stephan Aßmus, <superstippi@gmx.de>
//------------------------------------------------------------------------------
/*
* Copyright 2005-2006, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* Stephan Aßmus <superstippi@gmx.de>
*/
#include <stdio.h>
#include <string.h>

View File

@ -1,13 +1,14 @@
//------------------------------------------------------------------------------
// Copyright 2005, Haiku, Inc. All rights reserved.
// Distributed under the terms of the MIT License.
//
// Author: Stephan Aßmus, <superstippi@gmx.de>
//------------------------------------------------------------------------------
/*
* Copyright 2005-2006, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
* Stephan Aßmus <superstippi@gmx.de>
*/
#ifndef HW_INTERFACE_H
#define HW_INTERFACE_H
#include <Accelerant.h>
#include <GraphicsCard.h>
#include <OS.h>
@ -76,6 +77,7 @@ class HWInterface : public MultiLocker {
virtual void InvertRegion(/*const*/ BRegion& region) {}
// cursor handling (these do their own Read/Write locking)
ServerCursor* Cursor() const { return fCursor; }
virtual void SetCursor(ServerCursor* cursor);
virtual void SetCursorVisible(bool visible);
bool IsCursorVisible();