New window manager comming in.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11513 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
f8411ab138
commit
e438905abd
@ -37,6 +37,7 @@
|
||||
#include "RootLayer.h"
|
||||
#include "ServerConfig.h"
|
||||
#include "ServerScreen.h"
|
||||
#include "ServerApp.h"
|
||||
#include "ServerWindow.h"
|
||||
#include "ViewDriver.h"
|
||||
#include "DirectDriver.h"
|
||||
@ -158,23 +159,25 @@ void Desktop::InitMode(void)
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
inline
|
||||
Screen* Desktop::ScreenAt(int32 index) const
|
||||
{
|
||||
Screen *sc= static_cast<Screen*>(fScreenList.ItemAt(index));
|
||||
|
||||
return sc;
|
||||
return static_cast<Screen*>(fScreenList.ItemAt(index));
|
||||
}
|
||||
|
||||
inline
|
||||
int32 Desktop::ScreenCount(void) const
|
||||
{
|
||||
return fScreenList.CountItems();
|
||||
}
|
||||
|
||||
inline
|
||||
Screen* Desktop::ActiveScreen(void) const
|
||||
{
|
||||
return fActiveScreen;
|
||||
}
|
||||
|
||||
inline
|
||||
void Desktop::SetActiveRootLayerByIndex(int32 listIndex)
|
||||
{
|
||||
RootLayer *rl=RootLayerAt(listIndex);
|
||||
@ -183,6 +186,7 @@ void Desktop::SetActiveRootLayerByIndex(int32 listIndex)
|
||||
SetActiveRootLayer(rl);
|
||||
}
|
||||
|
||||
inline
|
||||
void Desktop::SetActiveRootLayer(RootLayer* rl)
|
||||
{
|
||||
if (fActiveRootLayer == rl)
|
||||
@ -196,6 +200,7 @@ RootLayer* Desktop::ActiveRootLayer(void) const
|
||||
return fActiveRootLayer;
|
||||
}
|
||||
|
||||
inline
|
||||
int32 Desktop::ActiveRootLayerIndex(void) const
|
||||
{
|
||||
int32 rootLayerCount = CountRootLayers();
|
||||
@ -207,18 +212,19 @@ int32 Desktop::ActiveRootLayerIndex(void) const
|
||||
return -1;
|
||||
}
|
||||
|
||||
inline
|
||||
RootLayer* Desktop::RootLayerAt(int32 index)
|
||||
{
|
||||
RootLayer *rl=static_cast<RootLayer*>(fRootLayerList.ItemAt(index));
|
||||
|
||||
return rl;
|
||||
return static_cast<RootLayer*>(fRootLayerList.ItemAt(index));
|
||||
}
|
||||
|
||||
inline
|
||||
int32 Desktop::CountRootLayers() const
|
||||
{
|
||||
return fRootLayerList.CountItems();
|
||||
}
|
||||
|
||||
inline
|
||||
DisplayDriver* Desktop::GetDisplayDriver() const
|
||||
{
|
||||
return ScreenAt(0)->DDriver();
|
||||
@ -228,55 +234,215 @@ DisplayDriver* Desktop::GetDisplayDriver() const
|
||||
// Methods for layer(WinBorder) manipulation.
|
||||
//---------------------------------------------------------------------------
|
||||
|
||||
|
||||
void Desktop::AddWinBorder(WinBorder* winBorder)
|
||||
void Desktop::AddWinBorder(WinBorder *winBorder)
|
||||
{
|
||||
desktop->fGeneralLock.Lock();
|
||||
|
||||
if(fWinBorderList.HasItem(winBorder))
|
||||
if (!winBorder)
|
||||
return;
|
||||
|
||||
// special case for Tracker background window.
|
||||
if (winBorder->Level() == B_SYSTEM_LAST)
|
||||
{
|
||||
// it's added in all RottLayers
|
||||
for(int32 i=0; i<fRootLayerList.CountItems(); i++)
|
||||
((RootLayer*)fRootLayerList.ItemAt(i))->AddWinBorder(winBorder);
|
||||
}
|
||||
else
|
||||
// other windows are added to the current RootLayer only.
|
||||
ActiveRootLayer()->AddWinBorder(winBorder);
|
||||
int32 feel = winBorder->Window()->Feel();
|
||||
|
||||
// add that pointer to user winboder list so that we can keep track of them.
|
||||
fLayerLock.Lock();
|
||||
// we're playing with window list. lock first.
|
||||
Lock();
|
||||
|
||||
if (fWinBorderList.HasItem(winBorder))
|
||||
{
|
||||
Unlock();
|
||||
debugger("AddWinBorder: WinBorder already in Desktop list\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// we have a new window. store a record of it.
|
||||
fWinBorderList.AddItem(winBorder);
|
||||
fLayerLock.Unlock();
|
||||
|
||||
desktop->fGeneralLock.Unlock();
|
||||
// add FLOATING_APP windows to the local list of all normal windows.
|
||||
// This is to keep the order all floating windows (app or subset) when we go from
|
||||
// one normal window to another.
|
||||
if (feel == B_FLOATING_APP_WINDOW_FEEL)
|
||||
{
|
||||
WinBorder *wb = NULL;
|
||||
int32 count = fWinBorderList.CountItems();
|
||||
|
||||
for(int32 i = 0; i < count; i++)
|
||||
{
|
||||
wb = (WinBorder*)fWinBorderList.ItemAt(i);
|
||||
if (wb->App()->ClientTeamID() == winBorder->App()->ClientTeamID()
|
||||
&& wb->Window()->Feel() == B_NORMAL_WINDOW_FEEL)
|
||||
// R2: RootLayer comparison is needed.
|
||||
{
|
||||
wb->fFMWList.AddWinBorder(winBorder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add application's list of modal windows.
|
||||
if (feel == B_MODAL_APP_WINDOW_FEEL)
|
||||
{
|
||||
winBorder->App()->fAppFMWList.AddWinBorder(winBorder);
|
||||
}
|
||||
|
||||
// hey, unlock!
|
||||
Unlock();
|
||||
|
||||
// R2: how to determine the RootLayer to which this window should be added???
|
||||
// for now, use ActiveRootLayer() because we only have one instance.
|
||||
|
||||
// these are added to windows's FMWList and Workspaces when
|
||||
// BWindow::AddToSubset() is called. not now.
|
||||
if (feel != B_FLOATING_SUBSET_WINDOW_FEEL && feel != B_MODAL_SUBSET_WINDOW_FEEL)
|
||||
{
|
||||
// send WinBorder to be added to workspaces
|
||||
ActiveRootLayer()->AddWinBorder(winBorder);
|
||||
}
|
||||
}
|
||||
|
||||
void Desktop::RemoveWinBorder(WinBorder* winBorder)
|
||||
void Desktop::RemoveWinBorder(WinBorder *winBorder)
|
||||
{
|
||||
desktop->fGeneralLock.Lock();
|
||||
if (!winBorder)
|
||||
return;
|
||||
|
||||
if(winBorder->Level() == B_SYSTEM_LAST)
|
||||
// we're playing with window list. lock first.
|
||||
Lock();
|
||||
|
||||
// remove from main WinBorder list.
|
||||
if (fWinBorderList.RemoveItem(winBorder))
|
||||
{
|
||||
for(int32 i=0; i<fRootLayerList.CountItems(); i++)
|
||||
((RootLayer*)fRootLayerList.ItemAt(i))->RemoveWinBorder(winBorder);
|
||||
int32 feel = winBorder->Window()->Feel();
|
||||
|
||||
// floating app/subset and modal_subset windows require special atention because
|
||||
// they are/may_be added to the list of a lot normal windows.
|
||||
if (feel == B_FLOATING_SUBSET_WINDOW_FEEL
|
||||
|| feel == B_MODAL_SUBSET_WINDOW_FEEL
|
||||
|| feel == B_FLOATING_APP_WINDOW_FEEL)
|
||||
{
|
||||
WinBorder *wb = NULL;
|
||||
int32 count = fWinBorderList.CountItems();
|
||||
|
||||
for (int32 i = 0; i < count; i++)
|
||||
{
|
||||
wb = (WinBorder*)fWinBorderList.ItemAt(i);
|
||||
|
||||
if (wb->Window()->Feel() == B_NORMAL_WINDOW_FEEL
|
||||
&& wb->App()->ClientTeamID() == winBorder->App()->ClientTeamID())
|
||||
// R2: RootLayer comparison is needed. We'll see.
|
||||
{
|
||||
wb->fFMWList.RemoveItem(winBorder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// remove from application's list
|
||||
if (feel == B_MODAL_APP_WINDOW_FEEL)
|
||||
{
|
||||
winBorder->App()->fAppFMWList.RemoveItem(winBorder);
|
||||
}
|
||||
}
|
||||
else
|
||||
winBorder->GetRootLayer()->RemoveWinBorder(winBorder);
|
||||
{
|
||||
Unlock();
|
||||
debugger("RemoveWinBorder: WinBorder not found in Desktop list\n");
|
||||
return;
|
||||
}
|
||||
|
||||
fLayerLock.Lock();
|
||||
fWinBorderList.RemoveItem(winBorder);
|
||||
fLayerLock.Unlock();
|
||||
// unlock!
|
||||
Unlock();
|
||||
|
||||
// Tell to winBorder's RootLayer about this.
|
||||
ActiveRootLayer()->RemoveWinBorder(winBorder);
|
||||
|
||||
desktop->fGeneralLock.Unlock();
|
||||
}
|
||||
|
||||
bool Desktop::HasWinBorder(WinBorder* winBorder)
|
||||
void Desktop::AddWinBorderToSubset(WinBorder *winBorder, WinBorder *toWinBorder)
|
||||
{
|
||||
return fWinBorderList.HasItem(winBorder);
|
||||
// we're playing with window list. lock first.
|
||||
Lock();
|
||||
|
||||
if (!winBorder || !toWinBorder
|
||||
|| !fWinBorderList.HasItem(winBorder) || !fWinBorderList.HasItem(toWinBorder))
|
||||
{
|
||||
Unlock();
|
||||
debugger("AddWinBorderToSubset: NULL WinBorder or not found in Desktop list\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if ( (winBorder->Window()->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL
|
||||
|| winBorder->Window()->Feel() == B_MODAL_SUBSET_WINDOW_FEEL)
|
||||
&& toWinBorder->Window()->Feel() == B_NORMAL_WINDOW_FEEL
|
||||
&& toWinBorder->App()->ClientTeamID() == winBorder->App()->ClientTeamID()
|
||||
&& !toWinBorder->fFMWList.HasItem(winBorder))
|
||||
{
|
||||
// add to normal_window's list
|
||||
toWinBorder->fFMWList.AddWinBorder(winBorder);
|
||||
}
|
||||
else
|
||||
{
|
||||
Unlock();
|
||||
debugger("AddWinBorderToSubset: you must add a subset_window to a normal_window's subset with the same team_id\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// hey, unlock!
|
||||
Unlock();
|
||||
|
||||
// send WinBorder to be added to workspaces, if not already in there.
|
||||
ActiveRootLayer()->AddSubsetWinBorder(winBorder, toWinBorder);
|
||||
}
|
||||
|
||||
void Desktop::RemoveWinBorderFromSubset(WinBorder *winBorder, WinBorder *fromWinBorder)
|
||||
{
|
||||
// we're playing with window list. lock first.
|
||||
Lock();
|
||||
|
||||
if (!winBorder || !fromWinBorder
|
||||
|| !fWinBorderList.HasItem(winBorder) || !fWinBorderList.HasItem(fromWinBorder))
|
||||
{
|
||||
Unlock();
|
||||
debugger("RemoveWinBorderFromSubset: NULL WinBorder or not found in Desktop list\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (fromWinBorder->Window()->Feel() == B_NORMAL_WINDOW_FEEL)
|
||||
{
|
||||
//remove from this normal_window's subset.
|
||||
fromWinBorder->fFMWList.RemoveItem(winBorder);
|
||||
}
|
||||
else
|
||||
{
|
||||
Unlock();
|
||||
debugger("RemoveWinBorderFromSubset: you must remove a subset_window from a normal_window's subset\n");
|
||||
return;
|
||||
}
|
||||
|
||||
// hey, unlock!
|
||||
Unlock();
|
||||
|
||||
// remove WinBorder from workspace, if needed - some other windows may still have it in their subset
|
||||
ActiveRootLayer()->RemoveSubsetWinBorder(winBorder, fromWinBorder);
|
||||
}
|
||||
|
||||
inline
|
||||
bool Desktop::HasWinBorder(WinBorder *winBorder)
|
||||
{
|
||||
bool isIn = false;
|
||||
Lock();
|
||||
isIn = fWinBorderList.HasItem(winBorder);
|
||||
Unlock();
|
||||
return isIn;
|
||||
}
|
||||
|
||||
WinBorder* Desktop::FindWinBorderByServerWindowTokenAndTeamID(int32 token, team_id teamID)
|
||||
{
|
||||
WinBorder* wb;
|
||||
|
||||
Lock();
|
||||
for (int32 i = 0; (wb = (WinBorder*)fWinBorderList.ItemAt(i)); i++)
|
||||
{
|
||||
if (wb->Window()->ClientToken() == token
|
||||
&& wb->Window()->ClientTeamID() == teamID)
|
||||
break;
|
||||
}
|
||||
Unlock();
|
||||
|
||||
return wb;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
@ -322,33 +488,6 @@ mode_mouse Desktop::FFMouseMode(void) const
|
||||
return fMouseMode;
|
||||
}
|
||||
|
||||
void Desktop::RemoveSubsetWindow(WinBorder* wb)
|
||||
{
|
||||
WinBorder *winBorder = NULL;
|
||||
|
||||
fLayerLock.Lock();
|
||||
int32 count = fWinBorderList.CountItems();
|
||||
for(int32 i=0; i < count; i++)
|
||||
{
|
||||
winBorder = static_cast<WinBorder*>(fWinBorderList.ItemAt(i));
|
||||
if (winBorder->Level() == B_NORMAL_FEEL)
|
||||
winBorder->Window()->fWinFMWList.RemoveItem(wb);
|
||||
}
|
||||
fLayerLock.Unlock();
|
||||
|
||||
RootLayer *rl = winBorder->GetRootLayer();
|
||||
|
||||
if (!fGeneralLock.IsLocked())
|
||||
debugger("Desktop::RemoveWinBorder() - fGeneralLock must be locked!\n");
|
||||
if (!(rl->fMainLock.IsLocked()))
|
||||
debugger("Desktop::RemoveWinBorder() - fMainLock must be locked!\n");
|
||||
|
||||
int32 countWKs = rl->WorkspaceCount();
|
||||
for (int32 i=0; i < countWKs; i++)
|
||||
rl->WorkspaceAt(i+1)->RemoveWinBorder(wb);
|
||||
|
||||
}
|
||||
|
||||
void Desktop::PrintToStream(void)
|
||||
{
|
||||
printf("RootLayer List:\n=======\n");
|
||||
@ -366,33 +505,6 @@ void Desktop::PrintToStream(void)
|
||||
printf("\t%ld\n", ((Screen*)fScreenList.ItemAt(i))->ScreenNumber());
|
||||
}
|
||||
|
||||
WinBorder* Desktop::FindWinBorderByServerWindowTokenAndTeamID(int32 token, team_id teamID)
|
||||
{
|
||||
WinBorder* wb;
|
||||
fLayerLock.Lock();
|
||||
for (int32 i = 0; (wb = (WinBorder*)fWinBorderList.ItemAt(i)); i++)
|
||||
{
|
||||
if (wb->Window()->ClientToken() == token
|
||||
&& wb->Window()->ClientTeamID() == teamID)
|
||||
break;
|
||||
}
|
||||
fLayerLock.Unlock();
|
||||
|
||||
return wb;
|
||||
}
|
||||
|
||||
void Desktop::PrintVisibleInRootLayerNo(int32 no)
|
||||
{
|
||||
if (no<0 || no>=fRootLayerList.CountItems())
|
||||
return;
|
||||
|
||||
printf("Visible windows in RootLayer %ld, Workspace %ld\n",
|
||||
ActiveRootLayerIndex(), ActiveRootLayer()->ActiveWorkspaceIndex());
|
||||
WinBorder *wb = NULL;
|
||||
Workspace *ws = ActiveRootLayer()->ActiveWorkspace();
|
||||
for(wb = (WinBorder*)ws->GoToTopItem(); wb != NULL; wb = (WinBorder*)ws->GoToLowerItem())
|
||||
{
|
||||
if (!wb->IsHidden())
|
||||
wb->PrintToStream();
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ class Desktop
|
||||
public:
|
||||
// startup methods
|
||||
Desktop(void);
|
||||
~Desktop(void);
|
||||
virtual ~Desktop(void);
|
||||
void Init(void);
|
||||
|
||||
// 1-BigScreen or n-SmallScreens
|
||||
@ -67,8 +67,24 @@ public:
|
||||
// Methods for layer(WinBorder) manipulation.
|
||||
void AddWinBorder(WinBorder *winBorder);
|
||||
void RemoveWinBorder(WinBorder *winBorder);
|
||||
void AddWinBorderToSubset(WinBorder *winBorder, WinBorder *toWinBorder);
|
||||
void RemoveWinBorderFromSubset(WinBorder *winBorder, WinBorder *fromWinBorder);
|
||||
bool HasWinBorder(WinBorder *winBorder);
|
||||
|
||||
WinBorder* FindWinBorderByServerWindowTokenAndTeamID(int32 token, team_id teamID);
|
||||
// get list of registed windows
|
||||
const BList& WindowList() const
|
||||
{
|
||||
if (!IsLocked())
|
||||
debugger("You must lock before getting registered windows list\n");
|
||||
return fWinBorderList;
|
||||
}
|
||||
|
||||
// locking with regards to registered windows list
|
||||
bool Lock() { return fWinLock.Lock(); }
|
||||
void Unlock() { return fWinLock.Unlock(); }
|
||||
bool IsLocked() const { return fWinLock.IsLocked(); }
|
||||
|
||||
// Methods for various desktop stuff handled by the server
|
||||
void SetScrollBarInfo(const scroll_bar_info &info);
|
||||
scroll_bar_info ScrollBarInfo(void) const;
|
||||
@ -85,27 +101,22 @@ public:
|
||||
void PrintToStream(void);
|
||||
void PrintVisibleInRootLayerNo(int32 no);
|
||||
|
||||
// "Private" to app_server :-) - means they should not be used very much
|
||||
void RemoveSubsetWindow(WinBorder *wb);
|
||||
WinBorder *FindWinBorderByServerWindowTokenAndTeamID(int32 token, team_id teamID);
|
||||
|
||||
BLocker fGeneralLock;
|
||||
BLocker fLayerLock;
|
||||
BList fWinBorderList;
|
||||
|
||||
private:
|
||||
void AddDriver(DisplayDriver *driver);
|
||||
|
||||
BList fRootLayerList;
|
||||
RootLayer *fActiveRootLayer;
|
||||
void AddDriver(DisplayDriver *driver);
|
||||
|
||||
BList fScreenList;
|
||||
Screen *fActiveScreen;
|
||||
BList fWinBorderList;
|
||||
BLocker fWinLock;
|
||||
|
||||
BList fRootLayerList;
|
||||
RootLayer *fActiveRootLayer;
|
||||
|
||||
BList fScreenList;
|
||||
Screen *fActiveScreen;
|
||||
|
||||
scroll_bar_info fScrollBarInfo;
|
||||
menu_info fMenuInfo;
|
||||
mode_mouse fMouseMode;
|
||||
bool fFFMouseMode;
|
||||
menu_info fMenuInfo;
|
||||
mode_mouse fMouseMode;
|
||||
bool fFFMouseMode;
|
||||
};
|
||||
|
||||
extern Desktop *desktop;
|
||||
|
@ -1,14 +1,4 @@
|
||||
#ifndef _GLOBALS_H_
|
||||
#define _GLOBALS_H_
|
||||
|
||||
#define B_SYSTEM_LAST 10
|
||||
#define B_NORMAL_FEEL 11
|
||||
#define B_FLOATING_SUBSET_FEEL 12
|
||||
#define B_FLOATING_APP_FEEL 13
|
||||
#define B_MODAL_SUBSET_FEEL 14
|
||||
#define B_MODAL_APP_FEEL 15
|
||||
#define B_FLOATING_ALL_FEEL 16
|
||||
#define B_MODAL_ALL_FEEL 17
|
||||
#define B_SYSTEM_FIRST 18
|
||||
|
||||
#endif
|
||||
|
@ -102,7 +102,7 @@ Layer::Layer(BRect frame, const char *name, int32 token, uint32 resize,
|
||||
|
||||
fInUpdate = false;
|
||||
fIsTopLayer = false;
|
||||
fLevel = 0;
|
||||
fLevel = -100;
|
||||
|
||||
fViewToken = token;
|
||||
fServerWin = NULL;
|
||||
@ -201,7 +201,7 @@ void Layer::AddChild(Layer *layer, ServerWindow *serverWin)
|
||||
c->SetRootLayer(c->fParent->fRootLayer);
|
||||
|
||||
// 2.2) this Layer must know if it has a ServerWindow object attached.
|
||||
fServerWin=serverWin;
|
||||
c->fServerWin=serverWin;
|
||||
|
||||
// 2.3) we are attached to the main tree so build our full region.
|
||||
c->RebuildFullRegion();
|
||||
@ -298,7 +298,7 @@ void Layer::RemoveChild(Layer *layer)
|
||||
// 2.1) set the RootLayer for this object.
|
||||
c->SetRootLayer(NULL);
|
||||
// 2.2) this Layer must know if it has a ServerWindow object attached.
|
||||
fServerWin=NULL;
|
||||
c->fServerWin=NULL;
|
||||
// 2.3) we were removed from the main tree so clear our full region.
|
||||
c->fFull.MakeEmpty();
|
||||
// 2.4) clear fullVisible region.
|
||||
@ -645,7 +645,10 @@ void Layer::Draw(const BRect &r)
|
||||
r.PrintToStream();
|
||||
#endif
|
||||
|
||||
fDriver->FillRect(r, fLayerData->viewcolor);
|
||||
// fDriver->FillRect(r, fLayerData->viewcolor);
|
||||
srand(123);
|
||||
RGBColor c(rand()%255,rand()%255,rand()%255);
|
||||
fDriver->FillRect(r, c);
|
||||
|
||||
// empty HOOK function.
|
||||
}
|
||||
@ -730,14 +733,14 @@ void Layer::RebuildFullRegion(void)
|
||||
STRACE(("Layer(%s)::RebuildFullRegion()\n", GetName()));
|
||||
|
||||
if (fParent)
|
||||
fFull.Set( fParent->ConvertToTop( fFrame ) );
|
||||
fFull.Set(fParent->ConvertToTop(fFrame ));
|
||||
else
|
||||
fFull.Set( fFrame );
|
||||
fFull.Set(fFrame);
|
||||
|
||||
// TODO: restrict to screen coordinates
|
||||
|
||||
// TODO: Convert to screen coordinates
|
||||
|
||||
|
||||
LayerData *ld;
|
||||
ld = fLayerData;
|
||||
do
|
||||
@ -1086,9 +1089,9 @@ void Layer::StartRebuildRegions( const BRegion& reg, Layer *target, uint32 actio
|
||||
BRegion oldVisible = fVisible;
|
||||
|
||||
fVisible = fFullVisible;
|
||||
|
||||
|
||||
// Rebuild regions for children...
|
||||
for(Layer *lay = VirtualBottomChild(); lay != NULL; lay = VirtualUpperSibling())
|
||||
for(Layer *lay = VirtualBottomChild(); lay; lay = VirtualUpperSibling())
|
||||
{
|
||||
if (lay == target)
|
||||
lay->RebuildRegions(reg, action, pt, BPoint(0.0f, 0.0f));
|
||||
@ -1404,7 +1407,7 @@ BRegion Layer::ConvertToTop(BRegion *reg)
|
||||
//! Converts the passed rectangle to screen coordinates
|
||||
BRect Layer::ConvertToTop(BRect rect)
|
||||
{
|
||||
if (fParent!=NULL)
|
||||
if (fParent)
|
||||
return(fParent->ConvertToTop(rect.OffsetByCopy(fFrame.LeftTop())) );
|
||||
else
|
||||
return(rect);
|
||||
@ -1412,7 +1415,7 @@ BRect Layer::ConvertToTop(BRect rect)
|
||||
|
||||
BPoint Layer::ConvertFromTop(BPoint pt)
|
||||
{
|
||||
if (fParent!=NULL)
|
||||
if (fParent)
|
||||
{
|
||||
return(fParent->ConvertFromTop(pt-fFrame.LeftTop()));
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <String.h>
|
||||
#include <OS.h>
|
||||
#include <Locker.h>
|
||||
#include "ServerWindow.h"
|
||||
#include "RGBColor.h"
|
||||
|
||||
enum
|
||||
@ -60,7 +61,7 @@ enum
|
||||
AS_ROOTLAYER_CLASS = 3,
|
||||
};
|
||||
|
||||
class ServerWindow;
|
||||
class ServerApp;
|
||||
class RootLayer;
|
||||
class DisplayDriver;
|
||||
class LayerData;
|
||||
@ -101,9 +102,9 @@ public:
|
||||
|
||||
virtual void Draw(const BRect &r);
|
||||
|
||||
virtual void Show(bool invalidate=true);
|
||||
virtual void Hide(bool invalidate=true);
|
||||
virtual bool IsHidden(void) const;
|
||||
void Show(bool invalidate=true);
|
||||
void Hide(bool invalidate=true);
|
||||
bool IsHidden(void) const;
|
||||
|
||||
BRect Bounds(void) const;
|
||||
BRect Frame(void) const;
|
||||
@ -126,6 +127,7 @@ public:
|
||||
|
||||
DisplayDriver *GetDisplayDriver(void) const { return fDriver; }
|
||||
ServerWindow *Window(void) const { return fServerWin; }
|
||||
ServerApp *App(void) const { return fServerWin? fServerWin->App(): NULL; }
|
||||
virtual bool HasClient(void) { return true; }
|
||||
bool IsServerLayer() const;
|
||||
int32 Level() const { return fLevel; }
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -68,35 +68,32 @@ public:
|
||||
virtual Layer *VirtualUpperSibling(void) const;
|
||||
virtual Layer *VirtualBottomChild(void) const;
|
||||
|
||||
void ReadWorkspaceData(const char *path);
|
||||
void SaveWorkspaceData(const char *path);
|
||||
|
||||
void AddWinBorder(WinBorder *winBorder);
|
||||
void RemoveWinBorder(WinBorder *winBorder);
|
||||
void HideWinBorder(WinBorder* winBorder);
|
||||
void ShowWinBorder(WinBorder* winBorder);
|
||||
WinBorder* WinBorderAt(const BPoint& pt);
|
||||
void ChangeWorkspacesFor(WinBorder *winBorder, uint32 newWorkspaces);
|
||||
bool SetFrontWinBorder(WinBorder *winBorder);
|
||||
void SetWinBorderWorskpaces(WinBorder *winBorder, uint32 newWksIndex);
|
||||
WinBorder* WinBorderAt(const BPoint& pt) const;
|
||||
WinBorder* FocusWinBorder() const;
|
||||
|
||||
void SetWorkspaceCount(int32 wksCount);
|
||||
int32 WorkspaceCount() const { return fWsCount; }
|
||||
Workspace* WorkspaceAt(int32 index) const { return fWorkspace[index]; }
|
||||
Workspace* ActiveWorkspace() const { return fWorkspace[fActiveWksIndex]; }
|
||||
int32 ActiveWorkspaceIndex() const { return fActiveWksIndex; }
|
||||
void SetActiveWorkspace(int32 index);
|
||||
|
||||
void ReadWorkspaceData(const char *path);
|
||||
void SaveWorkspaceData(const char *path);
|
||||
|
||||
void SetScreens(Screen *screen[], int32 rows, int32 columns);
|
||||
Screen **Screens(void);
|
||||
bool SetScreenResolution(int32 width, int32 height, uint32 colorspace);
|
||||
int32 ScreenRows(void) const { return fRows; }
|
||||
int32 ScreenColumns(void) const { return fColumns; }
|
||||
|
||||
void SetWorkspaceCount(const int32 count);
|
||||
int32 WorkspaceCount(void) const;
|
||||
Workspace *WorkspaceAt(const int32 index) const;
|
||||
void SetActiveWorkspaceByIndex(const int32 index);
|
||||
void SetActiveWorkspace(Workspace *ws);
|
||||
int32 ActiveWorkspaceIndex(void) const;
|
||||
Workspace *ActiveWorkspace(void) const;
|
||||
|
||||
|
||||
void SetBGColor(const RGBColor &col);
|
||||
RGBColor BGColor(void) const;
|
||||
|
||||
int32 Buttons(void);
|
||||
int32 Buttons(void) { return fButtons; }
|
||||
virtual bool HasClient(void) { return false; }
|
||||
|
||||
void AddWinBorderToWorkspaces(WinBorder *winBorder, uint32 wks);
|
||||
@ -124,18 +121,17 @@ public:
|
||||
// Debug methods
|
||||
void PrintToStream(void);
|
||||
|
||||
// "Private" to app_server :-) - they should not be used
|
||||
void RemoveAppWindow(WinBorder *wb);
|
||||
|
||||
FMWList fMainFMWList;
|
||||
BRegion fRedrawReg;
|
||||
BList fCopyRegList;
|
||||
BList fCopyList;
|
||||
|
||||
// TODO: remove! Quick!
|
||||
BLocker fMainLock;
|
||||
|
||||
private:
|
||||
friend class Desktop;
|
||||
// these are meant for Desktop class only!
|
||||
void AddWinBorder(WinBorder* winBorder);
|
||||
void RemoveWinBorder(WinBorder* winBorder);
|
||||
void AddSubsetWinBorder(WinBorder *winBorder, WinBorder *toWinBorder);
|
||||
void RemoveSubsetWinBorder(WinBorder *winBorder, WinBorder *fromWinBorder);
|
||||
|
||||
void show_winBorder(WinBorder* winBorder);
|
||||
void hide_winBorder(WinBorder* winBorder);
|
||||
@ -160,8 +156,12 @@ private:
|
||||
uint32 fColorSpace;
|
||||
int32 fButtons;
|
||||
|
||||
BList fWorkspaceList;
|
||||
Workspace *fActiveWorkspace;
|
||||
int32 fActiveWksIndex;
|
||||
int32 fWsCount;
|
||||
Workspace* fWorkspace[32];
|
||||
mutable WinBorder** fWinBorderList;
|
||||
mutable int32 fWinBorderCount;
|
||||
mutable int32 fWinBorderIndex;
|
||||
|
||||
int32 fScreenShotIndex;
|
||||
bool fQuiting;
|
||||
|
@ -66,7 +66,7 @@
|
||||
# define STRACE(x) ;
|
||||
#endif
|
||||
|
||||
#define DEBUG_SERVERAPP_FONT
|
||||
//#define DEBUG_SERVERAPP_FONT
|
||||
|
||||
#ifdef DEBUG_SERVERAPP_FONT
|
||||
# include <stdio.h>
|
||||
@ -317,6 +317,57 @@ int32 ServerApp::MonitorApp(void *data)
|
||||
|
||||
switch(code)
|
||||
{
|
||||
case AS_CREATE_WINDOW:
|
||||
{
|
||||
// Create the ServerWindow to node monitor a new OBWindow
|
||||
|
||||
// Attached data:
|
||||
// 2) BRect window frame
|
||||
// 3) uint32 window look
|
||||
// 4) uint32 window feel
|
||||
// 5) uint32 window flags
|
||||
// 6) uint32 workspace index
|
||||
// 7) int32 BHandler token of the window
|
||||
// 8) port_id window's message port
|
||||
// 9) const char * title
|
||||
|
||||
BRect frame;
|
||||
uint32 look;
|
||||
uint32 feel;
|
||||
uint32 flags;
|
||||
uint32 wkspaces;
|
||||
int32 token = B_NULL_TOKEN;
|
||||
port_id sendPort = -1;
|
||||
port_id looperPort = -1;
|
||||
char *title = NULL;
|
||||
port_id replyport = -1;
|
||||
|
||||
msgqueue.Read<BRect>(&frame);
|
||||
msgqueue.Read<int32>((int32*)&look);
|
||||
msgqueue.Read<int32>((int32*)&feel);
|
||||
msgqueue.Read<int32>((int32*)&flags);
|
||||
msgqueue.Read<int32>((int32*)&wkspaces);
|
||||
msgqueue.Read<int32>(&token);
|
||||
msgqueue.Read<port_id>(&sendPort);
|
||||
msgqueue.Read<port_id>(&looperPort);
|
||||
msgqueue.ReadString(&title);
|
||||
|
||||
STRACE(("ServerApp %s: Got 'New Window' message, trying to do smething...\n",app->fSignature.String()));
|
||||
|
||||
// ServerWindow constructor will reply with port_id of a newly created port
|
||||
ServerWindow *sw = NULL;
|
||||
sw = new ServerWindow(frame, title, look, feel, flags, app,
|
||||
sendPort, looperPort, replyport, wkspaces, token);
|
||||
sw->Init();
|
||||
|
||||
STRACE(("\nServerApp %s: New Window %s (%.1f,%.1f,%.1f,%.1f)\n",
|
||||
app->fSignature.String(),title,frame.left,frame.top,frame.right,frame.bottom));
|
||||
|
||||
if (title)
|
||||
free(title);
|
||||
|
||||
break;
|
||||
}
|
||||
case AS_QUIT_APP:
|
||||
{
|
||||
// This message is received only when the app_server is asked to shut down in
|
||||
@ -548,57 +599,6 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case AS_CREATE_WINDOW:
|
||||
{
|
||||
// Create the ServerWindow to node monitor a new OBWindow
|
||||
|
||||
// Attached data:
|
||||
// 2) BRect window frame
|
||||
// 3) uint32 window look
|
||||
// 4) uint32 window feel
|
||||
// 5) uint32 window flags
|
||||
// 6) uint32 workspace index
|
||||
// 7) int32 BHandler token of the window
|
||||
// 8) port_id window's message port
|
||||
// 9) const char * title
|
||||
|
||||
BRect frame;
|
||||
uint32 look;
|
||||
uint32 feel;
|
||||
uint32 flags;
|
||||
uint32 wkspaces;
|
||||
int32 token = B_NULL_TOKEN;
|
||||
port_id sendPort = -1;
|
||||
port_id looperPort = -1;
|
||||
char *title = NULL;
|
||||
port_id replyport = -1;
|
||||
|
||||
msg.Read<BRect>(&frame);
|
||||
msg.Read<int32>((int32*)&look);
|
||||
msg.Read<int32>((int32*)&feel);
|
||||
msg.Read<int32>((int32*)&flags);
|
||||
msg.Read<int32>((int32*)&wkspaces);
|
||||
msg.Read<int32>(&token);
|
||||
msg.Read<port_id>(&sendPort);
|
||||
msg.Read<port_id>(&looperPort);
|
||||
msg.ReadString(&title);
|
||||
|
||||
STRACE(("ServerApp %s: Got 'New Window' message, trying to do smething...\n",fSignature.String()));
|
||||
|
||||
// ServerWindow constructor will reply with port_id of a newly created port
|
||||
ServerWindow *sw = NULL;
|
||||
sw = new ServerWindow(frame, title, look, feel, flags, this,
|
||||
sendPort, looperPort, replyport, wkspaces, token);
|
||||
sw->Init();
|
||||
|
||||
STRACE(("\nServerApp %s: New Window %s (%.1f,%.1f,%.1f,%.1f)\n",
|
||||
fSignature.String(),title,frame.left,frame.top,frame.right,frame.bottom));
|
||||
|
||||
if (title)
|
||||
free(title);
|
||||
|
||||
break;
|
||||
}
|
||||
case AS_CREATE_BITMAP:
|
||||
{
|
||||
STRACE(("ServerApp %s: Received BBitmap creation request\n",fSignature.String()));
|
||||
@ -747,7 +747,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
}
|
||||
case AS_ACTIVATE_WORKSPACE:
|
||||
{
|
||||
STRACE(("ServerApp %s: Activate Workspace\n",fSignature.String()));
|
||||
STRACE(("ServerApp %s: Activate Workspace UNIMPLEMETED\n",fSignature.String()));
|
||||
|
||||
// Attached data
|
||||
// 1) int32 workspace index
|
||||
@ -756,9 +756,6 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
int32 workspace;
|
||||
msg.Read<int32>(&workspace);
|
||||
|
||||
RootLayer *root=desktop->ActiveRootLayer();
|
||||
if(root)
|
||||
root->SetActiveWorkspaceByIndex(workspace);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1128,15 +1125,15 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
// Returns:
|
||||
// 1) font_family The name of the font family
|
||||
// 2) font_style - name of the style
|
||||
int32 famid, styid;
|
||||
uint16 famid, styid;
|
||||
port_id replyport;
|
||||
font_family fam;
|
||||
font_style sty;
|
||||
|
||||
msg.Read<int32>(&famid);
|
||||
msg.Read<int32>(&styid);
|
||||
msg.Read<uint16>(&famid);
|
||||
msg.Read<uint16>(&styid);
|
||||
msg.Read<port_id>(&replyport);
|
||||
|
||||
|
||||
replylink.SetSendPort(replyport);
|
||||
|
||||
fontserver->Lock();
|
||||
@ -1157,6 +1154,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
||||
}
|
||||
|
||||
fontserver->Unlock();
|
||||
|
||||
break;
|
||||
}
|
||||
case AS_GET_FONT_DIRECTION:
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
team_id ClientTeamID();
|
||||
|
||||
FMWList fAppFMWList;
|
||||
|
||||
const char * Title() const { return fSignature.String(); }
|
||||
protected:
|
||||
friend class AppServer;
|
||||
friend class ServerWindow;
|
||||
|
@ -45,7 +45,6 @@
|
||||
#include "ServerApp.h"
|
||||
#include "ServerProtocol.h"
|
||||
#include "WinBorder.h"
|
||||
#include "Desktop.h"
|
||||
#include "TokenHandler.h"
|
||||
#include "Utils.h"
|
||||
#include "DisplayDriver.h"
|
||||
@ -53,10 +52,10 @@
|
||||
#include "Workspace.h"
|
||||
#include "MessagePrivate.h"
|
||||
|
||||
#define DEBUG_SERVERWINDOW
|
||||
//#define DEBUG_SERVERWINDOW
|
||||
//#define DEBUG_SERVERWINDOW_MOUSE
|
||||
//#define DEBUG_SERVERWINDOW_KEYBOARD
|
||||
#define DEBUG_SERVERWINDOW_GRAPHICS
|
||||
//#define DEBUG_SERVERWINDOW_GRAPHICS
|
||||
|
||||
|
||||
#ifdef DEBUG_SERVERWINDOW
|
||||
@ -150,7 +149,30 @@ ServerWindow::ServerWindow(BRect rect, const char *string, uint32 wlook,
|
||||
fClientLooperPort = looperPort;
|
||||
fClientTeamID = winapp->ClientTeamID();
|
||||
fWorkspaces = index;
|
||||
|
||||
|
||||
// floating and modal windows must appear in every workspace where
|
||||
// their main window is present. Thus their wksIndex will be set to
|
||||
// '0x0' and they will be made visible when needed.
|
||||
switch (fFeel)
|
||||
{
|
||||
case B_MODAL_APP_WINDOW_FEEL:
|
||||
case B_MODAL_SUBSET_WINDOW_FEEL:
|
||||
case B_FLOATING_APP_WINDOW_FEEL:
|
||||
case B_FLOATING_SUBSET_WINDOW_FEEL:
|
||||
fWorkspaces = 0x0UL;
|
||||
break;
|
||||
case B_MODAL_ALL_WINDOW_FEEL:
|
||||
case B_FLOATING_ALL_WINDOW_FEEL:
|
||||
case B_SYSTEM_LAST:
|
||||
case B_SYSTEM_FIRST:
|
||||
fWorkspaces = 0xffffffffUL;
|
||||
break;
|
||||
case B_NORMAL_WINDOW_FEEL:
|
||||
if (fWorkspaces == 0x0UL)
|
||||
;;
|
||||
// TODO: get RootLayer's ActiveWorkspaceIndex
|
||||
}
|
||||
|
||||
fWinBorder = NULL;
|
||||
cl = NULL; //current layer
|
||||
|
||||
@ -178,7 +200,6 @@ void ServerWindow::Init(void)
|
||||
{
|
||||
fWinBorder = new WinBorder( fFrame, fTitle.String(), fLook, fFeel, 0UL,
|
||||
this, desktop->GetDisplayDriver());
|
||||
fWinBorder->RebuildFullRegion();
|
||||
|
||||
// Spawn our message-monitoring thread
|
||||
fMonitorThreadID = spawn_thread(MonitorWin, fTitle.String(), B_NORMAL_PRIORITY, this);
|
||||
@ -192,9 +213,14 @@ ServerWindow::~ServerWindow(void)
|
||||
{
|
||||
STRACE(("*ServerWindow (%s):~ServerWindow()\n",fTitle.String()));
|
||||
|
||||
desktop->RemoveWinBorder(fWinBorder);
|
||||
STRACE(("ServerWindow(%s) Successfully removed from the desktop\n", fTitle.String()));
|
||||
|
||||
if (fWinBorder)
|
||||
{
|
||||
delete fWinBorder;
|
||||
fWinBorder = NULL;
|
||||
}
|
||||
|
||||
cl = NULL;
|
||||
|
||||
if(fMsgSender)
|
||||
{
|
||||
delete fMsgSender;
|
||||
@ -206,14 +232,6 @@ ServerWindow::~ServerWindow(void)
|
||||
delete fMsgReader;
|
||||
fMsgReader=NULL;
|
||||
}
|
||||
|
||||
if (fWinBorder)
|
||||
{
|
||||
delete fWinBorder;
|
||||
fWinBorder = NULL;
|
||||
}
|
||||
|
||||
cl = NULL;
|
||||
|
||||
STRACE(("#ServerWindow(%s) will exit NOW\n", fTitle.String()));
|
||||
}
|
||||
@ -245,7 +263,7 @@ void ServerWindow::Quit(void)
|
||||
//! Shows the window's WinBorder
|
||||
void ServerWindow::Show(void)
|
||||
{
|
||||
|
||||
STRACE(("ServerWindow %s: Show\n",fTitle.String()));
|
||||
if (!IsLocked())
|
||||
debugger("you must lock a ServerWindow object before calling ::Show()\n");
|
||||
|
||||
@ -258,6 +276,7 @@ void ServerWindow::Show(void)
|
||||
//! Hides the window's WinBorder
|
||||
void ServerWindow::Hide(void)
|
||||
{
|
||||
STRACE(("ServerWindow %s: Hide\n",fTitle.String()));
|
||||
if (!IsLocked())
|
||||
debugger("you must lock a ServerWindow object before calling ::Hide()\n");
|
||||
|
||||
@ -565,7 +584,7 @@ Layer * ServerWindow::CreateLayerTree(Layer *localRoot, LinkMsgReader &link)
|
||||
link.Read<int32>(&childCount);
|
||||
|
||||
STRACE(("ServerWindow(%s)::CreateLayerTree()-> layer %s, token %ld\n", fTitle.String(),name,token));
|
||||
|
||||
|
||||
Layer *newLayer;
|
||||
newLayer = new Layer(frame, name, token, resizeMask,
|
||||
flags, desktop->GetDisplayDriver());
|
||||
@ -719,7 +738,7 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
||||
case AS_LAYER_CREATE_ROOT:
|
||||
{
|
||||
STRACE(("ServerWindow %s: Message AS_LAYER_CREATE_ROOT\n", fTitle.String()));
|
||||
|
||||
|
||||
// Start receiving top_view data -- pass NULL as the parent view.
|
||||
// This should be the *only* place where this happens.
|
||||
if (cl != NULL)
|
||||
@ -732,8 +751,6 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
||||
|
||||
// connect decorator and top layer.
|
||||
fWinBorder->AddChild(fWinBorder->fTopLayer, NULL);
|
||||
desktop->AddWinBorder(fWinBorder);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1439,7 +1456,9 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
||||
WinBorder *wb;
|
||||
int32 mainToken;
|
||||
team_id teamID;
|
||||
|
||||
|
||||
printf("ServerWindow %s: Message AS_ADD_TO_SUBSET UNIMPLEMENTED\n",fTitle.String());
|
||||
|
||||
link.Read<int32>(&mainToken);
|
||||
link.Read(&teamID, sizeof(team_id));
|
||||
|
||||
@ -1449,7 +1468,7 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
||||
fMsgSender->StartMessage(SERVER_TRUE);
|
||||
fMsgSender->Flush();
|
||||
|
||||
fWinBorder->AddToSubsetOf(wb);
|
||||
// fWinBorder->AddToSubsetOf(wb);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1464,6 +1483,8 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
||||
WinBorder *wb;
|
||||
int32 mainToken;
|
||||
team_id teamID;
|
||||
|
||||
printf("ServerWindow %s: Message AS_REM_FROM_SUBSET UNIMPLEMENTED\n",fTitle.String());
|
||||
|
||||
link.Read<int32>(&mainToken);
|
||||
link.Read(&teamID, sizeof(team_id));
|
||||
@ -1474,7 +1495,7 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
||||
fMsgSender->StartMessage(SERVER_TRUE);
|
||||
fMsgSender->Flush();
|
||||
|
||||
fWinBorder->RemoveFromSubsetOf(wb);
|
||||
// fWinBorder->RemoveFromSubsetOf(wb);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -88,8 +88,6 @@ WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const i
|
||||
|
||||
fMouseButtons = 0;
|
||||
fKeyModifiers = 0;
|
||||
fServerHidden = false;
|
||||
fMainWinBorder = NULL;
|
||||
fDecorator = NULL;
|
||||
fTopLayer = NULL;
|
||||
fAdFlags = fAdFlags | B_LAYER_CHILDREN_DEPENDANT;
|
||||
@ -107,6 +105,10 @@ WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const i
|
||||
if (feel!= B_NO_BORDER_WINDOW_LOOK)
|
||||
fDecorator = new_decorator(r, name, look, feel, flags, fDriver);
|
||||
|
||||
RebuildFullRegion();
|
||||
|
||||
desktop->AddWinBorder(this);
|
||||
|
||||
STRACE(("WinBorder %s:\n",GetName()));
|
||||
STRACE(("\tFrame: (%.1f,%.1f,%.1f,%.1f)\n",r.left,r.top,r.right,r.bottom));
|
||||
STRACE(("\tWindow %s\n",win?win->Title():"NULL"));
|
||||
@ -115,6 +117,9 @@ WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const i
|
||||
WinBorder::~WinBorder(void)
|
||||
{
|
||||
STRACE(("WinBorder(%s)::~WinBorder()\n",GetName()));
|
||||
|
||||
desktop->RemoveWinBorder(this);
|
||||
|
||||
if (fTopLayer){
|
||||
delete fTopLayer;
|
||||
fTopLayer = NULL;
|
||||
@ -402,7 +407,14 @@ void WinBorder::Draw(const BRect &r)
|
||||
|
||||
// if we have a visible region, it is decorator's one.
|
||||
if(fDecorator)
|
||||
{
|
||||
WinBorder *wb = GetRootLayer()->FocusWinBorder();
|
||||
if (wb && wb == this)
|
||||
fDecorator->SetFocus(true);
|
||||
else
|
||||
fDecorator->SetFocus(false);
|
||||
fDecorator->Draw(fUpdateReg.Frame());
|
||||
}
|
||||
}
|
||||
|
||||
//! Moves the winborder with redraw
|
||||
@ -427,25 +439,6 @@ void WinBorder::ResizeBy(float x, float y)
|
||||
resize_layer(x,y);
|
||||
}
|
||||
|
||||
//! Returns true if hidden
|
||||
bool WinBorder::IsHidden() const
|
||||
{
|
||||
if (fServerHidden)
|
||||
return true;
|
||||
|
||||
return Layer::IsHidden();
|
||||
}
|
||||
|
||||
void WinBorder::ServerHide()
|
||||
{
|
||||
fServerHidden = true;
|
||||
}
|
||||
|
||||
void WinBorder::ServerUnhide()
|
||||
{
|
||||
fServerHidden = false;
|
||||
}
|
||||
|
||||
//! Sets the minimum and maximum sizes of the window
|
||||
void WinBorder::SetSizeLimits(float minwidth, float maxwidth, float minheight, float maxheight)
|
||||
{
|
||||
@ -473,186 +466,6 @@ bool WinBorder::HasPoint(const BPoint& pt) const
|
||||
return fFullVisible.Contains(pt);
|
||||
}
|
||||
|
||||
void WinBorder::SetMainWinBorder(WinBorder *newMain)
|
||||
{
|
||||
fMainWinBorder = newMain;
|
||||
}
|
||||
|
||||
WinBorder* WinBorder::MainWinBorder() const
|
||||
{
|
||||
return fMainWinBorder;
|
||||
}
|
||||
|
||||
void WinBorder::SetLevel(void)
|
||||
{
|
||||
switch(fServerWin->Feel())
|
||||
{
|
||||
case B_NORMAL_WINDOW_FEEL:
|
||||
fLevel = B_NORMAL_FEEL;
|
||||
break;
|
||||
case B_FLOATING_SUBSET_WINDOW_FEEL:
|
||||
fLevel = B_FLOATING_SUBSET_FEEL;
|
||||
break;
|
||||
case B_FLOATING_APP_WINDOW_FEEL:
|
||||
fLevel = B_FLOATING_APP_FEEL;
|
||||
break;
|
||||
case B_FLOATING_ALL_WINDOW_FEEL:
|
||||
fLevel = B_FLOATING_ALL_FEEL;
|
||||
break;
|
||||
case B_MODAL_SUBSET_WINDOW_FEEL:
|
||||
fLevel = B_MODAL_SUBSET_FEEL;
|
||||
break;
|
||||
case B_MODAL_APP_WINDOW_FEEL:
|
||||
fLevel = B_MODAL_APP_FEEL;
|
||||
break;
|
||||
case B_MODAL_ALL_WINDOW_FEEL:
|
||||
fLevel = B_MODAL_ALL_FEEL;
|
||||
break;
|
||||
case B_SYSTEM_LAST:
|
||||
case B_SYSTEM_FIRST:
|
||||
|
||||
// TODO: uncomment later when this code makes its way into the real server!
|
||||
// if(_win->ServerTeamID() != _win->ClientTeamID())
|
||||
// _win->QuietlySetFeel(B_NORMAL_WINDOW_FEEL);
|
||||
// else
|
||||
fLevel = fServerWin->Feel();
|
||||
break;
|
||||
default:
|
||||
fServerWin->QuietlySetFeel(B_NORMAL_WINDOW_FEEL);
|
||||
fLevel = B_NORMAL_FEEL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Makes the calling WinBorder a subset window of another
|
||||
void WinBorder::AddToSubsetOf(WinBorder* main)
|
||||
{
|
||||
STRACE(("WinBorder(%s)::AddToSubsetOf()\n", GetName()));
|
||||
if (!main || (main && !(main->GetRootLayer())))
|
||||
return;
|
||||
|
||||
if (main->Window()->fWinFMWList.HasItem(this) || !(desktop->HasWinBorder(this)))
|
||||
return;
|
||||
|
||||
if (main->Window()->Feel() == B_NORMAL_WINDOW_FEEL &&
|
||||
(Window()->Feel()==B_FLOATING_SUBSET_WINDOW_FEEL || Window()->Feel()==B_MODAL_SUBSET_WINDOW_FEEL) )
|
||||
{
|
||||
// if the main window is hidden also hide this one.
|
||||
if(main->IsHidden())
|
||||
Hide();//fHidden = true;
|
||||
|
||||
// add to main window's subset
|
||||
main->Window()->fWinFMWList.AddItem(this);
|
||||
|
||||
// set this member accordingly
|
||||
fMainWinBorder = main;
|
||||
|
||||
// because this window is in a subset it should appear in the
|
||||
// workspaces its main window appears in.
|
||||
Window()->QuietlySetWorkspaces(main->Window()->Workspaces());
|
||||
|
||||
// this is a modal window, so add it to main window's workspaces.
|
||||
if (Window()->Feel() == B_MODAL_SUBSET_WINDOW_FEEL)
|
||||
{
|
||||
RootLayer *rl = main->GetRootLayer();
|
||||
rl->fMainLock.Lock();
|
||||
rl->AddWinBorderToWorkspaces(this, main->Window()->Workspaces());
|
||||
rl->fMainLock.Unlock();
|
||||
}
|
||||
|
||||
// this a *floating* window so if the main window is 'front', and add it to workspace.
|
||||
if ( !(main->IsHidden()) && Window()->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL)
|
||||
{
|
||||
RootLayer *rl = main->GetRootLayer();
|
||||
|
||||
desktop->fGeneralLock.Lock();
|
||||
STRACE(("WinBorder(%s)::AddToSubsetOf(%s) - General lock acquired\n", GetName(), main->GetName()));
|
||||
|
||||
rl->fMainLock.Lock();
|
||||
STRACE(("WinBorder(%s)::AddToSubsetOf(%s) - Main lock acquired\n", GetName(), main->GetName()));
|
||||
|
||||
for(int32 i = 0; i < rl->WorkspaceCount(); i++)
|
||||
{
|
||||
Workspace *ws = rl->WorkspaceAt(i+1);
|
||||
if(ws->FrontLayer() == main)
|
||||
ws->AddWinBorder(this);
|
||||
}
|
||||
|
||||
rl->fMainLock.Unlock();
|
||||
STRACE(("WinBorder(%s)::AddToSubsetOf(%s) - Main lock released\n", GetName(), main->GetName()));
|
||||
|
||||
desktop->fGeneralLock.Unlock();
|
||||
STRACE(("WinBorder(%s)::AddToSubsetOf(%s) - General lock released\n", GetName(), main->GetName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Removes the calling WinBorder from the subset window of another
|
||||
void WinBorder::RemoveFromSubsetOf(WinBorder* main)
|
||||
{
|
||||
STRACE(("WinBorder(%s)::RemoveFromSubsetOf()\n", GetName()));
|
||||
RootLayer *rl = main->GetRootLayer();
|
||||
|
||||
desktop->fGeneralLock.Lock();
|
||||
STRACE(("WinBorder(%s)::RemoveFromSubsetOf(%s) - General lock acquired\n", GetName(), main->GetName()));
|
||||
|
||||
rl->fMainLock.Lock();
|
||||
STRACE(("WinBorder(%s)::RemoveFromSubsetOf(%s) - Main lock acquired\n", GetName(), main->GetName()));
|
||||
|
||||
// remove from main window's subset list.
|
||||
if(main->Window()->fWinFMWList.RemoveItem(this))
|
||||
{
|
||||
int32 count = main->GetRootLayer()->WorkspaceCount();
|
||||
for(int32 i=0; i < count; i++)
|
||||
{
|
||||
if(main->Window()->Workspaces() & (0x00000001 << i))
|
||||
{
|
||||
Workspace *ws = main->GetRootLayer()->WorkspaceAt(i+1);
|
||||
|
||||
// if its main window is in 'i' workspaces, remove it from
|
||||
// workspace 'i' if it's in there...
|
||||
ws->RemoveWinBorder(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
fMainWinBorder = NULL;
|
||||
|
||||
rl->fMainLock.Unlock();
|
||||
STRACE(("WinBorder(%s)::RemoveFromSubsetOf(%s) - Main lock released\n", GetName(), main->GetName()));
|
||||
|
||||
desktop->fGeneralLock.Unlock();
|
||||
STRACE(("WinBorder(%s)::RemoveFromSubsetOf(%s) - General lock released\n", GetName(), main->GetName()));
|
||||
}
|
||||
|
||||
//! Prints information about the WinBorder's current state
|
||||
void WinBorder::PrintToStream()
|
||||
{
|
||||
printf("\t%s", GetName());
|
||||
|
||||
if (fLevel == B_FLOATING_SUBSET_FEEL)
|
||||
printf("\t%s", "B_FLOATING_SUBSET_WINDOW_FEEL");
|
||||
|
||||
if (fLevel == B_FLOATING_APP_FEEL)
|
||||
printf("\t%s", "B_FLOATING_APP_WINDOW_FEEL");
|
||||
|
||||
if (fLevel == B_FLOATING_ALL_FEEL)
|
||||
printf("\t%s", "B_FLOATING_ALL_WINDOW_FEEL");
|
||||
|
||||
if (fLevel == B_MODAL_SUBSET_FEEL)
|
||||
printf("\t%s", "B_MODAL_SUBSET_WINDOW_FEEL");
|
||||
|
||||
if (fLevel == B_MODAL_APP_FEEL)
|
||||
printf("\t%s", "B_MODAL_APP_WINDOW_FEEL");
|
||||
|
||||
if (fLevel == B_MODAL_ALL_FEEL)
|
||||
printf("\t%s", "B_MODAL_ALL_WINDOW_FEEL");
|
||||
|
||||
if (fLevel == B_NORMAL_FEEL)
|
||||
printf("\t%s", "B_NORMAL_WINDOW_FEEL");
|
||||
|
||||
printf("\t%s\n", IsHidden() ? "hidden" : "not hidden");
|
||||
}
|
||||
|
||||
// Unimplemented. Hook function for handling when system GUI colors change
|
||||
void WinBorder::UpdateColors(void)
|
||||
{
|
||||
@ -676,3 +489,43 @@ void WinBorder::UpdateScreen(void)
|
||||
{
|
||||
STRACE(("WinBorder %s: UpdateScreen unimplemented\n",GetName()));
|
||||
}
|
||||
|
||||
//--------------------- P R I V A T E -------------------
|
||||
void WinBorder::SetLevel()
|
||||
{
|
||||
switch(fServerWin->Feel())
|
||||
{
|
||||
case B_FLOATING_SUBSET_WINDOW_FEEL:
|
||||
case B_FLOATING_APP_WINDOW_FEEL:
|
||||
fLevel = B_FLOATING_APP;
|
||||
break;
|
||||
|
||||
case B_MODAL_SUBSET_WINDOW_FEEL:
|
||||
case B_MODAL_APP_WINDOW_FEEL:
|
||||
fLevel = B_MODAL_APP;
|
||||
break;
|
||||
|
||||
case B_NORMAL_WINDOW_FEEL:
|
||||
fLevel = B_NORMAL;
|
||||
break;
|
||||
|
||||
case B_FLOATING_ALL_WINDOW_FEEL:
|
||||
fLevel = B_FLOATING_ALL;
|
||||
break;
|
||||
|
||||
case B_MODAL_ALL_WINDOW_FEEL:
|
||||
fLevel = B_MODAL_ALL;
|
||||
break;
|
||||
|
||||
case B_SYSTEM_LAST:
|
||||
fLevel = B_SYSTEM_LAST;
|
||||
break;
|
||||
|
||||
case B_SYSTEM_FIRST:
|
||||
fLevel = B_SYSTEM_FIRST;
|
||||
break;
|
||||
|
||||
default:
|
||||
fLevel = B_NORMAL;
|
||||
}
|
||||
}
|
@ -31,6 +31,18 @@
|
||||
#include <Rect.h>
|
||||
#include <String.h>
|
||||
#include "Layer.h"
|
||||
#include "FMWList.h"
|
||||
|
||||
// these are used by window manager to properly place window.
|
||||
enum {
|
||||
B_SYSTEM_LAST = -10L,
|
||||
B_FLOATING_APP = 0L,
|
||||
B_MODAL_APP = 1L,
|
||||
B_NORMAL = 2L,
|
||||
B_FLOATING_ALL = 3L,
|
||||
B_MODAL_ALL = 4L,
|
||||
B_SYSTEM_FIRST = 10L,
|
||||
};
|
||||
|
||||
class ServerWindow;
|
||||
class Decorator;
|
||||
@ -66,10 +78,6 @@ public:
|
||||
|
||||
virtual void RebuildFullRegion(void);
|
||||
|
||||
virtual bool IsHidden() const;
|
||||
void ServerHide();
|
||||
void ServerUnhide();
|
||||
|
||||
void SetSizeLimits(float minwidth, float maxwidth, float minheight, float maxheight);
|
||||
|
||||
void MouseDown(PointerEvent& evt, bool sendMessage);
|
||||
@ -84,21 +92,16 @@ public:
|
||||
|
||||
virtual bool HasClient(void) { return false; }
|
||||
Decorator *GetDecorator(void) const { return fDecorator; }
|
||||
WinBorder *MainWinBorder() const;
|
||||
|
||||
void SetLevel();
|
||||
void HighlightDecorator(const bool &active);
|
||||
|
||||
bool HasPoint(const BPoint &pt) const;
|
||||
|
||||
void AddToSubsetOf(WinBorder* main);
|
||||
void RemoveFromSubsetOf(WinBorder* main);
|
||||
|
||||
void PrintToStream();
|
||||
|
||||
// Server "private" :-) - should not be used
|
||||
void SetMainWinBorder(WinBorder *newMain);
|
||||
|
||||
FMWList fFMWList;
|
||||
|
||||
private:
|
||||
void SetLevel();
|
||||
|
||||
protected:
|
||||
friend class Layer;
|
||||
friend class ServerWindow;
|
||||
@ -111,8 +114,6 @@ protected:
|
||||
int32 fKeyModifiers;
|
||||
BPoint fLastMousePosition;
|
||||
|
||||
bool fServerHidden;
|
||||
WinBorder *fMainWinBorder;
|
||||
bool fIsMoving;
|
||||
bool fIsResizing;
|
||||
bool fIsClosing;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, Haiku, Inc.
|
||||
// Copyright (c) 2001-2005, Haiku, Inc.
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||
// copy of this software and associated documentation files (the "Software"),
|
||||
@ -20,7 +20,7 @@
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// File Name: Workspace.h
|
||||
// Author: Adi Oanca <adioanca@myrealbox.com>
|
||||
// Author: Adi Oanca <adioanca@cotty.iren.com>
|
||||
// Description: Tracks workspaces
|
||||
//
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
@ -41,6 +41,7 @@ class WinBorder;
|
||||
|
||||
struct ListData
|
||||
{
|
||||
bool isFree;
|
||||
WinBorder *layerPtr;
|
||||
ListData *upperItem;
|
||||
ListData *lowerItem;
|
||||
@ -49,84 +50,101 @@ struct ListData
|
||||
class Workspace
|
||||
{
|
||||
public:
|
||||
Workspace(const uint32 colorspace, int32 ID, const RGBColor& BGColor);
|
||||
~Workspace(void);
|
||||
|
||||
bool AddWinBorder(WinBorder *layer);
|
||||
bool RemoveWinBorder(WinBorder *layer);
|
||||
bool HideSubsetWindows(WinBorder *layer);
|
||||
WinBorder *FocusLayer(void) const;
|
||||
WinBorder *FrontLayer(void) const;
|
||||
|
||||
void MoveToBack(WinBorder *newLast);
|
||||
|
||||
// The bottom item is the one which is visible
|
||||
WinBorder *GoToBottomItem(void);
|
||||
WinBorder *GoToUpperItem(void);
|
||||
WinBorder *GoToTopItem(void);
|
||||
WinBorder *GoToLowerItem(void);
|
||||
bool GoToItem(WinBorder *layer);
|
||||
Workspace( const int32 ID,
|
||||
const uint32 colorspace,
|
||||
const RGBColor& BGColor);
|
||||
~Workspace(void);
|
||||
|
||||
void SetLocalSpace(const uint32 colorspace);
|
||||
uint32 LocalSpace(void) const;
|
||||
int32 ID(void) const { return fID; }
|
||||
|
||||
void SetBGColor(const RGBColor &c);
|
||||
RGBColor BGColor(void) const;
|
||||
void AddWinBorder(WinBorder *winBorder);
|
||||
void RemoveWinBorder(WinBorder *winBorder);
|
||||
bool HasWinBorder(const WinBorder *winBorder) const;
|
||||
|
||||
WinBorder* Focus(void) const;
|
||||
WinBorder* Front(void) const;
|
||||
void GetWinBorderList(void **&list, int32 *itemCount ) const;
|
||||
|
||||
int32 ID(void) const { return fID; }
|
||||
bool MoveToBack(WinBorder *newLast);
|
||||
bool MoveToFront(WinBorder *newFront, bool doNotDisturb = false);
|
||||
|
||||
bool HideWinBorder(WinBorder *winBorder);
|
||||
bool ShowWinBorder(WinBorder *winBorder, bool userBusy = false);
|
||||
|
||||
// resolution related methods.
|
||||
void SetLocalSpace(const uint32 colorspace);
|
||||
uint32 LocalSpace(void) const;
|
||||
|
||||
void GetSettings(const BMessage &msg);
|
||||
void GetDefaultSettings(void);
|
||||
void PutSettings(BMessage *msg, const int32 &index) const;
|
||||
static void PutDefaultSettings(BMessage *msg, const int32 &index);
|
||||
|
||||
// debug methods
|
||||
void PrintToStream(void) const;
|
||||
void PrintItem(ListData *item) const;
|
||||
|
||||
// TODO: Bad Style. There should be a more elegant way of doing this
|
||||
// .... private :-) - do not use!
|
||||
void SearchAndSetNewFront(WinBorder *preferred);
|
||||
void SearchAndSetNewFocus(WinBorder *preferred);
|
||||
void BringToFrontANormalWindow(WinBorder *layer);
|
||||
void SetBGColor(const RGBColor &c);
|
||||
RGBColor BGColor(void) const;
|
||||
|
||||
// settings related methods
|
||||
void GetSettings(const BMessage &msg);
|
||||
void GetDefaultSettings(void);
|
||||
void PutSettings(BMessage *msg, const int32 &index) const;
|
||||
static void PutDefaultSettings(BMessage *msg, const int32 &index);
|
||||
|
||||
// debug methods
|
||||
void PrintToStream(void) const;
|
||||
void PrintItem(ListData *item) const;
|
||||
|
||||
private:
|
||||
void InsertItem(ListData *item, ListData *before);
|
||||
void RemoveItem(ListData *item);
|
||||
ListData* HasItem(const ListData *item, int32 *index = NULL) const;
|
||||
ListData* HasItem(const WinBorder *layer, int32 *index = NULL) const;
|
||||
int32 IndexOf(const ListData *item) const;
|
||||
|
||||
bool placeToBack(ListData *newLast);
|
||||
void placeInFront(ListData *item, const bool userBusy);
|
||||
|
||||
bool removeAndPlaceBefore(const WinBorder *wb, ListData *beforeItem);
|
||||
bool removeAndPlaceBefore(ListData *item, ListData *beforeItem);
|
||||
|
||||
WinBorder* searchFirstMainWindow(WinBorder *wb) const;
|
||||
|
||||
bool windowHasVisibleModals(const WinBorder *winBorder) const;
|
||||
ListData* putModalsInFront(ListData *item);
|
||||
void putFloatingInFront(ListData *item);
|
||||
void saveFloatingWindows(ListData *itemNormal);
|
||||
|
||||
ListData* findNextFront() const;
|
||||
|
||||
class MemoryPool
|
||||
{
|
||||
public:
|
||||
MemoryPool();
|
||||
~MemoryPool();
|
||||
ListData* GetCleanMemory(WinBorder* winborder);
|
||||
void ReleaseMemory(ListData* mem);
|
||||
private:
|
||||
void expandBuffer(int32 start);
|
||||
ListData *buffer;
|
||||
int32 count;
|
||||
};
|
||||
|
||||
int32 fID;
|
||||
uint32 fSpace;
|
||||
RGBColor fBGColor;
|
||||
|
||||
// first visible onscreen
|
||||
ListData *fBottomItem;
|
||||
|
||||
void InsertItem(ListData *item, ListData *before);
|
||||
void RemoveItem(ListData *item);
|
||||
ListData *HasItem(ListData *item);
|
||||
ListData *HasItem(WinBorder *layer);
|
||||
// the last visible(or covered by other Layers)
|
||||
ListData *fTopItem;
|
||||
|
||||
ListData *FindPlace(ListData *pref);
|
||||
// the focus WinBorder - for keyboard events
|
||||
ListData *fFocusItem;
|
||||
|
||||
int32 fID;
|
||||
uint32 fSpace;
|
||||
RGBColor fBGColor;
|
||||
// pointer for which "big" actions are intended
|
||||
ListData *fFrontItem;
|
||||
|
||||
// first visible onscreen
|
||||
ListData *fBottomItem;
|
||||
// settings for each workspace -- example taken from R5's app_server_settings file
|
||||
display_timing fDisplayTiming;
|
||||
int16 fVirtualWidth;
|
||||
int16 fVirtualHeight;
|
||||
|
||||
// the last visible(or covered by other Layers)
|
||||
ListData *fTopItem;
|
||||
|
||||
// pointer to the current element in the list
|
||||
ListData *fCurrentItem;
|
||||
|
||||
// the focus WinBorder - for keyboard events
|
||||
ListData *fFocusItem;
|
||||
|
||||
// the item that is the target of mouse operations
|
||||
ListData *fFrontItem;
|
||||
|
||||
// settings for each workspace -- example taken from R5's app_server_settings file
|
||||
display_timing fDisplayTiming;
|
||||
int16 fVirtualWidth;
|
||||
int16 fVirtualHeight;
|
||||
|
||||
// TODO: find out what specific values need to be contained in fFlags as per R5's server
|
||||
// not to be confused with display_timing.flags
|
||||
uint32 fFlags;
|
||||
MemoryPool fPool;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user