new code. use diff to see differences
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4577 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
80d0dc75a6
commit
92e26ba96d
@ -28,7 +28,6 @@
|
||||
#include "ColorSet.h"
|
||||
#include "Decorator.h"
|
||||
#include "DisplayDriver.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*!
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "ServerConfig.h"
|
||||
|
||||
#include "ViewDriver.h"
|
||||
#include "ServerWindow.h"
|
||||
|
||||
#if DISPLAYDRIVER == SCREENDRIVER
|
||||
#include "ScreenDriver.h"
|
||||
@ -39,12 +40,12 @@
|
||||
#include "AccelerantDriver.h"
|
||||
#endif
|
||||
|
||||
#include "ServerWindow.h"
|
||||
|
||||
//#define DEBUG_DESKTOP
|
||||
|
||||
#ifdef DEBUG_DESKTOP
|
||||
#include <stdio.h>
|
||||
# include <stdio.h>
|
||||
# define STRACE(x) printf x
|
||||
#else
|
||||
# define STRACE(x) ;
|
||||
#endif
|
||||
|
||||
bool ReadOBOSWorkspaceData(void);
|
||||
@ -88,9 +89,7 @@ void unlock_workspaces(void) { desktop_private::workspacelock.Unlock(); }
|
||||
*/
|
||||
void InitDesktop(void)
|
||||
{
|
||||
#ifdef DEBUG_DESKTOP
|
||||
printf("Desktop: InitWorkspace\n");
|
||||
#endif
|
||||
STRACE(("Desktop: InitWorkspace\n"));
|
||||
desktop_private::screenlist=new BList(0);
|
||||
DisplayDriver *tdriver;
|
||||
Screen *s=NULL;
|
||||
@ -116,9 +115,7 @@ printf("Desktop: InitWorkspace\n");
|
||||
tdriver->Shutdown();
|
||||
delete tdriver;
|
||||
tdriver=NULL;
|
||||
#ifdef DEBUG_DESKTOP
|
||||
printf("\t NULL display driver. OK. We crash now. :P\n");
|
||||
#endif
|
||||
STRACE(("\t NULL display driver. OK. We crash now. :P\n"));
|
||||
}
|
||||
#else // end if not TEST_MODE
|
||||
|
||||
@ -143,9 +140,7 @@ printf("\t NULL display driver. OK. We crash now. :P\n");
|
||||
tdriver->Shutdown();
|
||||
delete tdriver;
|
||||
tdriver=NULL;
|
||||
#ifdef DEBUG_DESKTOP
|
||||
printf("\t NULL display driver. OK. We crash now. :P\n");
|
||||
#endif
|
||||
STRACE(("\t NULL display driver. OK. We crash now. :P\n"));
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -156,8 +151,7 @@ printf("\t NULL display driver. OK. We crash now. :P\n");
|
||||
desktop_private::activescreen=s;
|
||||
s->SetSpace(0,B_32_BIT_640x480,true);
|
||||
}
|
||||
#ifdef DEBUG_DESKTOP
|
||||
else
|
||||
#ifndef DEBUG_DESKTOP
|
||||
printf("ERROR: NULL display driver\n");
|
||||
#endif
|
||||
}
|
||||
@ -165,9 +159,7 @@ printf("ERROR: NULL display driver\n");
|
||||
//! Shuts down the graphics subsystem
|
||||
void ShutdownDesktop(void)
|
||||
{
|
||||
#ifdef DEBUG_DESKTOP
|
||||
printf("Desktop: ShutdownDesktop\n");
|
||||
#endif
|
||||
STRACE(("Desktop: ShutdownDesktop\n"));
|
||||
Screen *s;
|
||||
|
||||
for(int32 i=0;i<desktop_private::screenlist->CountItems();i++)
|
||||
@ -195,9 +187,7 @@ printf("Desktop: ShutdownDesktop\n");
|
||||
*/
|
||||
void AddWorkspace(int32 index)
|
||||
{
|
||||
#ifdef DEBUG_DESKTOP
|
||||
printf("Desktop: AddWorkspace(%ld)\n",index+1);
|
||||
#endif
|
||||
STRACE(("Desktop: AddWorkspace(%ld)\n",index+1));
|
||||
lock_workspaces();
|
||||
lock_layers();
|
||||
|
||||
@ -225,9 +215,7 @@ printf("Desktop: AddWorkspace(%ld)\n",index+1);
|
||||
*/
|
||||
void DeleteWorkspace(int32 index)
|
||||
{
|
||||
#ifdef DEBUG_DESKTOP
|
||||
printf("Desktop: DeleteWorkspace(%ld)\n",index+1);
|
||||
#endif
|
||||
STRACE(("Desktop: DeleteWorkspace(%ld)\n",index+1));
|
||||
lock_workspaces();
|
||||
lock_layers();
|
||||
|
||||
@ -273,9 +261,7 @@ int32 CountWorkspaces(void)
|
||||
*/
|
||||
void SetWorkspaceCount(int32 count)
|
||||
{
|
||||
#ifdef DEBUG_DESKTOP
|
||||
printf("Desktop: SetWorkspaceCount(%ld)\n",count);
|
||||
#endif
|
||||
STRACE(("Desktop: SetWorkspaceCount(%ld)\n",count));
|
||||
if(count<1 || count>32)
|
||||
return;
|
||||
lock_workspaces();
|
||||
@ -328,9 +314,7 @@ Workspace *WorkspaceAt(int32 index)
|
||||
*/
|
||||
void SetWorkspace(int32 workspace)
|
||||
{
|
||||
#ifdef DEBUG_DESKTOP
|
||||
printf("Desktop: SetWorkspace(%ld)\n",workspace+1);
|
||||
#endif
|
||||
STRACE(("Desktop: SetWorkspace(%ld)\n",workspace+1));
|
||||
lock_workspaces();
|
||||
if(workspace<0 || workspace>(CountWorkspaces()-1))
|
||||
{
|
||||
@ -355,9 +339,7 @@ printf("Desktop: SetWorkspace(%ld)\n",workspace+1);
|
||||
*/
|
||||
void SetScreen(screen_id id)
|
||||
{
|
||||
#ifdef DEBUG_DESKTOP
|
||||
printf("Desktop: SetScreen(%ld)\n",id.id);
|
||||
#endif
|
||||
STRACE(("Desktop: SetScreen(%ld)\n",id.id));
|
||||
Screen *scr;
|
||||
for(int32 i=0;i<desktop_private::screenlist->CountItems();i++)
|
||||
{
|
||||
@ -425,10 +407,10 @@ DisplayDriver *GetGfxDriver(screen_id screen)
|
||||
*/
|
||||
status_t SetSpace(int32 index, int32 res, screen_id screen, bool stick)
|
||||
{
|
||||
#ifdef DEBUG_DESKTOP
|
||||
printf("Desktop: SetSpace(%ld,%ld,%s,%ld)\n",index+1,res,
|
||||
stick?"stick":"non-stick",screen.id);
|
||||
#endif
|
||||
|
||||
STRACE(("Desktop: SetSpace(%ld,%ld,%s,%ld)\n",index+1,res,
|
||||
stick?"stick":"non-stick",screen.id));
|
||||
|
||||
desktop_private::workspacelock.Lock();
|
||||
status_t stat=desktop_private::activescreen->SetSpace(index,res,stick);
|
||||
desktop_private::workspacelock.Unlock();
|
||||
@ -443,10 +425,10 @@ printf("Desktop: SetSpace(%ld,%ld,%s,%ld)\n",index+1,res,
|
||||
*/
|
||||
void AddWindowToDesktop(ServerWindow *win, int32 workspace, screen_id screen)
|
||||
{
|
||||
#ifdef DEBUG_DESKTOP
|
||||
printf("Desktop: AddWindowToDesktop(%s,%ld,%ld)\n",win?win->GetTitle():"NULL",
|
||||
workspace+1,screen.id);
|
||||
#endif
|
||||
|
||||
STRACE(("Desktop: AddWindowToDesktop(%s,%ld,%ld)\n",win?win->GetTitle():"NULL",
|
||||
workspace+1,screen.id));
|
||||
|
||||
// Workspace() will be non-NULL if it has already been added to the desktop
|
||||
if(!win || win->GetWorkspace())
|
||||
return;
|
||||
@ -463,10 +445,10 @@ printf("Desktop: AddWindowToDesktop(%s,%ld,%ld)\n",win?win->GetTitle():"NULL",
|
||||
}
|
||||
|
||||
WinBorder* WindowContainsPoint( BPoint pt ){
|
||||
#ifdef DEBUG_DESKTOP
|
||||
printf("Desktop: WindowContainsPoint(%s,%f,%f)\n",win?win->GetTitle():"NULL",
|
||||
pt.x, pt.y);
|
||||
#endif
|
||||
|
||||
STRACE(("Desktop: WindowContainsPoint(%s,%f,%f)\n",win?win->GetTitle():"NULL",
|
||||
pt.x, pt.y));
|
||||
|
||||
WinBorder *wb;
|
||||
|
||||
desktop_private::workspacelock.Lock();
|
||||
@ -485,9 +467,7 @@ printf("Desktop: WindowContainsPoint(%s,%f,%f)\n",win?win->GetTitle():"NULL",
|
||||
*/
|
||||
void RemoveWindowFromDesktop(ServerWindow *win)
|
||||
{
|
||||
#ifdef DEBUG_DESKTOP
|
||||
printf("Desktop: RemoveWindowFromDesktop(%s)\n",win?win->GetTitle():"NULL");
|
||||
#endif
|
||||
STRACE(("Desktop: RemoveWindowFromDesktop(%s)\n",win?win->GetTitle():"NULL"));
|
||||
lock_workspaces();
|
||||
lock_layers();
|
||||
|
||||
@ -519,9 +499,7 @@ ServerWindow *GetActiveWindow(void)
|
||||
*/
|
||||
void SetActiveWindow(ServerWindow *win)
|
||||
{
|
||||
#ifdef DEBUG_DESKTOP
|
||||
printf("Desktop: SetActiveWindow(%s)\n",win?win->GetTitle():"NULL");
|
||||
#endif
|
||||
STRACE(("Desktop: SetActiveWindow(%s)\n",win?win->GetTitle():"NULL"));
|
||||
lock_workspaces();
|
||||
Workspace *w=desktop_private::activescreen->GetActiveWorkspace();
|
||||
if(win && win->GetWorkspace()!=w)
|
||||
|
@ -43,10 +43,17 @@
|
||||
//#define DEBUG_SCREEN
|
||||
|
||||
#ifdef DEBUG_WORKSPACE
|
||||
#include <stdio.h>
|
||||
# include <stdio.h>
|
||||
# define STRACE_WS(x) printf x
|
||||
#else
|
||||
# define STRACE_WS(x) ;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_SCREEN
|
||||
#include <stdio.h>
|
||||
# include <stdio.h>
|
||||
# define STRACE_SCREEN(x) printf x
|
||||
#else
|
||||
# define STRACE_SCREEN(x) ;
|
||||
#endif
|
||||
|
||||
// Defined and initialized in AppServer.cpp
|
||||
@ -68,9 +75,7 @@ Workspace::Workspace(const graphics_card_info &gcinfo, const frame_buffer_info &
|
||||
_rootlayer=new RootLayer(BRect(0,0,fbinfo.display_width-1,fbinfo.display_height-1),
|
||||
"Workspace Root",_screen->GetGfxDriver());
|
||||
_rootlayer->SetColor(workspace_default_color);
|
||||
#ifdef DEBUG_WORKSPACE
|
||||
printf("Workspace::Workspace(%s)\n",_rootlayer->GetName());
|
||||
#endif
|
||||
STRACE_WS(("Workspace::Workspace(%s)\n",_rootlayer->GetName()));
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -86,9 +91,7 @@ Workspace::Workspace(as_workspace_data *data, Screen *screen)
|
||||
*/
|
||||
Workspace::~Workspace(void)
|
||||
{
|
||||
#ifdef DEBUG_WORKSPACE
|
||||
printf("Workspace::~Workspace(%s)\n",_rootlayer->GetName());
|
||||
#endif
|
||||
STRACE_WS(("Workspace::~Workspace(%s)\n",_rootlayer->GetName()));
|
||||
if(_rootlayer)
|
||||
{
|
||||
_rootlayer->PruneTree();
|
||||
@ -103,9 +106,8 @@ printf("Workspace::~Workspace(%s)\n",_rootlayer->GetName());
|
||||
*/
|
||||
void Workspace::SetBGColor(const RGBColor &c)
|
||||
{
|
||||
#ifdef DEBUG_WORKSPACE
|
||||
printf("Workspace::SetBGColor(): "); c.PrintToStream();
|
||||
#endif
|
||||
STRACE_WS(("Workspace::SetBGColor(): "));
|
||||
c.PrintToStream();
|
||||
_rootlayer->SetColor(c);
|
||||
}
|
||||
|
||||
@ -134,9 +136,7 @@ RootLayer *Workspace::GetRoot(void)
|
||||
*/
|
||||
void Workspace::SetData(const graphics_card_info &gcinfo, const frame_buffer_info &fbinfo)
|
||||
{
|
||||
#ifdef DEBUG_WORKSPACE
|
||||
printf("Workspace::SetData(%s)\n",_rootlayer->GetName());
|
||||
#endif
|
||||
STRACE_WS(("Workspace::SetData(%s)\n",_rootlayer->GetName()));
|
||||
if(_fbinfo.display_width!=fbinfo.display_width ||
|
||||
_fbinfo.display_height!=fbinfo.display_height)
|
||||
{
|
||||
@ -167,9 +167,7 @@ void Workspace::GetData(graphics_card_info *gcinfo, frame_buffer_info *fbinfo)
|
||||
*/
|
||||
void Workspace::SetSpace(int32 res)
|
||||
{
|
||||
#ifdef DEBUG_WORKSPACE
|
||||
printf("Workspace::SetSpace(%ld) unimplemented\n",res);
|
||||
#endif
|
||||
STRACE_WS(("Workspace::SetSpace(%ld) unimplemented\n",res));
|
||||
// TODO: Implement
|
||||
}
|
||||
|
||||
@ -180,9 +178,7 @@ printf("Workspace::SetSpace(%ld) unimplemented\n",res);
|
||||
*/
|
||||
Screen::Screen(DisplayDriver *gfxmodule, uint8 workspaces)
|
||||
{
|
||||
#ifdef DEBUG_SCREEN
|
||||
printf("Screen::Screen(%s,%u)\n",gfxmodule?"driver":"NULL",workspaces);
|
||||
#endif
|
||||
STRACE_SCREEN(("Screen::Screen(%s,%u)\n",gfxmodule?"driver":"NULL",workspaces));
|
||||
_workspacelist=NULL;
|
||||
_driver=gfxmodule;
|
||||
_resolution=0;
|
||||
@ -238,9 +234,7 @@ printf("Screen::Screen(%s,%u)\n",gfxmodule?"driver":"NULL",workspaces);
|
||||
*/
|
||||
Screen::~Screen(void)
|
||||
{
|
||||
#ifdef DEBUG_SCREEN
|
||||
printf("Screen::~Screen\n");
|
||||
#endif
|
||||
STRACE_SCREEN(("Screen::~Screen\n"));
|
||||
if ( _workspacelist )
|
||||
{
|
||||
int i;
|
||||
@ -258,9 +252,7 @@ printf("Screen::~Screen\n");
|
||||
*/
|
||||
void Screen::AddWorkspace(int32 index)
|
||||
{
|
||||
#ifdef DEBUG_SCREEN
|
||||
printf("Screen::AddWorkspace(%ld)\n",index+1);
|
||||
#endif
|
||||
STRACE_SCREEN(("Screen::AddWorkspace(%ld)\n",index+1));
|
||||
Workspace *workspace = new Workspace(_gcinfo,_fbinfo,this);
|
||||
if ( (index == -1) || !_workspacelist->AddItem(workspace,index) )
|
||||
_workspacelist->AddItem(workspace);
|
||||
@ -275,9 +267,7 @@ printf("Screen::AddWorkspace(%ld)\n",index+1);
|
||||
*/
|
||||
void Screen::AddWorkspace(Workspace *workspace,int32 index)
|
||||
{
|
||||
#ifdef DEBUG_SCREEN
|
||||
printf("Screen::AddWorkspace(%s)\n",(workspace && workspace->GetRoot())?workspace->GetRoot()->GetName():"NULL");
|
||||
#endif
|
||||
STRACE_SCREEN(("Screen::AddWorkspace(%s)\n",(workspace && workspace->GetRoot())?workspace->GetRoot()->GetName():"NULL"));
|
||||
if ( (index==-1) || !_workspacelist->AddItem(workspace,index) )
|
||||
_workspacelist->AddItem(workspace);
|
||||
}
|
||||
@ -288,9 +278,7 @@ printf("Screen::AddWorkspace(%s)\n",(workspace && workspace->GetRoot())?workspac
|
||||
*/
|
||||
void Screen::DeleteWorkspace(int32 index)
|
||||
{
|
||||
#ifdef DEBUG_SCREEN
|
||||
printf("Screen::DeleteWorkspace(%ld)\n",index+1);
|
||||
#endif
|
||||
STRACE_SCREEN(("Screen::DeleteWorkspace(%ld)\n",index+1));
|
||||
Workspace *workspace;
|
||||
workspace = (Workspace *)_workspacelist->RemoveItem(index);
|
||||
if ( workspace )
|
||||
@ -330,9 +318,7 @@ void Screen::SetWorkspaceCount(int32 count)
|
||||
if ( _currentworkspace > count-1 )
|
||||
SetWorkspace(count-1);
|
||||
|
||||
#ifdef DEBUG_SCREEN
|
||||
printf("Screen::SetWorkspaceCount(%ld)\n",count);
|
||||
#endif
|
||||
STRACE_SCREEN(("Screen::SetWorkspaceCount(%ld)\n",count));
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -350,9 +336,7 @@ int32 Screen::CurrentWorkspace(void)
|
||||
*/
|
||||
void Screen::SetWorkspace(int32 index)
|
||||
{
|
||||
#ifdef DEBUG_SCREEN
|
||||
printf("Screen::SetWorkspace(%ld)\n",index+1);
|
||||
#endif
|
||||
STRACE_SCREEN(("Screen::SetWorkspace(%ld)\n",index+1));
|
||||
if ( (index >= 0) && (index <= _workspacecount-1) )
|
||||
{
|
||||
_currentworkspace = index;
|
||||
@ -366,9 +350,7 @@ printf("Screen::SetWorkspace(%ld)\n",index+1);
|
||||
*/
|
||||
void Screen::Activate(bool active)
|
||||
{
|
||||
#ifdef DEBUG_SCREEN
|
||||
printf("Screen::Activate(%s)\n",active?"active":"inactive");
|
||||
#endif
|
||||
STRACE_SCREEN(("Screen::Activate(%s)\n",active?"active":"inactive"));
|
||||
_active=active;
|
||||
}
|
||||
|
||||
@ -390,9 +372,7 @@ DisplayDriver *Screen::GetGfxDriver(void)
|
||||
*/
|
||||
status_t Screen::SetSpace(int32 index, int32 res,bool stick)
|
||||
{
|
||||
#ifdef DEBUG_SCREEN
|
||||
printf("Screen::SetSpace(%ld,%ld,%s)\n",index,res,stick?"stick":"non-stick");
|
||||
#endif
|
||||
STRACE_SCREEN(("Screen::SetSpace(%ld,%ld,%s)\n",index,res,stick?"stick":"non-stick"));
|
||||
// the specified workspace isn't active, so this should be easy...
|
||||
Workspace *wkspc=(Workspace*)_workspacelist->ItemAt(index);
|
||||
if(!wkspc)
|
||||
@ -419,9 +399,7 @@ printf("Screen::SetSpace(%ld,%ld,%s)\n",index,res,stick?"stick":"non-stick");
|
||||
*/
|
||||
void Screen::AddWindow(ServerWindow *win, int32 workspace)
|
||||
{
|
||||
#ifdef DEBUG_SCREEN
|
||||
printf("Screen::AddWindow(%s,%ld)\n",win?win->GetTitle():"NULL", workspace+1);
|
||||
#endif
|
||||
STRACE_SCREEN(("Screen::AddWindow(%s,%ld)\n",win?win->GetTitle():"NULL", workspace+1));
|
||||
if(!win || !win->_winborder)
|
||||
return;
|
||||
|
||||
@ -439,9 +417,7 @@ printf("Screen::AddWindow(%s,%ld)\n",win?win->GetTitle():"NULL", workspace+1);
|
||||
*/
|
||||
void Screen::RemoveWindow(ServerWindow *win)
|
||||
{
|
||||
#ifdef DEBUG_SCREEN
|
||||
printf("Screen::RemoveWindow(%s)\n",win?win->GetTitle():"NULL");
|
||||
#endif
|
||||
STRACE_SCREEN(("Screen::RemoveWindow(%s)\n",win?win->GetTitle():"NULL"));
|
||||
if(!win || !win->_winborder)
|
||||
return;
|
||||
|
||||
@ -458,7 +434,7 @@ WinBorder* Screen::GetWindowAt( BPoint pt ){
|
||||
Layer *child;
|
||||
for(child = rl->_bottomchild; child!=NULL; child = child->_uppersibling)
|
||||
{
|
||||
if(child->_hidecount>0)
|
||||
if(child->_hidden)
|
||||
continue;
|
||||
wb = dynamic_cast<WinBorder*>( child );
|
||||
if (wb)
|
||||
|
@ -36,9 +36,6 @@
|
||||
#include "RectUtils.h"
|
||||
#include "RootLayer.h"
|
||||
|
||||
//! TokenHandler object used to provide IDs for all Layers and, thus, BViews
|
||||
TokenHandler view_token_handler;
|
||||
|
||||
/*!
|
||||
\brief Constructor
|
||||
\param frame Size and placement of the Layer
|
||||
@ -47,41 +44,39 @@ TokenHandler view_token_handler;
|
||||
\param flags BView flags as defined in View.h
|
||||
\param win ServerWindow to which the Layer belongs
|
||||
*/
|
||||
Layer::Layer(BRect frame, const char *name, int32 resize, int32 flags,ServerWindow *win)
|
||||
Layer::Layer(BRect frame, const char *name, int32 token, int32 resize,
|
||||
int32 flags, ServerWindow *win)
|
||||
{
|
||||
// frame is in _parent layer's coordinates
|
||||
if(frame.IsValid())
|
||||
_frame=frame;
|
||||
_frame = frame;
|
||||
else
|
||||
_frame.Set(0,0,5,5);
|
||||
|
||||
_name=new BString(name);
|
||||
_frame.Set(0, 0, 5, 5);
|
||||
|
||||
_name = new BString(name);
|
||||
// Layer does not start out as a part of the tree
|
||||
_parent=NULL;
|
||||
_uppersibling=NULL;
|
||||
_lowersibling=NULL;
|
||||
_topchild=NULL;
|
||||
_bottomchild=NULL;
|
||||
_parent = NULL;
|
||||
_uppersibling = NULL;
|
||||
_lowersibling = NULL;
|
||||
_topchild = NULL;
|
||||
_bottomchild = NULL;
|
||||
|
||||
_visible=new BRegion(Frame());
|
||||
_full=new BRegion(Frame());
|
||||
_invalid=new BRegion(Frame());
|
||||
_visible = new BRegion( _frame );
|
||||
_full = new BRegion( _frame );
|
||||
_invalid = new BRegion( _frame );
|
||||
|
||||
_serverwin=win;
|
||||
_flags = flags;
|
||||
_hidden = false;
|
||||
_is_dirty = false;
|
||||
_is_updating = false;
|
||||
_regions_invalid= false;
|
||||
_level = 0;
|
||||
_view_token = token;
|
||||
_layerdata = new LayerData;
|
||||
|
||||
// We have view tokens to be able to identify BViews
|
||||
_view_token=view_token_handler.GetToken();
|
||||
|
||||
_flags=flags;
|
||||
|
||||
_hidecount=0;
|
||||
_is_dirty=false;
|
||||
_is_updating=false;
|
||||
_regions_invalid=false;
|
||||
|
||||
_level=0;
|
||||
_layerdata=new LayerData;
|
||||
_serverwin = win;
|
||||
// what's this needed for?
|
||||
_portlink = NULL;
|
||||
}
|
||||
|
||||
//! Destructor frees all allocated heap space
|
||||
@ -131,7 +126,7 @@ printf("Layer::AddChild lacks before support\n");
|
||||
return;
|
||||
}
|
||||
layer->_parent=this;
|
||||
if(layer->_visible && layer->_hidecount==0 && _visible)
|
||||
if(layer->_visible && layer->_hidden==false && _visible)
|
||||
{
|
||||
RootLayer *rl;
|
||||
rl = dynamic_cast<RootLayer*>(this);
|
||||
@ -142,9 +137,8 @@ printf("Layer::AddChild lacks before support\n");
|
||||
else{
|
||||
// Technically, we could safely take the address of ConvertToParent(BRegion)
|
||||
// but we don't just to avoid a compiler nag
|
||||
BRegion *reg=new BRegion(layer->ConvertToParent(layer->_visible));
|
||||
_visible->Exclude(reg);
|
||||
delete reg;
|
||||
BRegion reg(layer->ConvertToParent(layer->_visible));
|
||||
_visible->Exclude(®);
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,11 +180,10 @@ void Layer::RemoveChild(Layer *layer, bool rebuild)
|
||||
return;
|
||||
}
|
||||
|
||||
if(_hidecount==0 && layer->_visible && layer->_parent->_visible)
|
||||
if( !_hidden && layer->_visible && layer->_parent->_visible)
|
||||
{
|
||||
BRegion *reg=new BRegion(ConvertToParent(_visible));
|
||||
layer->_parent->_visible->Include(reg);
|
||||
delete reg;
|
||||
BRegion reg(ConvertToParent(_visible));
|
||||
layer->_parent->_visible->Include(®);
|
||||
}
|
||||
|
||||
// Take care of _parent
|
||||
@ -252,7 +245,7 @@ Layer *Layer::GetChildAt(BPoint pt, bool recursive)
|
||||
if(child->_bottomchild!=NULL)
|
||||
child->GetChildAt(pt,true);
|
||||
|
||||
if(child->_hidecount>0)
|
||||
if(child->_hidden)
|
||||
continue;
|
||||
|
||||
if(child->_frame.Contains(pt))
|
||||
@ -263,7 +256,7 @@ Layer *Layer::GetChildAt(BPoint pt, bool recursive)
|
||||
{
|
||||
for(child=_bottomchild; child!=NULL; child=child->_uppersibling)
|
||||
{
|
||||
if(child->_hidecount>0)
|
||||
if(child->_hidden)
|
||||
continue;
|
||||
if(child->_frame.Contains(pt))
|
||||
return child;
|
||||
@ -357,7 +350,7 @@ void Layer::Invalidate(BRegion& region)
|
||||
BRect r;
|
||||
|
||||
// See if the region intersects with our current area
|
||||
if(region.Intersects(Bounds()) && _hidecount==0)
|
||||
if(region.Intersects(Bounds()) && !_hidden)
|
||||
{
|
||||
BRegion clippedreg(region);
|
||||
clippedreg.IntersectWith(_visible);
|
||||
@ -374,7 +367,7 @@ void Layer::Invalidate(BRegion& region)
|
||||
BRegion *reg;
|
||||
for(Layer *lay=_topchild;lay!=NULL; lay=lay->_lowersibling)
|
||||
{
|
||||
if(lay->_hidecount==0)
|
||||
if(lay->_hidden==false)
|
||||
{
|
||||
reg=new BRegion(lay->ConvertFromParent(®ion));
|
||||
|
||||
@ -442,7 +435,7 @@ printf("Layer: %s: RequestDraw(%.1f,%.1f,%.1f,%.1f) - unimplemented\n",
|
||||
_name->String(),r.left,r.top,r.right,r.bottom);
|
||||
|
||||
// TODO: Implement and fix
|
||||
/* if(_visible==NULL || _hidecount>0)
|
||||
/* if(_visible==NULL || _hidden)
|
||||
return;
|
||||
|
||||
if(_serverwin)
|
||||
@ -541,18 +534,14 @@ void Layer::UpdateRegions(bool force)
|
||||
//! Show the layer. Operates just like the BView call with the same name
|
||||
void Layer::Show(void)
|
||||
{
|
||||
if(_hidecount==0)
|
||||
return;
|
||||
|
||||
_hidecount--;
|
||||
|
||||
if(_hidecount>0)
|
||||
if( !_hidden )
|
||||
return;
|
||||
|
||||
_hidden = false;
|
||||
|
||||
if( _parent ){
|
||||
BRegion *reg=new BRegion(ConvertToParent(_visible));
|
||||
_parent->_visible->Exclude(reg);
|
||||
delete reg;
|
||||
BRegion reg(ConvertToParent(_visible));
|
||||
_parent->_visible->Exclude( ® );
|
||||
_parent->_is_dirty=true;
|
||||
}
|
||||
_is_dirty=true;
|
||||
@ -581,15 +570,16 @@ void Layer::Show(void)
|
||||
//! Hide the layer. Operates just like the BView call with the same name
|
||||
void Layer::Hide(void)
|
||||
{
|
||||
if(_hidecount==0)
|
||||
{
|
||||
BRegion *reg=new BRegion(ConvertToParent(_visible));
|
||||
_parent->_visible->Include(reg);
|
||||
delete reg;
|
||||
_parent->_is_dirty=true;
|
||||
_is_dirty=true;
|
||||
}
|
||||
_hidecount++;
|
||||
if ( _hidden )
|
||||
return;
|
||||
|
||||
_hidden = true;
|
||||
|
||||
BRegion reg(ConvertToParent(_visible));
|
||||
_parent->_visible->Include( ® );
|
||||
|
||||
_parent->_is_dirty=true;
|
||||
_is_dirty=true;
|
||||
|
||||
Layer *child;
|
||||
for(child=_topchild; child!=NULL; child=child->_lowersibling)
|
||||
@ -602,7 +592,7 @@ void Layer::Hide(void)
|
||||
*/
|
||||
bool Layer::IsHidden(void)
|
||||
{
|
||||
return (_hidecount==0)?false:true;
|
||||
return _hidden;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -714,7 +704,7 @@ void Layer::RebuildRegions(bool include_children)
|
||||
childlay->_visible->MakeEmpty();
|
||||
childlay->_visible->Include(childlay->_full);
|
||||
|
||||
if(childlay->_visible && childlay->_hidecount==0)
|
||||
if(childlay->_visible && childlay->_hidden==false)
|
||||
childlay->_visible->IntersectWith(_visible);
|
||||
|
||||
}
|
||||
@ -734,7 +724,7 @@ void Layer::RebuildRegions(bool include_children)
|
||||
if( clipregion.CountRects()>0 &&
|
||||
TestRectIntersection(siblay->Frame(),clipregion.Frame()) &&
|
||||
siblay->_visible &&
|
||||
siblay->_hidecount==0 )
|
||||
siblay->_hidden==false )
|
||||
{
|
||||
siblay->_visible->Exclude(&clipregion);
|
||||
}
|
||||
@ -779,7 +769,7 @@ void Layer::PrintToStream(void)
|
||||
printf("Bottom child: NULL\n");
|
||||
printf("Frame: "); _frame.PrintToStream();
|
||||
printf("Token: %ld\nLevel: %ld\n",_view_token, _level);
|
||||
printf("Hide count: %u\n",_hidecount);
|
||||
printf("Hide count: %s\n",_hidden?"true":"false");
|
||||
if(_invalid)
|
||||
{
|
||||
printf("Invalid Areas: "); _invalid->PrintToStream();
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <Locker.h>
|
||||
#include "LayerData.h"
|
||||
#include "DesktopClasses.h"
|
||||
#include "TokenHandler.h"
|
||||
|
||||
class ServerWindow;
|
||||
class PortLink;
|
||||
@ -54,8 +55,8 @@ class Screen;
|
||||
class Layer
|
||||
{
|
||||
public:
|
||||
Layer(BRect frame, const char *name, int32 resize,
|
||||
int32 flags,ServerWindow *win);
|
||||
Layer(BRect frame, const char *name, int32 token, int32 resize,
|
||||
int32 flags, ServerWindow *win);
|
||||
virtual ~Layer(void);
|
||||
|
||||
void AddChild(Layer *child, Layer *before=NULL, bool rebuild=true);
|
||||
@ -109,32 +110,28 @@ protected:
|
||||
friend class RootLayer;
|
||||
friend class WinBorder;
|
||||
friend class Screen;
|
||||
|
||||
friend class ServerWindow;
|
||||
|
||||
BRect _frame;
|
||||
|
||||
Layer *_parent,
|
||||
*_uppersibling,
|
||||
*_lowersibling,
|
||||
*_topchild,
|
||||
*_bottomchild;
|
||||
|
||||
BRegion *_visible,
|
||||
*_invalid,
|
||||
*_full;
|
||||
|
||||
ServerWindow *_serverwin;
|
||||
|
||||
BString *_name;
|
||||
int32 _view_token;
|
||||
int32 _level;
|
||||
int32 _flags;
|
||||
uint8 _hidecount;
|
||||
bool _is_dirty;
|
||||
bool _is_updating;
|
||||
bool _regions_invalid;
|
||||
LayerData *_layerdata;
|
||||
PortLink *_portlink;
|
||||
BRect _frame;
|
||||
Layer *_parent,
|
||||
*_uppersibling,
|
||||
*_lowersibling,
|
||||
*_topchild,
|
||||
*_bottomchild;
|
||||
BRegion *_visible,
|
||||
*_invalid,
|
||||
*_full;
|
||||
ServerWindow *_serverwin;
|
||||
BString *_name;
|
||||
int32 _view_token;
|
||||
int32 _level;
|
||||
int32 _flags;
|
||||
bool _hidden;
|
||||
bool _is_dirty;
|
||||
bool _is_updating;
|
||||
bool _regions_invalid;
|
||||
LayerData *_layerdata;
|
||||
PortLink *_portlink;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -388,8 +388,8 @@ status_t PicturePlayer::Play(int32 tableEntries,void *userData, LayerData *d)
|
||||
{
|
||||
int16 alphaSrcMode = GetInt16();
|
||||
int16 alphaFncMode = GetInt16();
|
||||
fldata.alpha_mode=(source_alpha)alphaSrcMode;
|
||||
fldata.blending_mode=(alpha_function)alphaFncMode;
|
||||
fldata.alphaSrcMode = (source_alpha)alphaSrcMode;
|
||||
fldata.alphaFncMode = (alpha_function)alphaFncMode;
|
||||
break;
|
||||
}
|
||||
case B_PIC_SET_FONT_FAMILY:
|
||||
|
@ -30,7 +30,7 @@
|
||||
|
||||
class DisplayDriver;
|
||||
class RGBColor;
|
||||
class Layer;
|
||||
//class Layer;
|
||||
|
||||
/*!
|
||||
\class RootLayer RootLayer.h
|
||||
|
@ -50,6 +50,13 @@
|
||||
#include "LayerData.h"
|
||||
#include "PNGDump.h"
|
||||
|
||||
#ifdef DEBUG_DRIVER_MODULE
|
||||
# include <stdio.h>
|
||||
# define STRACE(x) printf x
|
||||
#else
|
||||
# define STRACE(x) ;
|
||||
#endif
|
||||
|
||||
enum
|
||||
{
|
||||
SDWIN_CLEAR=100,
|
||||
@ -458,9 +465,7 @@ void ScreenDriver::CopyBits(BRect src, BRect dest)
|
||||
|
||||
void ScreenDriver::DrawBitmap(ServerBitmap *bitmap, BRect src, BRect dest)
|
||||
{
|
||||
#ifdef DEBUG_DRIVER_MODULE
|
||||
printf("ScreenDriver:: DrawBitmap unimplemented()\n");
|
||||
#endif
|
||||
STRACE(("ScreenDriver:: DrawBitmap unimplemented()\n"));
|
||||
}
|
||||
|
||||
void ScreenDriver::DrawChar(char c, BPoint pt, LayerData *d)
|
||||
@ -473,9 +478,7 @@ void ScreenDriver::DrawChar(char c, BPoint pt, LayerData *d)
|
||||
/*
|
||||
void ScreenDriver::DrawString(const char *string, int32 length, BPoint pt, LayerData *d, escapement_delta *delta=NULL)
|
||||
{
|
||||
#ifdef DEBUG_DRIVER_MODULE
|
||||
printf("ScreenDriver:: DrawString(\"%s\",%ld,BPoint(%f,%f))\n",string,length,pt.x,pt.y);
|
||||
#endif
|
||||
STRACE(("ScreenDriver:: DrawString(\"%s\",%ld,BPoint(%f,%f))\n",string,length,pt.x,pt.y));
|
||||
if(!d)
|
||||
return;
|
||||
BRect r;
|
||||
@ -770,9 +773,8 @@ void ScreenDriver::StrokeLine(BPoint start, BPoint end, LayerData *d, const Patt
|
||||
|
||||
void ScreenDriver::StrokeLineArray(BPoint *pts, int32 numlines, RGBColor *colors, LayerData *d)
|
||||
{
|
||||
#ifdef DEBUG_DRIVER_MODULE
|
||||
printf("ScreenDriver:: StrokeLineArray unimplemented\n");
|
||||
#endif
|
||||
STRACE(("ScreenDriver:: StrokeLineArray unimplemented\n"));
|
||||
|
||||
}
|
||||
|
||||
void ScreenDriver::StrokePolygon(BPoint *ptlist, int32 numpts, BRect rect, LayerData *d, const Pattern &pat, bool is_closed)
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <View.h> // for B_XXXXX_MOUSE_BUTTON defines
|
||||
#include <GraphicsDefs.h>
|
||||
#include <PortLink.h>
|
||||
#include "AppServer.h"
|
||||
#include "Layer.h"
|
||||
@ -47,11 +48,29 @@
|
||||
//#define DEBUG_SERVERWINDOW_MOUSE
|
||||
//#define DEBUG_SERVERWINDOW_KEYBOARD
|
||||
|
||||
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
#include <stdio.h>
|
||||
# include <stdio.h>
|
||||
# define STRACE(x) printf x
|
||||
#else
|
||||
# define STRACE(x) ;
|
||||
#endif
|
||||
|
||||
//! Handler to get BWindow tokens from
|
||||
#ifdef DEBUG_SERVERWINDOW_KEYBOARD
|
||||
# include <stdio.h>
|
||||
# define STRACE_KEY(x) printf x
|
||||
#else
|
||||
# define STRACE_KEY(x) ;
|
||||
#endif
|
||||
|
||||
#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
|
||||
TokenHandler win_token_handler;
|
||||
|
||||
//! Active winborder - used for tracking windows during moves, resizes, and tab slides
|
||||
@ -106,6 +125,7 @@ ServerWindow::ServerWindow(BRect rect, const char *string, uint32 wlook,
|
||||
_look=wlook;
|
||||
_feel=wfeel;
|
||||
_handlertoken=handlerID;
|
||||
cl = NULL;
|
||||
|
||||
_winborder=new WinBorder(_frame,_title->String(),wlook,wfeel,wflags,this);
|
||||
|
||||
@ -124,6 +144,8 @@ ServerWindow::ServerWindow(BRect rect, const char *string, uint32 wlook,
|
||||
ses->WriteData( &_receiver, sizeof(port_id) );
|
||||
ses->Sync();
|
||||
|
||||
top_layer = NULL;
|
||||
|
||||
_active=false;
|
||||
|
||||
// Spawn our message monitoring _monitorthread
|
||||
@ -137,20 +159,16 @@ ServerWindow::ServerWindow(BRect rect, const char *string, uint32 wlook,
|
||||
_token=win_token_handler.GetToken();
|
||||
|
||||
AddWindowToDesktop(this,index,ActiveScreen());
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s:\n",_title->String());
|
||||
printf("\tFrame (%.1f,%.1f,%.1f,%.1f)\n",rect.left,rect.top,rect.right,rect.bottom);
|
||||
printf("\tPort: %ld\n",_receiver);
|
||||
printf("\tWorkspace: %ld\n",index);
|
||||
#endif
|
||||
STRACE(("ServerWindow %s:\n",_title->String() ));
|
||||
STRACE(("\tFrame (%.1f,%.1f,%.1f,%.1f)\n",rect.left,rect.top,rect.right,rect.bottom));
|
||||
STRACE(("\tPort: %ld\n",_receiver));
|
||||
STRACE(("\tWorkspace: %ld\n",index));
|
||||
}
|
||||
|
||||
//!Tears down all connections with the user application, kills the monitoring thread.
|
||||
ServerWindow::~ServerWindow(void)
|
||||
{
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s:~ServerWindow()\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s:~ServerWindow()\n",_title->String()));
|
||||
RemoveWindowFromDesktop(this);
|
||||
if(_applink)
|
||||
{
|
||||
@ -160,7 +178,9 @@ ServerWindow::~ServerWindow(void)
|
||||
delete _winlink;
|
||||
delete _winborder;
|
||||
|
||||
|
||||
cl = NULL;
|
||||
if ( top_layer )
|
||||
delete top_layer;
|
||||
delete ses;
|
||||
ses = NULL;
|
||||
}
|
||||
@ -175,9 +195,7 @@ ServerWindow::~ServerWindow(void)
|
||||
*/
|
||||
void ServerWindow::RequestDraw(BRect rect)
|
||||
{
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Request Draw\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Request Draw\n",_title->String()));
|
||||
_winlink->SetOpCode(AS_LAYER_DRAW);
|
||||
_winlink->Attach(&rect,sizeof(BRect));
|
||||
_winlink->Flush();
|
||||
@ -192,18 +210,14 @@ void ServerWindow::RequestDraw(void)
|
||||
//! Forces the window border to update its decorator
|
||||
void ServerWindow::ReplaceDecorator(void)
|
||||
{
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Replace Decorator\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Replace Decorator\n",_title->String()));
|
||||
_winborder->UpdateDecorator();
|
||||
}
|
||||
|
||||
//! Requests that the ServerWindow's BWindow quit
|
||||
void ServerWindow::Quit(void)
|
||||
{
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Quit\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Quit\n",_title->String()));
|
||||
_winlink->SetOpCode(B_QUIT_REQUESTED);
|
||||
_winlink->Flush();
|
||||
}
|
||||
@ -229,9 +243,7 @@ ServerApp *ServerWindow::GetApp(void)
|
||||
//! Shows the window's WinBorder
|
||||
void ServerWindow::Show(void)
|
||||
{
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Show\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Show\n",_title->String()));
|
||||
if(_winborder)
|
||||
{
|
||||
_winborder->Show();
|
||||
@ -243,9 +255,7 @@ void ServerWindow::Show(void)
|
||||
//! Hides the window's WinBorder
|
||||
void ServerWindow::Hide(void)
|
||||
{
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Hide\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Hide\n",_title->String()));
|
||||
if(_winborder)
|
||||
_winborder->Hide();
|
||||
}
|
||||
@ -268,9 +278,7 @@ bool ServerWindow::IsHidden(void)
|
||||
*/
|
||||
void ServerWindow::SetFocus(bool value)
|
||||
{
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Set Focus to %s\n",_title->String(),value?"true":"false");
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Set Focus to %s\n",_title->String(),value?"true":"false"));
|
||||
if(_active!=value)
|
||||
{
|
||||
_active=value;
|
||||
@ -295,9 +303,7 @@ bool ServerWindow::HasFocus(void)
|
||||
*/
|
||||
void ServerWindow::WorkspaceActivated(int32 workspace, bool active)
|
||||
{
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: WorkspaceActivated(%ld,%s)\n",_title->String(),workspace,(active)?"active":"inactive");
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: WorkspaceActivated(%ld,%s)\n",_title->String(),workspace,(active)?"active":"inactive"));
|
||||
_winlink->SetOpCode(AS_WORKSPACE_ACTIVATED);
|
||||
_winlink->Attach<int32>(workspace);
|
||||
_winlink->Attach<bool>(active);
|
||||
@ -311,9 +317,7 @@ void ServerWindow::WorkspaceActivated(int32 workspace, bool active)
|
||||
*/
|
||||
void ServerWindow::WorkspacesChanged(int32 oldone,int32 newone)
|
||||
{
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: WorkspacesChanged(%ld,%ld)\n",_title->String(),oldone,newone);
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: WorkspacesChanged(%ld,%ld)\n",_title->String(),oldone,newone));
|
||||
_winlink->SetOpCode(AS_WORKSPACES_CHANGED);
|
||||
_winlink->Attach<int32>(oldone);
|
||||
_winlink->Attach<int32>(newone);
|
||||
@ -326,9 +330,7 @@ void ServerWindow::WorkspacesChanged(int32 oldone,int32 newone)
|
||||
*/
|
||||
void ServerWindow::WindowActivated(bool active)
|
||||
{
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: WindowActivated(%s)\n",_title->String(),(active)?"active":"inactive");
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: WindowActivated(%s)\n",_title->String(),(active)?"active":"inactive"));
|
||||
_winlink->SetOpCode(AS_WINDOW_ACTIVATED);
|
||||
_winlink->Attach<bool>(active);
|
||||
_winlink->Flush();
|
||||
@ -341,9 +343,7 @@ void ServerWindow::WindowActivated(bool active)
|
||||
*/
|
||||
void ServerWindow::ScreenModeChanged(const BRect frame, const color_space cspace)
|
||||
{
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: ScreenModeChanged\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: ScreenModeChanged\n",_title->String()));
|
||||
_winlink->SetOpCode(AS_SCREENMODE_CHANGED);
|
||||
_winlink->Attach<BRect>(frame);
|
||||
_winlink->Attach(&cspace,sizeof(color_space));
|
||||
@ -356,10 +356,8 @@ void ServerWindow::ScreenModeChanged(const BRect frame, const color_space cspace
|
||||
*/
|
||||
void ServerWindow::SetFrame(const BRect &rect)
|
||||
{
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Set Frame to (%.1f,%.1f,%.1f,%.1f)\n",_title->String(),
|
||||
rect.left,rect.top,rect.right,rect.bottom);
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Set Frame to (%.1f,%.1f,%.1f,%.1f)\n",_title->String(),
|
||||
rect.left,rect.top,rect.right,rect.bottom));
|
||||
_frame=rect;
|
||||
}
|
||||
|
||||
@ -378,18 +376,14 @@ BRect ServerWindow::Frame(void)
|
||||
*/
|
||||
status_t ServerWindow::Lock(void)
|
||||
{
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Lock\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Lock\n",_title->String()));
|
||||
return (_locker.Lock())?B_OK:B_ERROR;
|
||||
}
|
||||
|
||||
//! Unlocks the window
|
||||
void ServerWindow::Unlock(void)
|
||||
{
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Unlock\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Unlock\n",_title->String()));
|
||||
_locker.Unlock();
|
||||
}
|
||||
|
||||
@ -406,28 +400,64 @@ void ServerWindow::DispatchMessage( int32 code )
|
||||
{
|
||||
switch( code )
|
||||
{
|
||||
/********** BView Messages ***********/
|
||||
case AS_SET_CURRENT_LAYER:
|
||||
{
|
||||
int32 token;
|
||||
|
||||
ses->ReadInt32( &token );
|
||||
|
||||
Layer *current = FindLayer( top_layer, token );
|
||||
if (current)
|
||||
cl = current;
|
||||
else // hope this NEVER happens! :-)
|
||||
printf("!Server PANIC: window %s: cannot find Layer with ID %ld\n", _title->String(), token);
|
||||
|
||||
STRACE(("ServerWindow %s: Message Set_Current_Layer: Layer ID: %ld\n", _title->String(), token));
|
||||
break;
|
||||
}
|
||||
case AS_LAYER_CREATE:
|
||||
{
|
||||
// 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.
|
||||
|
||||
// Attached Data:
|
||||
// 1) (int32) id of the parent view
|
||||
// 2) (BRect) frame in parent's coordinates
|
||||
// 3) (int32) resize flags
|
||||
// 4) (int32) view flags
|
||||
// 5) (uint16) view's hide level
|
||||
Layer *oldCL = cl;
|
||||
|
||||
// This is a synchronous call, so reply immediately with the ID of the layer
|
||||
// so the BView can identify itself
|
||||
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Create_Layer unimplemented\n",_title->String());
|
||||
#endif
|
||||
|
||||
int32 token;
|
||||
BRect frame;
|
||||
uint32 resizeMask;
|
||||
uint32 flags;
|
||||
int32 childCount;
|
||||
char* name;
|
||||
|
||||
ses->ReadInt32( &token );
|
||||
name = ses->ReadString();
|
||||
ses->ReadRect( &frame );
|
||||
ses->ReadInt32( (int32*)&resizeMask );
|
||||
ses->ReadInt32( (int32*)&flags );
|
||||
ses->ReadInt32( &childCount );
|
||||
|
||||
Layer *newLayer;
|
||||
newLayer = new Layer(frame, name, token, resizeMask, flags, this);
|
||||
|
||||
// TODO: review Layer::AddChild
|
||||
cl->AddChild( newLayer );
|
||||
|
||||
cl = newLayer;
|
||||
|
||||
int32 msgCode;
|
||||
ses->ReadInt32( &msgCode ); // this is AS_LAYER_SET_STATE
|
||||
DispatchMessage( msgCode );
|
||||
|
||||
for(int i = 0; i < childCount; i++){
|
||||
ses->ReadInt32( &msgCode ); // this is AS_LAYER_CREATE
|
||||
DispatchMessage( msgCode );
|
||||
}
|
||||
|
||||
cl = oldCL;
|
||||
|
||||
STRACE(("ServerWindow %s: Message Create_Layer unimplemented\n",_title->String()));
|
||||
break;
|
||||
}
|
||||
case AS_LAYER_DELETE:
|
||||
@ -441,21 +471,86 @@ void ServerWindow::DispatchMessage( int32 code )
|
||||
// 1) (int32) id of the removed view
|
||||
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Delete_Layer unimplemented\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Message Delete_Layer unimplemented\n",_title->String()));
|
||||
|
||||
break;
|
||||
}
|
||||
case AS_LAYER_SET_STATE:
|
||||
{
|
||||
rgb_color highColor,
|
||||
lowColor,
|
||||
viewColor;
|
||||
pattern patt;
|
||||
int32 clippRegRects;
|
||||
|
||||
ses->ReadPoint( &(cl->_layerdata->penlocation) );
|
||||
ses->ReadFloat( &(cl->_layerdata->pensize) );
|
||||
ses->ReadData( &highColor, sizeof(rgb_color) );
|
||||
ses->ReadData( &lowColor, sizeof(rgb_color) );
|
||||
ses->ReadData( &viewColor, sizeof(rgb_color) );
|
||||
ses->ReadData( &patt, sizeof(pattern) );
|
||||
ses->ReadInt8( (int8*)&(cl->_layerdata->draw_mode) );
|
||||
ses->ReadPoint( &(cl->_layerdata->coordOrigin) );
|
||||
ses->ReadInt8( (int8*)&(cl->_layerdata->lineJoin) );
|
||||
ses->ReadInt8( (int8*)&(cl->_layerdata->lineCap) );
|
||||
ses->ReadFloat( &(cl->_layerdata->miterLimit) );
|
||||
ses->ReadInt8( (int8*)&(cl->_layerdata->alphaSrcMode) );
|
||||
ses->ReadInt8( (int8*)&(cl->_layerdata->alphaFncMode) );
|
||||
ses->ReadFloat( &(cl->_layerdata->scale) );
|
||||
ses->ReadBool( &(cl->_layerdata->fontAliasing) );
|
||||
ses->ReadInt32( &clippRegRects );
|
||||
|
||||
cl->_layerdata->patt.Set( (int8*)&patt );
|
||||
cl->_layerdata->highcolor.SetColor( highColor );
|
||||
cl->_layerdata->lowcolor.SetColor( lowColor );
|
||||
cl->_layerdata->viewcolor.SetColor( viewColor );
|
||||
|
||||
if( clippRegRects != 0 ){
|
||||
if( cl->_layerdata->clippReg == NULL)
|
||||
cl->_layerdata->clippReg = new BRegion();
|
||||
else
|
||||
cl->_layerdata->clippReg->MakeEmpty();
|
||||
|
||||
BRect rect;
|
||||
|
||||
for( int32 i = 0; i < clippRegRects; i++){
|
||||
ses->ReadRect( &rect );
|
||||
cl->_layerdata->clippReg->Include( rect );
|
||||
}
|
||||
}
|
||||
else{
|
||||
if ( cl->_layerdata->clippReg ){
|
||||
delete cl->_layerdata->clippReg;
|
||||
cl->_layerdata->clippReg = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
STRACE(("ServerWindow %s: Message Layer_Set_State\n",_title->String()));
|
||||
break;
|
||||
}
|
||||
|
||||
/********** END: BView Messages ***********/
|
||||
|
||||
/********** BWindow Messages ***********/
|
||||
case AS_LAYER_CREATE_ROOT:
|
||||
{
|
||||
// Received when a window creates its internal top view
|
||||
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Create_Layer_Root unimplemented\n",_title->String());
|
||||
#endif
|
||||
|
||||
int32 token;
|
||||
BRect frame;
|
||||
uint32 resizeMode;
|
||||
uint32 flags;
|
||||
char* name = NULL;
|
||||
|
||||
ses->ReadInt32( &token );
|
||||
ses->ReadRect( &frame );
|
||||
ses->ReadInt32( (int32*)&resizeMode );
|
||||
ses->ReadInt32( (int32*)&flags );
|
||||
name = ses->ReadString();
|
||||
|
||||
top_layer = new Layer( frame, name, token, resizeMode,
|
||||
flags, this );
|
||||
|
||||
STRACE(("ServerWindow %s: Message Create_Layer_Root\n",_title->String()));
|
||||
break;
|
||||
}
|
||||
case AS_LAYER_DELETE_ROOT:
|
||||
@ -463,183 +558,140 @@ void ServerWindow::DispatchMessage( int32 code )
|
||||
// Received when a window deletes its internal top view
|
||||
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Delete_Layer_Root unimplemented\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Message Delete_Layer_Root unimplemented\n",_title->String()));
|
||||
|
||||
break;
|
||||
}
|
||||
case AS_SHOW_WINDOW:
|
||||
{
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message AS_SHOW\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Message AS_SHOW\n",_title->String()));
|
||||
Show();
|
||||
break;
|
||||
}
|
||||
case AS_HIDE_WINDOW:
|
||||
{
|
||||
STRACE(("ServerWindow %s: Message AS_HIDE\n",_title->String()));
|
||||
Hide();
|
||||
break;
|
||||
}
|
||||
case AS_SEND_BEHIND:
|
||||
{
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Send_Behind unimplemented\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Message Send_Behind unimplemented\n",_title->String()));
|
||||
break;
|
||||
}
|
||||
case AS_ENABLE_UPDATES:
|
||||
{
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Enable_Updates unimplemented\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Message Enable_Updates unimplemented\n",_title->String()));
|
||||
break;
|
||||
}
|
||||
case AS_DISABLE_UPDATES:
|
||||
{
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Disable_Updates unimplemented\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Message Disable_Updates unimplemented\n",_title->String()));
|
||||
break;
|
||||
}
|
||||
case AS_NEEDS_UPDATE:
|
||||
{
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Needs_Update unimplemented\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Message Needs_Update unimplemented\n",_title->String()));
|
||||
break;
|
||||
}
|
||||
case AS_WINDOW_TITLE:
|
||||
{
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Set_Title unimplemented\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Message Set_Title unimplemented\n",_title->String()));
|
||||
break;
|
||||
}
|
||||
case AS_ADD_TO_SUBSET:
|
||||
{
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Add_To_Subset unimplemented\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Message Add_To_Subset unimplemented\n",_title->String()));
|
||||
break;
|
||||
}
|
||||
case AS_REM_FROM_SUBSET:
|
||||
{
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Remove_From_Subset unimplemented\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Message Remove_From_Subset unimplemented\n",_title->String()));
|
||||
break;
|
||||
}
|
||||
case AS_SET_LOOK:
|
||||
{
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Set_Look unimplemented\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Message Set_Look unimplemented\n",_title->String()));
|
||||
break;
|
||||
}
|
||||
case AS_SET_FLAGS:
|
||||
{
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Set_Flags unimplemented\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Message Set_Flags unimplemented\n",_title->String()));
|
||||
break;
|
||||
}
|
||||
case AS_SET_FEEL:
|
||||
{
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Set_Feel unimplemented\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Message Set_Feel unimplemented\n",_title->String()));
|
||||
break;
|
||||
}
|
||||
case AS_SET_ALIGNMENT:
|
||||
{
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Set_Alignment unimplemented\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Message Set_Alignment unimplemented\n",_title->String()));
|
||||
break;
|
||||
}
|
||||
case AS_GET_ALIGNMENT:
|
||||
{
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Get_Alignment unimplemented\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Message Get_Alignment unimplemented\n",_title->String()));
|
||||
break;
|
||||
}
|
||||
case AS_GET_WORKSPACES:
|
||||
{
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Get_Workspaces unimplemented\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Message Get_Workspaces unimplemented\n",_title->String()));
|
||||
break;
|
||||
}
|
||||
case AS_SET_WORKSPACES:
|
||||
{
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Set_Workspaces unimplemented\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Message Set_Workspaces unimplemented\n",_title->String()));
|
||||
break;
|
||||
}
|
||||
case AS_WINDOW_RESIZE:
|
||||
{
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Resize unimplemented\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Message Resize unimplemented\n",_title->String()));
|
||||
break;
|
||||
}
|
||||
case B_MINIMIZE:
|
||||
{
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Minimize unimplemented\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Message Minimize unimplemented\n",_title->String()));
|
||||
break;
|
||||
}
|
||||
case B_WINDOW_ACTIVATED:
|
||||
{
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Window_Activated unimplemented\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Message Window_Activated unimplemented\n",_title->String()));
|
||||
break;
|
||||
}
|
||||
case B_ZOOM:
|
||||
{
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Zoom unimplemented\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Message Zoom unimplemented\n",_title->String()));
|
||||
break;
|
||||
}
|
||||
case B_WINDOW_MOVE_TO:
|
||||
{
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Move_To unimplemented\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Message Move_To unimplemented\n",_title->String()));
|
||||
break;
|
||||
}
|
||||
case B_WINDOW_MOVE_BY:
|
||||
{
|
||||
// TODO: Implement
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Message Move_By unimplemented\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Message Move_By unimplemented\n",_title->String()));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -1207,9 +1259,7 @@ int32 ServerWindow::MonitorWin(void *data)
|
||||
if ( rv != B_BAD_PORT_ID ){
|
||||
switch( code ){
|
||||
case B_QUIT_REQUESTED:{
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s received Quit request\n",win->Title());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s received Quit request\n",win->Title()));
|
||||
// Our BWindow sent us this message when it quit.
|
||||
// We need to ask its ServerApp to delete our monitor
|
||||
win->_applink->SetOpCode(AS_DELETE_WINDOW);
|
||||
@ -1377,9 +1427,7 @@ void ServerWindow::HandleMouseEvent(PortMessage *msg)
|
||||
*/
|
||||
void ServerWindow::HandleKeyEvent(int32 code, int8 *buffer)
|
||||
{
|
||||
#ifdef DEBUG_SERVERWINDOW_KEYBOARD
|
||||
printf("ServerWindow::HandleKeyEvent unimplemented\n");
|
||||
#endif
|
||||
STRACE_KEY(("ServerWindow::HandleKeyEvent unimplemented\n"));
|
||||
/* ServerWindow *keywin=NULL;
|
||||
|
||||
// Dispatch the key event to the active window
|
||||
@ -1413,20 +1461,41 @@ Workspace *ServerWindow::GetWorkspace(void)
|
||||
*/
|
||||
void ServerWindow::SetWorkspace(Workspace *wkspc)
|
||||
{
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ServerWindow %s: Set Workspace\n",_title->String());
|
||||
#endif
|
||||
STRACE(("ServerWindow %s: Set Workspace\n",_title->String()));
|
||||
_workspace=wkspc;
|
||||
}
|
||||
|
||||
Layer* ServerWindow::FindLayer(const Layer* start, int32 token) const
|
||||
{
|
||||
if( !start )
|
||||
return NULL;
|
||||
|
||||
Layer *c = start->_topchild; //c = short for: current
|
||||
if( c != NULL )
|
||||
while( c != start ){
|
||||
if( c->_view_token == token )
|
||||
return c;
|
||||
|
||||
if( c->_topchild )
|
||||
c = c->_topchild;
|
||||
else
|
||||
if( c->_lowersibling )
|
||||
c = c->_lowersibling;
|
||||
else
|
||||
c = c->_parent;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
|
||||
/*!
|
||||
\brief Handles window activation stuff. Called by Desktop functions
|
||||
*/
|
||||
void ActivateWindow(ServerWindow *oldwin,ServerWindow *newwin)
|
||||
{
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
printf("ActivateWindow: old=%s, new=%s\n",oldwin?oldwin->Title():"NULL",newwin?newwin->Title():"NULL");
|
||||
#endif
|
||||
STRACE(("ActivateWindow: old=%s, new=%s\n",oldwin?oldwin->Title():"NULL",newwin?newwin->Title():"NULL"));
|
||||
if(oldwin==newwin)
|
||||
return;
|
||||
|
||||
|
@ -36,8 +36,6 @@
|
||||
#include <Window.h>
|
||||
#include <PortMessage.h>
|
||||
|
||||
#include <Session.h>
|
||||
|
||||
class BString;
|
||||
class BMessenger;
|
||||
class BPoint;
|
||||
@ -46,6 +44,8 @@ class Decorator;
|
||||
class PortLink;
|
||||
class WinBorder;
|
||||
class Workspace;
|
||||
class BSession;
|
||||
class Layer;
|
||||
|
||||
/*!
|
||||
\class ServerWindow ServerWindow.h
|
||||
@ -100,6 +100,8 @@ public:
|
||||
|
||||
//! Returns the window's title
|
||||
const char *Title(void) { return _title->String(); }
|
||||
|
||||
Layer* FindLayer(const Layer* start, int32 token) const;
|
||||
protected:
|
||||
friend class ServerApp;
|
||||
friend class WinBorder;
|
||||
@ -124,7 +126,9 @@ protected:
|
||||
int32 _handlertoken;
|
||||
|
||||
// ADI:
|
||||
BSession *ses;
|
||||
BSession* ses;
|
||||
Layer* top_layer;
|
||||
Layer* cl; // short for currentLayer. We'll use it a lot, that's why it's short :-)
|
||||
};
|
||||
|
||||
void ActivateWindow(ServerWindow *oldwin,ServerWindow *newwin);
|
||||
|
Loading…
Reference in New Issue
Block a user