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:
@@ -37,6 +37,7 @@
|
|||||||
#include "RootLayer.h"
|
#include "RootLayer.h"
|
||||||
#include "ServerConfig.h"
|
#include "ServerConfig.h"
|
||||||
#include "ServerScreen.h"
|
#include "ServerScreen.h"
|
||||||
|
#include "ServerApp.h"
|
||||||
#include "ServerWindow.h"
|
#include "ServerWindow.h"
|
||||||
#include "ViewDriver.h"
|
#include "ViewDriver.h"
|
||||||
#include "DirectDriver.h"
|
#include "DirectDriver.h"
|
||||||
@@ -158,23 +159,25 @@ void Desktop::InitMode(void)
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
inline
|
||||||
Screen* Desktop::ScreenAt(int32 index) const
|
Screen* Desktop::ScreenAt(int32 index) const
|
||||||
{
|
{
|
||||||
Screen *sc= static_cast<Screen*>(fScreenList.ItemAt(index));
|
return static_cast<Screen*>(fScreenList.ItemAt(index));
|
||||||
|
|
||||||
return sc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
int32 Desktop::ScreenCount(void) const
|
int32 Desktop::ScreenCount(void) const
|
||||||
{
|
{
|
||||||
return fScreenList.CountItems();
|
return fScreenList.CountItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
Screen* Desktop::ActiveScreen(void) const
|
Screen* Desktop::ActiveScreen(void) const
|
||||||
{
|
{
|
||||||
return fActiveScreen;
|
return fActiveScreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
void Desktop::SetActiveRootLayerByIndex(int32 listIndex)
|
void Desktop::SetActiveRootLayerByIndex(int32 listIndex)
|
||||||
{
|
{
|
||||||
RootLayer *rl=RootLayerAt(listIndex);
|
RootLayer *rl=RootLayerAt(listIndex);
|
||||||
@@ -183,6 +186,7 @@ void Desktop::SetActiveRootLayerByIndex(int32 listIndex)
|
|||||||
SetActiveRootLayer(rl);
|
SetActiveRootLayer(rl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
void Desktop::SetActiveRootLayer(RootLayer* rl)
|
void Desktop::SetActiveRootLayer(RootLayer* rl)
|
||||||
{
|
{
|
||||||
if (fActiveRootLayer == rl)
|
if (fActiveRootLayer == rl)
|
||||||
@@ -196,6 +200,7 @@ RootLayer* Desktop::ActiveRootLayer(void) const
|
|||||||
return fActiveRootLayer;
|
return fActiveRootLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
int32 Desktop::ActiveRootLayerIndex(void) const
|
int32 Desktop::ActiveRootLayerIndex(void) const
|
||||||
{
|
{
|
||||||
int32 rootLayerCount = CountRootLayers();
|
int32 rootLayerCount = CountRootLayers();
|
||||||
@@ -207,18 +212,19 @@ int32 Desktop::ActiveRootLayerIndex(void) const
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
RootLayer* Desktop::RootLayerAt(int32 index)
|
RootLayer* Desktop::RootLayerAt(int32 index)
|
||||||
{
|
{
|
||||||
RootLayer *rl=static_cast<RootLayer*>(fRootLayerList.ItemAt(index));
|
return static_cast<RootLayer*>(fRootLayerList.ItemAt(index));
|
||||||
|
|
||||||
return rl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
int32 Desktop::CountRootLayers() const
|
int32 Desktop::CountRootLayers() const
|
||||||
{
|
{
|
||||||
return fRootLayerList.CountItems();
|
return fRootLayerList.CountItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline
|
||||||
DisplayDriver* Desktop::GetDisplayDriver() const
|
DisplayDriver* Desktop::GetDisplayDriver() const
|
||||||
{
|
{
|
||||||
return ScreenAt(0)->DDriver();
|
return ScreenAt(0)->DDriver();
|
||||||
@@ -228,55 +234,215 @@ DisplayDriver* Desktop::GetDisplayDriver() const
|
|||||||
// Methods for layer(WinBorder) manipulation.
|
// Methods for layer(WinBorder) manipulation.
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void Desktop::AddWinBorder(WinBorder *winBorder)
|
||||||
void Desktop::AddWinBorder(WinBorder* winBorder)
|
|
||||||
{
|
{
|
||||||
desktop->fGeneralLock.Lock();
|
if (!winBorder)
|
||||||
|
|
||||||
if(fWinBorderList.HasItem(winBorder))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// special case for Tracker background window.
|
int32 feel = winBorder->Window()->Feel();
|
||||||
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);
|
|
||||||
|
|
||||||
// add that pointer to user winboder list so that we can keep track of them.
|
// we're playing with window list. lock first.
|
||||||
fLayerLock.Lock();
|
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);
|
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++)
|
int32 feel = winBorder->Window()->Feel();
|
||||||
((RootLayer*)fRootLayerList.ItemAt(i))->RemoveWinBorder(winBorder);
|
|
||||||
|
// 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
|
else
|
||||||
winBorder->GetRootLayer()->RemoveWinBorder(winBorder);
|
{
|
||||||
|
Unlock();
|
||||||
|
debugger("RemoveWinBorder: WinBorder not found in Desktop list\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
fLayerLock.Lock();
|
// unlock!
|
||||||
fWinBorderList.RemoveItem(winBorder);
|
Unlock();
|
||||||
fLayerLock.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;
|
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)
|
void Desktop::PrintToStream(void)
|
||||||
{
|
{
|
||||||
printf("RootLayer List:\n=======\n");
|
printf("RootLayer List:\n=======\n");
|
||||||
@@ -366,33 +505,6 @@ void Desktop::PrintToStream(void)
|
|||||||
printf("\t%ld\n", ((Screen*)fScreenList.ItemAt(i))->ScreenNumber());
|
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)
|
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:
|
public:
|
||||||
// startup methods
|
// startup methods
|
||||||
Desktop(void);
|
Desktop(void);
|
||||||
~Desktop(void);
|
virtual ~Desktop(void);
|
||||||
void Init(void);
|
void Init(void);
|
||||||
|
|
||||||
// 1-BigScreen or n-SmallScreens
|
// 1-BigScreen or n-SmallScreens
|
||||||
@@ -67,8 +67,24 @@ public:
|
|||||||
// Methods for layer(WinBorder) manipulation.
|
// Methods for layer(WinBorder) manipulation.
|
||||||
void AddWinBorder(WinBorder *winBorder);
|
void AddWinBorder(WinBorder *winBorder);
|
||||||
void RemoveWinBorder(WinBorder *winBorder);
|
void RemoveWinBorder(WinBorder *winBorder);
|
||||||
|
void AddWinBorderToSubset(WinBorder *winBorder, WinBorder *toWinBorder);
|
||||||
|
void RemoveWinBorderFromSubset(WinBorder *winBorder, WinBorder *fromWinBorder);
|
||||||
bool HasWinBorder(WinBorder *winBorder);
|
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
|
// Methods for various desktop stuff handled by the server
|
||||||
void SetScrollBarInfo(const scroll_bar_info &info);
|
void SetScrollBarInfo(const scroll_bar_info &info);
|
||||||
scroll_bar_info ScrollBarInfo(void) const;
|
scroll_bar_info ScrollBarInfo(void) const;
|
||||||
@@ -85,27 +101,22 @@ public:
|
|||||||
void PrintToStream(void);
|
void PrintToStream(void);
|
||||||
void PrintVisibleInRootLayerNo(int32 no);
|
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:
|
private:
|
||||||
void AddDriver(DisplayDriver *driver);
|
void AddDriver(DisplayDriver *driver);
|
||||||
|
|
||||||
BList fRootLayerList;
|
BList fWinBorderList;
|
||||||
RootLayer *fActiveRootLayer;
|
BLocker fWinLock;
|
||||||
|
|
||||||
BList fScreenList;
|
BList fRootLayerList;
|
||||||
Screen *fActiveScreen;
|
RootLayer *fActiveRootLayer;
|
||||||
|
|
||||||
|
BList fScreenList;
|
||||||
|
Screen *fActiveScreen;
|
||||||
|
|
||||||
scroll_bar_info fScrollBarInfo;
|
scroll_bar_info fScrollBarInfo;
|
||||||
menu_info fMenuInfo;
|
menu_info fMenuInfo;
|
||||||
mode_mouse fMouseMode;
|
mode_mouse fMouseMode;
|
||||||
bool fFFMouseMode;
|
bool fFFMouseMode;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Desktop *desktop;
|
extern Desktop *desktop;
|
||||||
|
|||||||
@@ -1,14 +1,4 @@
|
|||||||
#ifndef _GLOBALS_H_
|
#ifndef _GLOBALS_H_
|
||||||
#define _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
|
#endif
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ Layer::Layer(BRect frame, const char *name, int32 token, uint32 resize,
|
|||||||
|
|
||||||
fInUpdate = false;
|
fInUpdate = false;
|
||||||
fIsTopLayer = false;
|
fIsTopLayer = false;
|
||||||
fLevel = 0;
|
fLevel = -100;
|
||||||
|
|
||||||
fViewToken = token;
|
fViewToken = token;
|
||||||
fServerWin = NULL;
|
fServerWin = NULL;
|
||||||
@@ -201,7 +201,7 @@ void Layer::AddChild(Layer *layer, ServerWindow *serverWin)
|
|||||||
c->SetRootLayer(c->fParent->fRootLayer);
|
c->SetRootLayer(c->fParent->fRootLayer);
|
||||||
|
|
||||||
// 2.2) this Layer must know if it has a ServerWindow object attached.
|
// 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.
|
// 2.3) we are attached to the main tree so build our full region.
|
||||||
c->RebuildFullRegion();
|
c->RebuildFullRegion();
|
||||||
@@ -298,7 +298,7 @@ void Layer::RemoveChild(Layer *layer)
|
|||||||
// 2.1) set the RootLayer for this object.
|
// 2.1) set the RootLayer for this object.
|
||||||
c->SetRootLayer(NULL);
|
c->SetRootLayer(NULL);
|
||||||
// 2.2) this Layer must know if it has a ServerWindow object attached.
|
// 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.
|
// 2.3) we were removed from the main tree so clear our full region.
|
||||||
c->fFull.MakeEmpty();
|
c->fFull.MakeEmpty();
|
||||||
// 2.4) clear fullVisible region.
|
// 2.4) clear fullVisible region.
|
||||||
@@ -645,7 +645,10 @@ void Layer::Draw(const BRect &r)
|
|||||||
r.PrintToStream();
|
r.PrintToStream();
|
||||||
#endif
|
#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.
|
// empty HOOK function.
|
||||||
}
|
}
|
||||||
@@ -730,9 +733,9 @@ void Layer::RebuildFullRegion(void)
|
|||||||
STRACE(("Layer(%s)::RebuildFullRegion()\n", GetName()));
|
STRACE(("Layer(%s)::RebuildFullRegion()\n", GetName()));
|
||||||
|
|
||||||
if (fParent)
|
if (fParent)
|
||||||
fFull.Set( fParent->ConvertToTop( fFrame ) );
|
fFull.Set(fParent->ConvertToTop(fFrame ));
|
||||||
else
|
else
|
||||||
fFull.Set( fFrame );
|
fFull.Set(fFrame);
|
||||||
|
|
||||||
// TODO: restrict to screen coordinates
|
// TODO: restrict to screen coordinates
|
||||||
|
|
||||||
@@ -1088,7 +1091,7 @@ void Layer::StartRebuildRegions( const BRegion& reg, Layer *target, uint32 actio
|
|||||||
fVisible = fFullVisible;
|
fVisible = fFullVisible;
|
||||||
|
|
||||||
// Rebuild regions for children...
|
// Rebuild regions for children...
|
||||||
for(Layer *lay = VirtualBottomChild(); lay != NULL; lay = VirtualUpperSibling())
|
for(Layer *lay = VirtualBottomChild(); lay; lay = VirtualUpperSibling())
|
||||||
{
|
{
|
||||||
if (lay == target)
|
if (lay == target)
|
||||||
lay->RebuildRegions(reg, action, pt, BPoint(0.0f, 0.0f));
|
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
|
//! Converts the passed rectangle to screen coordinates
|
||||||
BRect Layer::ConvertToTop(BRect rect)
|
BRect Layer::ConvertToTop(BRect rect)
|
||||||
{
|
{
|
||||||
if (fParent!=NULL)
|
if (fParent)
|
||||||
return(fParent->ConvertToTop(rect.OffsetByCopy(fFrame.LeftTop())) );
|
return(fParent->ConvertToTop(rect.OffsetByCopy(fFrame.LeftTop())) );
|
||||||
else
|
else
|
||||||
return(rect);
|
return(rect);
|
||||||
@@ -1412,7 +1415,7 @@ BRect Layer::ConvertToTop(BRect rect)
|
|||||||
|
|
||||||
BPoint Layer::ConvertFromTop(BPoint pt)
|
BPoint Layer::ConvertFromTop(BPoint pt)
|
||||||
{
|
{
|
||||||
if (fParent!=NULL)
|
if (fParent)
|
||||||
{
|
{
|
||||||
return(fParent->ConvertFromTop(pt-fFrame.LeftTop()));
|
return(fParent->ConvertFromTop(pt-fFrame.LeftTop()));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <OS.h>
|
#include <OS.h>
|
||||||
#include <Locker.h>
|
#include <Locker.h>
|
||||||
|
#include "ServerWindow.h"
|
||||||
#include "RGBColor.h"
|
#include "RGBColor.h"
|
||||||
|
|
||||||
enum
|
enum
|
||||||
@@ -60,7 +61,7 @@ enum
|
|||||||
AS_ROOTLAYER_CLASS = 3,
|
AS_ROOTLAYER_CLASS = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
class ServerWindow;
|
class ServerApp;
|
||||||
class RootLayer;
|
class RootLayer;
|
||||||
class DisplayDriver;
|
class DisplayDriver;
|
||||||
class LayerData;
|
class LayerData;
|
||||||
@@ -101,9 +102,9 @@ public:
|
|||||||
|
|
||||||
virtual void Draw(const BRect &r);
|
virtual void Draw(const BRect &r);
|
||||||
|
|
||||||
virtual void Show(bool invalidate=true);
|
void Show(bool invalidate=true);
|
||||||
virtual void Hide(bool invalidate=true);
|
void Hide(bool invalidate=true);
|
||||||
virtual bool IsHidden(void) const;
|
bool IsHidden(void) const;
|
||||||
|
|
||||||
BRect Bounds(void) const;
|
BRect Bounds(void) const;
|
||||||
BRect Frame(void) const;
|
BRect Frame(void) const;
|
||||||
@@ -126,6 +127,7 @@ public:
|
|||||||
|
|
||||||
DisplayDriver *GetDisplayDriver(void) const { return fDriver; }
|
DisplayDriver *GetDisplayDriver(void) const { return fDriver; }
|
||||||
ServerWindow *Window(void) const { return fServerWin; }
|
ServerWindow *Window(void) const { return fServerWin; }
|
||||||
|
ServerApp *App(void) const { return fServerWin? fServerWin->App(): NULL; }
|
||||||
virtual bool HasClient(void) { return true; }
|
virtual bool HasClient(void) { return true; }
|
||||||
bool IsServerLayer() const;
|
bool IsServerLayer() const;
|
||||||
int32 Level() const { return fLevel; }
|
int32 Level() const { return fLevel; }
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -68,16 +68,21 @@ public:
|
|||||||
virtual Layer *VirtualUpperSibling(void) const;
|
virtual Layer *VirtualUpperSibling(void) const;
|
||||||
virtual Layer *VirtualBottomChild(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 HideWinBorder(WinBorder* winBorder);
|
||||||
void ShowWinBorder(WinBorder* winBorder);
|
void ShowWinBorder(WinBorder* winBorder);
|
||||||
WinBorder* WinBorderAt(const BPoint& pt);
|
void SetWinBorderWorskpaces(WinBorder *winBorder, uint32 newWksIndex);
|
||||||
void ChangeWorkspacesFor(WinBorder *winBorder, uint32 newWorkspaces);
|
WinBorder* WinBorderAt(const BPoint& pt) const;
|
||||||
bool SetFrontWinBorder(WinBorder *winBorder);
|
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);
|
void SetScreens(Screen *screen[], int32 rows, int32 columns);
|
||||||
Screen **Screens(void);
|
Screen **Screens(void);
|
||||||
@@ -85,18 +90,10 @@ public:
|
|||||||
int32 ScreenRows(void) const { return fRows; }
|
int32 ScreenRows(void) const { return fRows; }
|
||||||
int32 ScreenColumns(void) const { return fColumns; }
|
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);
|
void SetBGColor(const RGBColor &col);
|
||||||
RGBColor BGColor(void) const;
|
RGBColor BGColor(void) const;
|
||||||
|
|
||||||
int32 Buttons(void);
|
int32 Buttons(void) { return fButtons; }
|
||||||
virtual bool HasClient(void) { return false; }
|
virtual bool HasClient(void) { return false; }
|
||||||
|
|
||||||
void AddWinBorderToWorkspaces(WinBorder *winBorder, uint32 wks);
|
void AddWinBorderToWorkspaces(WinBorder *winBorder, uint32 wks);
|
||||||
@@ -124,18 +121,17 @@ public:
|
|||||||
// Debug methods
|
// Debug methods
|
||||||
void PrintToStream(void);
|
void PrintToStream(void);
|
||||||
|
|
||||||
// "Private" to app_server :-) - they should not be used
|
|
||||||
void RemoveAppWindow(WinBorder *wb);
|
|
||||||
|
|
||||||
FMWList fMainFMWList;
|
|
||||||
BRegion fRedrawReg;
|
BRegion fRedrawReg;
|
||||||
BList fCopyRegList;
|
BList fCopyRegList;
|
||||||
BList fCopyList;
|
BList fCopyList;
|
||||||
|
|
||||||
// TODO: remove! Quick!
|
|
||||||
BLocker fMainLock;
|
|
||||||
|
|
||||||
private:
|
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 show_winBorder(WinBorder* winBorder);
|
||||||
void hide_winBorder(WinBorder* winBorder);
|
void hide_winBorder(WinBorder* winBorder);
|
||||||
@@ -160,8 +156,12 @@ private:
|
|||||||
uint32 fColorSpace;
|
uint32 fColorSpace;
|
||||||
int32 fButtons;
|
int32 fButtons;
|
||||||
|
|
||||||
BList fWorkspaceList;
|
int32 fActiveWksIndex;
|
||||||
Workspace *fActiveWorkspace;
|
int32 fWsCount;
|
||||||
|
Workspace* fWorkspace[32];
|
||||||
|
mutable WinBorder** fWinBorderList;
|
||||||
|
mutable int32 fWinBorderCount;
|
||||||
|
mutable int32 fWinBorderIndex;
|
||||||
|
|
||||||
int32 fScreenShotIndex;
|
int32 fScreenShotIndex;
|
||||||
bool fQuiting;
|
bool fQuiting;
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
# define STRACE(x) ;
|
# define STRACE(x) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DEBUG_SERVERAPP_FONT
|
//#define DEBUG_SERVERAPP_FONT
|
||||||
|
|
||||||
#ifdef DEBUG_SERVERAPP_FONT
|
#ifdef DEBUG_SERVERAPP_FONT
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
@@ -317,6 +317,57 @@ int32 ServerApp::MonitorApp(void *data)
|
|||||||
|
|
||||||
switch(code)
|
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:
|
case AS_QUIT_APP:
|
||||||
{
|
{
|
||||||
// This message is received only when the app_server is asked to shut down in
|
// 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;
|
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:
|
case AS_CREATE_BITMAP:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Received BBitmap creation request\n",fSignature.String()));
|
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:
|
case AS_ACTIVATE_WORKSPACE:
|
||||||
{
|
{
|
||||||
STRACE(("ServerApp %s: Activate Workspace\n",fSignature.String()));
|
STRACE(("ServerApp %s: Activate Workspace UNIMPLEMETED\n",fSignature.String()));
|
||||||
|
|
||||||
// Attached data
|
// Attached data
|
||||||
// 1) int32 workspace index
|
// 1) int32 workspace index
|
||||||
@@ -756,9 +756,6 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
|||||||
int32 workspace;
|
int32 workspace;
|
||||||
msg.Read<int32>(&workspace);
|
msg.Read<int32>(&workspace);
|
||||||
|
|
||||||
RootLayer *root=desktop->ActiveRootLayer();
|
|
||||||
if(root)
|
|
||||||
root->SetActiveWorkspaceByIndex(workspace);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1128,13 +1125,13 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
|||||||
// Returns:
|
// Returns:
|
||||||
// 1) font_family The name of the font family
|
// 1) font_family The name of the font family
|
||||||
// 2) font_style - name of the style
|
// 2) font_style - name of the style
|
||||||
int32 famid, styid;
|
uint16 famid, styid;
|
||||||
port_id replyport;
|
port_id replyport;
|
||||||
font_family fam;
|
font_family fam;
|
||||||
font_style sty;
|
font_style sty;
|
||||||
|
|
||||||
msg.Read<int32>(&famid);
|
msg.Read<uint16>(&famid);
|
||||||
msg.Read<int32>(&styid);
|
msg.Read<uint16>(&styid);
|
||||||
msg.Read<port_id>(&replyport);
|
msg.Read<port_id>(&replyport);
|
||||||
|
|
||||||
replylink.SetSendPort(replyport);
|
replylink.SetSendPort(replyport);
|
||||||
@@ -1157,6 +1154,7 @@ void ServerApp::DispatchMessage(int32 code, LinkMsgReader &msg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fontserver->Unlock();
|
fontserver->Unlock();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_GET_FONT_DIRECTION:
|
case AS_GET_FONT_DIRECTION:
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public:
|
|||||||
team_id ClientTeamID();
|
team_id ClientTeamID();
|
||||||
|
|
||||||
FMWList fAppFMWList;
|
FMWList fAppFMWList;
|
||||||
|
const char * Title() const { return fSignature.String(); }
|
||||||
protected:
|
protected:
|
||||||
friend class AppServer;
|
friend class AppServer;
|
||||||
friend class ServerWindow;
|
friend class ServerWindow;
|
||||||
|
|||||||
@@ -45,7 +45,6 @@
|
|||||||
#include "ServerApp.h"
|
#include "ServerApp.h"
|
||||||
#include "ServerProtocol.h"
|
#include "ServerProtocol.h"
|
||||||
#include "WinBorder.h"
|
#include "WinBorder.h"
|
||||||
#include "Desktop.h"
|
|
||||||
#include "TokenHandler.h"
|
#include "TokenHandler.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
#include "DisplayDriver.h"
|
#include "DisplayDriver.h"
|
||||||
@@ -53,10 +52,10 @@
|
|||||||
#include "Workspace.h"
|
#include "Workspace.h"
|
||||||
#include "MessagePrivate.h"
|
#include "MessagePrivate.h"
|
||||||
|
|
||||||
#define DEBUG_SERVERWINDOW
|
//#define DEBUG_SERVERWINDOW
|
||||||
//#define DEBUG_SERVERWINDOW_MOUSE
|
//#define DEBUG_SERVERWINDOW_MOUSE
|
||||||
//#define DEBUG_SERVERWINDOW_KEYBOARD
|
//#define DEBUG_SERVERWINDOW_KEYBOARD
|
||||||
#define DEBUG_SERVERWINDOW_GRAPHICS
|
//#define DEBUG_SERVERWINDOW_GRAPHICS
|
||||||
|
|
||||||
|
|
||||||
#ifdef DEBUG_SERVERWINDOW
|
#ifdef DEBUG_SERVERWINDOW
|
||||||
@@ -151,6 +150,29 @@ ServerWindow::ServerWindow(BRect rect, const char *string, uint32 wlook,
|
|||||||
fClientTeamID = winapp->ClientTeamID();
|
fClientTeamID = winapp->ClientTeamID();
|
||||||
fWorkspaces = index;
|
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;
|
fWinBorder = NULL;
|
||||||
cl = NULL; //current layer
|
cl = NULL; //current layer
|
||||||
|
|
||||||
@@ -178,7 +200,6 @@ void ServerWindow::Init(void)
|
|||||||
{
|
{
|
||||||
fWinBorder = new WinBorder( fFrame, fTitle.String(), fLook, fFeel, 0UL,
|
fWinBorder = new WinBorder( fFrame, fTitle.String(), fLook, fFeel, 0UL,
|
||||||
this, desktop->GetDisplayDriver());
|
this, desktop->GetDisplayDriver());
|
||||||
fWinBorder->RebuildFullRegion();
|
|
||||||
|
|
||||||
// Spawn our message-monitoring thread
|
// Spawn our message-monitoring thread
|
||||||
fMonitorThreadID = spawn_thread(MonitorWin, fTitle.String(), B_NORMAL_PRIORITY, this);
|
fMonitorThreadID = spawn_thread(MonitorWin, fTitle.String(), B_NORMAL_PRIORITY, this);
|
||||||
@@ -192,8 +213,13 @@ ServerWindow::~ServerWindow(void)
|
|||||||
{
|
{
|
||||||
STRACE(("*ServerWindow (%s):~ServerWindow()\n",fTitle.String()));
|
STRACE(("*ServerWindow (%s):~ServerWindow()\n",fTitle.String()));
|
||||||
|
|
||||||
desktop->RemoveWinBorder(fWinBorder);
|
if (fWinBorder)
|
||||||
STRACE(("ServerWindow(%s) Successfully removed from the desktop\n", fTitle.String()));
|
{
|
||||||
|
delete fWinBorder;
|
||||||
|
fWinBorder = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
cl = NULL;
|
||||||
|
|
||||||
if(fMsgSender)
|
if(fMsgSender)
|
||||||
{
|
{
|
||||||
@@ -207,14 +233,6 @@ ServerWindow::~ServerWindow(void)
|
|||||||
fMsgReader=NULL;
|
fMsgReader=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fWinBorder)
|
|
||||||
{
|
|
||||||
delete fWinBorder;
|
|
||||||
fWinBorder = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
cl = NULL;
|
|
||||||
|
|
||||||
STRACE(("#ServerWindow(%s) will exit NOW\n", fTitle.String()));
|
STRACE(("#ServerWindow(%s) will exit NOW\n", fTitle.String()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -245,7 +263,7 @@ void ServerWindow::Quit(void)
|
|||||||
//! Shows the window's WinBorder
|
//! Shows the window's WinBorder
|
||||||
void ServerWindow::Show(void)
|
void ServerWindow::Show(void)
|
||||||
{
|
{
|
||||||
|
STRACE(("ServerWindow %s: Show\n",fTitle.String()));
|
||||||
if (!IsLocked())
|
if (!IsLocked())
|
||||||
debugger("you must lock a ServerWindow object before calling ::Show()\n");
|
debugger("you must lock a ServerWindow object before calling ::Show()\n");
|
||||||
|
|
||||||
@@ -258,6 +276,7 @@ void ServerWindow::Show(void)
|
|||||||
//! Hides the window's WinBorder
|
//! Hides the window's WinBorder
|
||||||
void ServerWindow::Hide(void)
|
void ServerWindow::Hide(void)
|
||||||
{
|
{
|
||||||
|
STRACE(("ServerWindow %s: Hide\n",fTitle.String()));
|
||||||
if (!IsLocked())
|
if (!IsLocked())
|
||||||
debugger("you must lock a ServerWindow object before calling ::Hide()\n");
|
debugger("you must lock a ServerWindow object before calling ::Hide()\n");
|
||||||
|
|
||||||
@@ -732,8 +751,6 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
|||||||
|
|
||||||
// connect decorator and top layer.
|
// connect decorator and top layer.
|
||||||
fWinBorder->AddChild(fWinBorder->fTopLayer, NULL);
|
fWinBorder->AddChild(fWinBorder->fTopLayer, NULL);
|
||||||
desktop->AddWinBorder(fWinBorder);
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1440,6 +1457,8 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
|||||||
int32 mainToken;
|
int32 mainToken;
|
||||||
team_id teamID;
|
team_id teamID;
|
||||||
|
|
||||||
|
printf("ServerWindow %s: Message AS_ADD_TO_SUBSET UNIMPLEMENTED\n",fTitle.String());
|
||||||
|
|
||||||
link.Read<int32>(&mainToken);
|
link.Read<int32>(&mainToken);
|
||||||
link.Read(&teamID, sizeof(team_id));
|
link.Read(&teamID, sizeof(team_id));
|
||||||
|
|
||||||
@@ -1449,7 +1468,7 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
|||||||
fMsgSender->StartMessage(SERVER_TRUE);
|
fMsgSender->StartMessage(SERVER_TRUE);
|
||||||
fMsgSender->Flush();
|
fMsgSender->Flush();
|
||||||
|
|
||||||
fWinBorder->AddToSubsetOf(wb);
|
// fWinBorder->AddToSubsetOf(wb);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1465,6 +1484,8 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
|||||||
int32 mainToken;
|
int32 mainToken;
|
||||||
team_id teamID;
|
team_id teamID;
|
||||||
|
|
||||||
|
printf("ServerWindow %s: Message AS_REM_FROM_SUBSET UNIMPLEMENTED\n",fTitle.String());
|
||||||
|
|
||||||
link.Read<int32>(&mainToken);
|
link.Read<int32>(&mainToken);
|
||||||
link.Read(&teamID, sizeof(team_id));
|
link.Read(&teamID, sizeof(team_id));
|
||||||
|
|
||||||
@@ -1474,7 +1495,7 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
|
|||||||
fMsgSender->StartMessage(SERVER_TRUE);
|
fMsgSender->StartMessage(SERVER_TRUE);
|
||||||
fMsgSender->Flush();
|
fMsgSender->Flush();
|
||||||
|
|
||||||
fWinBorder->RemoveFromSubsetOf(wb);
|
// fWinBorder->RemoveFromSubsetOf(wb);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -88,8 +88,6 @@ WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const i
|
|||||||
|
|
||||||
fMouseButtons = 0;
|
fMouseButtons = 0;
|
||||||
fKeyModifiers = 0;
|
fKeyModifiers = 0;
|
||||||
fServerHidden = false;
|
|
||||||
fMainWinBorder = NULL;
|
|
||||||
fDecorator = NULL;
|
fDecorator = NULL;
|
||||||
fTopLayer = NULL;
|
fTopLayer = NULL;
|
||||||
fAdFlags = fAdFlags | B_LAYER_CHILDREN_DEPENDANT;
|
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)
|
if (feel!= B_NO_BORDER_WINDOW_LOOK)
|
||||||
fDecorator = new_decorator(r, name, look, feel, flags, fDriver);
|
fDecorator = new_decorator(r, name, look, feel, flags, fDriver);
|
||||||
|
|
||||||
|
RebuildFullRegion();
|
||||||
|
|
||||||
|
desktop->AddWinBorder(this);
|
||||||
|
|
||||||
STRACE(("WinBorder %s:\n",GetName()));
|
STRACE(("WinBorder %s:\n",GetName()));
|
||||||
STRACE(("\tFrame: (%.1f,%.1f,%.1f,%.1f)\n",r.left,r.top,r.right,r.bottom));
|
STRACE(("\tFrame: (%.1f,%.1f,%.1f,%.1f)\n",r.left,r.top,r.right,r.bottom));
|
||||||
STRACE(("\tWindow %s\n",win?win->Title():"NULL"));
|
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)
|
WinBorder::~WinBorder(void)
|
||||||
{
|
{
|
||||||
STRACE(("WinBorder(%s)::~WinBorder()\n",GetName()));
|
STRACE(("WinBorder(%s)::~WinBorder()\n",GetName()));
|
||||||
|
|
||||||
|
desktop->RemoveWinBorder(this);
|
||||||
|
|
||||||
if (fTopLayer){
|
if (fTopLayer){
|
||||||
delete fTopLayer;
|
delete fTopLayer;
|
||||||
fTopLayer = NULL;
|
fTopLayer = NULL;
|
||||||
@@ -402,7 +407,14 @@ void WinBorder::Draw(const BRect &r)
|
|||||||
|
|
||||||
// if we have a visible region, it is decorator's one.
|
// if we have a visible region, it is decorator's one.
|
||||||
if(fDecorator)
|
if(fDecorator)
|
||||||
|
{
|
||||||
|
WinBorder *wb = GetRootLayer()->FocusWinBorder();
|
||||||
|
if (wb && wb == this)
|
||||||
|
fDecorator->SetFocus(true);
|
||||||
|
else
|
||||||
|
fDecorator->SetFocus(false);
|
||||||
fDecorator->Draw(fUpdateReg.Frame());
|
fDecorator->Draw(fUpdateReg.Frame());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Moves the winborder with redraw
|
//! Moves the winborder with redraw
|
||||||
@@ -427,25 +439,6 @@ void WinBorder::ResizeBy(float x, float y)
|
|||||||
resize_layer(x,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
|
//! Sets the minimum and maximum sizes of the window
|
||||||
void WinBorder::SetSizeLimits(float minwidth, float maxwidth, float minheight, float maxheight)
|
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);
|
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
|
// Unimplemented. Hook function for handling when system GUI colors change
|
||||||
void WinBorder::UpdateColors(void)
|
void WinBorder::UpdateColors(void)
|
||||||
{
|
{
|
||||||
@@ -676,3 +489,43 @@ void WinBorder::UpdateScreen(void)
|
|||||||
{
|
{
|
||||||
STRACE(("WinBorder %s: UpdateScreen unimplemented\n",GetName()));
|
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 <Rect.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include "Layer.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 ServerWindow;
|
||||||
class Decorator;
|
class Decorator;
|
||||||
@@ -66,10 +78,6 @@ public:
|
|||||||
|
|
||||||
virtual void RebuildFullRegion(void);
|
virtual void RebuildFullRegion(void);
|
||||||
|
|
||||||
virtual bool IsHidden() const;
|
|
||||||
void ServerHide();
|
|
||||||
void ServerUnhide();
|
|
||||||
|
|
||||||
void SetSizeLimits(float minwidth, float maxwidth, float minheight, float maxheight);
|
void SetSizeLimits(float minwidth, float maxwidth, float minheight, float maxheight);
|
||||||
|
|
||||||
void MouseDown(PointerEvent& evt, bool sendMessage);
|
void MouseDown(PointerEvent& evt, bool sendMessage);
|
||||||
@@ -84,20 +92,15 @@ public:
|
|||||||
|
|
||||||
virtual bool HasClient(void) { return false; }
|
virtual bool HasClient(void) { return false; }
|
||||||
Decorator *GetDecorator(void) const { return fDecorator; }
|
Decorator *GetDecorator(void) const { return fDecorator; }
|
||||||
WinBorder *MainWinBorder() const;
|
|
||||||
|
|
||||||
void SetLevel();
|
|
||||||
void HighlightDecorator(const bool &active);
|
void HighlightDecorator(const bool &active);
|
||||||
|
|
||||||
bool HasPoint(const BPoint &pt) const;
|
bool HasPoint(const BPoint &pt) const;
|
||||||
|
|
||||||
void AddToSubsetOf(WinBorder* main);
|
FMWList fFMWList;
|
||||||
void RemoveFromSubsetOf(WinBorder* main);
|
|
||||||
|
|
||||||
void PrintToStream();
|
private:
|
||||||
|
void SetLevel();
|
||||||
// Server "private" :-) - should not be used
|
|
||||||
void SetMainWinBorder(WinBorder *newMain);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class Layer;
|
friend class Layer;
|
||||||
@@ -111,8 +114,6 @@ protected:
|
|||||||
int32 fKeyModifiers;
|
int32 fKeyModifiers;
|
||||||
BPoint fLastMousePosition;
|
BPoint fLastMousePosition;
|
||||||
|
|
||||||
bool fServerHidden;
|
|
||||||
WinBorder *fMainWinBorder;
|
|
||||||
bool fIsMoving;
|
bool fIsMoving;
|
||||||
bool fIsResizing;
|
bool fIsResizing;
|
||||||
bool fIsClosing;
|
bool fIsClosing;
|
||||||
|
|||||||
+1211
-1172
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
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
// copy of this software and associated documentation files (the "Software"),
|
// copy of this software and associated documentation files (the "Software"),
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
//
|
//
|
||||||
// File Name: Workspace.h
|
// File Name: Workspace.h
|
||||||
// Author: Adi Oanca <adioanca@myrealbox.com>
|
// Author: Adi Oanca <adioanca@cotty.iren.com>
|
||||||
// Description: Tracks workspaces
|
// Description: Tracks workspaces
|
||||||
//
|
//
|
||||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
@@ -41,6 +41,7 @@ class WinBorder;
|
|||||||
|
|
||||||
struct ListData
|
struct ListData
|
||||||
{
|
{
|
||||||
|
bool isFree;
|
||||||
WinBorder *layerPtr;
|
WinBorder *layerPtr;
|
||||||
ListData *upperItem;
|
ListData *upperItem;
|
||||||
ListData *lowerItem;
|
ListData *lowerItem;
|
||||||
@@ -49,84 +50,101 @@ struct ListData
|
|||||||
class Workspace
|
class Workspace
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Workspace(const uint32 colorspace, int32 ID, const RGBColor& BGColor);
|
Workspace( const int32 ID,
|
||||||
~Workspace(void);
|
const uint32 colorspace,
|
||||||
|
const RGBColor& BGColor);
|
||||||
|
~Workspace(void);
|
||||||
|
|
||||||
bool AddWinBorder(WinBorder *layer);
|
int32 ID(void) const { return fID; }
|
||||||
bool RemoveWinBorder(WinBorder *layer);
|
|
||||||
bool HideSubsetWindows(WinBorder *layer);
|
|
||||||
WinBorder *FocusLayer(void) const;
|
|
||||||
WinBorder *FrontLayer(void) const;
|
|
||||||
|
|
||||||
void MoveToBack(WinBorder *newLast);
|
void AddWinBorder(WinBorder *winBorder);
|
||||||
|
void RemoveWinBorder(WinBorder *winBorder);
|
||||||
|
bool HasWinBorder(const WinBorder *winBorder) const;
|
||||||
|
|
||||||
// The bottom item is the one which is visible
|
WinBorder* Focus(void) const;
|
||||||
WinBorder *GoToBottomItem(void);
|
WinBorder* Front(void) const;
|
||||||
WinBorder *GoToUpperItem(void);
|
void GetWinBorderList(void **&list, int32 *itemCount ) const;
|
||||||
WinBorder *GoToTopItem(void);
|
|
||||||
WinBorder *GoToLowerItem(void);
|
|
||||||
bool GoToItem(WinBorder *layer);
|
|
||||||
|
|
||||||
void SetLocalSpace(const uint32 colorspace);
|
bool MoveToBack(WinBorder *newLast);
|
||||||
uint32 LocalSpace(void) const;
|
bool MoveToFront(WinBorder *newFront, bool doNotDisturb = false);
|
||||||
|
|
||||||
void SetBGColor(const RGBColor &c);
|
bool HideWinBorder(WinBorder *winBorder);
|
||||||
RGBColor BGColor(void) const;
|
bool ShowWinBorder(WinBorder *winBorder, bool userBusy = false);
|
||||||
|
|
||||||
int32 ID(void) const { return fID; }
|
// resolution related methods.
|
||||||
|
void SetLocalSpace(const uint32 colorspace);
|
||||||
|
uint32 LocalSpace(void) const;
|
||||||
|
|
||||||
void GetSettings(const BMessage &msg);
|
void SetBGColor(const RGBColor &c);
|
||||||
void GetDefaultSettings(void);
|
RGBColor BGColor(void) const;
|
||||||
void PutSettings(BMessage *msg, const int32 &index) const;
|
|
||||||
static void PutDefaultSettings(BMessage *msg, const int32 &index);
|
|
||||||
|
|
||||||
// debug methods
|
// settings related methods
|
||||||
void PrintToStream(void) const;
|
void GetSettings(const BMessage &msg);
|
||||||
void PrintItem(ListData *item) const;
|
void GetDefaultSettings(void);
|
||||||
|
void PutSettings(BMessage *msg, const int32 &index) const;
|
||||||
// TODO: Bad Style. There should be a more elegant way of doing this
|
static void PutDefaultSettings(BMessage *msg, const int32 &index);
|
||||||
// .... private :-) - do not use!
|
|
||||||
void SearchAndSetNewFront(WinBorder *preferred);
|
|
||||||
void SearchAndSetNewFocus(WinBorder *preferred);
|
|
||||||
void BringToFrontANormalWindow(WinBorder *layer);
|
|
||||||
|
|
||||||
|
// debug methods
|
||||||
|
void PrintToStream(void) const;
|
||||||
|
void PrintItem(ListData *item) const;
|
||||||
|
|
||||||
private:
|
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;
|
||||||
|
|
||||||
void InsertItem(ListData *item, ListData *before);
|
bool placeToBack(ListData *newLast);
|
||||||
void RemoveItem(ListData *item);
|
void placeInFront(ListData *item, const bool userBusy);
|
||||||
ListData *HasItem(ListData *item);
|
|
||||||
ListData *HasItem(WinBorder *layer);
|
|
||||||
|
|
||||||
ListData *FindPlace(ListData *pref);
|
bool removeAndPlaceBefore(const WinBorder *wb, ListData *beforeItem);
|
||||||
|
bool removeAndPlaceBefore(ListData *item, ListData *beforeItem);
|
||||||
|
|
||||||
int32 fID;
|
WinBorder* searchFirstMainWindow(WinBorder *wb) const;
|
||||||
uint32 fSpace;
|
|
||||||
RGBColor fBGColor;
|
|
||||||
|
|
||||||
// first visible onscreen
|
bool windowHasVisibleModals(const WinBorder *winBorder) const;
|
||||||
ListData *fBottomItem;
|
ListData* putModalsInFront(ListData *item);
|
||||||
|
void putFloatingInFront(ListData *item);
|
||||||
|
void saveFloatingWindows(ListData *itemNormal);
|
||||||
|
|
||||||
// the last visible(or covered by other Layers)
|
ListData* findNextFront() const;
|
||||||
ListData *fTopItem;
|
|
||||||
|
|
||||||
// pointer to the current element in the list
|
class MemoryPool
|
||||||
ListData *fCurrentItem;
|
{
|
||||||
|
public:
|
||||||
|
MemoryPool();
|
||||||
|
~MemoryPool();
|
||||||
|
ListData* GetCleanMemory(WinBorder* winborder);
|
||||||
|
void ReleaseMemory(ListData* mem);
|
||||||
|
private:
|
||||||
|
void expandBuffer(int32 start);
|
||||||
|
ListData *buffer;
|
||||||
|
int32 count;
|
||||||
|
};
|
||||||
|
|
||||||
// the focus WinBorder - for keyboard events
|
int32 fID;
|
||||||
ListData *fFocusItem;
|
uint32 fSpace;
|
||||||
|
RGBColor fBGColor;
|
||||||
|
|
||||||
// the item that is the target of mouse operations
|
// first visible onscreen
|
||||||
ListData *fFrontItem;
|
ListData *fBottomItem;
|
||||||
|
|
||||||
// settings for each workspace -- example taken from R5's app_server_settings file
|
// the last visible(or covered by other Layers)
|
||||||
display_timing fDisplayTiming;
|
ListData *fTopItem;
|
||||||
int16 fVirtualWidth;
|
|
||||||
int16 fVirtualHeight;
|
|
||||||
|
|
||||||
// TODO: find out what specific values need to be contained in fFlags as per R5's server
|
// the focus WinBorder - for keyboard events
|
||||||
// not to be confused with display_timing.flags
|
ListData *fFocusItem;
|
||||||
uint32 fFlags;
|
|
||||||
|
// pointer for which "big" actions are intended
|
||||||
|
ListData *fFrontItem;
|
||||||
|
|
||||||
|
// settings for each workspace -- example taken from R5's app_server_settings file
|
||||||
|
display_timing fDisplayTiming;
|
||||||
|
int16 fVirtualWidth;
|
||||||
|
int16 fVirtualHeight;
|
||||||
|
|
||||||
|
MemoryPool fPool;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user