2003-02-12 04:11:55 +03:00
|
|
|
//------------------------------------------------------------------------------
|
2004-09-21 02:50:02 +04:00
|
|
|
// Copyright (c) 2001-2002, Haiku, Inc.
|
2003-02-12 04:11:55 +03:00
|
|
|
//
|
|
|
|
// 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>
|
2004-09-21 02:50:02 +04:00
|
|
|
#include <malloc.h>
|
2005-01-23 18:39:01 +03:00
|
|
|
#include <View.h>
|
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>
|
2004-10-16 06:02:27 +04:00
|
|
|
#include <ViewAux.h>
|
2003-02-07 15:53:57 +03:00
|
|
|
#include "AppServer.h"
|
2004-10-16 06:02:27 +04:00
|
|
|
#include "BGet++.h"
|
|
|
|
#include "Desktop.h"
|
2003-02-07 15:53:57 +03:00
|
|
|
#include "Layer.h"
|
2004-10-16 06:02:27 +04:00
|
|
|
#include "RAMLinkMsgReader.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-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"
|
2004-01-13 03:56:36 +03:00
|
|
|
#include "Workspace.h"
|
2005-02-07 03:45:59 +03:00
|
|
|
#include "MessagePrivate.h"
|
2003-02-12 04:11:55 +03:00
|
|
|
|
2005-02-28 23:23:51 +03:00
|
|
|
//#define DEBUG_SERVERWINDOW
|
2003-03-23 23:52:37 +03:00
|
|
|
//#define DEBUG_SERVERWINDOW_MOUSE
|
|
|
|
//#define DEBUG_SERVERWINDOW_KEYBOARD
|
2005-02-28 23:23:51 +03:00
|
|
|
//#define DEBUG_SERVERWINDOW_GRAPHICS
|
2003-03-23 23:52:37 +03:00
|
|
|
|
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
|
|
|
|
|
2005-01-19 18:12:35 +03:00
|
|
|
#ifdef DEBUG_SERVERWINDOW_GRAPHICS
|
|
|
|
# include <stdio.h>
|
|
|
|
# define DTRACE(x) printf x
|
|
|
|
#else
|
|
|
|
# define DTRACE(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
|
|
|
//------------------------------------------------------------------------------
|
2004-09-14 04:51:51 +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-09-14 04:51:51 +04:00
|
|
|
*/
|
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;
|
2005-02-28 23:23:51 +03:00
|
|
|
|
|
|
|
// floating and modal windows must appear in every workspace where
|
|
|
|
// their main window is present. Thus their wksIndex will be set to
|
|
|
|
// '0x0' and they will be made visible when needed.
|
|
|
|
switch (fFeel)
|
|
|
|
{
|
|
|
|
case B_MODAL_APP_WINDOW_FEEL:
|
|
|
|
case B_MODAL_SUBSET_WINDOW_FEEL:
|
|
|
|
case B_FLOATING_APP_WINDOW_FEEL:
|
|
|
|
case B_FLOATING_SUBSET_WINDOW_FEEL:
|
|
|
|
fWorkspaces = 0x0UL;
|
|
|
|
break;
|
|
|
|
case B_MODAL_ALL_WINDOW_FEEL:
|
|
|
|
case B_FLOATING_ALL_WINDOW_FEEL:
|
|
|
|
case B_SYSTEM_LAST:
|
|
|
|
case B_SYSTEM_FIRST:
|
|
|
|
fWorkspaces = 0xffffffffUL;
|
|
|
|
break;
|
|
|
|
case B_NORMAL_WINDOW_FEEL:
|
|
|
|
if (fWorkspaces == 0x0UL)
|
|
|
|
;;
|
|
|
|
// TODO: get RootLayer's ActiveWorkspaceIndex
|
|
|
|
}
|
|
|
|
|
2004-06-11 18:47:36 +04:00
|
|
|
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-10-16 06:02:27 +04:00
|
|
|
fMsgSender=new LinkMsgSender(fClientWinPort);
|
|
|
|
fMsgReader=new LinkMsgReader(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-10-16 06:02:27 +04:00
|
|
|
fMsgSender->StartMessage(SERVER_TRUE);
|
|
|
|
fMsgSender->Attach<port_id>(fMessagePort);
|
|
|
|
fMsgSender->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)
|
|
|
|
{
|
2005-03-19 21:58:47 +03:00
|
|
|
char newName[256];
|
|
|
|
sprintf(newName, "%ld: %s", fClientTeamID, fTitle.String());
|
|
|
|
fWinBorder = new WinBorder( fFrame, newName, fLook, fFeel, 0UL,
|
2004-06-16 10:40:26 +04:00
|
|
|
this, desktop->GetDisplayDriver());
|
|
|
|
|
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()));
|
|
|
|
|
2005-02-28 23:23:51 +03:00
|
|
|
if (fWinBorder)
|
|
|
|
{
|
|
|
|
delete fWinBorder;
|
|
|
|
fWinBorder = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
cl = NULL;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
if(fMsgSender)
|
2004-06-11 18:47:36 +04:00
|
|
|
{
|
2004-10-16 06:02:27 +04:00
|
|
|
delete fMsgSender;
|
|
|
|
fMsgSender=NULL;
|
2004-01-13 03:56:36 +03:00
|
|
|
}
|
2004-10-16 06:02:27 +04:00
|
|
|
|
|
|
|
if(fMsgReader)
|
|
|
|
{
|
|
|
|
delete fMsgReader;
|
|
|
|
fMsgReader=NULL;
|
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
|
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)
|
|
|
|
{
|
2005-03-17 20:41:00 +03:00
|
|
|
// NOTE: if you do something else, other than sending a port message, PLEASE lock
|
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)
|
|
|
|
{
|
2005-03-17 20:41:00 +03:00
|
|
|
// NOTE: if you do something else, other than sending a port message, PLEASE lock
|
2005-02-28 23:23:51 +03:00
|
|
|
STRACE(("ServerWindow %s: Show\n",fTitle.String()));
|
2004-06-19 14:23:14 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
if(!fWinBorder->IsHidden())
|
2004-01-14 18:55:10 +03:00
|
|
|
return;
|
|
|
|
|
2005-01-22 00:18:25 +03:00
|
|
|
fWinBorder->GetRootLayer()->ShowWinBorder(fWinBorder);
|
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)
|
|
|
|
{
|
2005-03-17 20:41:00 +03:00
|
|
|
// NOTE: if you do something else, other than sending a port message, PLEASE lock
|
2005-02-28 23:23:51 +03:00
|
|
|
STRACE(("ServerWindow %s: Hide\n",fTitle.String()));
|
2004-06-19 14:23:14 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
if(fWinBorder->IsHidden())
|
2004-01-14 18:55:10 +03:00
|
|
|
return;
|
|
|
|
|
2005-01-22 00:18:25 +03:00
|
|
|
fWinBorder->GetRootLayer()->HideWinBorder(fWinBorder);
|
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
|
|
|
return fWinBorder->IsHidden();
|
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)
|
|
|
|
{
|
2005-03-17 20:41:00 +03:00
|
|
|
// NOTE: if you do something else, other than sending a port message, PLEASE lock
|
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)
|
|
|
|
{
|
2005-03-17 20:41:00 +03:00
|
|
|
// NOTE: if you do something else, other than sending a port message, PLEASE lock
|
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)
|
|
|
|
{
|
2005-02-23 04:45:48 +03:00
|
|
|
STRACE(("\nServerWindow %s: Lock\n",fTitle.String()));
|
2004-06-11 18:47:36 +04:00
|
|
|
|
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)
|
|
|
|
{
|
2005-02-23 04:45:48 +03:00
|
|
|
STRACE(("ServerWindow %s: Unlock\n\n",fTitle.String()));
|
2004-06-11 18:47:36 +04:00
|
|
|
|
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
|
|
|
|
*/
|
2004-10-16 06:02:27 +04:00
|
|
|
void ServerWindow::SetLayerFontState(Layer *layer, LinkMsgReader &link)
|
2004-06-11 18:47:36 +04:00
|
|
|
{
|
2005-02-23 04:45:48 +03:00
|
|
|
STRACE(("ServerWindow %s: SetLayerFontStateMessage for layer %s\n",
|
|
|
|
fTitle.String(), layer->fName->String()));
|
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-10-16 06:02:27 +04:00
|
|
|
link.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-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>((int32*)&fontID);
|
2005-01-21 16:13:08 +03:00
|
|
|
layer->fLayerData->font.SetFamilyAndStyle(fontID);
|
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-10-16 06:02:27 +04:00
|
|
|
link.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-10-16 06:02:27 +04:00
|
|
|
link.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-10-16 06:02:27 +04:00
|
|
|
link.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-10-16 06:02:27 +04:00
|
|
|
link.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-10-16 06:02:27 +04:00
|
|
|
link.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-10-16 06:02:27 +04:00
|
|
|
link.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-10-16 06:02:27 +04:00
|
|
|
link.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-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2004-10-16 06:02:27 +04:00
|
|
|
void ServerWindow::SetLayerState(Layer *layer, LinkMsgReader &link)
|
2004-06-11 18:47:36 +04:00
|
|
|
{
|
2005-02-23 04:45:48 +03:00
|
|
|
STRACE(("ServerWindow %s: SetLayerState for layer %s\n",fTitle.String(),
|
|
|
|
layer->fName->String()));
|
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-10-16 06:02:27 +04:00
|
|
|
link.Read<BPoint>( &(layer->fLayerData->penlocation));
|
|
|
|
link.Read<float>( &(layer->fLayerData->pensize));
|
|
|
|
link.Read( &highColor, sizeof(rgb_color));
|
|
|
|
link.Read( &lowColor, sizeof(rgb_color));
|
|
|
|
link.Read( &viewColor, sizeof(rgb_color));
|
|
|
|
link.Read( &patt, sizeof(pattern));
|
|
|
|
link.Read<int8>((int8*) &(layer->fLayerData->draw_mode));
|
|
|
|
link.Read<BPoint>( &(layer->fLayerData->coordOrigin));
|
|
|
|
link.Read<int8>((int8*) &(layer->fLayerData->lineJoin));
|
|
|
|
link.Read<int8>((int8*) &(layer->fLayerData->lineCap));
|
|
|
|
link.Read<float>( &(layer->fLayerData->miterLimit));
|
|
|
|
link.Read<int8>((int8*) &(layer->fLayerData->alphaSrcMode));
|
|
|
|
link.Read<int8>((int8*) &(layer->fLayerData->alphaFncMode));
|
|
|
|
link.Read<float>( &(layer->fLayerData->scale));
|
|
|
|
link.Read<bool>( &(layer->fLayerData->fontAliasing));
|
|
|
|
link.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-10-16 06:02:27 +04:00
|
|
|
link.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-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2004-10-16 06:02:27 +04:00
|
|
|
Layer * ServerWindow::CreateLayerTree(Layer *localRoot, LinkMsgReader &link)
|
2004-06-11 18:47:36 +04:00
|
|
|
{
|
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
|
|
|
|
|
|
|
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-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&token);
|
|
|
|
link.ReadString(&name);
|
|
|
|
link.Read<BRect>(&frame);
|
|
|
|
link.Read<uint32>(&resizeMask);
|
|
|
|
link.Read<uint32>(&flags);
|
|
|
|
link.Read<bool>(&hidden);
|
|
|
|
link.Read<int32>(&childCount);
|
2004-03-28 19:00:31 +04:00
|
|
|
|
2005-02-23 04:45:48 +03:00
|
|
|
STRACE(("ServerWindow(%s)::CreateLayerTree()-> layer %s, token %ld\n", fTitle.String(),name,token));
|
2005-02-28 23:23:51 +03: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
|
|
|
|
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-10-16 06:02:27 +04:00
|
|
|
void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
2003-02-24 18:47:06 +03:00
|
|
|
{
|
2004-07-30 19:16:59 +04:00
|
|
|
if (cl == NULL && code != AS_LAYER_CREATE_ROOT)
|
|
|
|
{
|
2005-01-19 20:35:17 +03:00
|
|
|
printf("ServerWindow %s received unexpected code - message offset %ld before top_view attached.\n",fTitle.String(), code - SERVER_TRUE);
|
2004-07-30 19:16:59 +04:00
|
|
|
return;
|
|
|
|
}
|
2005-01-22 23:51:12 +03:00
|
|
|
|
|
|
|
RootLayer *myRootLayer = fWinBorder->GetRootLayer();
|
|
|
|
|
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:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_DRAW_BITMAP_SYNC_AT_POINT: Layer name: %s\n", fTitle.String(), cl->fName->String()));
|
2004-04-16 21:52:31 +04:00
|
|
|
int32 bitmapToken;
|
|
|
|
BPoint point;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&bitmapToken);
|
|
|
|
link.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:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_DRAW_BITMAP_ASYNC_AT_POINT: Layer name: %s\n", fTitle.String(), cl->fName->String()));
|
2004-04-16 21:52:31 +04:00
|
|
|
int32 bitmapToken;
|
|
|
|
BPoint point;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&bitmapToken);
|
|
|
|
link.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:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_DRAW_BITMAP_SYNC_IN_RECT: Layer name: %s\n", fTitle.String(), cl->fName->String()));
|
2004-06-11 18:47:36 +04:00
|
|
|
int32 bitmapToken;
|
|
|
|
BRect srcRect, dstRect;
|
2004-04-16 21:52:31 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&bitmapToken);
|
|
|
|
link.Read<BRect>(&dstRect);
|
|
|
|
link.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:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_DRAW_BITMAP_ASYNC_IN_RECT: Layer name: %s\n", fTitle.String(), cl->fName->String()));
|
2004-06-11 18:47:36 +04:00
|
|
|
int32 bitmapToken;
|
|
|
|
BRect srcRect, dstRect;
|
2004-04-16 21:52:31 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&bitmapToken);
|
|
|
|
link.Read<BRect>(&dstRect);
|
|
|
|
link.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:
|
|
|
|
{
|
2003-12-07 08:40:51 +03:00
|
|
|
int32 token;
|
2003-09-09 01:18:39 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.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);
|
2005-02-23 04:45:48 +03:00
|
|
|
if(current)
|
|
|
|
{
|
|
|
|
DTRACE(("ServerWindow %s: Message AS_SET_CURRENT_LAYER: %s, token %ld\n", fTitle.String(), current->fName->String(), token));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
DTRACE(("ServerWindow %s: Message AS_SET_CURRENT_LAYER: layer not found, token %ld\n", fTitle.String(), 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:
|
|
|
|
{
|
2005-01-19 20:35:17 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_CREATE_ROOT\n", fTitle.String()));
|
2005-02-28 23:23:51 +03:00
|
|
|
|
2004-07-30 19:16:59 +04:00
|
|
|
// Start receiving top_view data -- pass NULL as the parent view.
|
|
|
|
// This should be the *only* place where this happens.
|
|
|
|
if (cl != NULL)
|
|
|
|
break;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
// fWinBorder->fTopLayer = CreateLayerTree(NULL);
|
|
|
|
fWinBorder->fTopLayer = CreateLayerTree(NULL, link);
|
2004-07-30 19:16:59 +04:00
|
|
|
fWinBorder->fTopLayer->SetAsTopLayer(true);
|
|
|
|
cl = fWinBorder->fTopLayer;
|
|
|
|
|
|
|
|
// connect decorator and top layer.
|
|
|
|
fWinBorder->AddChild(fWinBorder->fTopLayer, NULL);
|
|
|
|
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
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
// newLayer = CreateLayerTree(NULL);
|
|
|
|
newLayer = CreateLayerTree(NULL, link);
|
2004-06-16 10:40:26 +04:00
|
|
|
cl->AddChild(newLayer, this);
|
|
|
|
|
|
|
|
if (!(newLayer->IsHidden())){
|
2005-01-22 23:51:12 +03:00
|
|
|
myRootLayer->GoInvalidate(newLayer, 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
|
|
|
|
2005-01-22 23:51:12 +03:00
|
|
|
if (parent)
|
|
|
|
myRootLayer->GoInvalidate(parent, BRegion(cl->Frame()));
|
2004-08-08 00:30:58 +04:00
|
|
|
|
|
|
|
#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:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_STATE: Layer name: %s\n", fTitle.String(), cl->fName->String()));
|
2004-10-16 06:02:27 +04:00
|
|
|
// SetLayerState(cl);
|
|
|
|
SetLayerState(cl,link);
|
2004-03-28 19:00:31 +04:00
|
|
|
cl->RebuildFullRegion();
|
2003-09-15 23:14:45 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_FONT_STATE:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_FONT_STATE: Layer name: %s\n", fTitle.String(), cl->fName->String()));
|
2004-10-16 06:02:27 +04:00
|
|
|
// SetLayerFontState(cl);
|
|
|
|
SetLayerFontState(cl,link);
|
2004-03-28 19:00:31 +04:00
|
|
|
cl->RebuildFullRegion();
|
2003-09-15 23:14:45 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_STATE:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("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
|
2005-01-23 18:39:01 +03:00
|
|
|
// TODO: Implement *what*? SetFamilyAndStyle exists. :)
|
2004-10-16 06:02:27 +04:00
|
|
|
fMsgSender->StartMessage(SERVER_TRUE);
|
2004-08-08 00:30:58 +04:00
|
|
|
|
|
|
|
// Attach font state
|
2005-01-23 18:39:01 +03:00
|
|
|
fMsgSender->Attach<uint32>(ld->font.GetFamilyAndStyle());
|
2004-10-16 06:02:27 +04:00
|
|
|
fMsgSender->Attach<float>(ld->font.Size());
|
|
|
|
fMsgSender->Attach<float>(ld->font.Shear());
|
|
|
|
fMsgSender->Attach<float>(ld->font.Rotation());
|
|
|
|
fMsgSender->Attach<uint8>(ld->font.Spacing());
|
|
|
|
fMsgSender->Attach<uint8>(ld->font.Encoding());
|
|
|
|
fMsgSender->Attach<uint16>(ld->font.Face());
|
|
|
|
fMsgSender->Attach<uint32>(ld->font.Flags());
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2004-08-08 00:30:58 +04:00
|
|
|
// Attach view state
|
2004-10-16 06:02:27 +04:00
|
|
|
fMsgSender->Attach<BPoint>(ld->penlocation);
|
|
|
|
fMsgSender->Attach<float>(ld->pensize);
|
|
|
|
fMsgSender->Attach(&hc, sizeof(rgb_color));
|
|
|
|
fMsgSender->Attach(&lc, sizeof(rgb_color));
|
|
|
|
fMsgSender->Attach(&vc, sizeof(rgb_color));
|
|
|
|
fMsgSender->Attach<uint64>(patt);
|
|
|
|
fMsgSender->Attach<BPoint>(ld->coordOrigin);
|
|
|
|
fMsgSender->Attach<uint8>((uint8)(ld->draw_mode));
|
|
|
|
fMsgSender->Attach<uint8>((uint8)(ld->lineCap));
|
|
|
|
fMsgSender->Attach<uint8>((uint8)(ld->lineJoin));
|
|
|
|
fMsgSender->Attach<float>(ld->miterLimit);
|
|
|
|
fMsgSender->Attach<uint8>((uint8)(ld->alphaSrcMode));
|
|
|
|
fMsgSender->Attach<uint8>((uint8)(ld->alphaFncMode));
|
|
|
|
fMsgSender->Attach<float>(ld->scale);
|
|
|
|
fMsgSender->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-10-16 06:02:27 +04:00
|
|
|
fMsgSender->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-10-16 06:02:27 +04:00
|
|
|
fMsgSender->Attach<BRect>(ld->clipReg->RectAt(i));
|
2003-09-15 23:14:45 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
fMsgSender->Attach<float>(cl->fFrame.left);
|
|
|
|
fMsgSender->Attach<float>(cl->fFrame.top);
|
|
|
|
fMsgSender->Attach<BRect>(cl->fFrame.OffsetToCopy(cl->fBoundsLeftTop));
|
|
|
|
fMsgSender->Flush();
|
2004-07-30 19:16:59 +04:00
|
|
|
|
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-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&x);
|
|
|
|
link.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-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&newWidth);
|
|
|
|
link.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-10-16 06:02:27 +04:00
|
|
|
fMsgSender->StartMessage(SERVER_TRUE);
|
|
|
|
fMsgSender->Attach<float>(cl->fFrame.left);
|
|
|
|
fMsgSender->Attach<float>(cl->fFrame.top);
|
|
|
|
fMsgSender->Attach<BRect>(cl->fFrame.OffsetToCopy(cl->fBoundsLeftTop));
|
|
|
|
fMsgSender->Flush();
|
2004-07-30 19:16:59 +04:00
|
|
|
|
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-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&x);
|
|
|
|
link.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-10-16 06:02:27 +04:00
|
|
|
fMsgSender->StartMessage(SERVER_TRUE);
|
|
|
|
fMsgSender->Attach<BPoint>(cl->fLayerData->coordOrigin);
|
|
|
|
fMsgSender->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-10-16 06:02:27 +04:00
|
|
|
link.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:
|
|
|
|
{
|
2005-01-19 21:00:05 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_CURSOR: Layer: %s - NOT IMPLEMENTED\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-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&token);
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2005-01-19 21:00:05 +03:00
|
|
|
// TODO: implement; I think each Layer should have a member pointing
|
|
|
|
// to this requested cursor.
|
|
|
|
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-25 16:31:11 +04:00
|
|
|
case AS_LAYER_SET_FLAGS:
|
|
|
|
{
|
2004-10-16 06:02:27 +04:00
|
|
|
link.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:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("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-10-16 06:02:27 +04:00
|
|
|
link.Read<int8>(&lineCap);
|
|
|
|
link.Read<int8>(&lineJoin);
|
|
|
|
link.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:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_LINE_MODE: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-10-16 06:02:27 +04:00
|
|
|
fMsgSender->StartMessage(SERVER_TRUE);
|
|
|
|
fMsgSender->Attach<int8>((int8)(cl->fLayerData->lineCap));
|
|
|
|
fMsgSender->Attach<int8>((int8)(cl->fLayerData->lineJoin));
|
|
|
|
fMsgSender->Attach<float>(cl->fLayerData->miterLimit);
|
|
|
|
fMsgSender->Flush();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_PUSH_STATE:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("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:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("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
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("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;
|
2005-01-28 02:16:28 +03:00
|
|
|
ld->prevState = NULL;
|
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:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_SCALE: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&(cl->fLayerData->scale));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_SCALE:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("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-10-16 06:02:27 +04:00
|
|
|
fMsgSender->StartMessage(SERVER_TRUE);
|
|
|
|
fMsgSender->Attach<float>(scale);
|
|
|
|
fMsgSender->Flush();
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_PEN_LOC:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("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-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&x);
|
|
|
|
link.Read<float>(&y);
|
2004-07-30 19:16:59 +04:00
|
|
|
|
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:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_PEN_LOC: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-10-16 06:02:27 +04:00
|
|
|
fMsgSender->StartMessage(SERVER_TRUE);
|
|
|
|
fMsgSender->Attach<BPoint>(cl->fLayerData->penlocation);
|
|
|
|
fMsgSender->Flush();
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_PEN_SIZE:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_PEN_SIZE: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&(cl->fLayerData->pensize));
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_PEN_SIZE:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_PEN_SIZE: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-10-16 06:02:27 +04:00
|
|
|
fMsgSender->StartMessage(SERVER_TRUE);
|
|
|
|
fMsgSender->Attach<float>(cl->fLayerData->pensize);
|
|
|
|
fMsgSender->Flush();
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_VIEW_COLOR:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("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-10-16 06:02:27 +04:00
|
|
|
link.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
|
|
|
|
2005-01-22 23:51:12 +03:00
|
|
|
myRootLayer->GoRedraw(cl, cl->fVisible);
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_COLORS:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("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-10-16 06:02:27 +04:00
|
|
|
fMsgSender->StartMessage(SERVER_TRUE);
|
|
|
|
fMsgSender->Attach(&highColor, sizeof(rgb_color));
|
|
|
|
fMsgSender->Attach(&lowColor, sizeof(rgb_color));
|
|
|
|
fMsgSender->Attach(&viewColor, sizeof(rgb_color));
|
|
|
|
fMsgSender->Flush();
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_BLEND_MODE:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("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-10-16 06:02:27 +04:00
|
|
|
link.Read<int8>(&srcAlpha);
|
|
|
|
link.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:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_BLEND_MODE: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-10-16 06:02:27 +04:00
|
|
|
fMsgSender->StartMessage(SERVER_TRUE);
|
|
|
|
fMsgSender->Attach<int8>((int8)(cl->fLayerData->alphaSrcMode));
|
|
|
|
fMsgSender->Attach<int8>((int8)(cl->fLayerData->alphaFncMode));
|
|
|
|
fMsgSender->Flush();
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_DRAW_MODE:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("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-10-16 06:02:27 +04:00
|
|
|
link.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:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_GET_DRAW_MODE: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-10-16 06:02:27 +04:00
|
|
|
fMsgSender->StartMessage(SERVER_TRUE);
|
|
|
|
fMsgSender->Attach<int8>((int8)(cl->fLayerData->draw_mode));
|
|
|
|
fMsgSender->Flush();
|
2004-07-30 19:16:59 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_PRINT_ALIASING:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_PRINT_ALIASING: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-10-16 06:02:27 +04:00
|
|
|
link.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:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_CLIP_TO_PICTURE: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2005-03-19 21:58:47 +03:00
|
|
|
|
|
|
|
// TODO: you are not allowed to use Layer regions here!!!
|
|
|
|
// If there is no other way, then first lock RootLayer object first.
|
|
|
|
|
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-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&pictureToken);
|
|
|
|
link.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)
|
2005-01-22 23:51:12 +03:00
|
|
|
myRootLayer->GoRedraw(cl, reg);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_CLIP_TO_INVERSE_PICTURE:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("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-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&pictureToken);
|
|
|
|
link.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:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("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-10-16 06:02:27 +04:00
|
|
|
fMsgSender->StartMessage(SERVER_TRUE);
|
|
|
|
fMsgSender->Attach<int32>(0L);
|
|
|
|
fMsgSender->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-10-16 06:02:27 +04:00
|
|
|
fMsgSender->StartMessage(SERVER_TRUE);
|
|
|
|
fMsgSender->Attach<int32>(noOfRects);
|
2004-06-16 10:40:26 +04:00
|
|
|
|
|
|
|
for(int i = 0; i < noOfRects; i++)
|
2004-10-16 06:02:27 +04:00
|
|
|
fMsgSender->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:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("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-10-16 06:02:27 +04:00
|
|
|
link.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-10-16 06:02:27 +04:00
|
|
|
link.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()))
|
2005-01-22 23:51:12 +03:00
|
|
|
myRootLayer->GoInvalidate(cl, cl->fFull);
|
2004-06-16 10:40:26 +04:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-25 21:25:38 +04:00
|
|
|
case AS_LAYER_INVAL_RECT:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("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-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&invalRect);
|
2005-01-22 23:51:12 +03:00
|
|
|
|
|
|
|
myRootLayer->GoRedraw(cl, BRegion(invalRect));
|
2004-06-11 18:47:36 +04:00
|
|
|
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_INVAL_REGION:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("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-10-16 06:02:27 +04:00
|
|
|
link.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-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&rect);
|
2003-12-07 08:40:51 +03:00
|
|
|
invalReg.Include(rect);
|
2003-09-25 21:25:38 +04:00
|
|
|
}
|
|
|
|
|
2005-01-22 23:51:12 +03:00
|
|
|
myRootLayer->GoRedraw(cl, 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:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindowo %s: AS_BEGIN_UPDATE\n",fTitle.String()));
|
2004-07-06 00:37:13 +04:00
|
|
|
cl->UpdateStart();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_END_UPDATE:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindowo %s: AS_END_UPDATE\n",fTitle.String()));
|
2004-07-06 00:37:13 +04:00
|
|
|
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-10-17 02:42:08 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_ADD_TO_SUBSET\n",fTitle.String()));
|
2004-06-11 18:47:36 +04:00
|
|
|
WinBorder *wb;
|
|
|
|
int32 mainToken;
|
|
|
|
team_id teamID;
|
2005-02-28 23:23:51 +03:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&mainToken);
|
|
|
|
link.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-10-16 06:02:27 +04:00
|
|
|
fMsgSender->StartMessage(SERVER_TRUE);
|
|
|
|
fMsgSender->Flush();
|
2005-03-14 01:54:01 +03:00
|
|
|
|
|
|
|
BPortLink msg(-1, -1);
|
|
|
|
msg.StartMessage(AS_ROOTLAYER_ADD_TO_SUBSET);
|
|
|
|
msg.Attach<WinBorder*>(fWinBorder);
|
|
|
|
msg.Attach<WinBorder*>(wb);
|
|
|
|
fWinBorder->GetRootLayer()->EnqueueMessage(msg);
|
2004-01-14 03:26:15 +03:00
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
else
|
|
|
|
{
|
2004-10-16 06:02:27 +04:00
|
|
|
fMsgSender->StartMessage(SERVER_FALSE);
|
|
|
|
fMsgSender->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-10-17 02:42:08 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_REM_FROM_SUBSET\n",fTitle.String()));
|
2004-06-11 18:47:36 +04:00
|
|
|
WinBorder *wb;
|
|
|
|
int32 mainToken;
|
|
|
|
team_id teamID;
|
2005-02-28 23:23:51 +03:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&mainToken);
|
|
|
|
link.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-10-16 06:02:27 +04:00
|
|
|
fMsgSender->StartMessage(SERVER_TRUE);
|
|
|
|
fMsgSender->Flush();
|
2004-01-17 19:33:22 +03:00
|
|
|
|
2005-03-18 22:00:45 +03:00
|
|
|
BPortLink msg(-1, -1);
|
|
|
|
msg.StartMessage(AS_ROOTLAYER_REMOVE_FROM_SUBSET);
|
|
|
|
msg.Attach<WinBorder*>(fWinBorder);
|
|
|
|
msg.Attach<WinBorder*>(wb);
|
|
|
|
fWinBorder->GetRootLayer()->EnqueueMessage(msg);
|
2004-01-17 19:33:22 +03:00
|
|
|
}
|
2004-06-11 18:47:36 +04:00
|
|
|
else
|
|
|
|
{
|
2004-10-16 06:02:27 +04:00
|
|
|
fMsgSender->StartMessage(SERVER_FALSE);
|
|
|
|
fMsgSender->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-10-17 02:42:08 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_WINDOW_RESIZE\n",fTitle.String()));
|
2004-06-11 18:47:36 +04:00
|
|
|
float xResizeBy;
|
|
|
|
float yResizeBy;
|
2004-05-16 23:24:18 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&xResizeBy);
|
|
|
|
link.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:
|
|
|
|
{
|
2004-10-17 02:42:08 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_WINDOW_MOVE\n",fTitle.String()));
|
2004-06-18 23:13:06 +04:00
|
|
|
float xMoveBy;
|
|
|
|
float yMoveBy;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&xMoveBy);
|
|
|
|
link.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;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&wmin);
|
|
|
|
link.Read<float>(&wmax);
|
|
|
|
link.Read<float>(&hmin);
|
|
|
|
link.Read<float>(&hmax);
|
2004-08-08 00:30:58 +04:00
|
|
|
|
|
|
|
fWinBorder->SetSizeLimits(wmin,wmax,hmin,hmax);
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
fMsgSender->StartMessage(SERVER_TRUE);
|
|
|
|
fMsgSender->Flush();
|
2004-08-08 00:30:58 +04:00
|
|
|
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;
|
|
|
|
}
|
2004-09-14 04:51:51 +04:00
|
|
|
|
|
|
|
// -------------------- Graphics messages ----------------------------------
|
|
|
|
|
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
case AS_LAYER_SET_HIGH_COLOR:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_HIGH_COLOR: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-09-15 02:21:26 +04:00
|
|
|
rgb_color c;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read(&c, sizeof(rgb_color));
|
2004-09-15 02:21:26 +04:00
|
|
|
|
|
|
|
cl->fLayerData->highcolor.SetColor(c);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_LOW_COLOR:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_LOW_COLOR: Layer: %s\n",fTitle.String(), cl->fName->String()));
|
2004-09-15 02:21:26 +04:00
|
|
|
rgb_color c;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read(&c, sizeof(rgb_color));
|
2004-09-15 02:21:26 +04:00
|
|
|
|
|
|
|
cl->fLayerData->lowcolor.SetColor(c);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2004-09-14 04:51:51 +04:00
|
|
|
case AS_STROKE_LINE:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE_LINE\n",fTitle.String()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-14 04:51:51 +04:00
|
|
|
// TODO: Add clipping TO AS_STROKE_LINE
|
|
|
|
float x1, y1, x2, y2;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&x1);
|
|
|
|
link.Read<float>(&y1);
|
|
|
|
link.Read<float>(&x2);
|
|
|
|
link.Read<float>(&y2);
|
2004-09-14 04:51:51 +04:00
|
|
|
|
|
|
|
if (cl && cl->fLayerData)
|
|
|
|
{
|
|
|
|
BPoint p1(x1,y1);
|
|
|
|
BPoint p2(x2,y2);
|
|
|
|
desktop->GetDisplayDriver()->StrokeLine(cl->ConvertToTop(p1),cl->ConvertToTop(p2),
|
|
|
|
cl->fLayerData);
|
2004-10-17 02:42:08 +04:00
|
|
|
|
|
|
|
// We update the pen here because many DisplayDriver calls which do not update the
|
|
|
|
// pen position actually call StrokeLine
|
|
|
|
cl->fLayerData->penlocation=p2;
|
2004-09-14 04:51:51 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2005-01-21 05:01:28 +03:00
|
|
|
case AS_LAYER_INVERT_RECT:
|
|
|
|
{
|
|
|
|
DTRACE(("ServerWindow %s: Message AS_INVERT_RECT\n",fTitle.String()));
|
|
|
|
|
|
|
|
// TODO: Add clipping TO AS_INVERT_RECT
|
|
|
|
BRect rect;
|
|
|
|
link.Read<BRect>(&rect);
|
|
|
|
|
|
|
|
if (cl && cl->fLayerData)
|
|
|
|
desktop->GetDisplayDriver()->InvertRect(cl->ConvertToTop(rect));
|
|
|
|
break;
|
|
|
|
}
|
2004-09-15 02:21:26 +04:00
|
|
|
case AS_STROKE_RECT:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE_RECT\n",fTitle.String()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
// TODO: Add clipping TO AS_STROKE_RECT
|
|
|
|
float left, top, right, bottom;
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&left);
|
|
|
|
link.Read<float>(&top);
|
|
|
|
link.Read<float>(&right);
|
|
|
|
link.Read<float>(&bottom);
|
2004-09-15 02:21:26 +04:00
|
|
|
BRect rect(left,top,right,bottom);
|
2005-01-19 18:12:35 +03:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
if (cl && cl->fLayerData)
|
|
|
|
desktop->GetDisplayDriver()->StrokeRect(cl->ConvertToTop(rect),cl->fLayerData);
|
2004-10-17 02:42:08 +04:00
|
|
|
break;
|
2004-09-15 02:21:26 +04:00
|
|
|
}
|
|
|
|
case AS_FILL_RECT:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_FILL_RECT\n",fTitle.String()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
|
|
|
// TODO: Add clipping TO AS_FILL_RECT
|
2004-09-15 02:21:26 +04:00
|
|
|
BRect rect;
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&rect);
|
2004-09-15 02:21:26 +04:00
|
|
|
if (cl && cl->fLayerData)
|
|
|
|
desktop->GetDisplayDriver()->FillRect(cl->ConvertToTop(rect),cl->fLayerData);
|
2004-10-17 02:42:08 +04:00
|
|
|
break;
|
2004-09-15 02:21:26 +04:00
|
|
|
}
|
|
|
|
case AS_STROKE_ARC:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE_ARC\n",fTitle.String()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
// TODO: Add clipping to AS_STROKE_ARC
|
|
|
|
float angle, span;
|
|
|
|
BRect r;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&r);
|
|
|
|
link.Read<float>(&angle);
|
|
|
|
link.Read<float>(&span);
|
2004-09-15 02:21:26 +04:00
|
|
|
if (cl && cl->fLayerData)
|
|
|
|
desktop->GetDisplayDriver()->StrokeArc(cl->ConvertToTop(r),angle,span,cl->fLayerData);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_ARC:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_FILL_ARC\n",fTitle.String()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
|
|
|
// TODO: Add clipping to AS_FILL_ARC
|
2004-09-15 02:21:26 +04:00
|
|
|
float angle, span;
|
|
|
|
BRect r;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&r);
|
|
|
|
link.Read<float>(&angle);
|
|
|
|
link.Read<float>(&span);
|
2004-09-15 02:21:26 +04:00
|
|
|
if (cl && cl->fLayerData)
|
|
|
|
desktop->GetDisplayDriver()->FillArc(cl->ConvertToTop(r),angle,span,cl->fLayerData);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_BEZIER:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE_BEZIER\n",fTitle.String()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
// TODO: Add clipping to AS_STROKE_BEZIER
|
|
|
|
BPoint *pts;
|
|
|
|
int i;
|
|
|
|
pts = new BPoint[4];
|
|
|
|
|
|
|
|
for (i=0; i<4; i++)
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BPoint>(&(pts[i]));
|
2004-09-15 02:21:26 +04:00
|
|
|
|
|
|
|
if (cl && cl->fLayerData)
|
|
|
|
{
|
|
|
|
for (i=0; i<4; i++)
|
|
|
|
pts[i]=cl->ConvertToTop(pts[i]);
|
|
|
|
|
|
|
|
desktop->GetDisplayDriver()->StrokeBezier(pts,cl->fLayerData);
|
|
|
|
}
|
|
|
|
delete [] pts;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_BEZIER:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_FILL_BEZIER\n",fTitle.String()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
// TODO: Add clipping to AS_STROKE_BEZIER
|
|
|
|
BPoint *pts;
|
|
|
|
int i;
|
|
|
|
pts = new BPoint[4];
|
|
|
|
|
|
|
|
for (i=0; i<4; i++)
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BPoint>(&(pts[i]));
|
2004-09-15 02:21:26 +04:00
|
|
|
|
|
|
|
if (cl && cl->fLayerData)
|
|
|
|
{
|
|
|
|
for (i=0; i<4; i++)
|
|
|
|
pts[i]=cl->ConvertToTop(pts[i]);
|
|
|
|
|
|
|
|
desktop->GetDisplayDriver()->FillBezier(pts,cl->fLayerData);
|
|
|
|
}
|
|
|
|
delete [] pts;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_ELLIPSE:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE_ELLIPSE\n",fTitle.String()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
// TODO: Add clipping AS_STROKE_ELLIPSE
|
|
|
|
BRect rect;
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&rect);
|
2004-09-15 02:21:26 +04:00
|
|
|
if (cl && cl->fLayerData)
|
|
|
|
desktop->GetDisplayDriver()->StrokeEllipse(cl->ConvertToTop(rect),cl->fLayerData);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_ELLIPSE:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_FILL_ELLIPSE\n",fTitle.String()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
// TODO: Add clipping AS_STROKE_ELLIPSE
|
|
|
|
BRect rect;
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&rect);
|
2004-09-15 02:21:26 +04:00
|
|
|
if (cl && cl->fLayerData)
|
|
|
|
desktop->GetDisplayDriver()->FillEllipse(cl->ConvertToTop(rect),cl->fLayerData);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_ROUNDRECT:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE_ROUNDRECT\n",fTitle.String()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
// TODO: Add clipping AS_STROKE_ROUNDRECT
|
|
|
|
BRect rect;
|
|
|
|
float xrad,yrad;
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&rect);
|
|
|
|
link.Read<float>(&xrad);
|
|
|
|
link.Read<float>(&yrad);
|
2004-09-15 02:21:26 +04:00
|
|
|
|
|
|
|
if (cl && cl->fLayerData)
|
|
|
|
desktop->GetDisplayDriver()->StrokeRoundRect(cl->ConvertToTop(rect),xrad,yrad,cl->fLayerData);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_ROUNDRECT:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_FILL_ROUNDRECT\n",fTitle.String()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
// TODO: Add clipping AS_STROKE_ROUNDRECT
|
|
|
|
BRect rect;
|
|
|
|
float xrad,yrad;
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&rect);
|
|
|
|
link.Read<float>(&xrad);
|
|
|
|
link.Read<float>(&yrad);
|
2004-09-15 02:21:26 +04:00
|
|
|
|
|
|
|
if (cl && cl->fLayerData)
|
|
|
|
desktop->GetDisplayDriver()->FillRoundRect(cl->ConvertToTop(rect),xrad,yrad,cl->fLayerData);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_TRIANGLE:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE_TRIANGLE\n",fTitle.String()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
// TODO:: Add clipping to AS_STROKE_TRIANGLE
|
|
|
|
BPoint pts[3];
|
|
|
|
BRect rect;
|
|
|
|
|
|
|
|
for (int i=0; i<3; i++)
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BPoint>(&(pts[i]));
|
2004-09-15 02:21:26 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&rect);
|
2004-09-15 02:21:26 +04:00
|
|
|
|
|
|
|
if (cl && cl->fLayerData)
|
|
|
|
{
|
|
|
|
for(int i=0;i<3;i++)
|
|
|
|
pts[i]=cl->ConvertToTop(pts[i]);
|
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
desktop->GetDisplayDriver()->StrokeTriangle(pts,cl->ConvertToTop(rect),cl->fLayerData);
|
2004-09-15 02:21:26 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_TRIANGLE:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_FILL_TRIANGLE\n",fTitle.String()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-15 02:21:26 +04:00
|
|
|
// TODO:: Add clipping to AS_FILL_TRIANGLE
|
|
|
|
BPoint pts[3];
|
|
|
|
BRect rect;
|
|
|
|
|
|
|
|
for (int i=0; i<3; i++)
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BPoint>(&(pts[i]));
|
2004-09-15 02:21:26 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&rect);
|
2004-09-15 02:21:26 +04:00
|
|
|
|
|
|
|
if (cl && cl->fLayerData)
|
|
|
|
{
|
|
|
|
for(int i=0;i<3;i++)
|
|
|
|
pts[i]=cl->ConvertToTop(pts[i]);
|
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
desktop->GetDisplayDriver()->FillTriangle(pts,cl->ConvertToTop(rect),cl->fLayerData);
|
2004-09-15 02:21:26 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2004-09-17 14:27:58 +04:00
|
|
|
case AS_STROKE_POLYGON:
|
2003-02-24 18:47:06 +03:00
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE_POLYGON\n",fTitle.String()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
BRect polyframe;
|
|
|
|
bool isclosed;
|
|
|
|
int32 pointcount;
|
|
|
|
BPoint *pointlist;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&polyframe);
|
|
|
|
link.Read<bool>(&isclosed);
|
|
|
|
link.Read<int32>(&pointcount);
|
2004-09-17 14:27:58 +04:00
|
|
|
|
|
|
|
pointlist=new BPoint[pointcount];
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read(pointlist, sizeof(BPoint)*pointcount);
|
2004-09-21 02:50:02 +04:00
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
for(int32 i=0; i<pointcount; i++)
|
|
|
|
pointlist[i]=cl->ConvertToTop(pointlist[i]);
|
|
|
|
|
|
|
|
desktop->GetDisplayDriver()->StrokePolygon(pointlist,pointcount,polyframe,
|
|
|
|
cl->fLayerData,isclosed);
|
|
|
|
|
|
|
|
delete [] pointlist;
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
break;
|
|
|
|
}
|
2004-09-17 14:27:58 +04:00
|
|
|
case AS_FILL_POLYGON:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_FILL_POLYGON\n",fTitle.String()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
BRect polyframe;
|
|
|
|
int32 pointcount;
|
|
|
|
BPoint *pointlist;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&polyframe);
|
|
|
|
link.Read<int32>(&pointcount);
|
2004-09-17 14:27:58 +04:00
|
|
|
|
|
|
|
pointlist=new BPoint[pointcount];
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read(pointlist, sizeof(BPoint)*pointcount);
|
2004-09-17 14:27:58 +04:00
|
|
|
|
|
|
|
for(int32 i=0; i<pointcount; i++)
|
|
|
|
pointlist[i]=cl->ConvertToTop(pointlist[i]);
|
|
|
|
|
2004-09-21 02:50:02 +04:00
|
|
|
desktop->GetDisplayDriver()->FillPolygon(pointlist,pointcount,polyframe,cl->fLayerData);
|
2004-09-17 14:27:58 +04:00
|
|
|
|
|
|
|
delete [] pointlist;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_SHAPE:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE_SHAPE\n",fTitle.String()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
BRect shaperect;
|
|
|
|
int32 opcount;
|
|
|
|
int32 ptcount;
|
|
|
|
int32 *oplist;
|
|
|
|
BPoint *ptlist;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&shaperect);
|
|
|
|
link.Read<int32>(&opcount);
|
|
|
|
link.Read<int32>(&ptcount);
|
2004-09-17 14:27:58 +04:00
|
|
|
|
|
|
|
oplist=new int32[opcount];
|
|
|
|
ptlist=new BPoint[ptcount];
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read(oplist,sizeof(int32)*opcount);
|
|
|
|
link.Read(ptlist,sizeof(BPoint)*ptcount);
|
2004-09-17 14:27:58 +04:00
|
|
|
|
|
|
|
for(int32 i=0; i<ptcount; i++)
|
|
|
|
ptlist[i]=cl->ConvertToTop(ptlist[i]);
|
|
|
|
|
|
|
|
desktop->GetDisplayDriver()->StrokeShape(shaperect, opcount, oplist, ptcount, ptlist, cl->fLayerData);
|
|
|
|
delete oplist;
|
|
|
|
delete ptlist;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_SHAPE:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_FILL_SHAPE\n",fTitle.String()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
BRect shaperect;
|
|
|
|
int32 opcount;
|
|
|
|
int32 ptcount;
|
|
|
|
int32 *oplist;
|
|
|
|
BPoint *ptlist;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BRect>(&shaperect);
|
|
|
|
link.Read<int32>(&opcount);
|
|
|
|
link.Read<int32>(&ptcount);
|
2004-09-17 14:27:58 +04:00
|
|
|
|
|
|
|
oplist=new int32[opcount];
|
|
|
|
ptlist=new BPoint[ptcount];
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read(oplist,sizeof(int32)*opcount);
|
|
|
|
link.Read(ptlist,sizeof(BPoint)*ptcount);
|
2004-09-17 14:27:58 +04:00
|
|
|
|
|
|
|
for(int32 i=0; i<ptcount; i++)
|
|
|
|
ptlist[i]=cl->ConvertToTop(ptlist[i]);
|
|
|
|
|
|
|
|
desktop->GetDisplayDriver()->FillShape(shaperect, opcount, oplist, ptcount, ptlist, cl->fLayerData);
|
2004-08-29 19:01:44 +04:00
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
delete oplist;
|
|
|
|
delete ptlist;
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_REGION:
|
2003-07-09 06:28:33 +04:00
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_FILL_REGION\n",fTitle.String()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
int32 rectcount;
|
|
|
|
BRect *rectlist;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<int32>(&rectcount);
|
2004-09-17 14:27:58 +04:00
|
|
|
|
|
|
|
rectlist=new BRect[rectcount];
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read(rectlist, sizeof(BRect)*rectcount);
|
2004-09-17 14:27:58 +04:00
|
|
|
|
|
|
|
// Between the client-side conversion to BRects from clipping_rects to the overhead
|
|
|
|
// in repeatedly calling FillRect(), this is definitely in need of optimization. At
|
|
|
|
// least it works for now. :)
|
|
|
|
for(int32 i=0; i<rectcount; i++)
|
2004-09-21 02:50:02 +04:00
|
|
|
desktop->GetDisplayDriver()->FillRect(cl->ConvertToTop(rectlist[i]),cl->fLayerData);
|
2004-09-17 14:27:58 +04:00
|
|
|
|
|
|
|
delete [] rectlist;
|
|
|
|
|
|
|
|
// TODO: create support for clipping_rect usage for faster BRegion display.
|
|
|
|
// Tweaks to DisplayDriver are necessary along with conversion routines in Layer
|
|
|
|
|
|
|
|
break;
|
2003-07-09 06:28:33 +04:00
|
|
|
}
|
2004-09-17 14:27:58 +04:00
|
|
|
case AS_STROKE_LINEARRAY:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_STROKE_LINEARRAY\n",fTitle.String()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
// Attached Data:
|
|
|
|
// 1) int32 Number of lines in the array
|
|
|
|
// 2) array of struct _array_data_ objects, as defined in ViewAux.h
|
|
|
|
|
|
|
|
int32 linecount;
|
|
|
|
|
|
|
|
link.Read<int32>(&linecount);
|
|
|
|
if(linecount>0)
|
|
|
|
{
|
|
|
|
LineArrayData linedata[linecount], *index;
|
|
|
|
|
|
|
|
for(int32 i=0; i<linecount; i++)
|
|
|
|
{
|
|
|
|
index=&linedata[i];
|
|
|
|
|
|
|
|
link.Read<float>(&(index->pt1.x));
|
|
|
|
link.Read<float>(&(index->pt1.y));
|
|
|
|
link.Read<float>(&(index->pt2.x));
|
|
|
|
link.Read<float>(&(index->pt2.y));
|
|
|
|
link.Read<rgb_color>(&(index->color));
|
|
|
|
|
|
|
|
index->pt1=cl->ConvertToTop(index->pt1);
|
|
|
|
index->pt2=cl->ConvertToTop(index->pt2);
|
2004-10-17 02:42:08 +04:00
|
|
|
}
|
2004-10-16 06:02:27 +04:00
|
|
|
desktop->GetDisplayDriver()->StrokeLineArray(linecount,linedata,cl->fLayerData);
|
|
|
|
}
|
2004-09-17 14:27:58 +04:00
|
|
|
break;
|
|
|
|
}
|
2004-09-21 02:50:02 +04:00
|
|
|
case AS_DRAW_STRING:
|
2003-07-05 01:13:48 +04:00
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_DRAW_STRING\n",fTitle.String()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-21 02:50:02 +04:00
|
|
|
char *string;
|
|
|
|
int32 length;
|
|
|
|
BPoint location;
|
|
|
|
escapement_delta delta;
|
|
|
|
|
2004-10-17 02:42:08 +04:00
|
|
|
link.Read<int32>(&length);
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<BPoint>(&location);
|
|
|
|
link.Read<escapement_delta>(&delta);
|
|
|
|
link.ReadString(&string);
|
2004-09-21 02:50:02 +04:00
|
|
|
|
|
|
|
if(cl && cl->fLayerData)
|
|
|
|
desktop->GetDisplayDriver()->DrawString(string,length,cl->ConvertToTop(location),
|
|
|
|
cl->fLayerData);
|
|
|
|
|
|
|
|
free(string);
|
2004-09-17 14:27:58 +04:00
|
|
|
break;
|
2003-07-05 01:13:48 +04:00
|
|
|
}
|
2004-09-17 14:27:58 +04:00
|
|
|
case AS_MOVEPENTO:
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_MOVEPENTO\n",fTitle.String()));
|
2004-10-17 02:42:08 +04:00
|
|
|
|
2004-09-21 02:50:02 +04:00
|
|
|
float x,y;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&x);
|
|
|
|
link.Read<float>(&y);
|
2004-09-21 02:50:02 +04:00
|
|
|
if(cl && cl->fLayerData)
|
|
|
|
cl->fLayerData->penlocation.Set(x,y);
|
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SETPENSIZE:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_SETPENSIZE\n",fTitle.String()));
|
2004-09-21 02:50:02 +04:00
|
|
|
float size;
|
|
|
|
|
2004-10-16 06:02:27 +04:00
|
|
|
link.Read<float>(&size);
|
2004-09-21 02:50:02 +04:00
|
|
|
if(cl && cl->fLayerData)
|
|
|
|
cl->fLayerData->pensize=size;
|
|
|
|
|
2004-09-17 14:27:58 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SET_FONT:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_SET_FONT\n",fTitle.String()));
|
2004-09-21 02:50:02 +04:00
|
|
|
// TODO: Implement AS_SET_FONT?
|
2004-09-17 14:27:58 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SET_FONT_SIZE:
|
|
|
|
{
|
2005-01-19 18:12:35 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_SET_FONT_SIZE\n",fTitle.String()));
|
2004-09-21 02:50:02 +04:00
|
|
|
// TODO: Implement AS_SET_FONT_SIZE?
|
2004-09-17 14:27:58 +04:00
|
|
|
break;
|
|
|
|
}
|
2004-10-16 06:02:27 +04:00
|
|
|
case AS_AREA_MESSAGE:
|
|
|
|
{
|
2004-10-17 02:42:08 +04:00
|
|
|
STRACE(("ServerWindow %s: Message AS_AREA_MESSAGE\n",fTitle.String()));
|
2004-10-16 06:02:27 +04:00
|
|
|
// This occurs in only one kind of case: a message is too big to send over a port. This
|
|
|
|
// is really an edge case, so this shouldn't happen *too* often
|
|
|
|
|
|
|
|
// Attached Data:
|
|
|
|
// 1) area_id id of an area already owned by the server containing the message
|
|
|
|
// 2) size_t offset of the pointer in the area
|
|
|
|
// 3) size_t size of the message
|
|
|
|
|
|
|
|
area_id area;
|
|
|
|
size_t offset;
|
|
|
|
size_t msgsize;
|
|
|
|
area_info ai;
|
|
|
|
int8 *msgpointer;
|
|
|
|
|
|
|
|
link.Read<area_id>(&area);
|
|
|
|
link.Read<size_t>(&offset);
|
|
|
|
link.Read<size_t>(&msgsize);
|
|
|
|
|
|
|
|
// Part sanity check, part get base pointer :)
|
|
|
|
if(get_area_info(area,&ai)!=B_OK)
|
|
|
|
break;
|
|
|
|
|
|
|
|
msgpointer=(int8*)ai.address + offset;
|
|
|
|
|
|
|
|
RAMLinkMsgReader mlink(msgpointer);
|
|
|
|
DispatchMessage(mlink.Code(),mlink);
|
|
|
|
|
|
|
|
// This is a very special case in the sense that when ServerMemIO is used for this
|
|
|
|
// purpose, it will be set to NOT automatically free the memory which it had
|
|
|
|
// requested. This is the server's job once the message has been dispatched.
|
|
|
|
fServerApp->fSharedMem->ReleaseBuffer(msgpointer);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
2004-11-01 19:18:44 +03:00
|
|
|
case AS_SYNC:
|
|
|
|
{
|
|
|
|
// TODO: AS_SYNC is a no-op for now, just to get things working
|
|
|
|
fMsgSender->StartMessage(SERVER_TRUE);
|
|
|
|
fMsgSender->Flush();
|
|
|
|
break;
|
|
|
|
}
|
2005-01-21 05:01:28 +03:00
|
|
|
case AS_LAYER_DRAG_IMAGE:
|
|
|
|
{
|
2005-01-23 18:39:01 +03:00
|
|
|
// TODO: Implement AS_LAYER_DRAG_IMAGE
|
2005-01-21 05:01:28 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_DRAG_IMAGE unimplemented\n",fTitle.String()));
|
|
|
|
DTRACE(("ServerWindow %s: Message AS_DRAG_IMAGE unimplemented\n",fTitle.String()));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_DRAG_RECT:
|
|
|
|
{
|
2005-01-23 18:39:01 +03:00
|
|
|
// TODO: Implement AS_LAYER_DRAG_RECT
|
2005-01-21 05:01:28 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_DRAG_RECT unimplemented\n",fTitle.String()));
|
|
|
|
DTRACE(("ServerWindow %s: Message AS_DRAG_RECT unimplemented\n",fTitle.String()));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_MOUSE_COORDS:
|
|
|
|
{
|
2005-02-06 00:39:39 +03:00
|
|
|
DTRACE(("ServerWindow %s: Message AS_GET_MOUSE_COORDS\n",fTitle.String()));
|
|
|
|
|
2005-01-21 05:01:28 +03:00
|
|
|
// Attached Data:
|
|
|
|
// 1) port_id reply port
|
|
|
|
|
|
|
|
// Returns
|
|
|
|
// 1) BPoint mouse location
|
|
|
|
// 2) int32 button state
|
|
|
|
|
|
|
|
// For now, it's unimplemented, but this is a synchronous call, so to prevent debugging of
|
|
|
|
// applications which make this call, we'll reply with a SERVER_FALSE until it is implemeneted
|
|
|
|
|
|
|
|
port_id replyport;
|
|
|
|
link.Read<port_id>(&replyport);
|
|
|
|
|
2005-02-06 00:39:39 +03:00
|
|
|
int32 buttons=desktop->ActiveRootLayer()->Buttons();
|
|
|
|
|
2005-01-21 05:01:28 +03:00
|
|
|
BPortLink replylink(replyport);
|
2005-02-06 00:39:39 +03:00
|
|
|
replylink.StartMessage(SERVER_TRUE);
|
|
|
|
replylink.Attach<BPoint>(desktop->GetDisplayDriver()->GetCursorPosition());
|
|
|
|
replylink.Attach<int32>(buttons);
|
2005-01-21 05:01:28 +03:00
|
|
|
replylink.Flush();
|
|
|
|
break;
|
|
|
|
}
|
2004-09-17 14:27:58 +04:00
|
|
|
default:
|
|
|
|
{
|
2005-01-21 05:01:28 +03:00
|
|
|
printf("ServerWindow %s received unexpected code - message offset %ld\n",fTitle.String(), code - SERVER_TRUE);
|
2004-09-17 14:27:58 +04:00
|
|
|
break;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
}
|
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-10-16 06:02:27 +04:00
|
|
|
LinkMsgReader *ses = win->fMsgReader;
|
|
|
|
|
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
|
|
|
{
|
2005-01-17 00:35:02 +03: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-10-16 06:02:27 +04:00
|
|
|
err = ses->GetNextMessage(&code);
|
2004-07-30 19:16:59 +04:00
|
|
|
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()));
|
2005-03-04 02:21:36 +03:00
|
|
|
// RootLayer *myRootLayer = win->fWinBorder->GetRootLayer();
|
2005-01-22 23:51:12 +03:00
|
|
|
|
2005-03-04 02:21:36 +03:00
|
|
|
// quitting = true;
|
2005-01-22 23:51:12 +03:00
|
|
|
|
|
|
|
// we are preparing to delete a ServerWindow, RootLayer should be aware
|
|
|
|
// of that and stop for a moment.
|
|
|
|
// also we must wait a bit for the associated WinBorder to become hidden
|
2005-03-04 02:21:36 +03:00
|
|
|
// while(1)
|
|
|
|
// {
|
|
|
|
// myRootLayer->Lock();
|
|
|
|
// if (win->IsHidden())
|
|
|
|
// break;
|
|
|
|
// else
|
|
|
|
// myRootLayer->Unlock();
|
|
|
|
// }
|
2004-06-19 17:04:50 +04:00
|
|
|
// ServerWindow's destructor takes care of pulling this object off the desktop.
|
2005-03-04 02:21:36 +03:00
|
|
|
if (!win->IsHidden())
|
|
|
|
debugger("ServerWindow: a window must be hidden before it's deleted\n");
|
2004-01-13 03:56:36 +03:00
|
|
|
delete win;
|
2005-03-04 02:21:36 +03:00
|
|
|
// myRootLayer->Unlock();
|
2005-01-22 23:51:12 +03:00
|
|
|
|
|
|
|
exit_thread(0);
|
2004-01-13 03:56:36 +03:00
|
|
|
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()));
|
2005-01-22 23:51:12 +03:00
|
|
|
win->Quit();
|
2004-01-13 03:56:36 +03:00
|
|
|
break;
|
|
|
|
}
|
2004-01-20 01:18:37 +03:00
|
|
|
default:
|
|
|
|
{
|
2004-10-16 06:02:27 +04:00
|
|
|
win->DispatchMessage(code, *ses);
|
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
|
|
|
//------------------------------------------------------------------------------
|
2005-02-07 03:45:59 +03:00
|
|
|
void ServerWindow::SendMessageToClient(const BMessage* msg, int32 target, bool usePreferred) const
|
2004-01-20 01:18:37 +03:00
|
|
|
{
|
2003-09-25 16:31:11 +04:00
|
|
|
ssize_t size;
|
|
|
|
char *buffer;
|
2005-02-07 03:45:59 +03:00
|
|
|
|
2003-09-25 16:31:11 +04:00
|
|
|
size = msg->FlattenedSize();
|
|
|
|
buffer = new char[size];
|
2004-01-20 01:18:37 +03:00
|
|
|
|
|
|
|
if (msg->Flatten(buffer, size) == B_OK)
|
2005-02-07 03:45:59 +03:00
|
|
|
BMessage::Private::SendFlattenedMessage(buffer, size,
|
|
|
|
fClientLooperPort, target, usePreferred, B_INFINITE_TIMEOUT);
|
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
|
|
|
|
2005-02-05 23:12:05 +03:00
|
|
|
delete [] buffer;
|
2003-09-25 16:31:11 +04:00
|
|
|
}
|
2004-06-19 14:23:14 +04:00
|
|
|
//------------------------------------------------------------------------------
|
2003-09-09 01:18:39 +04:00
|
|
|
|