2003-02-12 04:11:55 +03:00
|
|
|
//------------------------------------------------------------------------------
|
|
|
|
// Copyright (c) 2001-2002, OpenBeOS
|
|
|
|
//
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
// copy of this software and associated documentation files (the "Software"),
|
|
|
|
// to deal in the Software without restriction, including without limitation
|
|
|
|
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
// and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
// Software is furnished to do so, subject to the following conditions:
|
|
|
|
//
|
|
|
|
// The above copyright notice and this permission notice shall be included in
|
|
|
|
// all copies or substantial portions of the Software.
|
|
|
|
//
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
// DEALINGS IN THE SOFTWARE.
|
|
|
|
//
|
|
|
|
// File Name: ServerWindow.cpp
|
|
|
|
// Author: DarkWyrm <bpmagic@columbus.rr.com>
|
|
|
|
// Description: Shadow BWindow class
|
|
|
|
//
|
|
|
|
//------------------------------------------------------------------------------
|
2003-02-07 15:53:57 +03:00
|
|
|
#include <AppDefs.h>
|
|
|
|
#include <Rect.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <View.h> // for B_XXXXX_MOUSE_BUTTON defines
|
2003-09-25 16:31:11 +04:00
|
|
|
#include <Message.h>
|
2003-09-09 01:18:39 +04:00
|
|
|
#include <GraphicsDefs.h>
|
2003-07-11 00:22:07 +04:00
|
|
|
#include <PortLink.h>
|
2003-10-04 23:10:11 +04:00
|
|
|
#include <Session.h>
|
2003-02-07 15:53:57 +03:00
|
|
|
#include "AppServer.h"
|
|
|
|
#include "Layer.h"
|
2003-08-31 21:38:34 +04:00
|
|
|
#include "RootLayer.h"
|
2003-02-07 15:53:57 +03:00
|
|
|
#include "ServerWindow.h"
|
|
|
|
#include "ServerApp.h"
|
|
|
|
#include "ServerProtocol.h"
|
2003-02-14 04:53:53 +03:00
|
|
|
#include "WinBorder.h"
|
2003-02-07 15:53:57 +03:00
|
|
|
#include "Desktop.h"
|
2003-02-12 04:11:55 +03:00
|
|
|
#include "TokenHandler.h"
|
2003-06-24 17:55:18 +04:00
|
|
|
#include "Utils.h"
|
2003-08-31 21:38:34 +04:00
|
|
|
#include "DisplayDriver.h"
|
2003-09-25 16:31:11 +04:00
|
|
|
#include "ServerPicture.h"
|
2003-09-25 21:25:38 +04:00
|
|
|
#include "CursorManager.h"
|
2004-01-13 03:56:36 +03:00
|
|
|
#include "Workspace.h"
|
2003-02-12 04:11:55 +03:00
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
#define DEBUG_SERVERWINDOW
|
2003-03-23 23:52:37 +03:00
|
|
|
//#define DEBUG_SERVERWINDOW_MOUSE
|
|
|
|
//#define DEBUG_SERVERWINDOW_KEYBOARD
|
|
|
|
|
2003-09-09 01:18:39 +04:00
|
|
|
|
2003-03-23 23:52:37 +03:00
|
|
|
#ifdef DEBUG_SERVERWINDOW
|
2003-09-09 01:18:39 +04:00
|
|
|
# include <stdio.h>
|
|
|
|
# define STRACE(x) printf x
|
|
|
|
#else
|
|
|
|
# define STRACE(x) ;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef DEBUG_SERVERWINDOW_KEYBOARD
|
|
|
|
# include <stdio.h>
|
|
|
|
# define STRACE_KEY(x) printf x
|
|
|
|
#else
|
|
|
|
# define STRACE_KEY(x) ;
|
2003-03-23 23:52:37 +03:00
|
|
|
#endif
|
|
|
|
|
2003-09-09 01:18:39 +04:00
|
|
|
#ifdef DEBUG_SERVERWINDOW_MOUSE
|
|
|
|
# include <stdio.h>
|
|
|
|
# define STRACE_MOUSE(x) printf x
|
|
|
|
#else
|
|
|
|
# define STRACE_MOUSE(x) ;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
//! TokenHandler object used to provide IDs for all windows in the system
|
2003-02-12 04:11:55 +03:00
|
|
|
TokenHandler win_token_handler;
|
|
|
|
|
2003-06-28 23:06:30 +04:00
|
|
|
//! Active winborder - used for tracking windows during moves, resizes, and tab slides
|
|
|
|
WinBorder *active_winborder=NULL;
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int8 *read_pattern_from_buffer(int8 **_buffer)
|
|
|
|
{
|
|
|
|
int8 *pattern = *_buffer;
|
|
|
|
|
|
|
|
*_buffer += AS_PATTERN_SIZE;
|
|
|
|
|
|
|
|
return pattern;
|
|
|
|
}
|
|
|
|
|
|
|
|
template<class Type> void
|
|
|
|
write_to_buffer(int8 **_buffer, Type value)
|
|
|
|
{
|
|
|
|
Type *typedBuffer = (Type *)(*_buffer);
|
|
|
|
|
|
|
|
*typedBuffer = value;
|
|
|
|
typedBuffer++;
|
|
|
|
|
|
|
|
*_buffer = (int8 *)(typedBuffer);
|
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
fFrame = rect;
|
|
|
|
fFlags = wflags;
|
|
|
|
fLook = wlook;
|
|
|
|
fFeel = wfeel;
|
|
|
|
fHandlerToken = handlerID;
|
|
|
|
fClientLooperPort = looperPort;
|
2004-01-13 03:56:36 +03:00
|
|
|
fWorkspaces = index;
|
|
|
|
fClientTeamID = winapp->ClientTeamID();
|
2004-01-20 01:18:37 +03:00
|
|
|
fWorkspace = NULL;
|
|
|
|
fToken = win_token_handler.GetToken();
|
2003-02-07 15:53:57 +03:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
// fClientWinPort is the port to which the app awaits messages from the server
|
2004-02-24 14:54:44 +03: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-02-24 14:54:44 +03:00
|
|
|
fMessagePort = create_port(30,fTitle.String());
|
2004-01-13 03:56:36 +03:00
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession = new BSession(fMessagePort, fClientWinPort);
|
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.
|
2003-12-07 08:40:51 +03:00
|
|
|
|
|
|
|
// Temporarily use winlink to save time and memory
|
2004-02-24 14:54:44 +03:00
|
|
|
PortLink winLink(replyport);
|
2003-08-31 21:38:34 +04:00
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
winLink.SetOpCode(AS_CREATE_WINDOW);
|
|
|
|
winLink.Attach<port_id>(fMessagePort);
|
|
|
|
winLink.Flush();
|
2003-02-12 04:11:55 +03:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
// Wait for top_view data and create ServerWindow's top most Layer
|
2003-11-14 03:15:29 +03:00
|
|
|
int32 vToken;
|
|
|
|
BRect vFrame;
|
|
|
|
uint32 vResizeMode;
|
|
|
|
uint32 vFlags;
|
|
|
|
char* vName = NULL;
|
2003-12-07 08:40:51 +03:00
|
|
|
|
|
|
|
PortMessage pmsg;
|
2004-01-20 01:18:37 +03:00
|
|
|
pmsg.ReadFromPort(fMessagePort);
|
2003-12-07 08:40:51 +03:00
|
|
|
if(pmsg.Code() != AS_LAYER_CREATE_ROOT)
|
2003-11-14 03:15:29 +03:00
|
|
|
debugger("SERVER ERROR: ServerWindow(xxx): NO top_view data received!\n");
|
2004-01-13 03:56:36 +03:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
pmsg.Read<int32>(&vToken);
|
|
|
|
pmsg.Read<BRect>(&vFrame);
|
|
|
|
pmsg.Read<uint32>(&vResizeMode);
|
|
|
|
pmsg.Read<uint32>(&vFlags);
|
|
|
|
pmsg.ReadString(&vName);
|
2004-01-13 03:56:36 +03:00
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fTopLayer = new Layer(vFrame, vName, vToken, vResizeMode, vFlags, desktop->GetDisplayDriver());
|
|
|
|
fTopLayer->SetServerWindow(this);
|
|
|
|
|
2003-11-14 03:15:29 +03:00
|
|
|
delete vName;
|
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
cl = fTopLayer;
|
2003-11-14 03:15:29 +03:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
// Create a WindoBorder object for our ServerWindow.
|
2004-02-24 14:54:44 +03:00
|
|
|
fWinBorder = NULL;
|
|
|
|
fWinBorder = new WinBorder(fFrame,fTitle.String(),wlook,wfeel,wflags,this,desktop->GetDisplayDriver());
|
|
|
|
printf("=============%s\n", desktop->ActiveRootLayer()->GetName());
|
|
|
|
fWinBorder->SetRootLayer(desktop->ActiveRootLayer());
|
2003-11-14 03:15:29 +03:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
// NOTE: this MUST be before the monitor thread is spawned!
|
2004-01-20 01:18:37 +03:00
|
|
|
desktop->AddWinBorder(fWinBorder);
|
2003-02-07 15:53:57 +03:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
// Spawn our message-monitoring fMonitorThreadID
|
|
|
|
fMonitorThreadID = spawn_thread(MonitorWin, fTitle.String(), B_NORMAL_PRIORITY, this);
|
|
|
|
if(fMonitorThreadID != B_NO_MORE_THREADS && fMonitorThreadID != B_NO_MEMORY)
|
|
|
|
resume_thread(fMonitorThreadID);
|
2003-02-07 15:53:57 +03:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s:\n",fTitle.String()));
|
2003-12-07 08:40:51 +03:00
|
|
|
STRACE(("\tFrame (%.1f,%.1f,%.1f,%.1f)\n",rect.left,rect.top,rect.right,rect.bottom));
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("\tPort: %ld\n",fMessagePort));
|
2003-12-07 08:40:51 +03:00
|
|
|
STRACE(("\tWorkspace: %ld\n",index));
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
//!Tears down all connections with the user application, kills the monitoring thread.
|
2003-02-07 15:53:57 +03:00
|
|
|
ServerWindow::~ServerWindow(void)
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("*ServerWindow (%s):~ServerWindow()\n",fTitle.String()));
|
2004-01-13 03:56:36 +03:00
|
|
|
|
|
|
|
desktop->fGeneralLock.Lock();
|
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
desktop->RemoveWinBorder(fWinBorder);
|
|
|
|
STRACE(("SW(%s) Successfuly removed from the desktop\n", fTitle.String()));
|
|
|
|
if(fSession){
|
|
|
|
delete fSession;
|
|
|
|
fSession = NULL;
|
2004-01-13 03:56:36 +03:00
|
|
|
}
|
2004-01-20 01:18:37 +03:00
|
|
|
if (fWinBorder){
|
|
|
|
delete fWinBorder;
|
|
|
|
fWinBorder = NULL;
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2004-01-13 03:56:36 +03:00
|
|
|
cl = NULL;
|
2004-01-20 01:18:37 +03:00
|
|
|
if (fTopLayer)
|
|
|
|
delete fTopLayer;
|
2004-01-13 03:56:36 +03:00
|
|
|
|
|
|
|
desktop->fGeneralLock.Unlock();
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("#ServerWindow(%s) will exit NOW!!!\n", fTitle.String()));
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
/*!
|
|
|
|
\brief Requests an update of the specified rectangle
|
|
|
|
\param rect The area to update, in the parent's coordinates
|
|
|
|
|
|
|
|
This could be considered equivalent to BView::Invalidate()
|
|
|
|
*/
|
2003-02-07 15:53:57 +03:00
|
|
|
void ServerWindow::RequestDraw(BRect rect)
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Request Draw\n",fTitle.String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
BMessage msg;
|
|
|
|
|
|
|
|
msg.what = _UPDATE_;
|
|
|
|
msg.AddRect("_rect", rect);
|
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
SendMessageToClient(&msg);
|
2003-02-12 04:11:55 +03:00
|
|
|
}
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
//! Requests an update for the entire window
|
|
|
|
void ServerWindow::RequestDraw(void)
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
RequestDraw(fFrame);
|
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-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Replace Decorator\n",fTitle.String()));
|
|
|
|
fWinBorder->UpdateDecorator();
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
//! Requests that the ServerWindow's BWindow quit
|
2003-02-07 15:53:57 +03:00
|
|
|
void ServerWindow::Quit(void)
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Quit\n",fTitle.String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
BMessage msg;
|
|
|
|
|
|
|
|
msg.what = B_QUIT_REQUESTED;
|
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
SendMessageToClient(&msg);
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
//! Shows the window's WinBorder
|
2003-02-07 15:53:57 +03:00
|
|
|
void ServerWindow::Show(void)
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
if(!fWinBorder->IsHidden())
|
2004-01-14 18:55:10 +03:00
|
|
|
return;
|
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Show\n",fTitle.String()));
|
|
|
|
if(fWinBorder)
|
2003-03-31 01:09:39 +04:00
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
RootLayer *rl = fWinBorder->GetRootLayer();
|
2004-01-14 18:55:10 +03:00
|
|
|
int32 wksCount;
|
2004-01-13 03:56:36 +03:00
|
|
|
|
|
|
|
desktop->fGeneralLock.Lock();
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow(%s)::Show() - General lock acquired\n", fWinBorder->GetName()));
|
2004-01-14 03:26:15 +03:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
rl->fMainLock.Lock();
|
|
|
|
STRACE(("ServerWindow(%s)::Show() - Main lock acquired\n", fWinBorder->GetName()));
|
|
|
|
|
|
|
|
fWinBorder->Show();
|
2004-01-14 18:55:10 +03:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
if ((fFeel == B_FLOATING_SUBSET_WINDOW_FEEL || fFeel == B_MODAL_SUBSET_WINDOW_FEEL)
|
|
|
|
&& fWinBorder->MainWinBorder() == NULL)
|
2004-01-14 18:55:10 +03:00
|
|
|
{
|
|
|
|
// This window hasn't been added to a normal window subset,
|
|
|
|
// so don't call placement or redrawing methods!
|
|
|
|
goto goOut;
|
|
|
|
}
|
2004-01-20 01:18:37 +03:00
|
|
|
|
2004-01-14 18:55:10 +03:00
|
|
|
wksCount = rl->WorkspaceCount();
|
2004-01-13 03:56:36 +03:00
|
|
|
for(int32 i = 0; i < wksCount; i++){
|
2004-01-14 03:26:15 +03:00
|
|
|
if (fWorkspaces & (0x00000001UL << i)){
|
|
|
|
Workspace *ws = rl->WorkspaceAt(i+1);
|
2004-01-20 01:18:37 +03:00
|
|
|
ws->BringToFrontANormalWindow(fWinBorder);
|
|
|
|
ws->SearchAndSetNewFront(fWinBorder);
|
|
|
|
ws->SetFocusLayer(fWinBorder);
|
2004-01-14 03:26:15 +03:00
|
|
|
}
|
2004-01-13 03:56:36 +03:00
|
|
|
}
|
2004-01-14 18:55:10 +03:00
|
|
|
|
|
|
|
goOut:
|
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
rl->fMainLock.Unlock();
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow(%s)::Show() - Main lock released\n", fWinBorder->GetName()));
|
2004-01-13 03:56:36 +03:00
|
|
|
desktop->fGeneralLock.Unlock();
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow(%s)::Show() - General lock released\n", fWinBorder->GetName()));
|
2003-03-31 01:09:39 +04:00
|
|
|
}
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
//! Hides the window's WinBorder
|
2003-02-07 15:53:57 +03:00
|
|
|
void ServerWindow::Hide(void)
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
if(fWinBorder->IsHidden())
|
2004-01-14 18:55:10 +03:00
|
|
|
return;
|
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Hide\n",fTitle.String()));
|
|
|
|
if(fWinBorder){
|
|
|
|
RootLayer *rl = fWinBorder->GetRootLayer();
|
2004-01-13 03:56:36 +03:00
|
|
|
Workspace *ws = NULL;
|
|
|
|
|
2004-01-14 03:26:15 +03:00
|
|
|
desktop->fGeneralLock.Lock();
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow(%s)::Hide() - General lock acquired\n", fWinBorder->GetName()));
|
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
rl->fMainLock.Lock();
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow(%s)::Hide() - Main lock acquired\n", fWinBorder->GetName()));
|
2004-01-14 03:26:15 +03:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
fWinBorder->Hide();
|
2004-01-14 03:26:15 +03:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
int32 wksCount= rl->WorkspaceCount();
|
|
|
|
for(int32 i = 0; i < wksCount; i++){
|
|
|
|
ws = rl->WorkspaceAt(i+1);
|
2004-01-20 01:18:37 +03:00
|
|
|
if (ws->FrontLayer() == fWinBorder){
|
|
|
|
ws->HideSubsetWindows(fWinBorder);
|
2004-01-17 19:33:22 +03:00
|
|
|
ws->SetFocusLayer(ws->FrontLayer());
|
|
|
|
}
|
|
|
|
else{
|
2004-01-20 01:18:37 +03:00
|
|
|
if (ws->FocusLayer() == fWinBorder){
|
|
|
|
ws->SetFocusLayer(fWinBorder);
|
2004-01-14 03:26:15 +03:00
|
|
|
}
|
|
|
|
else{
|
2004-01-17 19:33:22 +03:00
|
|
|
ws->Invalidate();
|
2004-01-14 03:26:15 +03:00
|
|
|
}
|
2004-01-13 03:56:36 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
rl->fMainLock.Unlock();
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow(%s)::Hide() - Main lock released\n", fWinBorder->GetName()));
|
|
|
|
|
2004-01-14 03:26:15 +03:00
|
|
|
desktop->fGeneralLock.Unlock();
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow(%s)::Hide() - General lock released\n", fWinBorder->GetName()));
|
2004-01-13 03:56:36 +03:00
|
|
|
}
|
2003-02-12 04:11:55 +03:00
|
|
|
}
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
/*
|
|
|
|
\brief Determines whether the window is hidden or not
|
|
|
|
\return true if hidden, false if not
|
|
|
|
*/
|
2003-02-12 04:11:55 +03:00
|
|
|
bool ServerWindow::IsHidden(void)
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
if(fWinBorder)
|
|
|
|
return fWinBorder->IsHidden();
|
2003-02-24 18:47:06 +03:00
|
|
|
return true;
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
|
|
|
|
2003-11-15 03:28:40 +03:00
|
|
|
void ServerWindow::Minimize(bool status){
|
|
|
|
bool sendMessages = false;
|
|
|
|
|
|
|
|
if (status){
|
2003-12-07 08:40:51 +03:00
|
|
|
if (!IsHidden()){
|
2003-11-15 03:28:40 +03:00
|
|
|
Hide();
|
|
|
|
sendMessages = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
2003-12-07 08:40:51 +03:00
|
|
|
if (IsHidden()){
|
2003-11-15 03:28:40 +03:00
|
|
|
Show();
|
|
|
|
sendMessages = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sendMessages){
|
2003-11-15 03:28:40 +03:00
|
|
|
BMessage msg;
|
|
|
|
msg.what = B_MINIMIZE;
|
|
|
|
msg.AddInt64("when", real_time_clock_usecs());
|
2003-12-07 08:40:51 +03:00
|
|
|
msg.AddBool("minimize", status);
|
2003-11-15 03:28:40 +03:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
SendMessageToClient(&msg);
|
2003-11-15 03:28:40 +03:00
|
|
|
|
|
|
|
// TODO: notify tracker! how???
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void ServerWindow::Zoom(){
|
|
|
|
// TODO: implement;
|
|
|
|
}
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
/*!
|
|
|
|
\brief Handles focus and redrawing when changing focus states
|
|
|
|
|
|
|
|
The ServerWindow is set to (in)active and its decorator is redrawn based on its active status
|
|
|
|
*/
|
2003-02-07 15:53:57 +03:00
|
|
|
void ServerWindow::SetFocus(bool value)
|
|
|
|
{
|
2004-02-24 14:54:44 +03:00
|
|
|
STRACE(("ServerWindow %s: Set Focus to %s - UNIMPLEMENTED\n",fTitle.String(),value?"true":"false"));
|
|
|
|
/*
|
2004-01-20 01:18:37 +03:00
|
|
|
if(fIsActive!=value)
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
fIsActive=value;
|
|
|
|
fWinBorder->SetFocus(value);
|
|
|
|
// fWinBorder->RequestDraw();
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2004-02-24 14:54:44 +03:00
|
|
|
*/
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
/*!
|
|
|
|
\brief Determines whether or not the window is active
|
|
|
|
\return true if active, false if not
|
|
|
|
*/
|
2003-02-12 04:11:55 +03:00
|
|
|
bool ServerWindow::HasFocus(void)
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
return fIsActive;
|
2003-02-07 15:53:57 +03: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-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: WorkspaceActivated(%ld,%s)\n",fTitle.String(),workspace,(active)?"active":"inactive"));
|
2003-09-25 16:31:11 +04:00
|
|
|
BMessage msg;
|
|
|
|
|
|
|
|
msg.what = B_WORKSPACE_ACTIVATED;
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
/*!
|
|
|
|
\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-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: WorkspacesChanged(%ld,%ld)\n",fTitle.String(),oldone,newone));
|
2003-09-25 16:31:11 +04:00
|
|
|
BMessage msg;
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
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-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: WindowActivated(%s)\n",fTitle.String(),(active)?"active":"inactive"));
|
2003-09-25 16:31:11 +04:00
|
|
|
BMessage msg;
|
|
|
|
|
|
|
|
msg.what = B_WINDOW_ACTIVATED;
|
|
|
|
msg.AddBool("active", active);
|
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
SendMessageToClient(&msg);
|
2003-02-07 15:53:57 +03: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-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: ScreenModeChanged\n",fTitle.String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
BMessage msg;
|
|
|
|
|
|
|
|
msg.what = B_SCREEN_CHANGED;
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
/*
|
|
|
|
\brief Sets the frame size of the window
|
|
|
|
\rect New window size
|
|
|
|
*/
|
2003-02-12 04:11:55 +03:00
|
|
|
void ServerWindow::SetFrame(const BRect &rect)
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Set Frame to (%.1f,%.1f,%.1f,%.1f)\n",fTitle.String(),
|
2003-09-09 01:18:39 +04:00
|
|
|
rect.left,rect.top,rect.right,rect.bottom));
|
2004-01-20 01:18:37 +03:00
|
|
|
fFrame=rect;
|
2003-02-12 04:11:55 +03:00
|
|
|
}
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
/*!
|
|
|
|
\brief Returns the frame of the window in screen coordinates
|
|
|
|
\return The frame of the window in screen coordinates
|
|
|
|
*/
|
2003-02-12 04:11:55 +03:00
|
|
|
BRect ServerWindow::Frame(void)
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
return fFrame;
|
2003-02-12 04:11:55 +03:00
|
|
|
}
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
/*!
|
|
|
|
\brief Locks the window
|
|
|
|
\return B_OK if everything is ok, B_ERROR if something went wrong
|
|
|
|
*/
|
2003-02-12 04:11:55 +03:00
|
|
|
status_t ServerWindow::Lock(void)
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Lock\n",fTitle.String()));
|
|
|
|
return (fLocker.Lock())?B_OK:B_ERROR;
|
2003-02-12 04:11:55 +03:00
|
|
|
}
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
//! Unlocks the window
|
2003-02-12 04:11:55 +03:00
|
|
|
void ServerWindow::Unlock(void)
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Unlock\n",fTitle.String()));
|
|
|
|
fLocker.Unlock();
|
2003-02-12 04:11:55 +03: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.
|
|
|
|
*/
|
2003-02-12 04:11:55 +03:00
|
|
|
bool ServerWindow::IsLocked(void)
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
return fLocker.IsLocked();
|
2003-02-12 04:11:55 +03:00
|
|
|
}
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
void ServerWindow::DispatchMessage(int32 code)
|
2003-02-24 18:47:06 +03:00
|
|
|
{
|
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 -----------------
|
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-02-24 14:54:44 +03:00
|
|
|
fSession->ReadInt32(&token);
|
2003-09-09 01:18:39 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
Layer *current = FindLayer(fTopLayer, token);
|
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
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_SET_CURRENT_LAYER: Layer name: %s\n", fTitle.String(), cl->_name->String()));
|
2003-09-09 01:18:39 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-02-24 18:47:06 +03:00
|
|
|
case AS_LAYER_CREATE:
|
|
|
|
{
|
2003-12-07 08:40:51 +03:00
|
|
|
/*
|
2004-01-20 05:02:01 +03:00
|
|
|
// TODO: Figure out what Adi did here and convert to PortMessages
|
2003-12-07 08:40:51 +03:00
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
// Received when a view is attached to a window. This will require
|
|
|
|
// us to attach a layer in the tree in the same manner and invalidate
|
|
|
|
// the area in which the new layer resides assuming that it is
|
|
|
|
// visible.
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: AS_LAYER_CREATE...\n", fTitle.String()));
|
2004-01-13 03:56:36 +03:00
|
|
|
Layer *oldCL = cl;
|
2003-09-09 01:18:39 +04:00
|
|
|
|
|
|
|
int32 token;
|
|
|
|
BRect frame;
|
|
|
|
uint32 resizeMask;
|
|
|
|
uint32 flags;
|
2003-09-15 23:14:45 +04:00
|
|
|
bool hidden;
|
2003-09-09 01:18:39 +04:00
|
|
|
int32 childCount;
|
|
|
|
char* name;
|
2003-02-24 18:47:06 +03:00
|
|
|
|
2004-01-20 05:02:01 +03:00
|
|
|
msg->Read<int32>(&token);
|
|
|
|
msg->ReadString(&name);
|
|
|
|
msg->Read<BRect>(&frame);
|
|
|
|
msg->Read<int32>((int32*)&resizeMask);
|
|
|
|
msg->Read<int32>((int32*)&flags);
|
|
|
|
msg->Read<bool>(&hidden);
|
|
|
|
msg->Read<int32>(&childCount);
|
2003-02-24 18:47:06 +03:00
|
|
|
|
2004-01-20 05:02:01 +03:00
|
|
|
// view's visible area is invalidated here
|
2003-09-09 01:18:39 +04:00
|
|
|
Layer *newLayer;
|
|
|
|
newLayer = new Layer(frame, name, token, resizeMask, flags, this);
|
2004-01-20 05:02:01 +03:00
|
|
|
|
|
|
|
// there is no way of setting this, other than manual. :-)
|
2003-09-15 23:14:45 +04:00
|
|
|
newLayer->_hidden = hidden;
|
|
|
|
|
2003-11-14 03:15:29 +03:00
|
|
|
// we set Layer's attributes (BView's state)
|
2004-01-13 03:56:36 +03:00
|
|
|
cl = newLayer;
|
2003-09-09 01:18:39 +04:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
int32 msgCode;
|
2004-01-20 05:02:01 +03:00
|
|
|
msg->Read<int32>(&msgCode); // this is AS_LAYER_SET_FONT_STATE
|
2003-12-07 08:40:51 +03:00
|
|
|
DispatchMessage(msgCode);
|
2003-09-15 23:14:45 +04:00
|
|
|
|
2004-01-20 05:02:01 +03:00
|
|
|
msg->Read<int32>(&msgCode); // this is AS_LAYER_SET_STATE
|
2003-12-07 08:40:51 +03:00
|
|
|
DispatchMessage(msgCode);
|
2003-11-14 03:15:29 +03:00
|
|
|
|
2004-01-20 05:02:01 +03:00
|
|
|
// attach the view to the tree structure.
|
2003-12-07 08:40:51 +03:00
|
|
|
oldCL->AddChild(newLayer);
|
2003-09-09 01:18:39 +04:00
|
|
|
|
2004-01-20 05:02:01 +03:00
|
|
|
// attach its children.
|
|
|
|
for(int i = 0; i < childCount; i++)
|
|
|
|
{
|
|
|
|
msg->Read<int32>(&msgCode); // this is AS_LAYER_CREATE
|
2003-12-07 08:40:51 +03:00
|
|
|
DispatchMessage(msgCode);
|
2003-09-09 01:18:39 +04:00
|
|
|
}
|
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl = oldCL;
|
2003-09-09 01:18:39 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("DONE: ServerWindow %s: Message AS_CREATE_LAYER: Parent: %s, Child: %s\n", fTitle.String(), cl->_name->String(), name));
|
2004-01-20 05:02:01 +03:00
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
break;
|
2004-01-20 05:02:01 +03: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-01-20 01:18:37 +03:00
|
|
|
STRACE(("SW %s: AS_LAYER_DELETE(self)...\n", fTitle.String()));
|
2003-09-15 23:14:45 +04:00
|
|
|
Layer *parent;
|
2004-01-13 03:56:36 +03:00
|
|
|
parent = cl->_parent;
|
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();
|
2004-01-20 05:02:01 +03:00
|
|
|
|
2003-09-15 23:14:45 +04:00
|
|
|
// TODO: invalidate the region occupied by this view.
|
2004-01-20 05:02:01 +03:00
|
|
|
// Should be done in Layer::RemoveChild() though!
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->PruneTree();
|
2003-02-24 18:47:06 +03:00
|
|
|
|
2003-09-15 23:14:45 +04:00
|
|
|
parent->PrintTree();
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("DONE: ServerWindow %s: Message AS_DELETE_LAYER: Parent: %s Layer: %s\n", fTitle.String(), parent->_name->String(), cl->_name->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:
|
|
|
|
{
|
|
|
|
rgb_color highColor,
|
|
|
|
lowColor,
|
|
|
|
viewColor;
|
|
|
|
pattern patt;
|
|
|
|
int32 clippRegRects;
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadPoint(&(cl->_layerdata->penlocation));
|
|
|
|
fSession->ReadFloat(&(cl->_layerdata->pensize));
|
|
|
|
fSession->ReadData(&highColor, sizeof(rgb_color));
|
|
|
|
fSession->ReadData(&lowColor, sizeof(rgb_color));
|
|
|
|
fSession->ReadData(&viewColor, sizeof(rgb_color));
|
|
|
|
fSession->ReadData(&patt, sizeof(pattern));
|
|
|
|
fSession->ReadInt8((int8*)&(cl->_layerdata->draw_mode));
|
|
|
|
fSession->ReadPoint(&(cl->_layerdata->coordOrigin));
|
|
|
|
fSession->ReadInt8((int8*)&(cl->_layerdata->lineJoin));
|
|
|
|
fSession->ReadInt8((int8*)&(cl->_layerdata->lineCap));
|
|
|
|
fSession->ReadFloat(&(cl->_layerdata->miterLimit));
|
|
|
|
fSession->ReadInt8((int8*)&(cl->_layerdata->alphaSrcMode));
|
|
|
|
fSession->ReadInt8((int8*)&(cl->_layerdata->alphaFncMode));
|
|
|
|
fSession->ReadFloat(&(cl->_layerdata->scale));
|
|
|
|
fSession->ReadBool(&(cl->_layerdata->fontAliasing));
|
|
|
|
fSession->ReadInt32(&clippRegRects);
|
2003-09-09 01:18:39 +04:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->_layerdata->patt.Set(*((uint64*)&patt));
|
|
|
|
cl->_layerdata->highcolor.SetColor(highColor);
|
|
|
|
cl->_layerdata->lowcolor.SetColor(lowColor);
|
|
|
|
cl->_layerdata->viewcolor.SetColor(viewColor);
|
2003-09-09 01:18:39 +04:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
if(clippRegRects != 0){
|
2004-01-13 03:56:36 +03:00
|
|
|
if(cl->_layerdata->clippReg == NULL)
|
|
|
|
cl->_layerdata->clippReg = new BRegion();
|
2003-09-09 01:18:39 +04:00
|
|
|
else
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->_layerdata->clippReg->MakeEmpty();
|
2003-09-09 01:18:39 +04:00
|
|
|
|
|
|
|
BRect rect;
|
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
for(int32 i = 0; i < clippRegRects; i++){
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadRect(&rect);
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->_layerdata->clippReg->Include(rect);
|
2003-09-09 01:18:39 +04:00
|
|
|
}
|
2003-11-14 03:15:29 +03:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->RebuildFullRegion();
|
2003-09-09 01:18:39 +04:00
|
|
|
}
|
|
|
|
else{
|
2004-01-13 03:56:36 +03:00
|
|
|
if (cl->_layerdata->clippReg){
|
|
|
|
delete cl->_layerdata->clippReg;
|
|
|
|
cl->_layerdata->clippReg = NULL;
|
2003-11-14 03:15:29 +03:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->RebuildFullRegion();
|
2003-09-09 01:18:39 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_STATE: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-15 23:14:45 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_FONT_STATE:
|
|
|
|
{
|
|
|
|
uint16 mask;
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadUInt16(&mask);
|
2003-09-15 23:14:45 +04:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
if (mask & B_FONT_FAMILY_AND_STYLE){
|
2003-09-15 23:14:45 +04:00
|
|
|
uint32 fontID;
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadInt32((int32*)&fontID);
|
2003-09-15 23:14:45 +04:00
|
|
|
// TODO: implement later. Currently there is no SetFamAndStyle(uint32)
|
|
|
|
// in ServerFont class. DW, could you add one?
|
2004-01-13 03:56:36 +03:00
|
|
|
//cl->_layerdata->font->
|
2003-09-15 23:14:45 +04:00
|
|
|
}
|
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
if (mask & B_FONT_SIZE){
|
2003-09-15 23:14:45 +04:00
|
|
|
float size;
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadFloat(&size);
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->_layerdata->font.SetSize(size);
|
2003-09-15 23:14:45 +04:00
|
|
|
}
|
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
if (mask & B_FONT_SHEAR){
|
2003-09-15 23:14:45 +04:00
|
|
|
float shear;
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadFloat(&shear);
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->_layerdata->font.SetShear(shear);
|
2003-09-15 23:14:45 +04:00
|
|
|
}
|
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
if (mask & B_FONT_ROTATION){
|
2003-09-15 23:14:45 +04:00
|
|
|
float rotation;
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadFloat(&rotation);
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->_layerdata->font.SetRotation(rotation);
|
2003-09-15 23:14:45 +04:00
|
|
|
}
|
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
if (mask & B_FONT_SPACING){
|
2003-09-15 23:14:45 +04:00
|
|
|
uint8 spacing;
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadUInt8(&spacing); // uint8
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->_layerdata->font.SetSpacing(spacing);
|
2003-09-15 23:14:45 +04:00
|
|
|
}
|
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
if (mask & B_FONT_ENCODING){
|
2003-09-15 23:14:45 +04:00
|
|
|
uint8 encoding;
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadUInt8((uint8*)&encoding); // uint8
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->_layerdata->font.SetEncoding(encoding);
|
2003-09-15 23:14:45 +04:00
|
|
|
}
|
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
if (mask & B_FONT_FACE){
|
2003-09-15 23:14:45 +04:00
|
|
|
uint16 face;
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadUInt16(&face); // uint16
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->_layerdata->font.SetFace(face);
|
2003-09-15 23:14:45 +04:00
|
|
|
}
|
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
if (mask & B_FONT_FLAGS){
|
2003-09-15 23:14:45 +04:00
|
|
|
uint32 flags;
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadUInt32(&flags); // uint32
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->_layerdata->font.SetFlags(flags);
|
2003-09-15 23:14:45 +04:00
|
|
|
}
|
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_FONT_STATE: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-15 23:14:45 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_STATE:
|
|
|
|
{
|
|
|
|
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
|
|
|
|
uint64 patt; // current pattern as a uint64
|
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
ld = cl->_layerdata; // now we write fewer characters. :-)
|
2003-09-15 23:14:45 +04:00
|
|
|
hc = ld->highcolor.GetColor32();
|
|
|
|
lc = ld->lowcolor.GetColor32();
|
|
|
|
vc = ld->viewcolor.GetColor32();
|
|
|
|
patt = ld->patt.GetInt64();
|
|
|
|
|
|
|
|
// TODO: DW implement such a method in ServerFont class!
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->WriteUInt32(0UL /*uint32 ld->font.GetFamAndStyle()*/);
|
|
|
|
fSession->WriteFloat(ld->font.Size());
|
|
|
|
fSession->WriteFloat(ld->font.Shear());
|
|
|
|
fSession->WriteFloat(ld->font.Rotation());
|
|
|
|
fSession->WriteUInt8(ld->font.Spacing());
|
|
|
|
fSession->WriteUInt8(ld->font.Encoding());
|
|
|
|
fSession->WriteUInt16(ld->font.Face());
|
|
|
|
fSession->WriteUInt32(ld->font.Flags());
|
|
|
|
|
|
|
|
fSession->WritePoint(ld->penlocation);
|
|
|
|
fSession->WriteFloat(ld->pensize);
|
|
|
|
fSession->WriteData(&hc, sizeof(rgb_color));
|
|
|
|
fSession->WriteData(&lc, sizeof(rgb_color));
|
|
|
|
fSession->WriteData(&vc, sizeof(rgb_color));
|
2003-12-07 08:40:51 +03:00
|
|
|
// TODO: fix this to use the templatized version
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->WriteData(&patt,sizeof(pattern));
|
|
|
|
fSession->WritePoint(ld->coordOrigin);
|
|
|
|
fSession->WriteUInt8((uint8)(ld->draw_mode));
|
|
|
|
fSession->WriteUInt8((uint8)(ld->lineCap));
|
|
|
|
fSession->WriteUInt8((uint8)(ld->lineJoin));
|
|
|
|
fSession->WriteFloat(ld->miterLimit);
|
|
|
|
fSession->WriteUInt8((uint8)(ld->alphaSrcMode));
|
|
|
|
fSession->WriteUInt8((uint8)(ld->alphaFncMode));
|
|
|
|
fSession->WriteFloat(ld->scale);
|
|
|
|
fSession->WriteFloat(ld->fontAliasing);
|
2003-09-15 23:14:45 +04:00
|
|
|
|
|
|
|
int32 noOfRects = 0;
|
2003-12-07 08:40:51 +03:00
|
|
|
if (ld->clippReg)
|
2003-09-15 23:14:45 +04:00
|
|
|
noOfRects = ld->clippReg->CountRects();
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->WriteInt32(noOfRects);
|
2003-09-15 23:14:45 +04:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
for(int i = 0; i < noOfRects; i++){
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->WriteRect(ld->clippReg->RectAt(i));
|
2003-09-15 23:14:45 +04:00
|
|
|
}
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->WriteFloat(cl->_frame.left);
|
|
|
|
fSession->WriteFloat(cl->_frame.top);
|
|
|
|
fSession->WriteRect(cl->_frame.OffsetToCopy(cl->_boundsLeftTop));
|
|
|
|
fSession->Sync();
|
2003-09-15 23:14:45 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_STATE: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-09 01:18:39 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-25 16:31:11 +04:00
|
|
|
case AS_LAYER_MOVETO:
|
|
|
|
{
|
|
|
|
float x, y;
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadFloat(&x);
|
|
|
|
fSession->ReadFloat(&y);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->MoveBy(x, y);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_MOVETO: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_RESIZETO:
|
|
|
|
{
|
|
|
|
float newWidth, newHeight;
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadFloat(&newWidth);
|
|
|
|
fSession->ReadFloat(&newHeight);
|
2004-01-20 01:18:37 +03:00
|
|
|
|
|
|
|
// TODO: check for minimum alowed. WinBorder should provide such
|
|
|
|
// a method, based on its decorator.
|
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->ResizeBy(newWidth, newHeight);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_RESIZETO: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_COORD:
|
|
|
|
{
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->WriteFloat(cl->_frame.left);
|
|
|
|
fSession->WriteFloat(cl->_frame.top);
|
|
|
|
fSession->WriteRect(cl->_frame.OffsetToCopy(cl->_boundsLeftTop));
|
|
|
|
fSession->Sync();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_COORD: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-25 21:25:38 +04:00
|
|
|
case AS_LAYER_SET_ORIGIN:
|
|
|
|
{
|
|
|
|
float x, y;
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadFloat(&x);
|
|
|
|
fSession->ReadFloat(&y);
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->_layerdata->coordOrigin.Set(x, y);
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_ORIGIN: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_ORIGIN:
|
|
|
|
{
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->WritePoint(cl->_layerdata->coordOrigin);
|
|
|
|
fSession->Sync();
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_ORIGIN: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_RESIZE_MODE:
|
|
|
|
{
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadUInt32(&(cl->_resize_mode));
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_RESIZE_MODE: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_CURSOR:
|
|
|
|
{
|
|
|
|
int32 token;
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadInt32(&token);
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
cursormanager->SetCursor(token);
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_CURSOR: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-25 16:31:11 +04:00
|
|
|
case AS_LAYER_SET_FLAGS:
|
|
|
|
{
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadUInt32(&(cl->_flags));
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_FLAGS: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_HIDE:
|
|
|
|
{
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->Hide();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_HIDE: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SHOW:
|
|
|
|
{
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->Show();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SHOW: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_LINE_MODE:
|
|
|
|
{
|
|
|
|
int8 lineCap, lineJoin;
|
2004-01-20 01:18:37 +03:00
|
|
|
|
|
|
|
// TODO: speak with DW! Shouldn't we lock before modifying certain memebers?
|
|
|
|
// Because redraw code might use an updated value instead of one for witch
|
|
|
|
// it was called. e.g.: different lineCap or lineJoin. Strange result
|
|
|
|
// would appear.
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadInt8(&lineCap);
|
|
|
|
fSession->ReadInt8(&lineJoin);
|
|
|
|
fSession->ReadFloat(&(cl->_layerdata->miterLimit));
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->_layerdata->lineCap = (cap_mode)lineCap;
|
|
|
|
cl->_layerdata->lineJoin = (join_mode)lineJoin;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_LINE_MODE: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_LINE_MODE:
|
|
|
|
{
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->WriteInt8((int8)(cl->_layerdata->lineCap));
|
|
|
|
fSession->WriteInt8((int8)(cl->_layerdata->lineJoin));
|
|
|
|
fSession->WriteFloat(cl->_layerdata->miterLimit);
|
|
|
|
fSession->Sync();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_LINE_MODE: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_PUSH_STATE:
|
|
|
|
{
|
|
|
|
LayerData *ld = new LayerData();
|
2004-01-13 03:56:36 +03:00
|
|
|
ld->prevState = cl->_layerdata;
|
|
|
|
cl->_layerdata = ld;
|
2003-11-14 03:15:29 +03:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->RebuildFullRegion();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_PUSH_STATE: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_POP_STATE:
|
|
|
|
{
|
2004-01-13 03:56:36 +03:00
|
|
|
if (!(cl->_layerdata->prevState)) {
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("WARNING: SW(%s): User called BView(%s)::PopState(), but there is NO state on stack!\n", fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
LayerData *ld = cl->_layerdata;
|
|
|
|
cl->_layerdata = cl->_layerdata->prevState;
|
2003-09-25 16:31:11 +04:00
|
|
|
delete ld;
|
2003-11-14 03:15:29 +03:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->RebuildFullRegion();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_POP_STATE: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_SCALE:
|
|
|
|
{
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadFloat(&(cl->_layerdata->scale));
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_SCALE: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_SCALE:
|
|
|
|
{
|
2004-01-13 03:56:36 +03:00
|
|
|
LayerData *ld = cl->_layerdata;
|
2003-09-25 16:31:11 +04:00
|
|
|
float scale = ld->scale;
|
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
while((ld = ld->prevState))
|
2003-09-25 16:31:11 +04:00
|
|
|
scale *= ld->scale;
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->WriteFloat(scale);
|
|
|
|
fSession->Sync();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_SCALE: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_PEN_LOC:
|
|
|
|
{
|
|
|
|
float x, y;
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadFloat(&x);
|
|
|
|
fSession->ReadFloat(&y);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->_layerdata->penlocation.Set(x, y);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_PEN_LOC: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_PEN_LOC:
|
|
|
|
{
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->WritePoint(cl->_layerdata->penlocation);
|
|
|
|
fSession->Sync();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_PEN_LOC: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_PEN_SIZE:
|
|
|
|
{
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadFloat(&(cl->_layerdata->pensize));
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_PEN_SIZE: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_PEN_SIZE:
|
|
|
|
{
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->WriteFloat(cl->_layerdata->pensize);
|
|
|
|
fSession->Sync();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_PEN_SIZE: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_HIGH_COLOR:
|
|
|
|
{
|
|
|
|
rgb_color c;
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadData(&c, sizeof(rgb_color));
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->_layerdata->highcolor.SetColor(c);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_HIGH_COLOR: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_LOW_COLOR:
|
|
|
|
{
|
|
|
|
rgb_color c;
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadData(&c, sizeof(rgb_color));
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->_layerdata->lowcolor.SetColor(c);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_LOW_COLOR: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_VIEW_COLOR:
|
|
|
|
{
|
|
|
|
rgb_color c;
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadData(&c, sizeof(rgb_color));
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->_layerdata->viewcolor.SetColor(c);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_VIEW_COLOR: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_COLORS:
|
|
|
|
{
|
|
|
|
rgb_color highColor, lowColor, viewColor;
|
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
highColor = cl->_layerdata->highcolor.GetColor32();
|
|
|
|
lowColor = cl->_layerdata->lowcolor.GetColor32();
|
|
|
|
viewColor = cl->_layerdata->viewcolor.GetColor32();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->WriteData(&highColor, sizeof(rgb_color));
|
|
|
|
fSession->WriteData(&lowColor, sizeof(rgb_color));
|
|
|
|
fSession->WriteData(&viewColor, sizeof(rgb_color));
|
|
|
|
fSession->Sync();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_COLORS: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_BLEND_MODE:
|
|
|
|
{
|
|
|
|
int8 srcAlpha, alphaFunc;
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadInt8(&srcAlpha);
|
|
|
|
fSession->ReadInt8(&alphaFunc);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->_layerdata->alphaSrcMode = (source_alpha)srcAlpha;
|
|
|
|
cl->_layerdata->alphaFncMode = (alpha_function)alphaFunc;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_BLEND_MODE: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_BLEND_MODE:
|
|
|
|
{
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->WriteInt8((int8)(cl->_layerdata->alphaSrcMode));
|
|
|
|
fSession->WriteInt8((int8)(cl->_layerdata->alphaFncMode));
|
|
|
|
fSession->Sync();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_BLEND_MODE: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_DRAW_MODE:
|
|
|
|
{
|
|
|
|
int8 drawingMode;
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadInt8(&drawingMode);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->_layerdata->draw_mode = (drawing_mode)drawingMode;
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_DRAW_MODE: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_DRAW_MODE:
|
|
|
|
{
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->WriteInt8((int8)(cl->_layerdata->draw_mode));
|
|
|
|
fSession->Sync();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_DRAW_MODE: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_PRINT_ALIASING:
|
|
|
|
{
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadBool(&(cl->_layerdata->fontAliasing));
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_PRINT_ALIASING: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_CLIP_TO_PICTURE:
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
// TODO: watch out for the coordinate system
|
2003-09-25 16:31:11 +04:00
|
|
|
int32 pictureToken;
|
|
|
|
BPoint where;
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadInt32(&pictureToken);
|
|
|
|
fSession->ReadPoint(&where);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2003-11-14 03:15:29 +03: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-01-13 03:56:36 +03:00
|
|
|
if (cl->clipToPicture && cl->_fullVisible.CountRects() > 0){
|
|
|
|
reg.Include(&cl->_fullVisible);
|
2003-11-14 03:15:29 +03:00
|
|
|
redraw = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// search for a picture with the specified token.
|
2003-09-25 16:31:11 +04:00
|
|
|
ServerPicture *sp = NULL;
|
|
|
|
int32 i = 0;
|
2004-01-20 01:18:37 +03:00
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
sp=static_cast<ServerPicture*>(cl->_serverwin->fServerApp->fPictureList->ItemAt(i++));
|
2003-09-25 16:31:11 +04:00
|
|
|
if (!sp)
|
|
|
|
break;
|
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
if(sp->GetToken() == pictureToken){
|
2004-01-13 03:56:36 +03:00
|
|
|
// cl->clipToPicture = sp;
|
2004-01-20 01:18:37 +03:00
|
|
|
// TODO: increase that picture's reference count.(~ allocate a picture)
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// avoid compiler warning
|
|
|
|
i = 0;
|
|
|
|
|
2003-11-14 03:15:29 +03:00
|
|
|
// we have a new picture to clip to, so rebuild our full region
|
2004-01-13 03:56:36 +03:00
|
|
|
if(cl->clipToPicture) {
|
2003-11-14 03:15:29 +03:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->clipToPictureInverse = false;
|
2003-11-14 03:15:29 +03:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->RebuildFullRegion();
|
2003-11-14 03:15:29 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// we need to rebuild the visible region, we may have a valid one.
|
2004-01-13 03:56:36 +03:00
|
|
|
if (cl->_parent && !(cl->_hidden)){
|
2004-02-24 14:54:44 +03:00
|
|
|
// cl->_parent->RebuildChildRegions(cl->_full.Frame(), cl);
|
2003-11-14 03:15:29 +03:00
|
|
|
}
|
|
|
|
else{
|
|
|
|
// will this happen? Maybe...
|
2004-02-24 14:54:44 +03:00
|
|
|
// cl->RebuildRegions(cl->_full.Frame());
|
2003-11-14 03:15:29 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// include our full visible region in the region to be redrawn
|
2004-01-13 03:56:36 +03:00
|
|
|
if (!(cl->_hidden) && (cl->_fullVisible.CountRects() > 0)){
|
|
|
|
reg.Include(&(cl->_fullVisible));
|
2003-11-14 03:15:29 +03:00
|
|
|
redraw = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
// redraw if: we had OR if we NOW have a picture to clip to.
|
|
|
|
if (redraw){
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->Invalidate(reg);
|
2003-11-14 03:15:29 +03:00
|
|
|
}
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_CLIP_TO_PICTURE: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_CLIP_TO_INVERSE_PICTURE:
|
|
|
|
{
|
2003-09-25 21:25:38 +04:00
|
|
|
// TODO: watch out for the coordinate system
|
2003-09-25 16:31:11 +04:00
|
|
|
int32 pictureToken;
|
|
|
|
BPoint where;
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadInt32(&pictureToken);
|
|
|
|
fSession->ReadPoint(&where);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
|
|
|
ServerPicture *sp = NULL;
|
|
|
|
int32 i = 0;
|
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
sp= static_cast<ServerPicture*>(cl->_serverwin->fServerApp->fPictureList->ItemAt(i++));
|
2003-09-25 16:31:11 +04:00
|
|
|
if (!sp)
|
|
|
|
break;
|
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
if(sp->GetToken() == pictureToken){
|
2004-01-13 03:56:36 +03:00
|
|
|
// cl->clipToPicture = sp;
|
2003-12-07 08:40:51 +03:00
|
|
|
// TODO: increase that picture's reference count.(~ allocate a picture)
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// avoid compiler warning
|
|
|
|
i = 0;
|
|
|
|
|
2003-11-14 03:15:29 +03:00
|
|
|
// if a picture has been found...
|
2004-01-13 03:56:36 +03:00
|
|
|
if(cl->clipToPicture) {
|
2003-11-14 03:15:29 +03:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->clipToPictureInverse = true;
|
2003-11-14 03:15:29 +03:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->RebuildFullRegion();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
// cl->RequestDraw(cl->clipToPicture->Frame());
|
2003-11-14 03:15:29 +03:00
|
|
|
}
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_CLIP_TO_INVERSE_PICTURE: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_GET_CLIP_REGION:
|
|
|
|
{
|
2003-09-25 21:25:38 +04:00
|
|
|
// TODO: watch out for the coordinate system
|
2003-09-25 16:31:11 +04:00
|
|
|
BRegion reg;
|
|
|
|
LayerData *ld;
|
|
|
|
int32 noOfRects;
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
ld = cl->_layerdata;
|
|
|
|
reg = cl->ConvertFromParent(&(cl->_visible));
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
if(ld->clippReg)
|
|
|
|
reg.IntersectWith(ld->clippReg);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
while((ld = ld->prevState))
|
|
|
|
if(ld->clippReg)
|
|
|
|
reg.IntersectWith(ld->clippReg);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
|
|
|
noOfRects = reg.CountRects();
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->WriteInt32(noOfRects);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
for(int i = 0; i < noOfRects; i++){
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->WriteRect(reg.RectAt(i));
|
2003-09-25 16:31:11 +04:00
|
|
|
}
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->Sync();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_GET_CLIP_REGION: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_SET_CLIP_REGION:
|
|
|
|
{
|
2003-09-25 21:25:38 +04:00
|
|
|
// TODO: watch out for the coordinate system
|
2003-09-25 16:31:11 +04:00
|
|
|
int32 noOfRects;
|
|
|
|
BRect r;
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
if(cl->_layerdata->clippReg)
|
|
|
|
cl->_layerdata->clippReg->MakeEmpty();
|
2003-09-25 16:31:11 +04:00
|
|
|
else
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->_layerdata->clippReg = new BRegion();
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadInt32(&noOfRects);
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
for(int i = 0; i < noOfRects; i++){
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadRect(&r);
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->_layerdata->clippReg->Include(r);
|
2003-09-25 16:31:11 +04:00
|
|
|
}
|
2003-11-14 03:15:29 +03:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->RebuildFullRegion();
|
2003-11-14 03:15:29 +03:00
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
// cl->RequestDraw(cl->clipToPicture->Frame());
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_SET_CLIP_REGION: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 16:31:11 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-25 21:25:38 +04:00
|
|
|
|
|
|
|
case AS_LAYER_INVAL_RECT:
|
|
|
|
{
|
|
|
|
// TODO: watch out for the coordinate system
|
|
|
|
BRect invalRect;
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadRect(&invalRect);
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->Invalidate(invalRect);
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
// cl->RequestDraw(invalRect);
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_INVAL_RECT: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_LAYER_INVAL_REGION:
|
|
|
|
{
|
|
|
|
// TODO: watch out for the coordinate system
|
|
|
|
BRegion invalReg;
|
|
|
|
int32 noOfRects;
|
|
|
|
BRect rect;
|
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadInt32(&noOfRects);
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
for(int i = 0; i < noOfRects; i++){
|
2004-02-24 14:54:44 +03:00
|
|
|
fSession->ReadRect(&rect);
|
2003-12-07 08:40:51 +03:00
|
|
|
invalReg.Include(rect);
|
2003-09-25 21:25:38 +04:00
|
|
|
}
|
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
cl->Invalidate(invalReg);
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
// cl->RequestDraw(invalReg.Frame());
|
2003-09-25 21:25:38 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_LAYER_INVAL_RECT: Layer: %s\n",fTitle.String(), cl->_name->String()));
|
2003-09-25 21:25:38 +04:00
|
|
|
break;
|
|
|
|
}
|
2003-09-25 16:31:11 +04:00
|
|
|
|
2003-09-09 01:18:39 +04:00
|
|
|
|
|
|
|
/********** END: BView Messages ***********/
|
|
|
|
|
|
|
|
/********** BWindow Messages ***********/
|
2003-06-24 17:55:18 +04:00
|
|
|
case AS_LAYER_DELETE_ROOT:
|
|
|
|
{
|
|
|
|
// Received when a window deletes its internal top view
|
|
|
|
|
|
|
|
// TODO: Implement
|
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-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_SHOW\n",fTitle.String()));
|
2003-02-24 18:47:06 +03:00
|
|
|
Show();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_HIDE_WINDOW:
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message AS_HIDE\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
|
|
|
{
|
|
|
|
// TODO: Implement
|
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
|
|
|
{
|
|
|
|
// TODO: Implement
|
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
|
|
|
{
|
|
|
|
// TODO: Implement
|
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
|
|
|
{
|
|
|
|
// TODO: Implement
|
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
|
|
|
{
|
|
|
|
// TODO: Implement
|
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-01-14 03:26:15 +03:00
|
|
|
WinBorder *wb;
|
|
|
|
int32 mainToken;
|
2004-01-16 19:09:36 +03:00
|
|
|
team_id teamID;
|
2004-01-14 03:26:15 +03:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
fSession->ReadInt32(&mainToken);
|
|
|
|
fSession->ReadData(&teamID, sizeof(team_id));
|
2004-01-14 03:26:15 +03:00
|
|
|
|
2004-01-16 19:09:36 +03:00
|
|
|
wb = desktop->FindWinBorderByServerWindowTokenAndTeamID(mainToken, teamID);
|
2004-01-14 03:26:15 +03:00
|
|
|
if(wb){
|
2004-01-20 01:18:37 +03:00
|
|
|
fSession->WriteInt32(SERVER_TRUE);
|
|
|
|
fSession->Sync();
|
2004-01-14 03:26:15 +03:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
fWinBorder->AddToSubsetOf(wb);
|
2004-01-14 03:26:15 +03:00
|
|
|
}
|
|
|
|
else{
|
2004-01-20 01:18:37 +03:00
|
|
|
fSession->WriteInt32(SERVER_FALSE);
|
|
|
|
fSession->Sync();
|
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-01-17 19:33:22 +03:00
|
|
|
WinBorder *wb;
|
|
|
|
int32 mainToken;
|
|
|
|
team_id teamID;
|
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
fSession->ReadInt32(&mainToken);
|
|
|
|
fSession->ReadData(&teamID, sizeof(team_id));
|
2004-01-17 19:33:22 +03:00
|
|
|
|
|
|
|
wb = desktop->FindWinBorderByServerWindowTokenAndTeamID(mainToken, teamID);
|
|
|
|
if(wb){
|
2004-01-20 01:18:37 +03:00
|
|
|
fSession->WriteInt32(SERVER_TRUE);
|
|
|
|
fSession->Sync();
|
2004-01-17 19:33:22 +03:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
fWinBorder->RemoveFromSubsetOf(wb);
|
2004-01-17 19:33:22 +03:00
|
|
|
}
|
|
|
|
else{
|
2004-01-20 01:18:37 +03:00
|
|
|
fSession->WriteInt32(SERVER_FALSE);
|
|
|
|
fSession->Sync();
|
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
|
|
|
{
|
|
|
|
// TODO: Implement
|
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
|
|
|
{
|
|
|
|
// TODO: Implement
|
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
|
|
|
{
|
|
|
|
// TODO: Implement
|
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
|
|
|
{
|
|
|
|
// TODO: Implement
|
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
|
|
|
{
|
|
|
|
// TODO: Implement
|
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
|
|
|
{
|
|
|
|
// TODO: Implement
|
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
|
|
|
{
|
|
|
|
// TODO: Implement
|
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
|
|
|
{
|
|
|
|
// TODO: Implement
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message Resize unimplemented\n",fTitle.String()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-02-24 18:47:06 +03:00
|
|
|
case B_MINIMIZE:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
|
|
|
// TODO: Implement
|
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
|
|
|
{
|
|
|
|
// TODO: Implement
|
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
|
|
|
{
|
|
|
|
// TODO: Implement
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message Zoom unimplemented\n",fTitle.String()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-02-24 18:47:06 +03:00
|
|
|
case B_WINDOW_MOVE_TO:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
|
|
|
// TODO: Implement
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message Move_To unimplemented\n",fTitle.String()));
|
2003-03-23 23:52:37 +03:00
|
|
|
break;
|
|
|
|
}
|
2003-02-24 18:47:06 +03:00
|
|
|
case B_WINDOW_MOVE_BY:
|
2003-03-23 23:52:37 +03:00
|
|
|
{
|
|
|
|
// TODO: Implement
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Message Move_By unimplemented\n",fTitle.String()));
|
2003-02-24 18:47:06 +03:00
|
|
|
break;
|
2003-03-23 23:52:37 +03:00
|
|
|
}
|
2003-02-24 18:47:06 +03:00
|
|
|
default:
|
|
|
|
{
|
2004-02-24 14:54:44 +03:00
|
|
|
printf("ServerWindow %s received unexpected code - message offset %lx\n",fTitle.String(), code - SERVER_TRUE);
|
2003-02-24 18:47:06 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-03-19 04:12:53 +03:00
|
|
|
/*!
|
|
|
|
\brief Iterator for graphics update messages
|
|
|
|
\param msgsize Size of the buffer containing the graphics messages
|
|
|
|
\param msgbuffer Buffer containing the graphics message
|
|
|
|
*/
|
|
|
|
void ServerWindow::DispatchGraphicsMessage(int32 msgsize, int8 *msgbuffer)
|
|
|
|
{
|
2003-07-05 01:13:48 +04:00
|
|
|
Layer *layer;
|
2003-06-23 06:53:55 +04:00
|
|
|
LayerData *layerdata;
|
|
|
|
int32 code;
|
2003-07-05 01:13:48 +04:00
|
|
|
int32 view_token;
|
|
|
|
uint32 sizeRemaining = (uint32)msgsize;
|
2003-07-09 06:28:33 +04:00
|
|
|
BRegion WindowClipRegion;
|
|
|
|
BRegion LayerClipRegion;
|
2004-02-24 14:54:44 +03:00
|
|
|
// Layer *sibling;
|
2003-09-04 01:43:09 +04:00
|
|
|
int32 numRects = 0;
|
2003-06-24 04:14:33 +04:00
|
|
|
|
2003-12-07 08:40:51 +03:00
|
|
|
if (!msgsize || !msgbuffer)
|
2003-06-23 06:53:55 +04:00
|
|
|
return;
|
2003-12-07 08:40:51 +03:00
|
|
|
if (IsHidden())
|
2003-07-09 06:28:33 +04:00
|
|
|
return;
|
2004-02-24 14:54:44 +03:00
|
|
|
|
|
|
|
// TODO: fix!
|
|
|
|
/*
|
2004-01-20 01:18:37 +03:00
|
|
|
WindowClipRegion.Set(fWinBorder->Frame());
|
|
|
|
sibling = fWinBorder->UpperSibling();
|
2003-12-07 08:40:51 +03:00
|
|
|
while (sibling)
|
2003-07-09 06:28:33 +04:00
|
|
|
{
|
|
|
|
WindowClipRegion.Exclude(sibling->Frame());
|
2004-01-13 03:56:36 +03:00
|
|
|
sibling = sibling->UpperSibling();
|
2003-07-09 06:28:33 +04:00
|
|
|
}
|
2004-02-24 14:54:44 +03:00
|
|
|
*/
|
2003-12-07 08:40:51 +03:00
|
|
|
if (!WindowClipRegion.Frame().IsValid())
|
2003-07-09 06:28:33 +04:00
|
|
|
return;
|
2003-03-19 04:12:53 +03:00
|
|
|
|
2003-07-05 01:13:48 +04:00
|
|
|
// We need to decide whether coordinates are specified in view or root coordinates.
|
|
|
|
// For now, we assume root level coordinates.
|
2003-07-09 06:28:33 +04:00
|
|
|
code = AS_BEGIN_UPDATE;
|
|
|
|
while ((sizeRemaining > 2*sizeof(int32)) && (code != AS_END_UPDATE))
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
2003-07-05 01:13:48 +04:00
|
|
|
code = read_from_buffer<int32>(&msgbuffer);
|
|
|
|
view_token = read_from_buffer<int32>(&msgbuffer);
|
2004-01-13 03:56:36 +03:00
|
|
|
//TODO: fix!
|
2004-01-20 01:18:37 +03:00
|
|
|
layer = NULL;//fWorkspace->GetRoot()->FindLayer(view_token);
|
2003-12-07 08:40:51 +03:00
|
|
|
if (layer)
|
2003-07-09 06:28:33 +04:00
|
|
|
{
|
2004-02-24 14:54:44 +03:00
|
|
|
// TODO: fix!
|
|
|
|
// layerdata = layer->GetLayerData();
|
2003-07-09 06:28:33 +04:00
|
|
|
LayerClipRegion.Set(layer->Frame());
|
|
|
|
LayerClipRegion.IntersectWith(&WindowClipRegion);
|
|
|
|
numRects = LayerClipRegion.CountRects();
|
|
|
|
}
|
2003-07-05 01:13:48 +04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
layerdata = NULL;
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received invalid view token %lx",fTitle.String(),view_token));
|
2003-07-05 01:13:48 +04:00
|
|
|
}
|
2003-06-23 06:53:55 +04:00
|
|
|
switch (code)
|
|
|
|
{
|
|
|
|
case AS_SET_HIGH_COLOR:
|
|
|
|
{
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_SET_COLOR_MSG_SIZE)
|
2003-07-05 01:13:48 +04:00
|
|
|
{
|
|
|
|
uint8 r, g, b, a;
|
|
|
|
r = read_from_buffer<uint8>(&msgbuffer);
|
|
|
|
g = read_from_buffer<uint8>(&msgbuffer);
|
|
|
|
b = read_from_buffer<uint8>(&msgbuffer);
|
|
|
|
a = read_from_buffer<uint8>(&msgbuffer);
|
2003-12-07 08:40:51 +03:00
|
|
|
if (layerdata)
|
2003-07-05 01:13:48 +04:00
|
|
|
layerdata->highcolor.SetColor(r,g,b,a);
|
|
|
|
sizeRemaining -= AS_SET_COLOR_MSG_SIZE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
|
|
|
}
|
2003-06-23 06:53:55 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SET_LOW_COLOR:
|
|
|
|
{
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_SET_COLOR_MSG_SIZE)
|
2003-07-05 01:13:48 +04:00
|
|
|
{
|
|
|
|
uint8 r, g, b, a;
|
|
|
|
r = read_from_buffer<uint8>(&msgbuffer);
|
|
|
|
g = read_from_buffer<uint8>(&msgbuffer);
|
|
|
|
b = read_from_buffer<uint8>(&msgbuffer);
|
|
|
|
a = read_from_buffer<uint8>(&msgbuffer);
|
2003-12-07 08:40:51 +03:00
|
|
|
if (layerdata)
|
2003-07-05 01:13:48 +04:00
|
|
|
layerdata->lowcolor.SetColor(r,g,b,a);
|
|
|
|
sizeRemaining -= AS_SET_COLOR_MSG_SIZE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
|
|
|
}
|
2003-06-23 06:53:55 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SET_VIEW_COLOR:
|
|
|
|
{
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_SET_COLOR_MSG_SIZE)
|
2003-07-05 01:13:48 +04:00
|
|
|
{
|
|
|
|
uint8 r, g, b, a;
|
|
|
|
r = read_from_buffer<uint8>(&msgbuffer);
|
|
|
|
g = read_from_buffer<uint8>(&msgbuffer);
|
|
|
|
b = read_from_buffer<uint8>(&msgbuffer);
|
|
|
|
a = read_from_buffer<uint8>(&msgbuffer);
|
2003-12-07 08:40:51 +03:00
|
|
|
if (layerdata)
|
2003-07-05 01:13:48 +04:00
|
|
|
layerdata->viewcolor.SetColor(r,g,b,a);
|
|
|
|
sizeRemaining -= AS_SET_COLOR_MSG_SIZE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
|
|
|
}
|
2003-06-23 06:53:55 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_ARC:
|
|
|
|
{
|
|
|
|
// TODO:: Add clipping
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_STROKE_ARC_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
float left, top, right, bottom, angle, span;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
|
|
|
|
|
|
|
left = read_from_buffer<float>(&msgbuffer);
|
|
|
|
top = read_from_buffer<float>(&msgbuffer);
|
|
|
|
right = read_from_buffer<float>(&msgbuffer);
|
|
|
|
bottom = read_from_buffer<float>(&msgbuffer);
|
|
|
|
angle = read_from_buffer<float>(&msgbuffer);
|
|
|
|
span = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 06:22:15 +03:00
|
|
|
//BRect rect(left,top,right,bottom);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->StrokeArc(rect,angle,span,layerdata,pattern);
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_STROKE_ARC_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_BEZIER:
|
|
|
|
{
|
|
|
|
// TODO:: Add clipping
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_STROKE_BEZIER_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
BPoint *pts;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
2003-06-23 06:53:55 +04:00
|
|
|
int i;
|
|
|
|
pts = new BPoint[4];
|
|
|
|
for (i=0; i<4; i++)
|
|
|
|
{
|
2003-07-05 01:13:48 +04:00
|
|
|
pts[i].x = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pts[i].y = read_from_buffer<float>(&msgbuffer);
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
2003-07-05 01:13:48 +04:00
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->StrokeBezier(pts,layerdata,pattern);
|
2003-06-23 06:53:55 +04:00
|
|
|
delete[] pts;
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_STROKE_BEZIER_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_ELLIPSE:
|
|
|
|
{
|
|
|
|
// TODO:: Add clipping
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_STROKE_ELLIPSE_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
float left, top, right, bottom;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
|
|
|
left = read_from_buffer<float>(&msgbuffer);
|
|
|
|
top = read_from_buffer<float>(&msgbuffer);
|
|
|
|
right = read_from_buffer<float>(&msgbuffer);
|
|
|
|
bottom = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 06:22:15 +03:00
|
|
|
//BRect rect(left,top,right,bottom);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->StrokeEllipse(rect,layerdata,pattern);
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_STROKE_ELLIPSE_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_LINE:
|
|
|
|
{
|
|
|
|
// TODO:: Add clipping
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_STROKE_LINE_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
float x1, y1, x2, y2;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
|
|
|
x1 = read_from_buffer<float>(&msgbuffer);
|
|
|
|
y1 = read_from_buffer<float>(&msgbuffer);
|
|
|
|
x2 = read_from_buffer<float>(&msgbuffer);
|
|
|
|
y2 = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 06:22:15 +03:00
|
|
|
//BPoint p1(x1,y1);
|
|
|
|
//BPoint p2(x2,y2);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->StrokeLine(p1,p2,layerdata,pattern);
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_STROKE_LINE_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_LINEARRAY:
|
|
|
|
{
|
|
|
|
// TODO: Implement
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_POLYGON:
|
|
|
|
{
|
|
|
|
// TODO: Implement
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_RECT:
|
|
|
|
{
|
|
|
|
// TODO:: Add clipping
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_STROKE_RECT_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
float left, top, right, bottom;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
|
|
|
left = read_from_buffer<float>(&msgbuffer);
|
|
|
|
top = read_from_buffer<float>(&msgbuffer);
|
|
|
|
right = read_from_buffer<float>(&msgbuffer);
|
|
|
|
bottom = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 06:22:15 +03:00
|
|
|
//BRect rect(left,top,right,bottom);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->StrokeRect(rect,layerdata,pattern);
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_STROKE_RECT_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_ROUNDRECT:
|
|
|
|
{
|
|
|
|
// TODO:: Add clipping
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_STROKE_ROUNDRECT_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
float left, top, right, bottom, xrad, yrad;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
|
|
|
left = read_from_buffer<float>(&msgbuffer);
|
|
|
|
top = read_from_buffer<float>(&msgbuffer);
|
|
|
|
right = read_from_buffer<float>(&msgbuffer);
|
|
|
|
bottom = read_from_buffer<float>(&msgbuffer);
|
|
|
|
xrad = read_from_buffer<float>(&msgbuffer);
|
|
|
|
yrad = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 06:22:15 +03:00
|
|
|
//BRect rect(left,top,right,bottom);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->StrokeRoundRect(rect,xrad,yrad,layerdata,pattern);
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_STROKE_ROUNDRECT_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_SHAPE:
|
|
|
|
{
|
|
|
|
// TODO: Implement
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_STROKE_TRIANGLE:
|
|
|
|
{
|
|
|
|
// TODO:: Add clipping
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_STROKE_TRIANGLE_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
BPoint *pts;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
2003-06-23 06:53:55 +04:00
|
|
|
float left, top, right, bottom;
|
|
|
|
int i;
|
|
|
|
pts = new BPoint[3];
|
|
|
|
for (i=0; i<3; i++)
|
|
|
|
{
|
2003-07-05 01:13:48 +04:00
|
|
|
pts[i].x = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pts[i].y = read_from_buffer<float>(&msgbuffer);
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
2003-07-05 01:13:48 +04:00
|
|
|
left = read_from_buffer<float>(&msgbuffer);
|
|
|
|
top = read_from_buffer<float>(&msgbuffer);
|
|
|
|
right = read_from_buffer<float>(&msgbuffer);
|
|
|
|
bottom = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 06:22:15 +03:00
|
|
|
//BRect rect(left,top,right,bottom);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->StrokeTriangle(pts,rect,layerdata,pattern);
|
2003-06-23 06:53:55 +04:00
|
|
|
delete[] pts;
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_STROKE_TRIANGLE_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_ARC:
|
|
|
|
{
|
|
|
|
// TODO:: Add clipping
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_FILL_ARC_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
float left, top, right, bottom, angle, span;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
|
|
|
left = read_from_buffer<float>(&msgbuffer);
|
|
|
|
top = read_from_buffer<float>(&msgbuffer);
|
|
|
|
right = read_from_buffer<float>(&msgbuffer);
|
|
|
|
bottom = read_from_buffer<float>(&msgbuffer);
|
|
|
|
angle = read_from_buffer<float>(&msgbuffer);
|
|
|
|
span = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 06:22:15 +03:00
|
|
|
//BRect rect(left,top,right,bottom);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->FillArc(rect,angle,span,layerdata,pattern);
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_FILL_ARC_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_BEZIER:
|
|
|
|
{
|
|
|
|
// TODO:: Add clipping
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_FILL_BEZIER_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
BPoint *pts;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
2003-06-23 06:53:55 +04:00
|
|
|
int i;
|
|
|
|
pts = new BPoint[4];
|
|
|
|
for (i=0; i<4; i++)
|
|
|
|
{
|
2003-07-05 01:13:48 +04:00
|
|
|
pts[i].x = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pts[i].y = read_from_buffer<float>(&msgbuffer);
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
2003-07-05 01:13:48 +04:00
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->FillBezier(pts,layerdata,pattern);
|
2003-06-23 06:53:55 +04:00
|
|
|
delete[] pts;
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_FILL_BEZIER_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_ELLIPSE:
|
|
|
|
{
|
|
|
|
// TODO:: Add clipping
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_FILL_ELLIPSE_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
float left, top, right, bottom;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
|
|
|
left = read_from_buffer<float>(&msgbuffer);
|
|
|
|
top = read_from_buffer<float>(&msgbuffer);
|
|
|
|
right = read_from_buffer<float>(&msgbuffer);
|
|
|
|
bottom = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 06:22:15 +03:00
|
|
|
//BRect rect(left,top,right,bottom);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->FillEllipse(rect,layerdata,pattern);
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_FILL_ELLIPSE_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_POLYGON:
|
|
|
|
{
|
|
|
|
// TODO: Implement
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_RECT:
|
|
|
|
{
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_FILL_RECT_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
float left, top, right, bottom;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
|
|
|
left = read_from_buffer<float>(&msgbuffer);
|
|
|
|
top = read_from_buffer<float>(&msgbuffer);
|
|
|
|
right = read_from_buffer<float>(&msgbuffer);
|
|
|
|
bottom = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 06:22:15 +03:00
|
|
|
/*
|
2003-06-23 06:53:55 +04:00
|
|
|
BRect rect(left,top,right,bottom);
|
2003-12-07 08:40:51 +03:00
|
|
|
if (layerdata && numRects)
|
|
|
|
if (numRects == 1)
|
2004-01-20 01:18:37 +03:00
|
|
|
fServerApp->_driver->FillRect(rect,layerdata,pattern);
|
2003-07-09 06:28:33 +04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i=0; i<numRects; i++)
|
2004-01-20 01:18:37 +03:00
|
|
|
fServerApp->_driver->FillRect(LayerClipRegion.RectAt(i),layerdata,pattern);
|
2003-07-09 06:28:33 +04:00
|
|
|
}
|
2003-12-07 06:22:15 +03:00
|
|
|
*/
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_FILL_RECT_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_REGION:
|
|
|
|
{
|
|
|
|
// TODO: Implement
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_ROUNDRECT:
|
|
|
|
{
|
|
|
|
// TODO:: Add clipping
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_FILL_ROUNDRECT_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
float left, top, right, bottom, xrad, yrad;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
|
|
|
left = read_from_buffer<float>(&msgbuffer);
|
|
|
|
top = read_from_buffer<float>(&msgbuffer);
|
|
|
|
right = read_from_buffer<float>(&msgbuffer);
|
|
|
|
bottom = read_from_buffer<float>(&msgbuffer);
|
|
|
|
xrad = read_from_buffer<float>(&msgbuffer);
|
|
|
|
yrad = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 06:22:15 +03:00
|
|
|
//BRect rect(left,top,right,bottom);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->FillRoundRect(rect,xrad,yrad,layerdata,pattern);
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_FILL_ROUNDRECT_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_SHAPE:
|
|
|
|
{
|
|
|
|
// TODO: Implement
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_FILL_TRIANGLE:
|
|
|
|
{
|
|
|
|
// TODO:: Add clipping
|
2003-12-07 08:40:51 +03:00
|
|
|
if (sizeRemaining >= AS_FILL_TRIANGLE_MSG_SIZE)
|
2003-06-23 06:53:55 +04:00
|
|
|
{
|
|
|
|
BPoint *pts;
|
2003-07-05 01:13:48 +04:00
|
|
|
int8 *pattern;
|
2003-06-23 06:53:55 +04:00
|
|
|
float left, top, right, bottom;
|
|
|
|
int i;
|
|
|
|
pts = new BPoint[3];
|
|
|
|
for (i=0; i<3; i++)
|
|
|
|
{
|
2003-07-05 01:13:48 +04:00
|
|
|
pts[i].x = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pts[i].y = read_from_buffer<float>(&msgbuffer);
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
2003-07-05 01:13:48 +04:00
|
|
|
left = read_from_buffer<float>(&msgbuffer);
|
|
|
|
top = read_from_buffer<float>(&msgbuffer);
|
|
|
|
right = read_from_buffer<float>(&msgbuffer);
|
|
|
|
bottom = read_from_buffer<float>(&msgbuffer);
|
|
|
|
pattern = read_pattern_from_buffer(&msgbuffer);
|
2003-12-07 06:22:15 +03:00
|
|
|
//BRect rect(left,top,right,bottom);
|
2003-12-07 08:40:51 +03:00
|
|
|
//if (layerdata)
|
2004-01-20 01:18:37 +03:00
|
|
|
//fServerApp->_driver->FillTriangle(pts,rect,layerdata,pattern);
|
2003-06-23 06:53:55 +04:00
|
|
|
delete[] pts;
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= AS_FILL_TRIANGLE_MSG_SIZE;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s received truncated graphics code %lx",fTitle.String(),code));
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining = 0;
|
2003-06-23 06:53:55 +04:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_MOVEPENBY:
|
|
|
|
{
|
|
|
|
// TODO: Implement
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_MOVEPENTO:
|
|
|
|
{
|
|
|
|
// TODO: Implement
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SETPENSIZE:
|
|
|
|
{
|
|
|
|
// TODO: Implement
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_DRAW_STRING:
|
|
|
|
{
|
|
|
|
// TODO: Implement
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SET_FONT:
|
|
|
|
{
|
|
|
|
// TODO: Implement
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case AS_SET_FONT_SIZE:
|
|
|
|
{
|
|
|
|
// TODO: Implement
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
2003-07-05 01:13:48 +04:00
|
|
|
sizeRemaining -= sizeof(int32);
|
2004-01-20 01:18:37 +03:00
|
|
|
printf("ServerWindow %s received unexpected graphics code %lx",fTitle.String(),code);
|
2003-06-23 06:53:55 +04:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-03-19 04:12:53 +03:00
|
|
|
}
|
|
|
|
|
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-02-24 14:54:44 +03:00
|
|
|
BSession *ses = win->fSession;
|
|
|
|
bool quitting = false;
|
|
|
|
int32 code;
|
2003-02-07 15:53:57 +03:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
while(!quitting)
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2004-02-24 14:54:44 +03:00
|
|
|
ses->ReadInt32(&code);
|
2004-01-20 05:02:01 +03:00
|
|
|
|
2004-02-24 14:54:44 +03:00
|
|
|
switch(code)
|
2004-01-20 01:18:37 +03:00
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
{
|
2004-01-13 03:56:36 +03:00
|
|
|
// this means the client has been killed
|
2004-01-20 01:18:37 +03:00
|
|
|
|
|
|
|
// TODO: A message code should *never* be 0. The source sending this message
|
|
|
|
// needs to be changed to something like AS_CLIENT_DEAD or something.
|
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
STRACE(("ServerWindow %s received '0' message code\n",win->Title()));
|
2004-01-20 01:18:37 +03:00
|
|
|
quitting = true;
|
2004-01-13 03:56:36 +03:00
|
|
|
delete win;
|
|
|
|
break;
|
|
|
|
}
|
2004-01-20 01:18:37 +03:00
|
|
|
case B_QUIT_REQUESTED:
|
|
|
|
{
|
2004-01-13 03:56:36 +03:00
|
|
|
STRACE(("ServerWindow %s received Quit request\n",win->Title()));
|
2004-01-20 01:18:37 +03:00
|
|
|
quitting = true;
|
2004-02-24 14:54:44 +03:00
|
|
|
printf("Deleting window...\n");
|
2004-01-13 03:56:36 +03:00
|
|
|
delete win;
|
|
|
|
break;
|
|
|
|
}
|
2004-01-20 01:18:37 +03:00
|
|
|
default:
|
|
|
|
{
|
|
|
|
STRACE(("ServerWindow %s: got a message to dispatch\n",win->Title()));
|
2004-02-24 14:54:44 +03:00
|
|
|
win->DispatchMessage(code);
|
2004-01-13 03:56:36 +03:00
|
|
|
break;
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2003-08-31 21:38:34 +04:00
|
|
|
}
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
/*!
|
2004-02-24 14:54:44 +03:00
|
|
|
\brief PasfSession mouse event messages to the appropriate window
|
2003-02-24 18:47:06 +03:00
|
|
|
\param code Message code of the mouse message
|
|
|
|
\param buffer Attachment buffer for the mouse message
|
|
|
|
*/
|
2003-07-11 00:22:07 +04:00
|
|
|
//void ServerWindow::HandleMouseEvent(int32 code, int8 *buffer)
|
|
|
|
void ServerWindow::HandleMouseEvent(PortMessage *msg)
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
/* ServerWindow *mousewin=NULL;
|
2003-07-11 00:22:07 +04:00
|
|
|
// int8 *index=buffer;
|
2003-02-07 15:53:57 +03:00
|
|
|
|
|
|
|
// Find the window which will receive our mouse event.
|
2004-01-20 01:18:37 +03:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
//TODO: resolve
|
|
|
|
Layer *root=NULL;//GetRootLayer(CurrentWorkspace(),ActiveScreen());
|
2004-01-20 01:18:37 +03:00
|
|
|
WinBorder *fWinBorder;
|
2003-02-07 15:53:57 +03:00
|
|
|
|
|
|
|
// activeborder is used to remember windows when resizing/moving windows
|
|
|
|
// or sliding a tab
|
2003-04-05 05:51:35 +04:00
|
|
|
if(!root)
|
|
|
|
{
|
|
|
|
printf("ERROR: HandleMouseEvent has NULL root layer!!!\n");
|
|
|
|
return;
|
|
|
|
}
|
2003-02-07 15:53:57 +03:00
|
|
|
|
|
|
|
// Dispatch the mouse event to the proper window
|
2003-07-11 00:22:07 +04:00
|
|
|
// switch(code)
|
|
|
|
switch(msg->Code())
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
|
|
|
case B_MOUSE_DOWN:
|
|
|
|
{
|
|
|
|
// Attached data:
|
|
|
|
// 1) int64 - time of mouse click
|
|
|
|
// 2) float - x coordinate of mouse click
|
|
|
|
// 3) float - y coordinate of mouse click
|
|
|
|
// 4) int32 - modifier keys down
|
|
|
|
// 5) int32 - buttons down
|
|
|
|
// 6) int32 - clicks
|
|
|
|
|
2003-07-11 00:22:07 +04:00
|
|
|
// index+=sizeof(int64);
|
|
|
|
// float x=*((float*)index); index+=sizeof(float);
|
|
|
|
// float y=*((float*)index); index+=sizeof(float);
|
|
|
|
// BPoint pt(x,y);
|
|
|
|
float x;
|
|
|
|
float y;
|
|
|
|
int64 dummy;
|
2003-07-14 00:56:00 +04:00
|
|
|
msg->Read<int64>(&dummy);
|
|
|
|
msg->Read<float>(&x);
|
|
|
|
msg->Read<float>(&y);
|
2004-01-13 03:56:36 +03:00
|
|
|
//TODO: resolve
|
|
|
|
// BPoint pt(x,y);
|
2003-07-11 00:22:07 +04:00
|
|
|
|
2003-02-07 15:53:57 +03:00
|
|
|
// If we have clicked on a window,
|
2004-01-20 01:18:37 +03:00
|
|
|
active_winborder = fWinBorder = NULL;
|
|
|
|
if(fWinBorder)
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
mousewin=fWinBorder->Window();
|
|
|
|
fWinBorder->MouseDown((int8*)msg->Buffer());
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case B_MOUSE_UP:
|
|
|
|
{
|
|
|
|
// Attached data:
|
|
|
|
// 1) int64 - time of mouse click
|
|
|
|
// 2) float - x coordinate of mouse click
|
|
|
|
// 3) float - y coordinate of mouse click
|
|
|
|
// 4) int32 - modifier keys down
|
|
|
|
|
2003-07-11 00:22:07 +04:00
|
|
|
// index+=sizeof(int64);
|
|
|
|
// float x=*((float*)index); index+=sizeof(float);
|
|
|
|
// float y=*((float*)index); index+=sizeof(float);
|
|
|
|
// BPoint pt(x,y);
|
|
|
|
float x;
|
|
|
|
float y;
|
|
|
|
int64 dummy;
|
|
|
|
msg->Read(&dummy);
|
|
|
|
msg->Read(&x);
|
|
|
|
msg->Read(&y);
|
2004-01-13 03:56:36 +03:00
|
|
|
//TODO: resolve
|
|
|
|
// BPoint pt(x,y);
|
2003-02-07 15:53:57 +03:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
// set_is_sliding_tab(false);
|
|
|
|
// set_is_moving_window(false);
|
|
|
|
// set_is_resizing_window(false);
|
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
//TODO: resolve
|
2004-01-20 01:18:37 +03:00
|
|
|
fWinBorder = NULL;//WindowContainsPoint(pt);
|
2003-06-28 23:06:30 +04:00
|
|
|
active_winborder=NULL;
|
2004-01-20 01:18:37 +03:00
|
|
|
if(fWinBorder)
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
mousewin=fWinBorder->Window();
|
2003-02-07 15:53:57 +03:00
|
|
|
|
|
|
|
// Eventually, we will build in MouseUp messages with buttons specified
|
|
|
|
// For now, we just "assume" no mouse specification with a 0.
|
2004-01-20 01:18:37 +03:00
|
|
|
fWinBorder->MouseUp((int8*)msg->Buffer());
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case B_MOUSE_MOVED:
|
|
|
|
{
|
|
|
|
// Attached data:
|
|
|
|
// 1) int64 - time of mouse click
|
|
|
|
// 2) float - x coordinate of mouse click
|
|
|
|
// 3) float - y coordinate of mouse click
|
|
|
|
// 4) int32 - buttons down
|
2003-07-11 00:22:07 +04:00
|
|
|
// index+=sizeof(int64);
|
|
|
|
// float x=*((float*)index); index+=sizeof(float);
|
|
|
|
// float y=*((float*)index); index+=sizeof(float);
|
|
|
|
// BPoint pt(x,y);
|
|
|
|
float x;
|
|
|
|
float y;
|
|
|
|
int64 dummy;
|
|
|
|
msg->Read(&dummy);
|
|
|
|
msg->Read(&x);
|
|
|
|
msg->Read(&y);
|
2004-01-20 01:18:37 +03:00
|
|
|
// BPoint pt(x,y);
|
|
|
|
//
|
|
|
|
// if(is_moving_window() || is_resizing_window() || is_sliding_tab())
|
|
|
|
// {
|
|
|
|
// active_winborder->MouseMoved((int8*)msg->Buffer());
|
|
|
|
// }
|
|
|
|
// else
|
|
|
|
// {
|
|
|
|
// fWinBorder = WindowContainsPoint(pt);
|
|
|
|
// if(fWinBorder)
|
|
|
|
// {
|
|
|
|
// mousewin=fWinBorder->Window();
|
|
|
|
// fWinBorder->MouseMoved((int8*)msg->Buffer());
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
break;
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2004-01-20 01:18:37 +03:00
|
|
|
*/
|
2003-02-14 04:53:53 +03:00
|
|
|
}
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
/*!
|
2004-02-24 14:54:44 +03:00
|
|
|
\brief PasfSession key event messages to the appropriate window
|
2003-02-24 18:47:06 +03:00
|
|
|
\param code Message code of the key message
|
|
|
|
\param buffer Attachment buffer for the key message
|
|
|
|
*/
|
2003-02-14 04:53:53 +03:00
|
|
|
void ServerWindow::HandleKeyEvent(int32 code, int8 *buffer)
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
/*
|
2003-09-09 01:18:39 +04:00
|
|
|
STRACE_KEY(("ServerWindow::HandleKeyEvent unimplemented\n"));
|
2004-01-20 01:18:37 +03:00
|
|
|
ServerWindow *keywin=NULL;
|
2003-02-24 18:47:06 +03:00
|
|
|
|
|
|
|
// Dispatch the key event to the active window
|
2003-07-11 00:22:07 +04:00
|
|
|
keywin=GetActiveWindow();
|
|
|
|
if(keywin)
|
|
|
|
{
|
|
|
|
keywin->Lock();
|
2004-01-20 01:18:37 +03:00
|
|
|
keywin->fWinLink->SetOpCode(code);
|
|
|
|
keywin->fWinLink
|
2003-07-11 00:22:07 +04:00
|
|
|
keywin->Unlock();
|
|
|
|
}
|
2003-02-24 18:47:06 +03:00
|
|
|
*/
|
|
|
|
}
|
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
/*!
|
|
|
|
\brief Send a message to the ServerWindow
|
|
|
|
\param code ID code of the message to post
|
|
|
|
\param size size of the data buffer
|
|
|
|
\param buffer Any attached data
|
|
|
|
*/
|
|
|
|
void ServerWindow::PostMessage(int32 code, size_t size, int8 *buffer)
|
|
|
|
{
|
|
|
|
write_port(fMessagePort,code, buffer, size);
|
|
|
|
}
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
/*!
|
|
|
|
\brief Returns the Workspace object to which the window belongs
|
|
|
|
|
|
|
|
If the window belongs to all workspaces, it returns the current workspace
|
|
|
|
*/
|
|
|
|
Workspace *ServerWindow::GetWorkspace(void)
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
//TODO: resolve
|
2004-01-13 03:56:36 +03:00
|
|
|
if(fWorkspaces==B_ALL_WORKSPACES)
|
|
|
|
return NULL;//fWorkspaces->GetScreen()->GetActiveWorkspace();
|
2003-02-24 18:47:06 +03:00
|
|
|
|
2004-01-13 03:56:36 +03:00
|
|
|
return NULL;
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
/*!
|
|
|
|
\brief Assign the window to a particular workspace object
|
|
|
|
\param The ServerWindow's new workspace
|
|
|
|
*/
|
2003-02-20 21:05:35 +03:00
|
|
|
void ServerWindow::SetWorkspace(Workspace *wkspc)
|
|
|
|
{
|
2004-01-20 01:18:37 +03:00
|
|
|
STRACE(("ServerWindow %s: Set Workspace\n",fTitle.String()));
|
|
|
|
fWorkspace=wkspc;
|
2003-02-20 21:05:35 +03:00
|
|
|
}
|
|
|
|
|
2003-09-09 01:18:39 +04:00
|
|
|
Layer* ServerWindow::FindLayer(const Layer* start, int32 token) const
|
|
|
|
{
|
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'
|
2003-12-07 08:40:51 +03:00
|
|
|
if(start->_view_token == token)
|
2003-09-15 23:14:45 +04:00
|
|
|
return const_cast<Layer*>(start);
|
2003-09-09 01:18:39 +04:00
|
|
|
|
2004-01-20 01:18:37 +03:00
|
|
|
Layer *c = start->_topchild; //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
|
|
|
|
{
|
2003-12-07 08:40:51 +03:00
|
|
|
if(c->_view_token == 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-01-20 01:18:37 +03:00
|
|
|
if( c->_topchild)
|
|
|
|
{
|
2003-09-09 01:18:39 +04:00
|
|
|
c = c->_topchild;
|
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
|
|
|
|
if(c->_lowersibling)
|
|
|
|
{
|
2003-09-09 01:18:39 +04:00
|
|
|
c = c->_lowersibling;
|
2003-09-15 23:14:45 +04:00
|
|
|
}
|
2004-01-20 01:18:37 +03:00
|
|
|
// go up
|
|
|
|
else
|
|
|
|
{
|
|
|
|
while(!c->_parent->_lowersibling && c->_parent != start)
|
|
|
|
{
|
2003-09-15 23:14:45 +04:00
|
|
|
c = c->_parent;
|
|
|
|
}
|
2004-01-20 01:18:37 +03:00
|
|
|
// that enough! We've reached the start layer.
|
2003-12-07 08:40:51 +03:00
|
|
|
if(c->_parent == start)
|
2003-09-15 23:14:45 +04:00
|
|
|
break;
|
|
|
|
|
|
|
|
c = c->_parent->_lowersibling;
|
|
|
|
}
|
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-01-20 01:18:37 +03:00
|
|
|
void ServerWindow::SendMessageToClient(const BMessage* msg) const
|
|
|
|
{
|
2003-09-25 16:31:11 +04:00
|
|
|
ssize_t size;
|
|
|
|
char *buffer;
|
|
|
|
|
|
|
|
size = msg->FlattenedSize();
|
|
|
|
buffer = new char[size];
|
2004-01-20 01:18:37 +03:00
|
|
|
|
|
|
|
if (msg->Flatten(buffer, size) == B_OK)
|
|
|
|
write_port(fClientLooperPort, msg->what, buffer, size);
|
2003-09-25 16:31:11 +04:00
|
|
|
else
|
2004-01-20 01:18:37 +03:00
|
|
|
printf("PANIC: ServerWindow %s: can't flatten message in 'SendMessageToClient()'\n", fTitle.String());
|
2003-09-25 16:31:11 +04:00
|
|
|
|
|
|
|
delete buffer;
|
|
|
|
}
|
2003-09-09 01:18:39 +04:00
|
|
|
|
2003-02-24 18:47:06 +03:00
|
|
|
/*!
|
|
|
|
\brief Handles window activation stuff. Called by Desktop functions
|
|
|
|
*/
|
2003-02-20 16:13:01 +03:00
|
|
|
void ActivateWindow(ServerWindow *oldwin,ServerWindow *newwin)
|
2003-02-07 15:53:57 +03:00
|
|
|
{
|
2003-09-09 01:18:39 +04:00
|
|
|
STRACE(("ActivateWindow: old=%s, new=%s\n",oldwin?oldwin->Title():"NULL",newwin?newwin->Title():"NULL"));
|
2003-02-24 18:47:06 +03:00
|
|
|
if(oldwin==newwin)
|
2003-02-07 15:53:57 +03:00
|
|
|
return;
|
2003-02-24 18:47:06 +03:00
|
|
|
|
|
|
|
if(oldwin)
|
|
|
|
oldwin->SetFocus(false);
|
|
|
|
|
|
|
|
if(newwin)
|
|
|
|
newwin->SetFocus(true);
|
2003-02-07 15:53:57 +03:00
|
|
|
}
|
2003-09-15 23:14:45 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
@log
|
2003-09-25 16:31:11 +04:00
|
|
|
*added handlers for AS_LAYER_(MOVE/RESIZE)TO messages
|
|
|
|
*added AS_LAYER_GET_COORD handler
|
|
|
|
*changed some methods to use BMessage class for sending messages to BWindow
|
2003-09-15 23:14:45 +04:00
|
|
|
*/
|