2003-02-12 04:11:55 +03:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Copyright (c) 2001-2002, OpenBeOS
|
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
// copy of this software and associated documentation files (the "Software"),
|
|
|
|
// to deal in the Software without restriction, including without limitation
|
|
|
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
// and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
// Software is furnished to do so, subject to the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
// DEALINGS IN THE SOFTWARE.
|
|
|
|
//
|
|
|
|
// File Name: ServerWindow.cpp
|
|
|
|
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
2004-04-03 19:05:49 +04:00
|
|
|
// Adi Oanca <adioanca@mymail.ro>
|
2003-02-12 04:11:55 +03:00
|
|
|
// Description: Shadow BWindow class
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------------------
|
2003-02-07 15:53:57 +03:00
|
|
|
#include <AppDefs.h>
|
|
|
|
#include <Rect.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <View.h> // for B_XXXXX_MOUSE_BUTTON defines
|
2003-09-25 16:31:11 +04:00
|
|
|
#include <Message.h>
|
2003-09-09 01:18:39 +04:00
|
|
|
#include <GraphicsDefs.h>
|
2003-07-11 00:22:07 +04:00
|
|
|
#include <PortLink.h>
|
2003-10-04 23:10:11 +04:00
|
|
|
#include <Session.h>
|
2003-02-07 15:53:57 +03:00
|
|
|
#include "AppServer.h"
|
|
|
|
#include "Layer.h"
|
2003-08-31 21:38:34 +04:00
|
|
|
#include "RootLayer.h"
|
2003-02-07 15:53:57 +03:00
|
|
|
#include "ServerWindow.h"
|
|
|
|
#include "ServerApp.h"
|
|
|
|
#include "ServerProtocol.h"
|
2003-02-14 04:53:53 +03:00
|
|
|
#include "WinBorder.h"
|
2003-02-07 15:53:57 +03:00
|
|
|
#include "Desktop.h"
|
2003-02-12 04:11:55 +03:00
|
|
|
#include "TokenHandler.h"
|
2003-06-24 17:55:18 +04:00
|
|
|
#include "Utils.h"
|
2003-08-31 21:38:34 +04:00
|
|
|
#include "DisplayDriver.h"
|
2003-09-25 16:31:11 +04:00
|
|
|
#include "ServerPicture.h"
|
2003-09-25 21:25:38 +04:00
|
|
|
#include "CursorManager.h"
|
2004-01-13 03:56:36 +03:00
|
|
|
#include "Workspace.h"
|
2003-02-12 04:11:55 +03:00
|
|
|
|
2004-06-18 15:50:17 +04:00
|
|
|
//#define DEBUG_SERVERWINDOW
|
2003-03-23 23:52:37 +03:00
|
|
|
//#define DEBUG_SERVERWINDOW_MOUSE
|
|
|
|
//#define DEBUG_SERVERWINDOW_KEYBOARD
|
|
|
|
|
2003-09-09 01:18:39 +04:00
|
|
|
|
2003-03-23 23:52:37 +03:00
|
|
|
#ifdef DEBUG_SERVERWINDOW
|
2003-09-09 01:18:39 +04:00
|
|
|
# include <stdio.h>
|
|
|
|
# define STRACE(x) printf x
|
|
|
|
#else
|
|
|
|
# define STRACE(x) ;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DEBUG_SERVERWINDOW_KEYBOARD
|
|
|
|
# include <stdio.h>
|
|
|
|
# define STRACE_KEY(x) printf x
|
|
|
|
#else
|
|
|
|
# define STRACE_KEY(x) ;
|
2003-03-23 23:52:37 +03:00
|
|
|
#endif
|
|
|
|
|
2003-09-09 01:18:39 +04:00
|
|
|
#ifdef DEBUG_SERVERWINDOW_MOUSE
|
|
|
|
# include <stdio.h>
|
|
|
|
# define STRACE_MOUSE(x) printf x
|
|
|
|
#else
|
|
|
|
# define STRACE_MOUSE(x) ;
|
|
|
|
#endif
|
|
|
|
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2003-06-28 23:06:30 +04:00
|
|
|
|
2003-07-05 01:13:48 +04:00
|
|
|
template<class Type> Type
|
|
|
|
read_from_buffer(int8 **_buffer)
|
|
|
|
{
|
|
|
|
Type *typedBuffer = (Type *)(*_buffer);
|
|
|
|
Type value = *typedBuffer;
|
|
|
|
|
|
|
|
typedBuffer++;
|
|
|
|
*_buffer = (int8 *)(typedBuffer);
|
|
|
|
|
|
|
|
return value;
|
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2003-07-05 01:13:48 +04:00
|
|
|
static int8 *read_pattern_from_buffer(int8 **_buffer)
|
|
|
|
{
|
|
|
|
int8 *pattern = *_buffer;
|
|
|
|
|
|
|
|
*_buffer += AS_PATTERN_SIZE;
|
|
|
|
|
|
|
|
return pattern;
|
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2003-07-05 01:13:48 +04:00
|
|
|
template<class Type> void
|
|
|
|
write_to_buffer(int8 **_buffer, Type value)
|
|
|
|
{
|
|
|
|
Type *typedBuffer = (Type *)(*_buffer);
|
|
|
|
|
|
|
|
*typedBuffer = value;
|
|
|
|
typedBuffer++;
|
|
|
|
|
|
|
|
*_buffer = (int8 *)(typedBuffer);
|
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2003-02-12 04:11:55 +03:00
|
|
|
/*!
|
|
|
|
\brief Contructor
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
Does a lot of stuff to set up for the window - new decorator, new winborder, spawn a
|
|
|
|
monitor thread.
|
2003-02-12 04:11:55 +03:00
|
|
|
*/
|
|
|
|
ServerWindow::ServerWindow(BRect rect, const char *string, uint32 wlook,
|
2003-09-25 16:31:11 +04:00
|
|
|
uint32 wfeel, uint32 wflags, ServerApp *winapp, port_id winport,
|
2003-12-07 08:40:51 +03:00
|
|
|
port_id looperPort, port_id replyport, uint32 index, int32 handlerID)
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2004-01-13 03:56:36 +03:00
|
|
|
STRACE(("ServerWindow(%s)::ServerWindow()\n",string? string: "NULL"));
|
2004-01-20 01:18:37 +03:00
|
|
|
fServerApp = winapp;
|
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
if(string)
|
2004-01-20 01:18:37 +03:00
|
|
|
fTitle.SetTo(string);
|
2004-07-30 19:16:59 +04:00
|
|
|
else
|
|
|
|
fTitle.SetTo(B_EMPTY_STRING);
|
2004-06-11 18:47:36 +04:00
|
|
|
|
|
|
|
fFrame = rect;
|
|
|
|
fFlags = wflags;
|
|
|
|
fLook = wlook;
|
|
|
|
fFeel = wfeel;
|
|
|
|
|
|
|
|
fHandlerToken = handlerID;
|
|
|
|
fClientLooperPort = looperPort;
|
|
|
|
fClientTeamID = winapp->ClientTeamID();
|
|
|
|
fWorkspaces = index;
|
|
|
|
|
|
|
|
fWinBorder = NULL;
|
2004-07-30 19:16:59 +04:00
|
|
|
cl = NULL; //current layer
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
// fClientWinPort is the port to which the app awaits messages from the server
|
2004-06-11 18:47:36 +04:00
|
|
|
fClientWinPort = winport;
|
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
// fMessagePort is the port to which the app sends messages for the server
|
2004-06-11 18:47:36 +04:00
|
|
|
fMessagePort = create_port(30,fTitle.String());
|
2004-01-13 03:56:36 +03:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession = new BPortLink(fClientWinPort, fMessagePort);
|
2003-12-07 08:40:51 +03:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
// Send a reply to our window - it is expecting fMessagePort port.
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->StartMessage(SERVER_TRUE);
|
|
|
|
fSession->Attach<port_id>(fMessagePort);
|
|
|
|
fSession->Flush();
|
2004-04-03 19:05:49 +04:00
|
|
|
|
2004-03-28 19:00:31 +04:00
|
|
|
STRACE(("ServerWindow %s:\n",fTitle.String()));
|
|
|
|
STRACE(("\tFrame (%.1f,%.1f,%.1f,%.1f)\n",rect.left,rect.top,rect.right,rect.bottom));
|
|
|
|
STRACE(("\tPort: %ld\n",fMessagePort));
|
|
|
|
STRACE(("\tWorkspace: %ld\n",index));
|
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2004-06-11 18:47:36 +04:00
|
|
|
void ServerWindow::Init(void)
|
|
|
|
{
|
2004-06-18 19:24:36 +04:00
|
|
|
fWinBorder = new WinBorder( fFrame, fTitle.String(), fLook, fFeel, 0UL,
|
2004-06-16 10:40:26 +04:00
|
|
|
this, desktop->GetDisplayDriver());
|
|
|
|
fWinBorder->RebuildFullRegion();
|
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
// Spawn our message-monitoring thread
|
|
|
|
fMonitorThreadID = spawn_thread(MonitorWin, fTitle.String(), B_NORMAL_PRIORITY, this);
|
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
if(fMonitorThreadID != B_NO_MORE_THREADS && fMonitorThreadID != B_NO_MEMORY)
|
|
|
|
resume_thread(fMonitorThreadID);
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2004-06-19 17:04:50 +04:00
|
|
|
//!Tears down all connections the main app_server objects, and deletes some internals.
|
2003-02-07 15:53:57 +03:00
|
|
|
ServerWindow::~ServerWindow(void)
|
|
|
|
{
|
2004-06-11 18:47:36 +04:00
|
|
|
STRACE(("*ServerWindow (%s):~ServerWindow()\n",fTitle.String()));
|
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
desktop->RemoveWinBorder(fWinBorder);
|
2004-06-11 18:47:36 +04:00
|
|
|
STRACE(("SW(%s) Successfully removed from the desktop\n", fTitle.String()));
|
|
|
|
|
|
|
|
if(fSession)
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
delete fSession;
|
|
|
|
fSession = NULL;
|
2004-01-13 03:56:36 +03:00
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
|
|
|
|
if (fWinBorder)
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
delete fWinBorder;
|
|
|
|
fWinBorder = NULL;
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
|
|
|
|
cl = NULL;
|
|
|
|
|
2004-06-26 06:15:48 +04:00
|
|
|
STRACE(("#ServerWindow(%s) will exit NOW\n", fTitle.String()));
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2004-06-26 06:15:48 +04:00
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
//! Forces the window border to update its decorator
|
2003-02-12 04:11:55 +03:00
|
|
|
void ServerWindow::ReplaceDecorator(void)
|
|
|
|
{
|
2004-06-19 14:23:14 +04:00
|
|
|
if (!IsLocked())
|
|
|
|
debugger("you must lock a ServerWindow object before calling ::ReplaceDecorator()\n");
|
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
STRACE(("ServerWindow %s: Replace Decorator\n",fTitle.String()));
|
2004-01-20 01:18:37 +03:00
|
|
|
fWinBorder->UpdateDecorator();
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2003-02-24 18:47:06 +03:00
|
|
|
//! Requests that the ServerWindow's BWindow quit
|
2003-02-07 15:53:57 +03:00
|
|
|
void ServerWindow::Quit(void)
|
|
|
|
{
|
2004-06-19 14:23:14 +04:00
|
|
|
if (!IsLocked())
|
|
|
|
debugger("you must lock a ServerWindow object before calling ::Quit()\n");
|
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
STRACE(("ServerWindow %s: Quit\n",fTitle.String()));
|
|
|
|
BMessage msg;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
msg.what = B_QUIT_REQUESTED;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
SendMessageToClient(&msg);
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2003-02-24 18:47:06 +03:00
|
|
|
//! Shows the window's WinBorder
|
2003-02-07 15:53:57 +03:00
|
|
|
void ServerWindow::Show(void)
|
|
|
|
{
|
2004-06-19 14:23:14 +04:00
|
|
|
if (!IsLocked())
|
|
|
|
debugger("you must lock a ServerWindow object before calling ::Show()\n");
|
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
if(!fWinBorder->IsHidden())
|
2004-01-14 18:55:10 +03:00
|
|
|
return;
|
|
|
|
|
2004-06-17 18:39:21 +04:00
|
|
|
STRACE(("ServerWindow (%s): Show()\n",fTitle.String()));
|
2004-01-20 01:18:37 +03:00
|
|
|
if(fWinBorder)
|
2003-03-31 01:09:39 +04:00
|
|
|
{
|
2004-06-11 18:47:36 +04:00
|
|
|
RootLayer *rl = fWinBorder->GetRootLayer();
|
|
|
|
int32 wksCount;
|
2004-01-13 03:56:36 +03:00
|
|
|
|
|
|
|
desktop->fGeneralLock.Lock();
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow(%s)::Show() - General lock acquired\n", fWinBorder->GetName()));
|
2004-01-14 03:26:15 +03:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
rl->fMainLock.Lock();
|
|
|
|
STRACE(("ServerWindow(%s)::Show() - Main lock acquired\n", fWinBorder->GetName()));
|
2004-04-05 00:26:17 +04:00
|
|
|
|
2004-06-19 02:27:46 +04:00
|
|
|
// make WinBorder unhidden, but *do not* rebuild and redraw! We'll do that
|
|
|
|
// after we bring it (its modal and floating windows also) in front.
|
2004-06-17 18:39:21 +04:00
|
|
|
fWinBorder->Show(false);
|
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
if ( (fFeel == B_FLOATING_SUBSET_WINDOW_FEEL || fFeel == B_MODAL_SUBSET_WINDOW_FEEL)
|
2004-01-20 01:18:37 +03:00
|
|
|
&& fWinBorder->MainWinBorder() == NULL)
|
2004-01-14 18:55:10 +03:00
|
|
|
{
|
2004-06-11 18:47:36 +04:00
|
|
|
// This window hasn't been added to a normal window subset,
|
|
|
|
// so don't call placement or redrawing methods
|
2004-01-14 18:55:10 +03:00
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
wksCount = rl->WorkspaceCount();
|
|
|
|
for(int32 i = 0; i < wksCount; i++)
|
|
|
|
{
|
|
|
|
if (fWorkspaces & (0x00000001UL << i))
|
|
|
|
{
|
2004-06-19 02:27:46 +04:00
|
|
|
WinBorder *previousFocus;
|
|
|
|
BRegion invalidRegion;
|
|
|
|
Workspace *ws;
|
2004-07-30 19:16:59 +04:00
|
|
|
|
|
|
|
// TODO: can you unify this method with Desktop::MouseEventHandler::B_MOUSE_DOWN
|
|
|
|
|
2004-06-19 02:27:46 +04:00
|
|
|
ws = rl->WorkspaceAt(i+1);
|
2004-06-11 18:47:36 +04:00
|
|
|
ws->BringToFrontANormalWindow(fWinBorder);
|
|
|
|
ws->SearchAndSetNewFront(fWinBorder);
|
2004-06-19 02:27:46 +04:00
|
|
|
previousFocus = ws->FocusLayer();
|
2004-07-10 10:28:41 +04:00
|
|
|
ws->SearchAndSetNewFocus(fWinBorder);
|
2004-07-30 19:16:59 +04:00
|
|
|
|
|
|
|
// TODO: only do this in for the active workspace!
|
|
|
|
|
2004-06-19 02:27:46 +04:00
|
|
|
// first redraw previous window's decorator. It has lost focus state.
|
|
|
|
if (previousFocus)
|
|
|
|
if (previousFocus->fDecorator)
|
|
|
|
fWinBorder->fParent->Invalidate(previousFocus->fVisible);
|
|
|
|
|
|
|
|
// we must build the rebuild region. we have nowhere to take it from.
|
|
|
|
// include decorator's(if any) and fTopLayer's full regions.
|
2004-06-21 00:02:32 +04:00
|
|
|
fWinBorder->fTopLayer->RebuildFullRegion();
|
2004-06-19 02:27:46 +04:00
|
|
|
fWinBorder->RebuildFullRegion();
|
2004-06-21 00:02:32 +04:00
|
|
|
invalidRegion.Include(&(fWinBorder->fTopLayer->fFull));
|
2004-06-19 02:27:46 +04:00
|
|
|
if (fWinBorder->fDecorator)
|
|
|
|
invalidRegion.Include(&(fWinBorder->fFull));
|
|
|
|
|
|
|
|
fWinBorder->fParent->FullInvalidate(invalidRegion);
|
2004-06-11 18:47:36 +04:00
|
|
|
}
|
2004-01-14 03:26:15 +03:00
|
|
|
}
|
2004-01-13 03:56:36 +03:00
|
|
|
}
|
2004-01-14 18:55:10 +03:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
rl->fMainLock.Unlock();
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow(%s)::Show() - Main lock released\n", fWinBorder->GetName()));
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
desktop->fGeneralLock.Unlock();
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow(%s)::Show() - General lock released\n", fWinBorder->GetName()));
|
2003-03-31 01:09:39 +04:00
|
|
|
}
|
2004-06-17 18:39:21 +04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
debugger("WARNING: NULL fWinBorder\n");
|
|
|
|
}
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2003-02-24 18:47:06 +03:00
|
|
|
//! Hides the window's WinBorder
|
2003-02-07 15:53:57 +03:00
|
|
|
void ServerWindow::Hide(void)
|
|
|
|
{
|
2004-06-19 14:23:14 +04:00
|
|
|
if (!IsLocked())
|
|
|
|
debugger("you must lock a ServerWindow object before calling ::Hide()\n");
|
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
if(fWinBorder->IsHidden())
|
2004-01-14 18:55:10 +03:00
|
|
|
return;
|
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Hide\n",fTitle.String()));
|
2004-06-11 18:47:36 +04:00
|
|
|
if(fWinBorder)
|
|
|
|
{
|
|
|
|
RootLayer *rl = fWinBorder->GetRootLayer();
|
|
|
|
Workspace *ws = NULL;
|
|
|
|
|
2004-01-14 03:26:15 +03:00
|
|
|
desktop->fGeneralLock.Lock();
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow(%s)::Hide() - General lock acquired\n", fWinBorder->GetName()));
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
rl->fMainLock.Lock();
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow(%s)::Hide() - Main lock acquired\n", fWinBorder->GetName()));
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
fWinBorder->Hide();
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
int32 wksCount= rl->WorkspaceCount();
|
2004-06-11 18:47:36 +04:00
|
|
|
for(int32 i = 0; i < wksCount; i++)
|
|
|
|
{
|
|
|
|
ws = rl->WorkspaceAt(i+1);
|
|
|
|
|
|
|
|
if (ws->FrontLayer() == fWinBorder)
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
ws->HideSubsetWindows(fWinBorder);
|
2004-07-10 10:28:41 +04:00
|
|
|
ws->SearchAndSetNewFocus(ws->FrontLayer());
|
2004-01-17 19:33:22 +03:00
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ws->FocusLayer() == fWinBorder)
|
2004-07-10 10:28:41 +04:00
|
|
|
ws->SearchAndSetNewFocus(fWinBorder);
|
2004-07-10 14:54:20 +04:00
|
|
|
else{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: RootLayer or Desktop class should take care of invalidating
|
2004-07-10 14:54:20 +04:00
|
|
|
// ws->Invalidate();
|
|
|
|
}
|
2004-01-13 03:56:36 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
rl->fMainLock.Unlock();
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow(%s)::Hide() - Main lock released\n", fWinBorder->GetName()));
|
|
|
|
|
2004-01-14 03:26:15 +03:00
|
|
|
desktop->fGeneralLock.Unlock();
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow(%s)::Hide() - General lock released\n", fWinBorder->GetName()));
|
2004-01-13 03:56:36 +03:00
|
|
|
}
|
2003-02-12 04:11:55 +03:00
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2003-02-24 18:47:06 +03:00
|
|
|
/*
|
|
|
|
\brief Determines whether the window is hidden or not
|
|
|
|
\return true if hidden, false if not
|
|
|
|
*/
|
2004-06-19 14:23:14 +04:00
|
|
|
bool ServerWindow::IsHidden(void) const
|
2003-02-12 04:11:55 +03:00
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
if(fWinBorder)
|
|
|
|
return fWinBorder->IsHidden();
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
return true;
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2004-06-11 18:47:36 +04:00
|
|
|
void ServerWindow::Minimize(bool status)
|
|
|
|
{
|
2004-06-15 00:32:21 +04:00
|
|
|
// This function doesn't need much -- check to make sure that we should and
|
|
|
|
// send the message to the client. According to the BeBook, the BWindow hook function
|
|
|
|
// does all the heavy lifting for us. :)
|
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
bool sendMessages = false;
|
2003-11-15 03:28:40 +03:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
if (status)
|
|
|
|
{
|
|
|
|
if (!IsHidden())
|
|
|
|
{
|
2003-11-15 03:28:40 +03:00
|
|
|
Hide();
|
2004-06-11 18:47:36 +04:00
|
|
|
sendMessages = true;
|
2003-11-15 03:28:40 +03:00
|
|
|
}
|
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (IsHidden())
|
|
|
|
{
|
2003-11-15 03:28:40 +03:00
|
|
|
Show();
|
2004-06-11 18:47:36 +04:00
|
|
|
sendMessages = true;
|
2003-11-15 03:28:40 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
if (sendMessages)
|
|
|
|
{
|
2004-06-15 00:32:21 +04:00
|
|
|
BMessage msg;
|
|
|
|
msg.what = B_MINIMIZE;
|
2003-11-15 03:28:40 +03:00
|
|
|
msg.AddInt64("when", real_time_clock_usecs());
|
2003-12-07 08:40:51 +03:00
|
|
|
msg.AddBool("minimize", status);
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
SendMessageToClient(&msg);
|
2003-11-15 03:28:40 +03:00
|
|
|
}
|
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2004-06-11 18:47:36 +04:00
|
|
|
// Sends a message to the client to perform a Zoom
|
|
|
|
void ServerWindow::Zoom(void)
|
|
|
|
{
|
2004-06-11 06:46:48 +04:00
|
|
|
BMessage msg;
|
|
|
|
msg.what=B_ZOOM;
|
|
|
|
SendMessageToClient(&msg);
|
2003-11-15 03:28:40 +03:00
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2003-02-24 18:47:06 +03:00
|
|
|
/*!
|
|
|
|
\brief Notifies window of workspace (de)activation
|
|
|
|
\param workspace Index of the workspace changed
|
|
|
|
\param active New active status of the workspace
|
|
|
|
*/
|
|
|
|
void ServerWindow::WorkspaceActivated(int32 workspace, bool active)
|
|
|
|
{
|
2004-06-11 18:47:36 +04:00
|
|
|
STRACE(("ServerWindow %s: WorkspaceActivated(%ld,%s)\n",fTitle.String(),
|
|
|
|
workspace,(active)?"active":"inactive"));
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
BMessage msg;
|
|
|
|
msg.what = B_WORKSPACE_ACTIVATED;
|
2003-09-25 16:31:11 +04:00
|
|
|
msg.AddInt32("workspace", workspace);
|
|
|
|
msg.AddBool("active", active);
|
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
SendMessageToClient(&msg);
|
2003-02-24 18:47:06 +03:00
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2003-02-24 18:47:06 +03:00
|
|
|
/*!
|
|
|
|
\brief Notifies window of a workspace switch
|
|
|
|
\param oldone index of the previous workspace
|
|
|
|
\param newone index of the new workspace
|
|
|
|
*/
|
|
|
|
void ServerWindow::WorkspacesChanged(int32 oldone,int32 newone)
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2004-06-11 18:47:36 +04:00
|
|
|
STRACE(("ServerWindow %s: WorkspacesChanged(%ld,%ld)\n",fTitle.String(),oldone,newone));
|
|
|
|
|
|
|
|
BMessage msg;
|
2003-09-25 16:31:11 +04:00
|
|
|
msg.what = B_WORKSPACES_CHANGED;
|
|
|
|
msg.AddInt32("old", oldone);
|
|
|
|
msg.AddInt32("new", newone);
|
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
SendMessageToClient(&msg);
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2003-02-24 18:47:06 +03:00
|
|
|
/*!
|
|
|
|
\brief Notifies window of a change in focus
|
|
|
|
\param active New active status of the window
|
|
|
|
*/
|
2003-02-12 04:11:55 +03:00
|
|
|
void ServerWindow::WindowActivated(bool active)
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2004-06-11 18:47:36 +04:00
|
|
|
STRACE(("ServerWindow %s: WindowActivated(%s)\n",fTitle.String(),(active)?"active":"inactive"));
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
BMessage msg;
|
|
|
|
msg.what = B_WINDOW_ACTIVATED;
|
2003-09-25 16:31:11 +04:00
|
|
|
msg.AddBool("active", active);
|
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
SendMessageToClient(&msg);
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2003-02-24 18:47:06 +03:00
|
|
|
/*!
|
|
|
|
\brief Notifies window of a change in screen resolution
|
|
|
|
\param frame Size of the new resolution
|
|
|
|
\param color_space Color space of the new screen mode
|
|
|
|
*/
|
|
|
|
void ServerWindow::ScreenModeChanged(const BRect frame, const color_space cspace)
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2004-06-11 18:47:36 +04:00
|
|
|
STRACE(("ServerWindow %s: ScreenModeChanged\n",fTitle.String()));
|
|
|
|
BMessage msg;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
msg.what = B_SCREEN_CHANGED;
|
2003-09-25 16:31:11 +04:00
|
|
|
msg.AddRect("frame", frame);
|
|
|
|
msg.AddInt32("mode", (int32)cspace);
|
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
SendMessageToClient(&msg);
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2003-02-24 18:47:06 +03:00
|
|
|
/*!
|
|
|
|
\brief Locks the window
|
|
|
|
\return B_OK if everything is ok, B_ERROR if something went wrong
|
|
|
|
*/
|
2003-02-12 04:11:55 +03:00
|
|
|
status_t ServerWindow::Lock(void)
|
|
|
|
{
|
2004-06-11 18:47:36 +04:00
|
|
|
STRACE(("ServerWindow %s: Lock\n",fTitle.String()));
|
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
return (fLocker.Lock())?B_OK:B_ERROR;
|
2003-02-12 04:11:55 +03:00
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2003-02-24 18:47:06 +03:00
|
|
|
//! Unlocks the window
|
2003-02-12 04:11:55 +03:00
|
|
|
void ServerWindow::Unlock(void)
|
|
|
|
{
|
2004-06-11 18:47:36 +04:00
|
|
|
STRACE(("ServerWindow %s: Unlock\n",fTitle.String()));
|
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
fLocker.Unlock();
|
2003-02-12 04:11:55 +03:00
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2003-02-24 18:47:06 +03:00
|
|
|
/*!
|
|
|
|
\brief Determines whether or not the window is locked
|
|
|
|
\return True if locked, false if not.
|
|
|
|
*/
|
2004-06-19 14:23:14 +04:00
|
|
|
bool ServerWindow::IsLocked(void) const
|
2003-02-12 04:11:55 +03:00
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
return fLocker.IsLocked();
|
2003-02-12 04:11:55 +03:00
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2004-06-11 18:47:36 +04:00
|
|
|
/*!
|
|
|
|
\brief Sets the font state for a layer
|
|
|
|
\param layer The layer to set the font
|
|
|
|
*/
|
|
|
|
void ServerWindow::SetLayerFontState(Layer *layer)
|
|
|
|
{
|
2004-06-19 14:23:14 +04:00
|
|
|
// NOTE: no need to check for a lock. This is a private method.
|
2004-06-11 18:47:36 +04:00
|
|
|
uint16 mask;
|
2004-03-28 19:00:31 +04:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<uint16>(&mask);
|
2004-03-28 19:00:31 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
if (mask & B_FONT_FAMILY_AND_STYLE)
|
|
|
|
{
|
2004-03-28 19:00:31 +04:00
|
|
|
uint32 fontID;
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<int32>((int32*)&fontID);
|
2004-08-29 19:01:44 +04:00
|
|
|
|
|
|
|
// TODO: Implement. ServerFont::SetFamilyAndStyle(uint32) is needed
|
2004-06-11 22:21:57 +04:00
|
|
|
//layer->fLayerData->font->
|
2004-03-28 19:00:31 +04:00
|
|
|
}
|
2004-04-03 19:05:49 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
if (mask & B_FONT_SIZE)
|
|
|
|
{
|
|
|
|
float size;
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<float>(&size);
|
2004-06-11 22:21:57 +04:00
|
|
|
layer->fLayerData->font.SetSize(size);
|
2004-03-28 19:00:31 +04:00
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
|
|
|
|
if (mask & B_FONT_SHEAR)
|
|
|
|
{
|
|
|
|
float shear;
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<float>(&shear);
|
2004-06-11 22:21:57 +04:00
|
|
|
layer->fLayerData->font.SetShear(shear);
|
2004-03-28 19:00:31 +04:00
|
|
|
}
|
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
if (mask & B_FONT_ROTATION)
|
|
|
|
{
|
|
|
|
float rotation;
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<float>(&rotation);
|
2004-06-11 22:21:57 +04:00
|
|
|
layer->fLayerData->font.SetRotation(rotation);
|
2004-03-28 19:00:31 +04:00
|
|
|
}
|
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
if (mask & B_FONT_SPACING)
|
|
|
|
{
|
|
|
|
uint8 spacing;
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<uint8>(&spacing);
|
2004-06-11 22:21:57 +04:00
|
|
|
layer->fLayerData->font.SetSpacing(spacing);
|
2004-03-28 19:00:31 +04:00
|
|
|
}
|
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
if (mask & B_FONT_ENCODING)
|
|
|
|
{
|
|
|
|
uint8 encoding;
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<uint8>((uint8*)&encoding);
|
2004-06-11 22:21:57 +04:00
|
|
|
layer->fLayerData->font.SetEncoding(encoding);
|
2004-03-28 19:00:31 +04:00
|
|
|
}
|
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
if (mask & B_FONT_FACE)
|
|
|
|
{
|
|
|
|
uint16 face;
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<uint16>(&face);
|
2004-06-11 22:21:57 +04:00
|
|
|
layer->fLayerData->font.SetFace(face);
|
2004-03-28 19:00:31 +04:00
|
|
|
}
|
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
if (mask & B_FONT_FLAGS)
|
|
|
|
{
|
|
|
|
uint32 flags;
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<uint32>(&flags);
|
2004-06-11 22:21:57 +04:00
|
|
|
layer->fLayerData->font.SetFlags(flags);
|
2004-03-28 19:00:31 +04:00
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
STRACE(("DONE: ServerWindow %s: Message AS_LAYER_SET_FONT_STATE: Layer: %s\n",
|
2004-06-16 10:40:26 +04:00
|
|
|
fTitle.String(), layer->fName->String()));
|
2004-03-28 19:00:31 +04:00
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2004-06-11 18:47:36 +04:00
|
|
|
void ServerWindow::SetLayerState(Layer *layer)
|
|
|
|
{
|
2004-06-19 14:23:14 +04:00
|
|
|
// NOTE: no need to check for a lock. This is a private method.
|
2004-06-11 18:47:36 +04:00
|
|
|
rgb_color highColor, lowColor, viewColor;
|
2004-07-30 19:16:59 +04:00
|
|
|
pattern patt;
|
2004-06-11 18:47:36 +04:00
|
|
|
int32 clipRegRects;
|
2004-03-28 19:00:31 +04:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<BPoint>( &(layer->fLayerData->penlocation));
|
|
|
|
fSession->Read<float>( &(layer->fLayerData->pensize));
|
|
|
|
fSession->Read( &highColor, sizeof(rgb_color));
|
|
|
|
fSession->Read( &lowColor, sizeof(rgb_color));
|
|
|
|
fSession->Read( &viewColor, sizeof(rgb_color));
|
|
|
|
fSession->Read( &patt, sizeof(pattern));
|
|
|
|
fSession->Read<int8>((int8*) &(layer->fLayerData->draw_mode));
|
|
|
|
fSession->Read<BPoint>( &(layer->fLayerData->coordOrigin));
|
|
|
|
fSession->Read<int8>((int8*) &(layer->fLayerData->lineJoin));
|
|
|
|
fSession->Read<int8>((int8*) &(layer->fLayerData->lineCap));
|
|
|
|
fSession->Read<float>( &(layer->fLayerData->miterLimit));
|
|
|
|
fSession->Read<int8>((int8*) &(layer->fLayerData->alphaSrcMode));
|
|
|
|
fSession->Read<int8>((int8*) &(layer->fLayerData->alphaFncMode));
|
|
|
|
fSession->Read<float>( &(layer->fLayerData->scale));
|
|
|
|
fSession->Read<bool>( &(layer->fLayerData->fontAliasing));
|
|
|
|
fSession->Read<int32>( &clipRegRects);
|
2004-03-28 19:00:31 +04:00
|
|
|
|
2004-06-11 22:21:57 +04:00
|
|
|
layer->fLayerData->patt.Set(*((uint64*)&patt));
|
|
|
|
layer->fLayerData->highcolor.SetColor(highColor);
|
|
|
|
layer->fLayerData->lowcolor.SetColor(lowColor);
|
|
|
|
layer->fLayerData->viewcolor.SetColor(viewColor);
|
2004-03-28 19:00:31 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
if(clipRegRects != 0)
|
|
|
|
{
|
2004-06-11 22:21:57 +04:00
|
|
|
if(layer->fLayerData->clipReg == NULL)
|
|
|
|
layer->fLayerData->clipReg = new BRegion();
|
2004-03-28 19:00:31 +04:00
|
|
|
else
|
2004-06-11 22:21:57 +04:00
|
|
|
layer->fLayerData->clipReg->MakeEmpty();
|
2004-03-28 19:00:31 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
BRect rect;
|
2004-03-28 19:00:31 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
for(int32 i = 0; i < clipRegRects; i++)
|
|
|
|
{
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<BRect>(&rect);
|
2004-06-11 22:21:57 +04:00
|
|
|
layer->fLayerData->clipReg->Include(rect);
|
2004-03-28 19:00:31 +04:00
|
|
|
}
|
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
else
|
|
|
|
{
|
2004-06-11 22:21:57 +04:00
|
|
|
if (layer->fLayerData->clipReg)
|
2004-06-11 18:47:36 +04:00
|
|
|
{
|
2004-06-11 22:21:57 +04:00
|
|
|
delete layer->fLayerData->clipReg;
|
|
|
|
layer->fLayerData->clipReg = NULL;
|
2004-03-28 19:00:31 +04:00
|
|
|
}
|
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
STRACE(("DONE: ServerWindow %s: Message AS_LAYER_SET_STATE: Layer: %s\n",fTitle.String(),
|
2004-06-16 10:40:26 +04:00
|
|
|
layer->fName->String()));
|
2004-03-28 19:00:31 +04:00
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2004-06-11 18:47:36 +04:00
|
|
|
Layer * ServerWindow::CreateLayerTree(Layer *localRoot)
|
|
|
|
{
|
2004-06-19 14:23:14 +04:00
|
|
|
// NOTE: no need to check for a lock. This is a private method.
|
2004-06-11 18:47:36 +04:00
|
|
|
STRACE(("ServerWindow(%s)::CreateLayerTree()\n", fTitle.String()));
|
|
|
|
|
|
|
|
int32 token;
|
|
|
|
BRect frame;
|
|
|
|
uint32 resizeMask;
|
|
|
|
uint32 flags;
|
|
|
|
bool hidden;
|
|
|
|
int32 childCount;
|
2004-07-30 19:16:59 +04:00
|
|
|
char *name = NULL;
|
2004-03-28 19:00:31 +04:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<int32>(&token);
|
|
|
|
fSession->ReadString(&name);
|
|
|
|
fSession->Read<BRect>(&frame);
|
|
|
|
fSession->Read<uint32>(&resizeMask);
|
|
|
|
fSession->Read<uint32>(&flags);
|
|
|
|
fSession->Read<bool>(&hidden);
|
|
|
|
fSession->Read<int32>(&childCount);
|
2004-03-28 19:00:31 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
Layer *newLayer;
|
2004-07-30 19:16:59 +04:00
|
|
|
newLayer = new Layer(frame, name, token, resizeMask,
|
2004-06-11 18:47:36 +04:00
|
|
|
flags, desktop->GetDisplayDriver());
|
2004-07-30 19:16:59 +04:00
|
|
|
if (name)
|
|
|
|
free(name);
|
2004-03-28 19:00:31 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
// there is no way of setting this, other than manually :-)
|
2004-06-18 23:13:06 +04:00
|
|
|
newLayer->fHidden = hidden;
|
2004-03-28 19:00:31 +04:00
|
|
|
|
|
|
|
// add the new Layer to the tree structure.
|
2004-06-11 18:47:36 +04:00
|
|
|
if(localRoot)
|
2004-06-16 10:40:26 +04:00
|
|
|
localRoot->AddChild(newLayer, NULL);
|
2004-07-30 19:16:59 +04:00
|
|
|
|
|
|
|
STRACE(("DONE: ServerWindow %s: Message AS_LAYER_CREATE: Parent: %s, Child: %s\n", fTitle.String(),
|
2004-06-16 10:40:26 +04:00
|
|
|
localRoot? localRoot->fName->String(): "NULL", newLayer->fName->String()));
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2004-04-03 19:05:49 +04:00
|
|
|
return newLayer;
|
2004-03-28 19:00:31 +04:00
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2004-02-24 14:54:44 +03:00
|
|
|
void ServerWindow::DispatchMessage(int32 code)
|
2003-02-24 18:47:06 +03:00
|
|
|
{
|
2004-07-30 19:16:59 +04:00
|
|
|
if (cl == NULL && code != AS_LAYER_CREATE_ROOT)
|
|
|
|
{
|
|
|
|
printf("ServerWindow %s received unexpected code - message offset %lx before top_view attached.\n",fTitle.String(), code - SERVER_TRUE);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
switch(code)
|
2003-02-24 18:47:06 +03:00
|
|
|
{
|
2003-12-07 08:40:51 +03:00
|
|
|
//--------- BView Messages -----------------
|
2004-04-16 21:52:31 +04:00
|
|
|
case AS_LAYER_DRAW_BITMAP_SYNC_AT_POINT:
|
|
|
|
{
|
|
|
|
int32 bitmapToken;
|
|
|
|
BPoint point;
|
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<int32>(&bitmapToken);
|
|
|
|
fSession->Read<BPoint>(&point);
|
2004-04-16 21:52:31 +04:00
|
|
|
|
|
|
|
ServerBitmap *sbmp = fServerApp->FindBitmap(bitmapToken);
|
|
|
|
if(sbmp)
|
|
|
|
{
|
|
|
|
BRect src, dst;
|
|
|
|
BRegion region;
|
|
|
|
|
|
|
|
src = sbmp->Bounds();
|
2004-06-11 22:21:57 +04:00
|
|
|
dst = cl->fParent->ConvertFromParent(cl->fFull.Frame());
|
|
|
|
region = cl->fParent->ConvertFromParent(&(cl->fFull));
|
2004-04-16 21:52:31 +04:00
|
|
|
dst.OffsetBy(point);
|
|
|
|
|
2004-06-11 22:21:57 +04:00
|
|
|
cl->fDriver->DrawBitmap(®ion, sbmp, src, dst, cl->fLayerData);
|
2004-04-16 21:52:31 +04:00
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Adi -- shouldn't AS_LAYER_DRAW_BITMAP_SYNC_AT_POINT sync with the client?
|
2004-04-16 21:52:31 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_DRAW_BITMAP_ASYNC_AT_POINT:
|
|
|
|
{
|
|
|
|
int32 bitmapToken;
|
|
|
|
BPoint point;
|
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<int32>(&bitmapToken);
|
|
|
|
fSession->Read<BPoint>(&point);
|
2004-04-16 21:52:31 +04:00
|
|
|
|
|
|
|
ServerBitmap *sbmp = fServerApp->FindBitmap(bitmapToken);
|
|
|
|
if(sbmp)
|
|
|
|
{
|
|
|
|
BRect src, dst;
|
|
|
|
BRegion region;
|
|
|
|
|
|
|
|
src = sbmp->Bounds();
|
2004-06-11 22:21:57 +04:00
|
|
|
dst = cl->fParent->ConvertFromParent(cl->fFull.Frame());
|
|
|
|
region = cl->fParent->ConvertFromParent(&(cl->fFull));
|
2004-04-16 21:52:31 +04:00
|
|
|
dst.OffsetBy(point);
|
|
|
|
|
2004-06-11 22:21:57 +04:00
|
|
|
cl->fDriver->DrawBitmap(®ion, sbmp, src, dst, cl->fLayerData);
|
2004-04-16 21:52:31 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_DRAW_BITMAP_SYNC_IN_RECT:
|
|
|
|
{
|
2004-06-11 18:47:36 +04:00
|
|
|
int32 bitmapToken;
|
|
|
|
BRect srcRect, dstRect;
|
2004-04-16 21:52:31 +04:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<int32>(&bitmapToken);
|
|
|
|
fSession->Read<BRect>(&dstRect);
|
|
|
|
fSession->Read<BRect>(&srcRect);
|
2004-04-16 21:52:31 +04:00
|
|
|
|
|
|
|
ServerBitmap *sbmp = fServerApp->FindBitmap(bitmapToken);
|
|
|
|
if(sbmp)
|
|
|
|
{
|
2004-06-11 18:47:36 +04:00
|
|
|
BRegion region;
|
|
|
|
BRect dst;
|
2004-06-11 22:21:57 +04:00
|
|
|
region = cl->fParent->ConvertFromParent(&(cl->fFull));
|
|
|
|
dst = cl->fParent->ConvertFromParent(cl->fFull.Frame());
|
2004-06-11 18:47:36 +04:00
|
|
|
dstRect.OffsetBy(dst.left, dst.top);
|
|
|
|
|
2004-06-11 22:21:57 +04:00
|
|
|
cl->fDriver->DrawBitmap(®ion, sbmp, srcRect, dstRect, cl->fLayerData);
|
2004-04-16 21:52:31 +04:00
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Adi -- shouldn't AS_LAYER_DRAW_BITMAP_SYNC_IN_RECT sync with the client?
|
2004-04-16 21:52:31 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_DRAW_BITMAP_ASYNC_IN_RECT:
|
|
|
|
{
|
2004-06-11 18:47:36 +04:00
|
|
|
int32 bitmapToken;
|
|
|
|
BRect srcRect, dstRect;
|
2004-04-16 21:52:31 +04:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<int32>(&bitmapToken);
|
|
|
|
fSession->Read<BRect>(&dstRect);
|
|
|
|
fSession->Read<BRect>(&srcRect);
|
2004-04-16 21:52:31 +04:00
|
|
|
|
|
|
|
ServerBitmap *sbmp = fServerApp->FindBitmap(bitmapToken);
|
|
|
|
if(sbmp)
|
|
|
|
{
|
2004-06-11 18:47:36 +04:00
|
|
|
BRegion region;
|
|
|
|
BRect dst;
|
2004-06-11 22:21:57 +04:00
|
|
|
region = cl->fParent->ConvertFromParent(&(cl->fFull));
|
|
|
|
dst = cl->fParent->ConvertFromParent(cl->fFull.Frame());
|
2004-04-16 21:52:31 +04:00
|
|
|
dstRect.OffsetBy(dst.left, dst.top);
|
|
|
|
|
2004-06-11 22:21:57 +04:00
|
|
|
cl->fDriver->DrawBitmap(®ion, sbmp, srcRect, dstRect, cl->fLayerData);
|
2004-04-16 21:52:31 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2003-09-09 01:18:39 +04:00
|
|
|
case AS_SET_CURRENT_LAYER:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_SET_CURRENT_LAYER: Layer name: %s\n", fTitle.String(), cl->fName->String()));
|
2003-12-07 08:40:51 +03:00
|
|
|
int32 token;
|
2003-09-09 01:18:39 +04:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<int32>(&token);
|
2003-09-09 01:18:39 +04:00
|
|
|
|
2004-06-21 00:02:32 +04:00
|
|
|
Layer *current = FindLayer(fWinBorder->fTopLayer, token);
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2003-09-09 01:18:39 +04:00
|
|
|
if (current)
|
2004-01-20 05:02:01 +03:00
|
|
|
cl=current;
|
2003-09-09 01:18:39 +04:00
|
|
|
else // hope this NEVER happens! :-)
|
2003-12-07 08:40:51 +03:00
|
|
|
debugger("Server PANIC: window cannot find Layer with ID\n");
|
2003-09-09 01:18:39 +04:00
|
|
|
break;
|
|
|
|
}
|
2004-07-30 19:16:59 +04:00
|
|
|
|
|
|
|
case AS_LAYER_CREATE_ROOT:
|
|
|
|
{
|
|
|
|
// Start receiving top_view data -- pass NULL as the parent view.
|
|
|
|
// This should be the *only* place where this happens.
|
|
|
|
if (cl != NULL)
|
|
|
|
break;
|
|
|
|
|
|
|
|
fWinBorder->fTopLayer = CreateLayerTree(NULL);
|
|
|
|
fWinBorder->fTopLayer->SetAsTopLayer(true);
|
|
|
|
cl = fWinBorder->fTopLayer;
|
|
|
|
|
|
|
|
// connect decorator and top layer.
|
|
|
|
fWinBorder->AddChild(fWinBorder->fTopLayer, NULL);
|
|
|
|
desktop->AddWinBorder(fWinBorder);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
case AS_LAYER_CREATE:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_CREATE: Layer name: %s\n", fTitle.String(), cl->fName->String()));
|
|
|
|
Layer *newLayer;
|
2004-07-30 19:16:59 +04:00
|
|
|
|
|
|
|
if (cl == NULL)
|
|
|
|
break;
|
2004-06-16 10:40:26 +04:00
|
|
|
|
|
|
|
newLayer = CreateLayerTree(NULL);
|
|
|
|
cl->AddChild(newLayer, this);
|
|
|
|
|
|
|
|
if (!(newLayer->IsHidden())){
|
|
|
|
// cl is the parent of newLayer, so this call is OK.
|
2004-06-19 14:23:14 +04:00
|
|
|
cl->FullInvalidate(BRegion(newLayer->fFull));
|
2004-06-16 10:40:26 +04:00
|
|
|
}
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
break;
|
2004-03-28 19:00:31 +04:00
|
|
|
}
|
2003-02-24 18:47:06 +03:00
|
|
|
case AS_LAYER_DELETE:
|
|
|
|
{
|
|
|
|
// Received when a view is detached from a window. This is definitely
|
|
|
|
// the less taxing operation - we call PruneTree() on the removed
|
|
|
|
// layer, detach the layer itself, delete it, and invalidate the
|
|
|
|
// area assuming that the view was visible when removed
|
2004-06-11 18:47:36 +04:00
|
|
|
|
|
|
|
STRACE(("ServerWindow %s: AS_LAYER_DELETE(self)...\n", fTitle.String()));
|
|
|
|
Layer *parent;
|
2004-06-11 22:21:57 +04:00
|
|
|
parent = cl->fParent;
|
2003-02-24 18:47:06 +03:00
|
|
|
|
2004-01-20 05:02:01 +03:00
|
|
|
// here we remove current layer from list.
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->RemoveSelf();
|
|
|
|
cl->PruneTree();
|
2004-08-08 00:30:58 +04:00
|
|
|
|
|
|
|
parent->Invalidate(cl->Frame());
|
|
|
|
|
|
|
|
#ifdef DEBUG_SERVERWINDOW
|
2003-09-15 23:14:45 +04:00
|
|
|
parent->PrintTree();
|
2004-08-08 00:30:58 +04:00
|
|
|
#endif
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("DONE: ServerWindow %s: Message AS_DELETE_LAYER: Parent: %s Layer: %s\n", fTitle.String(), parent->fName->String(), cl->fName->String()));
|
2003-06-24 17:55:18 +04:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
delete cl;
|
2003-09-15 23:14:45 +04:00
|
|
|
|
2004-01-20 05:02:01 +03:00
|
|
|
cl=parent;
|
2003-06-24 17:55:18 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-09 01:18:39 +04:00
|
|
|
case AS_LAYER_SET_STATE:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_STATE: Layer name: %s\n", fTitle.String(), cl->fName->String()));
|
2004-03-28 19:00:31 +04:00
|
|
|
SetLayerState(cl);
|
|
|
|
cl->RebuildFullRegion();
|
2003-09-15 23:14:45 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_FONT_STATE:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_FONT_STATE: Layer name: %s\n", fTitle.String(), cl->fName->String()));
|
2004-03-28 19:00:31 +04:00
|
|
|
SetLayerFontState(cl);
|
|
|
|
cl->RebuildFullRegion();
|
2003-09-15 23:14:45 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_STATE:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_STATE: Layer name: %s\n", fTitle.String(), cl->fName->String()));
|
2003-09-15 23:14:45 +04:00
|
|
|
LayerData *ld;
|
2004-01-20 01:18:37 +03:00
|
|
|
|
|
|
|
// these 4 are here because of a compiler warning. Maybe he's right... :-)
|
2003-09-15 23:14:45 +04:00
|
|
|
rgb_color hc, lc, vc; // high, low and view colors
|
2004-08-08 00:30:58 +04:00
|
|
|
uint64 patt;
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2004-08-08 00:30:58 +04:00
|
|
|
ld = cl->fLayerData; // now we write fewer characters. :-)
|
|
|
|
hc = ld->highcolor.GetColor32();
|
|
|
|
lc = ld->lowcolor.GetColor32();
|
|
|
|
vc = ld->viewcolor.GetColor32();
|
|
|
|
patt = ld->patt.GetInt64();
|
2003-09-15 23:14:45 +04:00
|
|
|
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement when ServerFont::SetfamilyAndStyle(int32) exists
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->StartMessage(SERVER_TRUE);
|
2004-08-08 00:30:58 +04:00
|
|
|
|
|
|
|
// Attach font state
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Attach<uint32>(0UL /*uint32 ld->font.GetFamAndStyle()*/);
|
|
|
|
fSession->Attach<float>(ld->font.Size());
|
|
|
|
fSession->Attach<float>(ld->font.Shear());
|
|
|
|
fSession->Attach<float>(ld->font.Rotation());
|
|
|
|
fSession->Attach<uint8>(ld->font.Spacing());
|
|
|
|
fSession->Attach<uint8>(ld->font.Encoding());
|
|
|
|
fSession->Attach<uint16>(ld->font.Face());
|
|
|
|
fSession->Attach<uint32>(ld->font.Flags());
|
|
|
|
|
2004-08-08 00:30:58 +04:00
|
|
|
// Attach view state
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Attach<BPoint>(ld->penlocation);
|
|
|
|
fSession->Attach<float>(ld->pensize);
|
|
|
|
fSession->Attach(&hc, sizeof(rgb_color));
|
|
|
|
fSession->Attach(&lc, sizeof(rgb_color));
|
|
|
|
fSession->Attach(&vc, sizeof(rgb_color));
|
2004-08-08 00:30:58 +04:00
|
|
|
fSession->Attach<uint64>(patt);
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Attach<BPoint>(ld->coordOrigin);
|
|
|
|
fSession->Attach<uint8>((uint8)(ld->draw_mode));
|
|
|
|
fSession->Attach<uint8>((uint8)(ld->lineCap));
|
|
|
|
fSession->Attach<uint8>((uint8)(ld->lineJoin));
|
|
|
|
fSession->Attach<float>(ld->miterLimit);
|
|
|
|
fSession->Attach<uint8>((uint8)(ld->alphaSrcMode));
|
|
|
|
fSession->Attach<uint8>((uint8)(ld->alphaFncMode));
|
|
|
|
fSession->Attach<float>(ld->scale);
|
|
|
|
fSession->Attach<float>(ld->fontAliasing);
|
2003-09-15 23:14:45 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
int32 noOfRects = 0;
|
2004-05-20 05:31:28 +04:00
|
|
|
if (ld->clipReg)
|
|
|
|
noOfRects = ld->clipReg->CountRects();
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Attach<int32>(noOfRects);
|
2003-09-15 23:14:45 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
for(int i = 0; i < noOfRects; i++)
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Attach<BRect>(ld->clipReg->RectAt(i));
|
2003-09-15 23:14:45 +04:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Attach<float>(cl->fFrame.left);
|
|
|
|
fSession->Attach<float>(cl->fFrame.top);
|
|
|
|
fSession->Attach<BRect>(cl->fFrame.OffsetToCopy(cl->fBoundsLeftTop));
|
|
|
|
fSession->Flush();
|
|
|
|
|
2003-09-09 01:18:39 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-25 16:31:11 +04:00
|
|
|
case AS_LAYER_MOVETO:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_MOVETO: Layer name: %s\n", fTitle.String(), cl->fName->String()));
|
2004-06-11 18:47:36 +04:00
|
|
|
float x, y;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<float>(&x);
|
|
|
|
fSession->Read<float>(&y);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->MoveBy(x, y);
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_RESIZETO:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_RESIZETO: Layer name: %s\n", fTitle.String(), cl->fName->String()));
|
2004-06-11 18:47:36 +04:00
|
|
|
float newWidth, newHeight;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<float>(&newWidth);
|
|
|
|
fSession->Read<float>(&newHeight);
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Check for minimum size allowed. Need WinBorder::GetSizeLimits
|
2004-01-20 01:18:37 +03:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->ResizeBy(newWidth, newHeight);
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_COORD:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_COORD: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->StartMessage(SERVER_TRUE);
|
|
|
|
fSession->Attach<float>(cl->fFrame.left);
|
|
|
|
fSession->Attach<float>(cl->fFrame.top);
|
|
|
|
fSession->Attach<BRect>(cl->fFrame.OffsetToCopy(cl->fBoundsLeftTop));
|
|
|
|
fSession->Flush();
|
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-25 21:25:38 +04:00
|
|
|
case AS_LAYER_SET_ORIGIN:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_ORIGIN: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-06-11 18:47:36 +04:00
|
|
|
float x, y;
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<float>(&x);
|
|
|
|
fSession->Read<float>(&y);
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2004-06-11 22:21:57 +04:00
|
|
|
cl->fLayerData->coordOrigin.Set(x, y);
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_ORIGIN:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_ORIGIN: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->StartMessage(SERVER_TRUE);
|
|
|
|
fSession->Attach<BPoint>(cl->fLayerData->coordOrigin);
|
|
|
|
fSession->Flush();
|
2003-09-25 21:25:38 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_RESIZE_MODE:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_RESIZE_MODE: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<uint32>(&(cl->fResizeMode));
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_CURSOR:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_CURSOR: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-06-11 18:47:36 +04:00
|
|
|
int32 token;
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<int32>(&token);
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
cursormanager->SetCursor(token);
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-25 16:31:11 +04:00
|
|
|
case AS_LAYER_SET_FLAGS:
|
|
|
|
{
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<uint32>(&(cl->fFlags));
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_FLAGS: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_HIDE:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_HIDE: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->Hide();
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SHOW:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SHOW: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->Show();
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_LINE_MODE:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_LINE_MODE: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-06-11 18:47:36 +04:00
|
|
|
int8 lineCap, lineJoin;
|
2004-01-20 01:18:37 +03:00
|
|
|
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Look into locking scheme relating to Layers and modifying redraw-related members
|
2004-01-20 01:18:37 +03:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<int8>(&lineCap);
|
|
|
|
fSession->Read<int8>(&lineJoin);
|
|
|
|
fSession->Read<float>(&(cl->fLayerData->miterLimit));
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-06-11 22:21:57 +04:00
|
|
|
cl->fLayerData->lineCap = (cap_mode)lineCap;
|
|
|
|
cl->fLayerData->lineJoin = (join_mode)lineJoin;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_LINE_MODE:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_LINE_MODE: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->StartMessage(SERVER_TRUE);
|
|
|
|
fSession->Attach<int8>((int8)(cl->fLayerData->lineCap));
|
|
|
|
fSession->Attach<int8>((int8)(cl->fLayerData->lineJoin));
|
|
|
|
fSession->Attach<float>(cl->fLayerData->miterLimit);
|
|
|
|
fSession->Flush();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_PUSH_STATE:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_PUSH_STATE: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-06-11 18:47:36 +04:00
|
|
|
LayerData *ld = new LayerData();
|
2004-06-11 22:21:57 +04:00
|
|
|
ld->prevState = cl->fLayerData;
|
|
|
|
cl->fLayerData = ld;
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->RebuildFullRegion();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_POP_STATE:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_POP_STATE: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-06-11 22:21:57 +04:00
|
|
|
if (!(cl->fLayerData->prevState))
|
2004-06-11 18:47:36 +04:00
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("WARNING: SW(%s): User called BView(%s)::PopState(), but there is NO state on stack!\n", fTitle.String(), cl->fName->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2004-06-11 22:21:57 +04:00
|
|
|
LayerData *ld = cl->fLayerData;
|
|
|
|
cl->fLayerData = cl->fLayerData->prevState;
|
2003-09-25 16:31:11 +04:00
|
|
|
delete ld;
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->RebuildFullRegion();
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_SCALE:
|
|
|
|
{
|
2004-07-30 19:16:59 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_SCALE: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
|
|
|
fSession->Read<float>(&(cl->fLayerData->scale));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_SCALE:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_SCALE: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-06-11 22:21:57 +04:00
|
|
|
LayerData *ld = cl->fLayerData;
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
float scale = ld->scale;
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
while((ld = ld->prevState))
|
2003-09-25 16:31:11 +04:00
|
|
|
scale *= ld->scale;
|
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->StartMessage(SERVER_TRUE);
|
|
|
|
fSession->Attach<float>(scale);
|
|
|
|
fSession->Flush();
|
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_PEN_LOC:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_PEN_LOC: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
float x, y;
|
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<float>(&x);
|
|
|
|
fSession->Read<float>(&y);
|
|
|
|
|
2004-06-11 22:21:57 +04:00
|
|
|
cl->fLayerData->penlocation.Set(x, y);
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_PEN_LOC:
|
|
|
|
{
|
2004-07-30 19:16:59 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_PEN_LOC: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
|
|
|
fSession->StartMessage(SERVER_TRUE);
|
|
|
|
fSession->Attach<BPoint>(cl->fLayerData->penlocation);
|
|
|
|
fSession->Flush();
|
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_PEN_SIZE:
|
|
|
|
{
|
2004-07-30 19:16:59 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_PEN_SIZE: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
|
|
|
fSession->Read<float>(&(cl->fLayerData->pensize));
|
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_PEN_SIZE:
|
|
|
|
{
|
2004-07-30 19:16:59 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_PEN_SIZE: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
|
|
|
fSession->StartMessage(SERVER_TRUE);
|
|
|
|
fSession->Attach<float>(cl->fLayerData->pensize);
|
|
|
|
fSession->Flush();
|
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_HIGH_COLOR:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_HIGH_COLOR: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-06-11 18:47:36 +04:00
|
|
|
rgb_color c;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read(&c, sizeof(rgb_color));
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-06-11 22:21:57 +04:00
|
|
|
cl->fLayerData->highcolor.SetColor(c);
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_LOW_COLOR:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_LOW_COLOR: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-06-11 18:47:36 +04:00
|
|
|
rgb_color c;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read(&c, sizeof(rgb_color));
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-06-11 22:21:57 +04:00
|
|
|
cl->fLayerData->lowcolor.SetColor(c);
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_VIEW_COLOR:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_VIEW_COLOR: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-06-11 18:47:36 +04:00
|
|
|
rgb_color c;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read(&c, sizeof(rgb_color));
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-06-11 22:21:57 +04:00
|
|
|
cl->fLayerData->viewcolor.SetColor(c);
|
2004-06-03 00:44:46 +04:00
|
|
|
|
2004-06-11 22:21:57 +04:00
|
|
|
cl->Invalidate(cl->fVisible);
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_COLORS:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_COLORS: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-06-11 18:47:36 +04:00
|
|
|
rgb_color highColor, lowColor, viewColor;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-06-11 22:21:57 +04:00
|
|
|
highColor = cl->fLayerData->highcolor.GetColor32();
|
|
|
|
lowColor = cl->fLayerData->lowcolor.GetColor32();
|
|
|
|
viewColor = cl->fLayerData->viewcolor.GetColor32();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->StartMessage(SERVER_TRUE);
|
|
|
|
fSession->Attach(&highColor, sizeof(rgb_color));
|
|
|
|
fSession->Attach(&lowColor, sizeof(rgb_color));
|
|
|
|
fSession->Attach(&viewColor, sizeof(rgb_color));
|
|
|
|
fSession->Flush();
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_BLEND_MODE:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_BLEND_MODE: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-06-11 18:47:36 +04:00
|
|
|
int8 srcAlpha, alphaFunc;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<int8>(&srcAlpha);
|
|
|
|
fSession->Read<int8>(&alphaFunc);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-06-11 22:21:57 +04:00
|
|
|
cl->fLayerData->alphaSrcMode = (source_alpha)srcAlpha;
|
|
|
|
cl->fLayerData->alphaFncMode = (alpha_function)alphaFunc;
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_BLEND_MODE:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_BLEND_MODE: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->StartMessage(SERVER_TRUE);
|
|
|
|
fSession->Attach<int8>((int8)(cl->fLayerData->alphaSrcMode));
|
|
|
|
fSession->Attach<int8>((int8)(cl->fLayerData->alphaFncMode));
|
|
|
|
fSession->Flush();
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_DRAW_MODE:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_DRAW_MODE: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-06-11 18:47:36 +04:00
|
|
|
int8 drawingMode;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<int8>(&drawingMode);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-06-11 22:21:57 +04:00
|
|
|
cl->fLayerData->draw_mode = (drawing_mode)drawingMode;
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_DRAW_MODE:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_DRAW_MODE: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->StartMessage(SERVER_TRUE);
|
|
|
|
fSession->Attach<int8>((int8)(cl->fLayerData->draw_mode));
|
|
|
|
fSession->Flush();
|
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_PRINT_ALIASING:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_PRINT_ALIASING: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<bool>(&(cl->fLayerData->fontAliasing));
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_CLIP_TO_PICTURE:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_CLIP_TO_PICTURE: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Watch out for the coordinate system in AS_LAYER_CLIP_TO_PICTURE
|
2004-06-11 18:47:36 +04:00
|
|
|
int32 pictureToken;
|
|
|
|
BPoint where;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<int32>(&pictureToken);
|
|
|
|
fSession->Read<BPoint>(&where);
|
2004-06-11 18:47:36 +04:00
|
|
|
|
|
|
|
|
|
|
|
BRegion reg;
|
|
|
|
bool redraw = false;
|
|
|
|
|
|
|
|
// if we had a picture to clip to, include the FULL visible region(if any) in the area to be redrawn
|
|
|
|
// in other words: invalidate what ever is visible for this layer and his children.
|
2004-06-11 22:21:57 +04:00
|
|
|
if (cl->clipToPicture && cl->fFullVisible.CountRects() > 0)
|
2004-06-11 18:47:36 +04:00
|
|
|
{
|
2004-06-11 22:21:57 +04:00
|
|
|
reg.Include(&cl->fFullVisible);
|
2003-11-14 03:15:29 +03:00
|
|
|
redraw = true;
|
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
|
|
|
|
// search for a picture with the specified token.
|
|
|
|
ServerPicture *sp = NULL;
|
|
|
|
int32 i = 0;
|
2004-01-20 01:18:37 +03:00
|
|
|
while(1)
|
|
|
|
{
|
2004-06-11 22:21:57 +04:00
|
|
|
sp=static_cast<ServerPicture*>(cl->fServerWin->fServerApp->fPictureList->ItemAt(i++));
|
2003-09-25 16:31:11 +04:00
|
|
|
if (!sp)
|
|
|
|
break;
|
2004-06-11 18:47:36 +04:00
|
|
|
|
|
|
|
if(sp->GetToken() == pictureToken)
|
|
|
|
{
|
|
|
|
//cl->clipToPicture = sp;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Increase that picture's reference count.(~ allocate a picture)
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
|
|
|
|
// avoid compiler warning
|
2003-09-25 16:31:11 +04:00
|
|
|
i = 0;
|
2004-06-11 18:47:36 +04:00
|
|
|
|
|
|
|
// we have a new picture to clip to, so rebuild our full region
|
|
|
|
if(cl->clipToPicture)
|
|
|
|
{
|
|
|
|
cl->clipToPictureInverse = false;
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->RebuildFullRegion();
|
2003-11-14 03:15:29 +03:00
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
|
|
|
|
// we need to rebuild the visible region, we may have a valid one.
|
2004-06-11 22:21:57 +04:00
|
|
|
if (cl->fParent && !(cl->fHidden))
|
2004-06-11 18:47:36 +04:00
|
|
|
{
|
2004-06-11 22:21:57 +04:00
|
|
|
//cl->fParent->RebuildChildRegions(cl->fFull.Frame(), cl);
|
2003-11-14 03:15:29 +03:00
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// will this happen? Maybe...
|
2004-06-11 22:21:57 +04:00
|
|
|
//cl->RebuildRegions(cl->fFull.Frame());
|
2003-11-14 03:15:29 +03:00
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
|
|
|
|
// include our full visible region in the region to be redrawn
|
2004-06-11 22:21:57 +04:00
|
|
|
if (!(cl->fHidden) && (cl->fFullVisible.CountRects() > 0))
|
2004-06-11 18:47:36 +04:00
|
|
|
{
|
2004-06-11 22:21:57 +04:00
|
|
|
reg.Include(&(cl->fFullVisible));
|
2003-11-14 03:15:29 +03:00
|
|
|
redraw = true;
|
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
|
|
|
|
// redraw if we previously had or if we have acquired a picture to clip to.
|
|
|
|
if (redraw)
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->Invalidate(reg);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_CLIP_TO_INVERSE_PICTURE:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_CLIP_TO_INVERSE_PICTURE: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Watch out for the coordinate system in AS_LAYER_CLIP_TO_INVERSE_PICTURE
|
2004-06-11 18:47:36 +04:00
|
|
|
int32 pictureToken;
|
|
|
|
BPoint where;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<int32>(&pictureToken);
|
|
|
|
fSession->Read<BPoint>(&where);
|
2004-06-11 18:47:36 +04:00
|
|
|
|
|
|
|
ServerPicture *sp = NULL;
|
|
|
|
int32 i = 0;
|
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
while(1)
|
|
|
|
{
|
2004-06-11 22:21:57 +04:00
|
|
|
sp= static_cast<ServerPicture*>(cl->fServerWin->fServerApp->fPictureList->ItemAt(i++));
|
2003-09-25 16:31:11 +04:00
|
|
|
if (!sp)
|
|
|
|
break;
|
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
if(sp->GetToken() == pictureToken)
|
|
|
|
{
|
|
|
|
//cl->clipToPicture = sp;
|
|
|
|
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Increase that picture's reference count.(~ allocate a picture)
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
// avoid compiler warning
|
2003-09-25 16:31:11 +04:00
|
|
|
i = 0;
|
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
// if a picture has been found...
|
|
|
|
if(cl->clipToPicture)
|
|
|
|
{
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->clipToPictureInverse = true;
|
|
|
|
cl->RebuildFullRegion();
|
2004-06-11 18:47:36 +04:00
|
|
|
//cl->RequestDraw(cl->clipToPicture->Frame());
|
2003-11-14 03:15:29 +03:00
|
|
|
}
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_CLIP_REGION:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_CLIP_REGION: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-08-29 19:01:44 +04:00
|
|
|
|
2004-06-16 10:40:26 +04:00
|
|
|
// if this Layer is hidden, it is clear that its visible region is void.
|
2004-08-29 19:01:44 +04:00
|
|
|
if (cl->IsHidden())
|
|
|
|
{
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->StartMessage(SERVER_TRUE);
|
|
|
|
fSession->Attach<int32>(0L);
|
|
|
|
fSession->Flush();
|
2004-06-16 10:40:26 +04:00
|
|
|
}
|
2004-08-29 19:01:44 +04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
// TODO: Watch out for the coordinate system in AS_LAYER_GET_CLIP_REGION
|
2004-06-16 10:40:26 +04:00
|
|
|
BRegion reg;
|
|
|
|
LayerData *ld;
|
|
|
|
int32 noOfRects;
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2004-06-16 10:40:26 +04:00
|
|
|
ld = cl->fLayerData;
|
|
|
|
reg = cl->ConvertFromParent(&(cl->fVisible));
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2004-05-20 05:31:28 +04:00
|
|
|
if(ld->clipReg)
|
|
|
|
reg.IntersectWith(ld->clipReg);
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2004-06-16 10:40:26 +04:00
|
|
|
while((ld = ld->prevState))
|
|
|
|
{
|
|
|
|
if(ld->clipReg)
|
|
|
|
reg.IntersectWith(ld->clipReg);
|
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2004-06-16 10:40:26 +04:00
|
|
|
noOfRects = reg.CountRects();
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->StartMessage(SERVER_TRUE);
|
|
|
|
fSession->Attach<int32>(noOfRects);
|
2004-06-16 10:40:26 +04:00
|
|
|
|
|
|
|
for(int i = 0; i < noOfRects; i++)
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Attach<BRect>(reg.RectAt(i));
|
2004-06-16 10:40:26 +04:00
|
|
|
}
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_CLIP_REGION:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_CLIP_REGION: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-08-29 19:01:44 +04:00
|
|
|
|
|
|
|
// TODO: Watch out for the coordinate system in AS_LAYER_SET_CLIP_REGION
|
2004-06-11 18:47:36 +04:00
|
|
|
int32 noOfRects;
|
|
|
|
BRect r;
|
|
|
|
|
2004-06-11 22:21:57 +04:00
|
|
|
if(cl->fLayerData->clipReg)
|
|
|
|
cl->fLayerData->clipReg->MakeEmpty();
|
2003-09-25 16:31:11 +04:00
|
|
|
else
|
2004-06-11 22:21:57 +04:00
|
|
|
cl->fLayerData->clipReg = new BRegion();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<int32>(&noOfRects);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
for(int i = 0; i < noOfRects; i++)
|
|
|
|
{
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<BRect>(&r);
|
2004-06-11 22:21:57 +04:00
|
|
|
cl->fLayerData->clipReg->Include(r);
|
2003-09-25 16:31:11 +04:00
|
|
|
}
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->RebuildFullRegion();
|
2004-06-16 10:40:26 +04:00
|
|
|
if (!(cl->IsHidden()))
|
|
|
|
{
|
|
|
|
if (cl->fParent)
|
|
|
|
cl->fParent->FullInvalidate(BRegion(cl->fFull));
|
|
|
|
else
|
|
|
|
cl->FullInvalidate(BRegion(cl->fFull));
|
|
|
|
}
|
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-25 21:25:38 +04:00
|
|
|
case AS_LAYER_INVAL_RECT:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_INVAL_RECT: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-08-29 19:01:44 +04:00
|
|
|
|
|
|
|
// TODO: Watch out for the coordinate system in AS_LAYER_INVAL_RECT
|
2003-09-25 21:25:38 +04:00
|
|
|
BRect invalRect;
|
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<BRect>(&invalRect);
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->Invalidate(invalRect);
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_INVAL_REGION:
|
|
|
|
{
|
2004-06-16 10:40:26 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_INVAL_RECT: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-08-29 19:01:44 +04:00
|
|
|
|
|
|
|
// TODO: Watch out for the coordinate system AS_LAYER_INVAL_REGION
|
2004-06-11 18:47:36 +04:00
|
|
|
BRegion invalReg;
|
|
|
|
int32 noOfRects;
|
|
|
|
BRect rect;
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<int32>(&noOfRects);
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
for(int i = 0; i < noOfRects; i++)
|
|
|
|
{
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<BRect>(&rect);
|
2003-12-07 08:40:51 +03:00
|
|
|
invalReg.Include(rect);
|
2003-09-25 21:25:38 +04:00
|
|
|
}
|
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->Invalidate(invalReg);
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
2004-07-06 00:37:13 +04:00
|
|
|
case AS_BEGIN_UPDATE:
|
|
|
|
{
|
|
|
|
cl->UpdateStart();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_END_UPDATE:
|
|
|
|
{
|
|
|
|
cl->UpdateEnd();
|
|
|
|
break;
|
|
|
|
}
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
// ********** END: BView Messages ***********
|
2003-09-09 01:18:39 +04:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
// ********* BWindow Messages ***********
|
2003-06-24 17:55:18 +04:00
|
|
|
case AS_LAYER_DELETE_ROOT:
|
|
|
|
{
|
|
|
|
// Received when a window deletes its internal top view
|
|
|
|
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_LAYER_DELETE_ROOT
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message Delete_Layer_Root unimplemented\n",fTitle.String()));
|
2003-02-24 18:47:06 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SHOW_WINDOW:
|
|
|
|
{
|
2004-06-17 18:39:21 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_SHOW_WINDOW\n",fTitle.String()));
|
2003-02-24 18:47:06 +03:00
|
|
|
Show();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_HIDE_WINDOW:
|
|
|
|
{
|
2004-06-17 18:39:21 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_HIDE_WINDOW\n",fTitle.String()));
|
2003-02-24 18:47:06 +03:00
|
|
|
Hide();
|
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_SEND_BEHIND:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_SEND_BEHIND
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message Send_Behind unimplemented\n",fTitle.String()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_ENABLE_UPDATES:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_ENABLE_UPDATES
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message Enable_Updates unimplemented\n",fTitle.String()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_DISABLE_UPDATES:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_DISABLE_UPDATES
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message Disable_Updates unimplemented\n",fTitle.String()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_NEEDS_UPDATE:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_NEEDS_UPDATE
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message Needs_Update unimplemented\n",fTitle.String()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_WINDOW_TITLE:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_WINDOW_TITLE
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message Set_Title unimplemented\n",fTitle.String()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_ADD_TO_SUBSET:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-06-11 18:47:36 +04:00
|
|
|
WinBorder *wb;
|
|
|
|
int32 mainToken;
|
|
|
|
team_id teamID;
|
2004-01-14 03:26:15 +03:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<int32>(&mainToken);
|
|
|
|
fSession->Read(&teamID, sizeof(team_id));
|
2004-01-14 03:26:15 +03:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
wb = desktop->FindWinBorderByServerWindowTokenAndTeamID(mainToken, teamID);
|
|
|
|
if(wb)
|
|
|
|
{
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->StartMessage(SERVER_TRUE);
|
|
|
|
fSession->Flush();
|
2004-01-14 03:26:15 +03:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
fWinBorder->AddToSubsetOf(wb);
|
2004-01-14 03:26:15 +03:00
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
else
|
|
|
|
{
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->StartMessage(SERVER_FALSE);
|
|
|
|
fSession->Flush();
|
2004-01-14 03:26:15 +03:00
|
|
|
}
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_REM_FROM_SUBSET:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-06-11 18:47:36 +04:00
|
|
|
WinBorder *wb;
|
|
|
|
int32 mainToken;
|
|
|
|
team_id teamID;
|
2004-01-17 19:33:22 +03:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<int32>(&mainToken);
|
|
|
|
fSession->Read(&teamID, sizeof(team_id));
|
2004-01-17 19:33:22 +03:00
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
wb = desktop->FindWinBorderByServerWindowTokenAndTeamID(mainToken, teamID);
|
|
|
|
if(wb)
|
|
|
|
{
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->StartMessage(SERVER_TRUE);
|
|
|
|
fSession->Flush();
|
2004-01-17 19:33:22 +03:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
fWinBorder->RemoveFromSubsetOf(wb);
|
2004-01-17 19:33:22 +03:00
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
else
|
|
|
|
{
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->StartMessage(SERVER_FALSE);
|
|
|
|
fSession->Flush();
|
2004-01-17 19:33:22 +03:00
|
|
|
}
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_SET_LOOK:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_SET_LOOK
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message Set_Look unimplemented\n",fTitle.String()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_SET_FLAGS:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_SET_FLAGS
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message Set_Flags unimplemented\n",fTitle.String()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_SET_FEEL:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_SET_FEEL
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message Set_Feel unimplemented\n",fTitle.String()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_SET_ALIGNMENT:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_SET_ALIGNMENT
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message Set_Alignment unimplemented\n",fTitle.String()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_GET_ALIGNMENT:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_GET_ALIGNMENT
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message Get_Alignment unimplemented\n",fTitle.String()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_GET_WORKSPACES:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_GET_WORKSPACES
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message Get_Workspaces unimplemented\n",fTitle.String()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
case AS_SET_WORKSPACES:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_SET_WORKSPACES
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message Set_Workspaces unimplemented\n",fTitle.String()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-04-18 23:58:43 +04:00
|
|
|
case AS_WINDOW_RESIZE:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-06-11 18:47:36 +04:00
|
|
|
float xResizeBy;
|
|
|
|
float yResizeBy;
|
2004-05-16 23:24:18 +04:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<float>(&xResizeBy);
|
|
|
|
fSession->Read<float>(&yResizeBy);
|
2004-05-16 23:24:18 +04:00
|
|
|
|
|
|
|
fWinBorder->ResizeBy(xResizeBy, yResizeBy);
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2004-06-18 23:13:06 +04:00
|
|
|
case AS_WINDOW_MOVE:
|
|
|
|
{
|
|
|
|
float xMoveBy;
|
|
|
|
float yMoveBy;
|
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
fSession->Read<float>(&xMoveBy);
|
|
|
|
fSession->Read<float>(&yMoveBy);
|
2004-06-18 23:13:06 +04:00
|
|
|
|
|
|
|
fWinBorder->MoveBy(xMoveBy, yMoveBy);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2004-08-08 00:30:58 +04:00
|
|
|
case AS_SET_SIZE_LIMITS:
|
|
|
|
{
|
|
|
|
// Attached Data:
|
|
|
|
// 1) float minimum width
|
|
|
|
// 2) float maximum width
|
|
|
|
// 3) float minimum height
|
|
|
|
// 4) float maximum height
|
|
|
|
|
|
|
|
float wmin,wmax,hmin,hmax;
|
|
|
|
|
|
|
|
fSession->Read<float>(&wmin);
|
|
|
|
fSession->Read<float>(&wmax);
|
|
|
|
fSession->Read<float>(&hmin);
|
|
|
|
fSession->Read<float>(&hmax);
|
|
|
|
|
|
|
|
fWinBorder->SetSizeLimits(wmin,wmax,hmin,hmax);
|
|
|
|
|
|
|
|
fSession->StartMessage(SERVER_TRUE);
|
|
|
|
fSession->Flush();
|
|
|
|
break;
|
|
|
|
}
|
2003-02-24 18:47:06 +03:00
|
|
|
case B_MINIMIZE:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement B_MINIMIZE
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message Minimize unimplemented\n",fTitle.String()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-02-24 18:47:06 +03:00
|
|
|
case B_WINDOW_ACTIVATED:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement B_WINDOW_ACTIVATED
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message Window_Activated unimplemented\n",fTitle.String()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-02-24 18:47:06 +03:00
|
|
|
case B_ZOOM:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement B_ZOOM
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message Zoom unimplemented\n",fTitle.String()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-02-24 18:47:06 +03:00
|
|
|
default:
|
|
|
|
{
|
2004-02-24 14:54:44 +03:00
|
|
|
printf("ServerWindow %s received unexpected code - message offset %lx\n",fTitle.String(), code - SERVER_TRUE);
|
2003-02-24 18:47:06 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2003-03-19 04:12:53 +03:00
|
|
|
/*!
|
|
|
|
\brief Iterator for graphics update messages
|
|
|
|
\param msgsize Size of the buffer containing the graphics messages
|
|
|
|
\param msgbuffer Buffer containing the graphics message
|
|
|
|
*/
|
|
|
|
void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer)
|
|
|
|
{
|
2003-07-05 01:13:48 +04:00
|
|
|
Layer *layer;
|
2003-06-23 06:53:55 +04:00
|
|
|
LayerData *layerdata;
|
|
|
|
int32 code;
|
2003-07-05 01:13:48 +04:00
|
|
|
int32 view_token;
|
|
|
|
uint32 sizeRemaining = (uint32)msgsize;
|
2003-07-09 06:28:33 +04:00
|
|
|
BRegion WindowClipRegion;
|
|
|
|
BRegion LayerClipRegion;
|
2004-02-24 14:54:44 +03:00
|
|
|
// Layer *sibling;
|
2003-09-04 01:43:09 +04:00
|
|
|
int32 numRects = 0;
|
2003-06-24 04:14:33 +04:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
if (!msgsize || !msgbuffer)
|
2003-06-23 06:53:55 +04:00
|
|
|
return;
|
2003-12-07 08:40:51 +03:00
|
|
|
if (IsHidden())
|
2003-07-09 06:28:33 +04:00
|
|
|
return;
|
2004-02-24 14:54:44 +03:00
|
|
|
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: fix sibling-related clipping calculations in DispatchGraphicsMessage
|
2004-06-11 18:47:36 +04:00
|
|
|
/* WindowClipRegion.Set(fWinBorder->Frame());
|
2004-01-20 01:18:37 +03:00
|
|
|
sibling = fWinBorder->UpperSibling();
|
2003-12-07 08:40:51 +03:00
|
|
|
while (sibling)
|
2003-07-09 06:28:33 +04:00
|
|
|
{
|
|
|
|
WindowClipRegion.Exclude(sibling->Frame());
|
2004-01-13 03:56:36 +03:00
|
|
|
sibling = sibling->UpperSibling();
|
2003-07-09 06:28:33 +04:00
|
|
|
}
|
2004-02-24 14:54:44 +03:00
|
|
|
*/
|
2004-08-29 19:01:44 +04:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
if (!WindowClipRegion.Frame().IsValid())
|
2003-07-09 06:28:33 +04:00
|
|
|
return;
|
2003-03-19 04:12:53 +03:00
|
|
|
|
2003-07-05 01:13:48 +04:00
|
|
|
// We need to decide whether coordinates are specified in view or root coordinates.
|
|
|
|
// For now, we assume root level coordinates.
|
2003-07-09 06:28:33 +04:00
|
|
|
code = AS_BEGIN_UPDATE;
|
|
|
|
while ((sizeRemaining > 2*sizeof(int32)) && (code != AS_END_UPDATE))
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
2003-07-05 01:13:48 +04:00
|
|
|
code = read_from_buffer<int32>(&msgbuffer);
|
|
|
|
view_token = read_from_buffer<int32>(&msgbuffer);
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2004-08-29 19:01:44 +04:00
|
|
|
//TODO: fix code to find a layer based on a view token in DispatchGraphicsMessage
|
2004-01-20 01:18:37 +03:00
|
|
|
layer = NULL;//fWorkspace->GetRoot()->FindLayer(view_token);
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
if (layer)
|
2003-07-09 06:28:33 +04:00
|
|
|
{
|
2004-08-08 00:30:58 +04:00
|
|
|
layerdata = layer->fLayerData;
|
2003-07-09 06:28:33 +04:00
|
|
|
LayerClipRegion.Set(layer->Frame());
|
|
|
|
LayerClipRegion.IntersectWith(&WindowClipRegion);
|
|
|
|
numRects = LayerClipRegion.CountRects();
|
|
|
|
}
|
2003-07-05 01:13:48 +04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
layerdata = NULL;
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received invalid view token %lx",fTitle.String(),view_token));
|
2003-07-05 01:13:48 +04:00
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2003-06-23 06:53:55 +04:00
|
|
|
switch (code)
|
|
|
|
{
|
|
|
|
case AS_SET_HIGH_COLOR:
|
|
|
|
{
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_SET_COLOR_MSG_SIZE)
|
2003-07-05 01:13:48 +04:00
|
|
|
{
|
|
|
|
uint8 r, g, b, a;
|
|
|
|
r = read_from_buffer<uint8>(&msgbuffer);
|
|
|
|
g = read_from_buffer<uint8>(&msgbuffer);
|
|
|
|
b = read_from_buffer<uint8>(&msgbuffer);
|
|
|
|
a = read_from_buffer<uint8>(&msgbuffer);
|
2003-12-07 08:40:51 +03:00
|
|
|
if (layerdata)
|
2003-07-05 01:13:48 +04:00
|
|
|
layerdata->highcolor.SetColor(r,g,b,a);
|
|
|
|
sizeRemaining -= AS_SET_COLOR_MSG_SIZE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
|
|
|
}
|
2003-06-23 06:53:55 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SET_LOW_COLOR:
|
|
|
|
{
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_SET_COLOR_MSG_SIZE)
|
2003-07-05 01:13:48 +04:00
|
|
|
{
|
|
|
|
uint8 r, g, b, a;
|
|
|
|
r = read_from_buffer<uint8>(&msgbuffer);
|
|
|
|
g = read_from_buffer<uint8>(&msgbuffer);
|
|
|
|
b = read_from_buffer<uint8>(&msgbuffer);
|
|
|
|
a = read_from_buffer<uint8>(&msgbuffer);
|
2003-12-07 08:40:51 +03:00
|
|
|
if (layerdata)
|
2003-07-05 01:13:48 +04:00
|
|
|
layerdata->lowcolor.SetColor(r,g,b,a);
|
|
|
|
sizeRemaining -= AS_SET_COLOR_MSG_SIZE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
|
|
|
}
|
2003-06-23 06:53:55 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SET_VIEW_COLOR:
|
|
|
|
{
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_SET_COLOR_MSG_SIZE)
|
2003-07-05 01:13:48 +04:00
|
|
|
{
|
|
|
|
uint8 r, g, b, a;
|
|
|
|
r = read_from_buffer<uint8>(&msgbuffer);
|
|
|
|
g = read_from_buffer<uint8>(&msgbuffer);
|
|
|
|
b = read_from_buffer<uint8>(&msgbuffer);
|
|
|
|
a = read_from_buffer<uint8>(&msgbuffer);
|
2003-12-07 08:40:51 +03:00
|
|
|
if (layerdata)
|
2003-07-05 01:13:48 +04:00
|
|
|
layerdata->viewcolor.SetColor(r,g,b,a);
|
|
|
|
sizeRemaining -= AS_SET_COLOR_MSG_SIZE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
|
|
|
}
|
2003-06-23 06:53:55 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_ARC:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Add clipping to AS_STROKE_ARC
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_STROKE_ARC_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
float left, top, right, bottom, angle, span;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2003-07-05 01:13:48 +04:00
|
|
|
left = read_from_buffer<float>(&msgbuffer);
|
|
|
|
top = read_from_buffer<float>(&msgbuffer);
|
|
|
|
right = read_from_buffer<float>(&msgbuffer);
|
|
|
|
bottom = read_from_buffer<float>(&msgbuffer);
|
|
|
|
angle = read_from_buffer<float>(&msgbuffer);
|
|
|
|
span = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 06:22:15 +03:00
|
|
|
//BRect rect(left,top,right,bottom);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->StrokeArc(rect,angle,span,layerdata,pattern);
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_STROKE_ARC_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_BEZIER:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Add clipping to AS_STROKE_BEZIER
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_STROKE_BEZIER_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
BPoint *pts;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
2003-06-23 06:53:55 +04:00
|
|
|
int i;
|
|
|
|
pts = new BPoint[4];
|
|
|
|
for (i=0; i<4; i++)
|
|
|
|
{
|
2003-07-05 01:13:48 +04:00
|
|
|
pts[i].x = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pts[i].y = read_from_buffer<float>(&msgbuffer);
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
2003-07-05 01:13:48 +04:00
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->StrokeBezier(pts,layerdata,pattern);
|
2003-06-23 06:53:55 +04:00
|
|
|
delete[] pts;
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_STROKE_BEZIER_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_ELLIPSE:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Add clipping AS_STROKE_ELLIPSE
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_STROKE_ELLIPSE_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
float left, top, right, bottom;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
|
|
|
left = read_from_buffer<float>(&msgbuffer);
|
|
|
|
top = read_from_buffer<float>(&msgbuffer);
|
|
|
|
right = read_from_buffer<float>(&msgbuffer);
|
|
|
|
bottom = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 06:22:15 +03:00
|
|
|
//BRect rect(left,top,right,bottom);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->StrokeEllipse(rect,layerdata,pattern);
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_STROKE_ELLIPSE_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_LINE:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Add clipping TO AS_STROKE_LINE
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_STROKE_LINE_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
float x1, y1, x2, y2;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
|
|
|
x1 = read_from_buffer<float>(&msgbuffer);
|
|
|
|
y1 = read_from_buffer<float>(&msgbuffer);
|
|
|
|
x2 = read_from_buffer<float>(&msgbuffer);
|
|
|
|
y2 = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 06:22:15 +03:00
|
|
|
//BPoint p1(x1,y1);
|
|
|
|
//BPoint p2(x2,y2);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->StrokeLine(p1,p2,layerdata,pattern);
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_STROKE_LINE_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_LINEARRAY:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_STROKE_LINEARRAY
|
2003-06-23 06:53:55 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_POLYGON:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_STROKE_POLYGON
|
2003-06-23 06:53:55 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_RECT:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Add clipping TO AS_STROKE_RECT
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_STROKE_RECT_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
float left, top, right, bottom;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
|
|
|
left = read_from_buffer<float>(&msgbuffer);
|
|
|
|
top = read_from_buffer<float>(&msgbuffer);
|
|
|
|
right = read_from_buffer<float>(&msgbuffer);
|
|
|
|
bottom = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 06:22:15 +03:00
|
|
|
//BRect rect(left,top,right,bottom);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->StrokeRect(rect,layerdata,pattern);
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_STROKE_RECT_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_ROUNDRECT:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Add clipping AS_STROKE_ROUNDRECT
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_STROKE_ROUNDRECT_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
float left, top, right, bottom, xrad, yrad;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
|
|
|
left = read_from_buffer<float>(&msgbuffer);
|
|
|
|
top = read_from_buffer<float>(&msgbuffer);
|
|
|
|
right = read_from_buffer<float>(&msgbuffer);
|
|
|
|
bottom = read_from_buffer<float>(&msgbuffer);
|
|
|
|
xrad = read_from_buffer<float>(&msgbuffer);
|
|
|
|
yrad = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 06:22:15 +03:00
|
|
|
//BRect rect(left,top,right,bottom);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->StrokeRoundRect(rect,xrad,yrad,layerdata,pattern);
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_STROKE_ROUNDRECT_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_SHAPE:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_STROKE_SHAPE
|
2003-06-23 06:53:55 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_TRIANGLE:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO:: Add clipping to AS_STROKE_TRIANGLE
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_STROKE_TRIANGLE_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
BPoint *pts;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
2003-06-23 06:53:55 +04:00
|
|
|
float left, top, right, bottom;
|
|
|
|
int i;
|
|
|
|
pts = new BPoint[3];
|
|
|
|
for (i=0; i<3; i++)
|
|
|
|
{
|
2003-07-05 01:13:48 +04:00
|
|
|
pts[i].x = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pts[i].y = read_from_buffer<float>(&msgbuffer);
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
2003-07-05 01:13:48 +04:00
|
|
|
left = read_from_buffer<float>(&msgbuffer);
|
|
|
|
top = read_from_buffer<float>(&msgbuffer);
|
|
|
|
right = read_from_buffer<float>(&msgbuffer);
|
|
|
|
bottom = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 06:22:15 +03:00
|
|
|
//BRect rect(left,top,right,bottom);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->StrokeTriangle(pts,rect,layerdata,pattern);
|
2003-06-23 06:53:55 +04:00
|
|
|
delete[] pts;
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_STROKE_TRIANGLE_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_ARC:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO:: Add clipping to AS_FILL_ARC
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_FILL_ARC_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
float left, top, right, bottom, angle, span;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
|
|
|
left = read_from_buffer<float>(&msgbuffer);
|
|
|
|
top = read_from_buffer<float>(&msgbuffer);
|
|
|
|
right = read_from_buffer<float>(&msgbuffer);
|
|
|
|
bottom = read_from_buffer<float>(&msgbuffer);
|
|
|
|
angle = read_from_buffer<float>(&msgbuffer);
|
|
|
|
span = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 06:22:15 +03:00
|
|
|
//BRect rect(left,top,right,bottom);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->FillArc(rect,angle,span,layerdata,pattern);
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_FILL_ARC_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_BEZIER:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO:: Add clipping to AS_FILL_BEZIER
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_FILL_BEZIER_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
BPoint *pts;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
2003-06-23 06:53:55 +04:00
|
|
|
int i;
|
|
|
|
pts = new BPoint[4];
|
|
|
|
for (i=0; i<4; i++)
|
|
|
|
{
|
2003-07-05 01:13:48 +04:00
|
|
|
pts[i].x = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pts[i].y = read_from_buffer<float>(&msgbuffer);
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
2003-07-05 01:13:48 +04:00
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->FillBezier(pts,layerdata,pattern);
|
2003-06-23 06:53:55 +04:00
|
|
|
delete[] pts;
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_FILL_BEZIER_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_ELLIPSE:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO:: Add clipping to AS_FILL_ELLIPSE
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_FILL_ELLIPSE_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
float left, top, right, bottom;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
|
|
|
left = read_from_buffer<float>(&msgbuffer);
|
|
|
|
top = read_from_buffer<float>(&msgbuffer);
|
|
|
|
right = read_from_buffer<float>(&msgbuffer);
|
|
|
|
bottom = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 06:22:15 +03:00
|
|
|
//BRect rect(left,top,right,bottom);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->FillEllipse(rect,layerdata,pattern);
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_FILL_ELLIPSE_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_POLYGON:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_FILL_POLYGON
|
2003-06-23 06:53:55 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_RECT:
|
|
|
|
{
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_FILL_RECT_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
float left, top, right, bottom;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
|
|
|
left = read_from_buffer<float>(&msgbuffer);
|
|
|
|
top = read_from_buffer<float>(&msgbuffer);
|
|
|
|
right = read_from_buffer<float>(&msgbuffer);
|
|
|
|
bottom = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 06:22:15 +03:00
|
|
|
/*
|
2003-06-23 06:53:55 +04:00
|
|
|
BRect rect(left,top,right,bottom);
|
2003-12-07 08:40:51 +03:00
|
|
|
if (layerdata && numRects)
|
|
|
|
if (numRects == 1)
|
2004-01-20 01:18:37 +03:00
|
|
|
fServerApp->_driver->FillRect(rect,layerdata,pattern);
|
2003-07-09 06:28:33 +04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i=0; i<numRects; i++)
|
2004-01-20 01:18:37 +03:00
|
|
|
fServerApp->_driver->FillRect(LayerClipRegion.RectAt(i),layerdata,pattern);
|
2003-07-09 06:28:33 +04:00
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
*/
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_FILL_RECT_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_REGION:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_FILL_REGION
|
2003-06-23 06:53:55 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_ROUNDRECT:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Add clipping to AS_FILL_ROUNDRECT
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_FILL_ROUNDRECT_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
float left, top, right, bottom, xrad, yrad;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
|
|
|
left = read_from_buffer<float>(&msgbuffer);
|
|
|
|
top = read_from_buffer<float>(&msgbuffer);
|
|
|
|
right = read_from_buffer<float>(&msgbuffer);
|
|
|
|
bottom = read_from_buffer<float>(&msgbuffer);
|
|
|
|
xrad = read_from_buffer<float>(&msgbuffer);
|
|
|
|
yrad = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 06:22:15 +03:00
|
|
|
//BRect rect(left,top,right,bottom);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->FillRoundRect(rect,xrad,yrad,layerdata,pattern);
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_FILL_ROUNDRECT_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_SHAPE:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_FILL_SHAPE
|
2003-06-23 06:53:55 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_TRIANGLE:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Add clipping to AS_FILL_TRIANGLE
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_FILL_TRIANGLE_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
BPoint *pts;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
2003-06-23 06:53:55 +04:00
|
|
|
float left, top, right, bottom;
|
|
|
|
int i;
|
|
|
|
pts = new BPoint[3];
|
|
|
|
for (i=0; i<3; i++)
|
|
|
|
{
|
2003-07-05 01:13:48 +04:00
|
|
|
pts[i].x = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pts[i].y = read_from_buffer<float>(&msgbuffer);
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
2003-07-05 01:13:48 +04:00
|
|
|
left = read_from_buffer<float>(&msgbuffer);
|
|
|
|
top = read_from_buffer<float>(&msgbuffer);
|
|
|
|
right = read_from_buffer<float>(&msgbuffer);
|
|
|
|
bottom = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 06:22:15 +03:00
|
|
|
//BRect rect(left,top,right,bottom);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->FillTriangle(pts,rect,layerdata,pattern);
|
2003-06-23 06:53:55 +04:00
|
|
|
delete[] pts;
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_FILL_TRIANGLE_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_MOVEPENBY:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_MOVEPENBY
|
2003-06-23 06:53:55 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_MOVEPENTO:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_MOVEPENTO
|
2003-06-23 06:53:55 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SETPENSIZE:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_SETPENSIZE
|
2003-06-23 06:53:55 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_DRAW_STRING:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_DRAW_STRING
|
2003-06-23 06:53:55 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SET_FONT:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_SET_FONT
|
2003-06-23 06:53:55 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SET_FONT_SIZE:
|
|
|
|
{
|
2004-08-29 19:01:44 +04:00
|
|
|
// TODO: Implement AS_SET_FONT_SIZE
|
2003-06-23 06:53:55 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= sizeof(int32);
|
2004-01-20 01:18:37 +03:00
|
|
|
printf("ServerWindow %s received unexpected graphics code %lx",fTitle.String(),code);
|
2003-06-23 06:53:55 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2003-02-24 18:47:06 +03:00
|
|
|
/*!
|
|
|
|
\brief Message-dispatching loop for the ServerWindow
|
|
|
|
|
|
|
|
MonitorWin() watches the ServerWindow's message port and dispatches as necessary
|
|
|
|
\param data The thread's ServerWindow
|
|
|
|
\return Throwaway code. Always 0.
|
|
|
|
*/
|
|
|
|
int32 ServerWindow::MonitorWin(void *data)
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2003-08-31 21:38:34 +04:00
|
|
|
ServerWindow *win = (ServerWindow *)data;
|
2004-07-30 19:16:59 +04:00
|
|
|
BPortLink *ses = win->fSession;
|
2004-02-24 14:54:44 +03:00
|
|
|
bool quitting = false;
|
|
|
|
int32 code;
|
2004-07-30 19:16:59 +04:00
|
|
|
status_t err = B_OK;
|
2003-02-07 15:53:57 +03:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
while(!quitting)
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2004-07-30 19:16:59 +04:00
|
|
|
printf("info: ServerWindow::MonitorWin listening on port %ld.\n", win->fMessagePort);
|
2004-06-19 14:23:14 +04:00
|
|
|
code = AS_CLIENT_DEAD;
|
2004-07-30 19:16:59 +04:00
|
|
|
err = ses->GetNextReply(&code);
|
|
|
|
if (err < B_OK)
|
|
|
|
return err;
|
2004-01-20 05:02:01 +03:00
|
|
|
|
2004-06-19 14:23:14 +04:00
|
|
|
win->Lock();
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
switch(code)
|
2004-01-20 01:18:37 +03:00
|
|
|
{
|
2004-06-19 17:04:50 +04:00
|
|
|
case AS_DELETE_WINDOW:
|
2004-06-19 14:23:14 +04:00
|
|
|
case AS_CLIENT_DEAD:
|
2004-01-20 01:18:37 +03:00
|
|
|
{
|
2004-01-13 03:56:36 +03:00
|
|
|
// this means the client has been killed
|
2004-06-19 17:04:50 +04:00
|
|
|
STRACE(("ServerWindow %s received 'AS_CLIENT_DEAD/AS_DELETE_WINDOW' message code\n",win->Title()));
|
2004-01-20 01:18:37 +03:00
|
|
|
quitting = true;
|
2004-06-19 17:04:50 +04:00
|
|
|
// ServerWindow's destructor takes care of pulling this object off the desktop.
|
2004-01-13 03:56:36 +03:00
|
|
|
delete win;
|
|
|
|
break;
|
|
|
|
}
|
2004-01-20 01:18:37 +03:00
|
|
|
case B_QUIT_REQUESTED:
|
|
|
|
{
|
2004-01-13 03:56:36 +03:00
|
|
|
STRACE(("ServerWindow %s received Quit request\n",win->Title()));
|
2004-01-20 01:18:37 +03:00
|
|
|
quitting = true;
|
2004-01-13 03:56:36 +03:00
|
|
|
delete win;
|
|
|
|
break;
|
|
|
|
}
|
2004-01-20 01:18:37 +03:00
|
|
|
default:
|
|
|
|
{
|
2004-02-24 14:54:44 +03:00
|
|
|
win->DispatchMessage(code);
|
2004-01-13 03:56:36 +03:00
|
|
|
break;
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2003-08-31 21:38:34 +04:00
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
|
|
|
|
win->Unlock();
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2004-07-30 19:16:59 +04:00
|
|
|
return err;
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2003-09-09 01:18:39 +04:00
|
|
|
Layer* ServerWindow::FindLayer(const Layer* start, int32 token) const
|
|
|
|
{
|
2004-06-19 14:23:14 +04:00
|
|
|
if (!IsLocked())
|
|
|
|
debugger("you must lock a ServerWindow object before calling ::FindLayer()\n");
|
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
if(!start)
|
2003-09-09 01:18:39 +04:00
|
|
|
return NULL;
|
2003-09-15 23:14:45 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
// see if we're looking for 'start'
|
2004-06-11 22:21:57 +04:00
|
|
|
if(start->fViewToken == token)
|
2003-09-15 23:14:45 +04:00
|
|
|
return const_cast<Layer*>(start);
|
2003-09-09 01:18:39 +04:00
|
|
|
|
2004-06-11 22:21:57 +04:00
|
|
|
Layer *c = start->fTopChild; //c = short for: current
|
2003-12-07 08:40:51 +03:00
|
|
|
if(c != NULL)
|
2004-01-20 01:18:37 +03:00
|
|
|
while(true)
|
|
|
|
{
|
2003-09-15 23:14:45 +04:00
|
|
|
// action block
|
|
|
|
{
|
2004-06-11 22:21:57 +04:00
|
|
|
if(c->fViewToken == token)
|
2003-09-15 23:14:45 +04:00
|
|
|
return c;
|
|
|
|
}
|
2003-09-09 01:18:39 +04:00
|
|
|
|
2003-09-15 23:14:45 +04:00
|
|
|
// go deep
|
2004-06-11 22:21:57 +04:00
|
|
|
if( c->fTopChild)
|
2004-01-20 01:18:37 +03:00
|
|
|
{
|
2004-06-11 22:21:57 +04:00
|
|
|
c = c->fTopChild;
|
2003-09-15 23:14:45 +04:00
|
|
|
}
|
2004-01-20 01:18:37 +03:00
|
|
|
// go right or up
|
2003-09-09 01:18:39 +04:00
|
|
|
else
|
2004-01-20 01:18:37 +03:00
|
|
|
// go right
|
2004-06-11 22:21:57 +04:00
|
|
|
if(c->fLowerSibling)
|
2004-01-20 01:18:37 +03:00
|
|
|
{
|
2004-06-11 22:21:57 +04:00
|
|
|
c = c->fLowerSibling;
|
2003-09-15 23:14:45 +04:00
|
|
|
}
|
2004-01-20 01:18:37 +03:00
|
|
|
// go up
|
|
|
|
else
|
|
|
|
{
|
2004-06-11 22:21:57 +04:00
|
|
|
while(!c->fParent->fLowerSibling && c->fParent != start)
|
2004-01-20 01:18:37 +03:00
|
|
|
{
|
2004-06-11 22:21:57 +04:00
|
|
|
c = c->fParent;
|
2003-09-15 23:14:45 +04:00
|
|
|
}
|
2004-01-20 01:18:37 +03:00
|
|
|
// that enough! We've reached the start layer.
|
2004-06-11 22:21:57 +04:00
|
|
|
if(c->fParent == start)
|
2003-09-15 23:14:45 +04:00
|
|
|
break;
|
|
|
|
|
2004-06-11 22:21:57 +04:00
|
|
|
c = c->fParent->fLowerSibling;
|
2003-09-15 23:14:45 +04:00
|
|
|
}
|
2003-09-09 01:18:39 +04:00
|
|
|
}
|
2003-09-15 23:14:45 +04:00
|
|
|
|
2003-09-09 01:18:39 +04:00
|
|
|
return NULL;
|
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2004-01-20 01:18:37 +03:00
|
|
|
void ServerWindow::SendMessageToClient(const BMessage* msg) const
|
|
|
|
{
|
2004-06-19 14:23:14 +04:00
|
|
|
if (!IsLocked())
|
|
|
|
debugger("you must lock a ServerWindow object before calling ::SendMessageToClient()\n");
|
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
ssize_t size;
|
|
|
|
char *buffer;
|
|
|
|
|
|
|
|
size = msg->FlattenedSize();
|
|
|
|
buffer = new char[size];
|
2004-01-20 01:18:37 +03:00
|
|
|
|
|
|
|
if (msg->Flatten(buffer, size) == B_OK)
|
|
|
|
write_port(fClientLooperPort, msg->what, buffer, size);
|
2003-09-25 16:31:11 +04:00
|
|
|
else
|
2004-01-20 01:18:37 +03:00
|
|
|
printf("PANIC: ServerWindow %s: can't flatten message in 'SendMessageToClient()'\n", fTitle.String());
|
2003-09-25 16:31:11 +04:00
|
|
|
|
|
|
|
delete buffer;
|
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2003-09-09 01:18:39 +04:00
|
|
|
|