Big cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12424 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca
2005-04-16 13:30:49 +00:00
parent af1a2a015b
commit d7c2c05061
9 changed files with 378 additions and 496 deletions
+8 -8
View File
@@ -253,7 +253,7 @@ void Desktop::AddWinBorder(WinBorder *winBorder)
// R2: how to determine the RootLayer to which this window should be added??? // R2: how to determine the RootLayer to which this window should be added???
// for now, use ActiveRootLayer() because we only have one instance. // for now, use ActiveRootLayer() because we only have one instance.
int32 feel = winBorder->Window()->Feel(); int32 feel = winBorder->Feel();
// we are ServerApp thread, we need to lock RootLayer here. // we are ServerApp thread, we need to lock RootLayer here.
ActiveRootLayer()->Lock(); ActiveRootLayer()->Lock();
@@ -287,7 +287,7 @@ void Desktop::AddWinBorder(WinBorder *winBorder)
{ {
wb = (WinBorder*)fWinBorderList.ItemAt(i); wb = (WinBorder*)fWinBorderList.ItemAt(i);
if (wb->App()->ClientTeamID() == winBorder->App()->ClientTeamID() if (wb->App()->ClientTeamID() == winBorder->App()->ClientTeamID()
&& wb->Window()->Feel() == feelToLookFor) && wb->Feel() == feelToLookFor)
// R2: RootLayer comparison is needed. // R2: RootLayer comparison is needed.
{ {
feel == B_NORMAL_WINDOW_FEEL ? feel == B_NORMAL_WINDOW_FEEL ?
@@ -326,7 +326,7 @@ void Desktop::RemoveWinBorder(WinBorder *winBorder)
// remove from main WinBorder list. // remove from main WinBorder list.
if (fWinBorderList.RemoveItem(winBorder)) if (fWinBorderList.RemoveItem(winBorder))
{ {
int32 feel = winBorder->Window()->Feel(); int32 feel = winBorder->Feel();
// floating app/subset and modal_subset windows require special atention because // floating app/subset and modal_subset windows require special atention because
// they are/may_be added to the list of a lot normal windows. // they are/may_be added to the list of a lot normal windows.
@@ -341,7 +341,7 @@ void Desktop::RemoveWinBorder(WinBorder *winBorder)
{ {
wb = (WinBorder*)fWinBorderList.ItemAt(i); wb = (WinBorder*)fWinBorderList.ItemAt(i);
if (wb->Window()->Feel() == B_NORMAL_WINDOW_FEEL if (wb->Feel() == B_NORMAL_WINDOW_FEEL
&& wb->App()->ClientTeamID() == winBorder->App()->ClientTeamID()) && wb->App()->ClientTeamID() == winBorder->App()->ClientTeamID())
// R2: RootLayer comparison is needed. We'll see. // R2: RootLayer comparison is needed. We'll see.
{ {
@@ -389,9 +389,9 @@ void Desktop::AddWinBorderToSubset(WinBorder *winBorder, WinBorder *toWinBorder)
return; return;
} }
if ( (winBorder->Window()->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL if ( (winBorder->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL
|| winBorder->Window()->Feel() == B_MODAL_SUBSET_WINDOW_FEEL) || winBorder->Feel() == B_MODAL_SUBSET_WINDOW_FEEL)
&& toWinBorder->Window()->Feel() == B_NORMAL_WINDOW_FEEL && toWinBorder->Feel() == B_NORMAL_WINDOW_FEEL
&& toWinBorder->App()->ClientTeamID() == winBorder->App()->ClientTeamID() && toWinBorder->App()->ClientTeamID() == winBorder->App()->ClientTeamID()
&& !toWinBorder->fFMWList.HasItem(winBorder)) && !toWinBorder->fFMWList.HasItem(winBorder))
{ {
@@ -431,7 +431,7 @@ void Desktop::RemoveWinBorderFromSubset(WinBorder *winBorder, WinBorder *fromWin
// remove WinBorder from workspace, if needed - some other windows may still have it in their subset // remove WinBorder from workspace, if needed - some other windows may still have it in their subset
ActiveRootLayer()->RemoveSubsetWinBorder(winBorder, fromWinBorder); ActiveRootLayer()->RemoveSubsetWinBorder(winBorder, fromWinBorder);
if (fromWinBorder->Window()->Feel() == B_NORMAL_WINDOW_FEEL) if (fromWinBorder->Feel() == B_NORMAL_WINDOW_FEEL)
{ {
//remove from this normal_window's subset. //remove from this normal_window's subset.
fromWinBorder->fFMWList.RemoveItem(winBorder); fromWinBorder->fFMWList.RemoveItem(winBorder);
+11 -11
View File
@@ -45,14 +45,14 @@ void FMWList::AddWinBorder(void *item)
if(HasItem(item)) if(HasItem(item))
return; return;
int32 feelItem = ((WinBorder*)item)->Window()->Feel();; int32 feelItem = ((WinBorder*)item)->Feel();;
int32 feelTemp = 0; int32 feelTemp = 0;
int32 location = 0; int32 location = 0;
for(int32 i=0; i<CountItems(); i++) for(int32 i=0; i<CountItems(); i++)
{ {
location = i + 1; location = i + 1;
feelTemp = ((WinBorder*)ItemAt(i))->Window()->Feel(); feelTemp = ((WinBorder*)ItemAt(i))->Feel();
// in short: if 'item' is a floating window // in short: if 'item' is a floating window
if( (feelItem == B_FLOATING_SUBSET_WINDOW_FEEL || if( (feelItem == B_FLOATING_SUBSET_WINDOW_FEEL ||
@@ -77,7 +77,7 @@ void FMWList::AddFMWList(FMWList *list)
int32 i=0; int32 i=0;
for(i=0; i<CountItems(); i++) for(i=0; i<CountItems(); i++)
{ {
int32 feel = ((WinBorder*)ItemAt(i))->Window()->Feel(); int32 feel = ((WinBorder*)ItemAt(i))->Feel();
if(feel == B_MODAL_SUBSET_WINDOW_FEEL || if(feel == B_MODAL_SUBSET_WINDOW_FEEL ||
feel == B_MODAL_APP_WINDOW_FEEL || feel == B_MODAL_APP_WINDOW_FEEL ||
feel == B_MODAL_ALL_WINDOW_FEEL) feel == B_MODAL_ALL_WINDOW_FEEL)
@@ -90,7 +90,7 @@ void FMWList::AddFMWList(FMWList *list)
for(j=0; j<list->CountItems(); j++) for(j=0; j<list->CountItems(); j++)
{ {
void *item = list->ItemAt(j); void *item = list->ItemAt(j);
int32 feel = ((WinBorder*)item)->Window()->Feel(); int32 feel = ((WinBorder*)item)->Feel();
if(feel == B_MODAL_SUBSET_WINDOW_FEEL || if(feel == B_MODAL_SUBSET_WINDOW_FEEL ||
feel == B_MODAL_APP_WINDOW_FEEL || feel == B_MODAL_APP_WINDOW_FEEL ||
feel == B_MODAL_ALL_WINDOW_FEEL) feel == B_MODAL_ALL_WINDOW_FEEL)
@@ -115,26 +115,26 @@ void FMWList::PrintToStream() const
printf("\t%s", wb->GetName()); printf("\t%s", wb->GetName());
if (wb->Window()->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL) if (wb->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL)
printf("\t%s\n", "B_FLOATING_SUBSET_WINDOW_FEEL"); printf("\t%s\n", "B_FLOATING_SUBSET_WINDOW_FEEL");
if (wb->Window()->Feel() == B_FLOATING_APP_WINDOW_FEEL) if (wb->Feel() == B_FLOATING_APP_WINDOW_FEEL)
printf("\t%s\n", "B_FLOATING_APP_WINDOW_FEEL"); printf("\t%s\n", "B_FLOATING_APP_WINDOW_FEEL");
if (wb->Window()->Feel() == B_FLOATING_ALL_WINDOW_FEEL) if (wb->Feel() == B_FLOATING_ALL_WINDOW_FEEL)
printf("\t%s\n", "B_FLOATING_ALL_WINDOW_FEEL"); printf("\t%s\n", "B_FLOATING_ALL_WINDOW_FEEL");
if (wb->Window()->Feel() == B_MODAL_SUBSET_WINDOW_FEEL) if (wb->Feel() == B_MODAL_SUBSET_WINDOW_FEEL)
printf("\t%s\n", "B_MODAL_SUBSET_WINDOW_FEEL"); printf("\t%s\n", "B_MODAL_SUBSET_WINDOW_FEEL");
if (wb->Window()->Feel() == B_MODAL_APP_WINDOW_FEEL) if (wb->Feel() == B_MODAL_APP_WINDOW_FEEL)
printf("\t%s\n", "B_MODAL_APP_WINDOW_FEEL"); printf("\t%s\n", "B_MODAL_APP_WINDOW_FEEL");
if (wb->Window()->Feel() == B_MODAL_ALL_WINDOW_FEEL) if (wb->Feel() == B_MODAL_ALL_WINDOW_FEEL)
printf("\t%s\n", "B_MODAL_ALL_WINDOW_FEEL"); printf("\t%s\n", "B_MODAL_ALL_WINDOW_FEEL");
// this should NOT happen // this should NOT happen
if (wb->Window()->Feel() == B_NORMAL_WINDOW_FEEL) if (wb->Feel() == B_NORMAL_WINDOW_FEEL)
printf("\t%s\n", "B_NORMAL_WINDOW_FEEL"); printf("\t%s\n", "B_NORMAL_WINDOW_FEEL");
} }
} }
+10 -9
View File
@@ -406,10 +406,10 @@ void RootLayer::AddWinBorder(WinBorder* winBorder)
} }
// Subset modals also need to have a main window before appearing in workspace list. // Subset modals also need to have a main window before appearing in workspace list.
int32 feel = winBorder->Window()->Feel(); int32 feel = winBorder->Feel();
if (feel != B_FLOATING_SUBSET_WINDOW_FEEL && feel != B_MODAL_SUBSET_WINDOW_FEEL) if (feel != B_FLOATING_SUBSET_WINDOW_FEEL && feel != B_MODAL_SUBSET_WINDOW_FEEL)
{ {
uint32 wks = winBorder->Window()->Workspaces(); uint32 wks = winBorder->Workspaces();
// add to current workspace // add to current workspace
if (wks == 0) if (wks == 0)
@@ -461,7 +461,7 @@ void RootLayer::RemoveWinBorder(WinBorder* winBorder)
void RootLayer::AddSubsetWinBorder(WinBorder *winBorder, WinBorder *toWinBorder) void RootLayer::AddSubsetWinBorder(WinBorder *winBorder, WinBorder *toWinBorder)
{ {
// SUBSET windows _must_ have their workspaceIndex set to 0x0 // SUBSET windows _must_ have their workspaceIndex set to 0x0
if (winBorder->Window()->Workspaces() != 0UL) if (winBorder->Workspaces() != 0UL)
{ {
debugger("SUBSET windows _must_ have their workspaceIndex set to 0x0\n"); debugger("SUBSET windows _must_ have their workspaceIndex set to 0x0\n");
return; return;
@@ -552,7 +552,7 @@ bool RootLayer::SetActiveWorkspace(int32 index)
for (int32 i = 0; i < ptrCount; i++) for (int32 i = 0; i < ptrCount; i++)
{ {
if (ptrWin[i]->Window()->Workspaces() & (0x00000001UL << index)) if (ptrWin[i]->Workspaces() & (0x00000001UL << index))
{ {
fWorkspace[index]->AddWinBorder(ptrWin[i]); fWorkspace[index]->AddWinBorder(ptrWin[i]);
if (!ptrWin[i]->IsHidden()) if (!ptrWin[i]->IsHidden())
@@ -589,7 +589,7 @@ bool RootLayer::SetActiveWorkspace(int32 index)
fResizingWindow = false; fResizingWindow = false;
// only normal windows can change workspaces // only normal windows can change workspaces
if (movingWinBorder->Window()->Feel() == B_NORMAL_WINDOW_FEEL if (movingWinBorder->Feel() == B_NORMAL_WINDOW_FEEL
&& !ActiveWorkspace()->HasWinBorder(movingWinBorder)) && !ActiveWorkspace()->HasWinBorder(movingWinBorder))
{ {
// Workspace class expects a window to be hidden when it's about to be removed. // Workspace class expects a window to be hidden when it's about to be removed.
@@ -604,14 +604,14 @@ bool RootLayer::SetActiveWorkspace(int32 index)
ActiveWorkspace()->ShowWinBorder(movingWinBorder); ActiveWorkspace()->ShowWinBorder(movingWinBorder);
// TODO: can you call SetWinBorderWorskpaces() instead of this? // TODO: can you call SetWinBorderWorskpaces() instead of this?
uint32 wks = movingWinBorder->Window()->Workspaces(); uint32 wks = movingWinBorder->Workspaces();
BMessage changedMsg(B_WORKSPACES_CHANGED); BMessage changedMsg(B_WORKSPACES_CHANGED);
changedMsg.AddInt64("when", real_time_clock_usecs()); changedMsg.AddInt64("when", real_time_clock_usecs());
changedMsg.AddInt32("old", wks); changedMsg.AddInt32("old", wks);
wks &= ~(0x00000001 << exIndex); wks &= ~(0x00000001 << exIndex);
wks |= (0x00000001 << fActiveWksIndex); wks |= (0x00000001 << fActiveWksIndex);
changedMsg.AddInt32("new", wks); changedMsg.AddInt32("new", wks);
movingWinBorder->Window()->QuietlySetWorkspaces(wks); movingWinBorder->QuietlySetWorkspaces(wks);
movingWinBorder->Window()->SendMessageToClient(&changedMsg, B_NULL_TOKEN, false); movingWinBorder->Window()->SendMessageToClient(&changedMsg, B_NULL_TOKEN, false);
} }
} }
@@ -650,7 +650,7 @@ void RootLayer::SetWinBorderWorskpaces(WinBorder *winBorder, uint32 oldWksIndex,
{ {
// you *cannot* set workspaces index for a window other than a normal one! // you *cannot* set workspaces index for a window other than a normal one!
// Note: See ServerWindow class. // Note: See ServerWindow class.
if (winBorder->Window()->Feel() != B_NORMAL_WINDOW_FEEL) if (winBorder->Feel() != B_NORMAL_WINDOW_FEEL)
return; return;
bool invalidate = false; bool invalidate = false;
@@ -716,6 +716,7 @@ void RootLayer::SetWinBorderWorskpaces(WinBorder *winBorder, uint32 oldWksIndex,
changedMsg.AddInt64("when", real_time_clock_usecs()); changedMsg.AddInt64("when", real_time_clock_usecs());
changedMsg.AddInt32("old", oldWksIndex); changedMsg.AddInt32("old", oldWksIndex);
changedMsg.AddInt32("new", newWksIndex); changedMsg.AddInt32("new", newWksIndex);
winBorder->QuietlySetWorkspaces(newWksIndex);
winBorder->Window()->SendMessageToClient(&changedMsg, B_NULL_TOKEN, false); winBorder->Window()->SendMessageToClient(&changedMsg, B_NULL_TOKEN, false);
if (invalidate) if (invalidate)
@@ -1012,7 +1013,7 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg)
if (target != FocusWinBorder()) if (target != FocusWinBorder())
sendMessage = false; sendMessage = false;
else if (exFocus != FocusWinBorder() else if (exFocus != FocusWinBorder()
&& !(target->Window()->Flags() & B_WILL_ACCEPT_FIRST_CLICK)) && !(target->WindowFlags() & B_WILL_ACCEPT_FIRST_CLICK))
sendMessage = false; sendMessage = false;
if (sendMessage && fLastMouseMoved != target->fTopLayer) if (sendMessage && fLastMouseMoved != target->fTopLayer)
+2 -4
View File
@@ -341,7 +341,6 @@ int32 ServerApp::MonitorApp(void *data)
port_id sendPort = -1; port_id sendPort = -1;
port_id looperPort = -1; port_id looperPort = -1;
char *title = NULL; char *title = NULL;
port_id replyport = -1;
msgqueue.Read<BRect>(&frame); msgqueue.Read<BRect>(&frame);
msgqueue.Read<uint32>(&look); msgqueue.Read<uint32>(&look);
@@ -357,9 +356,8 @@ int32 ServerApp::MonitorApp(void *data)
// ServerWindow constructor will reply with port_id of a newly created port // ServerWindow constructor will reply with port_id of a newly created port
ServerWindow *sw = NULL; ServerWindow *sw = NULL;
sw = new ServerWindow(frame, title, look, feel, flags, app, sw = new ServerWindow(title, app, sendPort, looperPort, token);
sendPort, looperPort, replyport, wkspaces, token); sw->Init(frame, look, feel, flags, wkspaces);
sw->Init();
STRACE(("\nServerApp %s: New Window %s (%.1f,%.1f,%.1f,%.1f)\n", STRACE(("\nServerApp %s: New Window %s (%.1f,%.1f,%.1f,%.1f)\n",
app->fSignature.String(),title,frame.left,frame.top,frame.right,frame.bottom)); app->fSignature.String(),title,frame.left,frame.top,frame.right,frame.bottom));
File diff suppressed because it is too large Load Diff
+62 -81
View File
@@ -66,74 +66,60 @@ class Layer;
class ServerWindow class ServerWindow
{ {
public: public:
ServerWindow(BRect rect, const char *string, uint32 wlook, uint32 wfeel, uint32 wflags, ServerWindow( const char *string,
ServerApp *winapp, port_id winport, port_id looperPort, port_id replyport, ServerApp *winapp,
uint32 index,int32 handlerID); port_id winport,
virtual ~ServerWindow(void); port_id looperPort,
int32 handlerID);
virtual ~ServerWindow(void);
void Init(); void Init( BRect frame,
uint32 wlook, uint32 wfeel, uint32 wflags,
uint32 wwksindex);
// ServerWindow must be locked for these ones. void ReplaceDecorator(void);
void ReplaceDecorator(void); void Show(void);
void Quit(void); void Hide(void);
void Show(void);
void Hide(void);
// methods for sending various messages to client. status_t Lock(void);
bool IsHidden(void) const; void Unlock(void);
void Minimize(bool status); bool IsLocked(void) const;
void Zoom(void);
void WorkspaceActivated(int32 workspace, bool active); // methods for sending various messages to client.
void WorkspacesChanged(int32 oldone,int32 newone); void Quit(void);
void WindowActivated(bool active); void Minimize(bool status);
void ScreenModeChanged(const BRect frame, const color_space cspace); void Zoom(void);
void ScreenModeChanged(const BRect frame, const color_space cspace);
status_t Lock(void); // util methods.
void Unlock(void); void SendMessageToClient(const BMessage* msg,
bool IsLocked(void) const; int32 target = B_NULL_TOKEN,
bool usePreferred = false) const;
// to who we belong. who do we own. our title.
inline ServerApp* App(void) const { return fServerApp; }
inline const WinBorder* GetWinBorder(void) const { return fWinBorder; }
inline const char* Title(void) const { return fName; }
// related thread/team_id(s).
inline team_id ClientTeamID(void) const { return fClientTeamID; }
inline thread_id ThreadID(void) const { return fMonitorThreadID;}
// server "private" - try not to use.
inline int32 ClientToken(void) const { return fHandlerToken; }
//! Returns the index of the workspaces to which it belongs FMWList fWinFMWList;
int32 GetWorkspaceIndex(void) { return fWorkspaces; }
// util methods.
Layer *FindLayer(const Layer *start, int32 token) const;
void SendMessageToClient(const BMessage* msg,
int32 target = B_NULL_TOKEN,
bool usePreferred = false) const;
// a few, not that important methods returning some internal settings.
int32 Look(void) const { return fLook; }
int32 Feel(void) const { return fFeel; }
uint32 Flags(void) const { return fFlags; }
uint32 Workspaces(void) const { return fWorkspaces; }
// to who we belong. who do we own. our title.
ServerApp *App(void) const { return fServerApp; }
const WinBorder *GetWinBorder(void) const { return fWinBorder; }
const char *Title(void) const { return fTitle.String(); }
// related thread/team_id(s).
team_id ClientTeamID(void) const { return fClientTeamID; }
thread_id ThreadID(void) const { return fMonitorThreadID;}
// server "private" - try not to use.
void QuietlySetWorkspaces(uint32 wks) { fWorkspaces = wks; }
void QuietlySetFeel(int32 feel) { fFeel = feel; }
int32 ClientToken(void) const { return fHandlerToken; }
FMWList fWinFMWList;
private: private:
// methods for retrieving and creating a tree strcture of Layers. // methods for retrieving and creating a tree strcture of Layers.
Layer *CreateLayerTree(Layer *localRoot, LinkMsgReader &link); Layer* CreateLayerTree(Layer *localRoot, LinkMsgReader &link);
void SetLayerState(Layer *layer, LinkMsgReader &link); void SetLayerState(Layer *layer, LinkMsgReader &link);
void SetLayerFontState(Layer *layer, LinkMsgReader &link); void SetLayerFontState(Layer *layer, LinkMsgReader &link);
// message handle methods.
void DispatchMessage(int32 code, LinkMsgReader &link);
void DispatchGraphicsMessage(int32 code, LinkMsgReader &link);
static int32 MonitorWin(void *data);
// message handle methods.
void DispatchMessage(int32 code, LinkMsgReader &link);
void DispatchGraphicsMessage(int32 code, LinkMsgReader &link);
static int32 MonitorWin(void *data);
protected: protected:
friend class ServerApp; friend class ServerApp;
@@ -141,32 +127,27 @@ protected:
friend class Screen; friend class Screen;
friend class Layer; friend class Layer;
BString fTitle; char fName[50];
int32 fLook;
int32 fFeel;
int32 fFlags;
uint32 fWorkspaces;
ServerApp *fServerApp; ServerApp* fServerApp;
WinBorder *fWinBorder; WinBorder* fWinBorder;
team_id fClientTeamID; team_id fClientTeamID;
thread_id fMonitorThreadID; thread_id fMonitorThreadID;
port_id fMessagePort; port_id fMessagePort;
port_id fClientWinPort; port_id fClientWinPort;
port_id fClientLooperPort; port_id fClientLooperPort;
BLocker fLocker; LinkMsgReader* fMsgReader;
BRect fFrame; LinkMsgSender* fMsgSender;
uint32 fToken;
int32 fHandlerToken;
LinkMsgReader *fMsgReader;
LinkMsgSender *fMsgSender;
// cl is short for currentLayer. We'll use it a lot, that's why it's short :-) BLocker fLocker;
Layer *cl;
int32 fHandlerToken;
// cl is short for currentLayer. We'll use it a lot, that's why it's short :-)
Layer* cl;
}; };
#endif #endif
+38 -12
View File
@@ -77,9 +77,19 @@ TokenHandler border_token_handler;
bool gMouseDown = false; bool gMouseDown = false;
WinBorder::WinBorder(const BRect &r, const char *name, const int32 look, const int32 feel, WinBorder::WinBorder( const BRect &r,
const int32 flags, ServerWindow *win, DisplayDriver *driver) const char *name,
: Layer(r, name, B_NULL_TOKEN, B_FOLLOW_NONE, flags, driver) const uint32 wlook,
const uint32 wfeel,
const uint32 wflags,
const uint32 wwksindex,
ServerWindow *win,
DisplayDriver *driver)
: Layer(r, name, B_NULL_TOKEN, B_FOLLOW_NONE, 0UL, driver),
fLook(wlook),
fFeel(wfeel),
fWindowFlags(wflags),
fWorkspaces(wwksindex)
{ {
// unlike BViews, windows start off as hidden // unlike BViews, windows start off as hidden
fHidden = true; fHidden = true;
@@ -100,11 +110,33 @@ cnt = 0; // for debugging
fIsMinimizing = false; fIsMinimizing = false;
fIsZooming = false; fIsZooming = false;
// 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)
;
}
fLastMousePosition.Set(-1,-1); fLastMousePosition.Set(-1,-1);
SetLevel(); SetLevel();
if (feel!= B_NO_BORDER_WINDOW_LOOK) if (fFeel != B_NO_BORDER_WINDOW_LOOK)
fDecorator = new_decorator(r, name, look, feel, flags, fDriver); fDecorator = new_decorator(r, name, fLook, fFeel, fWindowFlags, fDriver);
RebuildFullRegion(); RebuildFullRegion();
@@ -269,12 +301,6 @@ void WinBorder::MouseUp(click_type action)
} }
} }
void WinBorder::MouseWheel(PointerEvent& evt, BPoint& ptWhere)
{
// what should decorator do with mouse wheel message.
// maybe decorator should have some hook functions for mouse messages.
}
//! Sets the decorator focus to active or inactive colors //! Sets the decorator focus to active or inactive colors
void WinBorder::HighlightDecorator(const bool &active) void WinBorder::HighlightDecorator(const bool &active)
{ {
@@ -378,7 +404,7 @@ void WinBorder::UpdateScreen(void)
//--------------------- P R I V A T E ------------------- //--------------------- P R I V A T E -------------------
void WinBorder::SetLevel() void WinBorder::SetLevel()
{ {
switch(fServerWin->Feel()) switch(fFeel)
{ {
case B_FLOATING_SUBSET_WINDOW_FEEL: case B_FLOATING_SUBSET_WINDOW_FEEL:
case B_FLOATING_APP_WINDOW_FEEL: case B_FLOATING_APP_WINDOW_FEEL:
+62 -40
View File
@@ -68,69 +68,91 @@ class PointerEvent
class WinBorder : public Layer class WinBorder : public Layer
{ {
public: public:
WinBorder(const BRect &r, const char *name, const int32 look,const int32 feel, WinBorder( const BRect &r,
const int32 flags, ServerWindow *win, DisplayDriver *driver); const char *name,
virtual ~WinBorder(void); const uint32 wlook,
const uint32 wfeel,
const uint32 wflags,
const uint32 wwksindex,
ServerWindow *win,
DisplayDriver *driver);
virtual ~WinBorder(void);
virtual void Draw(const BRect &r); virtual void Draw(const BRect &r);
virtual void MoveBy(float x, float y); virtual void MoveBy(float x, float y);
virtual void ResizeBy(float x, float y); virtual void ResizeBy(float x, float y);
virtual void RebuildFullRegion(void); virtual void RebuildFullRegion(void);
void SetSizeLimits(float minwidth, float maxwidth, float minheight, float maxheight); void SetSizeLimits( float minwidth,
float maxwidth,
float minheight,
float maxheight);
click_type TellWhat(PointerEvent& evt) const; click_type TellWhat(PointerEvent& evt) const;
void MouseDown(click_type action); void MouseDown(click_type action);
void MouseMoved(click_type action); void MouseMoved(click_type action);
void MouseUp(click_type action); void MouseUp(click_type action);
void MouseWheel(PointerEvent& evt, BPoint& ptWhere);
void UpdateColors(void); void UpdateColors(void);
void UpdateDecorator(void); void UpdateDecorator(void);
void UpdateFont(void); void UpdateFont(void);
void UpdateScreen(void); void UpdateScreen(void);
virtual bool HasClient(void) { return false; } virtual bool HasClient(void) { return false; }
Decorator *GetDecorator(void) const { return fDecorator; } inline Decorator* GetDecorator(void) const { return fDecorator; }
void HighlightDecorator(const bool &active); inline int32 Look(void) const { return fLook; }
inline int32 Feel(void) const { return fFeel; }
inline uint32 WindowFlags(void) const { return fWindowFlags; }
inline uint32 Workspaces(void) const { return fWorkspaces; }
void HighlightDecorator(const bool &active);
bool HasPoint(const BPoint &pt) const; bool HasPoint(const BPoint &pt) const;
FMWList fFMWList; inline void QuietlySetWorkspaces(uint32 wks) { fWorkspaces = wks; }
FMWList fFMWList;
private: private:
void SetLevel(); void SetLevel();
protected: protected:
friend class Layer; friend class Layer;
friend class ServerWindow; friend class ServerWindow;
friend class RootLayer; friend class RootLayer;
Decorator *fDecorator; Decorator* fDecorator;
Layer *fTopLayer; Layer* fTopLayer;
BRegion zUpdateReg; BRegion zUpdateReg;
BRegion yUpdateReg; BRegion yUpdateReg;
BRegion fUpdateReg; BRegion fUpdateReg;
int32 fMouseButtons; int32 fMouseButtons;
int32 fKeyModifiers; int32 fKeyModifiers;
BPoint fLastMousePosition; BPoint fLastMousePosition;
bool fIsClosing; bool fIsClosing;
bool fIsMinimizing; bool fIsMinimizing;
bool fIsZooming; bool fIsZooming;
bool fInUpdate; bool fInUpdate;
bool fRequestSent; bool fRequestSent;
float fMinWidth, fMaxWidth; int32 fLook;
float fMinHeight, fMaxHeight; int32 fFeel;
int32 fWindowFlags;
uint32 fWorkspaces;
int cnt; // for debugging float fMinWidth,
fMaxWidth;
float fMinHeight,
fMaxHeight;
int cnt; // for debugging
}; };
#endif #endif
+14 -14
View File
@@ -284,7 +284,7 @@ STRACE(("\nWks(%ld)::MoveToFront ~%s~ \n", fID, newFront?newFront->GetName():"NU
// BUT it does not have focus. // BUT it does not have focus.
ListData *newFocusItem = HasItem(newFront); ListData *newFocusItem = HasItem(newFront);
if (newFocusItem && fFocusItem != newFocusItem if (newFocusItem && fFocusItem != newFocusItem
&& !(newFront->Window()->Flags() & B_AVOID_FOCUS)) && !(newFront->WindowFlags() & B_AVOID_FOCUS))
{ {
fFocusItem = newFocusItem; fFocusItem = newFocusItem;
} }
@@ -605,7 +605,7 @@ STRACE(("W(%ld)::HideWinBorder(%s) \n", fID, winBorder? winBorder->GetName(): "N
while(cursor) while(cursor)
{ {
if (!cursor->layerPtr->IsHidden() && !(cursor->layerPtr->Window()->Flags() & B_AVOID_FOCUS)) if (!cursor->layerPtr->IsHidden() && !(cursor->layerPtr->WindowFlags() & B_AVOID_FOCUS))
break; break;
else else
cursor = cursor->upperItem; cursor = cursor->upperItem;
@@ -906,7 +906,7 @@ STRACE(("W(%ld)::ShowWinBorder(%s) \n", fID, winBorder? winBorder->GetName(): "N
fFocusItem = NULL; fFocusItem = NULL;
while(cursor) while(cursor)
{ {
if (!cursor->layerPtr->IsHidden() && !(cursor->layerPtr->Window()->Flags() & B_AVOID_FOCUS)) if (!cursor->layerPtr->IsHidden() && !(cursor->layerPtr->WindowFlags() & B_AVOID_FOCUS))
{ {
if (cursor->layerPtr->Level() == B_FLOATING_APP || cursor->layerPtr->Level() == B_FLOATING_ALL) if (cursor->layerPtr->Level() == B_FLOATING_APP || cursor->layerPtr->Level() == B_FLOATING_ALL)
{ {
@@ -1025,23 +1025,23 @@ void Workspace::PrintToStream() const
{ {
WinBorder *wb = (WinBorder*)item->layerPtr; WinBorder *wb = (WinBorder*)item->layerPtr;
printf("\tName: %s\t%s", wb->GetName(), wb->IsHidden()?"Hidden\t": "Visible\t"); printf("\tName: %s\t%s", wb->GetName(), wb->IsHidden()?"Hidden\t": "Visible\t");
if(wb->Window()->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL) if(wb->Feel() == B_FLOATING_SUBSET_WINDOW_FEEL)
printf("\t%s\n", "B_FLOATING_SUBSET_WINDOW_FEEL"); printf("\t%s\n", "B_FLOATING_SUBSET_WINDOW_FEEL");
if(wb->Window()->Feel() == B_FLOATING_APP_WINDOW_FEEL) if(wb->Feel() == B_FLOATING_APP_WINDOW_FEEL)
printf("\t%s\n", "B_FLOATING_APP_WINDOW_FEEL"); printf("\t%s\n", "B_FLOATING_APP_WINDOW_FEEL");
if(wb->Window()->Feel() == B_FLOATING_ALL_WINDOW_FEEL) if(wb->Feel() == B_FLOATING_ALL_WINDOW_FEEL)
printf("\t%s\n", "B_FLOATING_ALL_WINDOW_FEEL"); printf("\t%s\n", "B_FLOATING_ALL_WINDOW_FEEL");
if(wb->Window()->Feel() == B_MODAL_SUBSET_WINDOW_FEEL) if(wb->Feel() == B_MODAL_SUBSET_WINDOW_FEEL)
printf("\t%s\n", "B_MODAL_SUBSET_WINDOW_FEEL"); printf("\t%s\n", "B_MODAL_SUBSET_WINDOW_FEEL");
if(wb->Window()->Feel() == B_MODAL_APP_WINDOW_FEEL) if(wb->Feel() == B_MODAL_APP_WINDOW_FEEL)
printf("\t%s\n", "B_MODAL_APP_WINDOW_FEEL"); printf("\t%s\n", "B_MODAL_APP_WINDOW_FEEL");
if(wb->Window()->Feel() == B_MODAL_ALL_WINDOW_FEEL) if(wb->Feel() == B_MODAL_ALL_WINDOW_FEEL)
printf("\t%s\n", "B_MODAL_ALL_WINDOW_FEEL"); printf("\t%s\n", "B_MODAL_ALL_WINDOW_FEEL");
if(wb->Window()->Feel() == B_NORMAL_WINDOW_FEEL) if(wb->Feel() == B_NORMAL_WINDOW_FEEL)
printf("\t%s\n", "B_NORMAL_WINDOW_FEEL"); printf("\t%s\n", "B_NORMAL_WINDOW_FEEL");
if(wb->Window()->Feel() == B_SYSTEM_LAST) if(wb->Feel() == B_SYSTEM_LAST)
printf("\t%s\n", "B_SYSTEM_LAST"); printf("\t%s\n", "B_SYSTEM_LAST");
if(wb->Window()->Feel() >= B_SYSTEM_FIRST) if(wb->Feel() >= B_SYSTEM_FIRST)
printf("\t%s\n", "B_SYSTEM_FIRST"); printf("\t%s\n", "B_SYSTEM_FIRST");
} }
@@ -1224,7 +1224,7 @@ bool Workspace::placeToBack(ListData *newLast)
ListData *cursor = newLast->upperItem; ListData *cursor = newLast->upperItem;
while ( cursor while ( cursor
&& ( cursor->layerPtr->IsHidden() && ( cursor->layerPtr->IsHidden()
|| cursor->layerPtr->Window()->Flags() & B_AVOID_FOCUS) || cursor->layerPtr->WindowFlags() & B_AVOID_FOCUS)
&& cursor->layerPtr->Level() == level) && cursor->layerPtr->Level() == level)
{ {
cursor = cursor->upperItem; cursor = cursor->upperItem;
@@ -1534,7 +1534,7 @@ ListData* Workspace::findNextFront() const
if (!item->layerPtr->IsHidden() if (!item->layerPtr->IsHidden()
&& item->layerPtr->Level() != B_FLOATING_ALL && item->layerPtr->Level() != B_FLOATING_ALL
&& item->layerPtr->Level() != B_FLOATING_APP && item->layerPtr->Level() != B_FLOATING_APP
&& !(item->layerPtr->Window()->Flags() & B_AVOID_FRONT)) && !(item->layerPtr->WindowFlags() & B_AVOID_FRONT))
{ {
return item; return item;
} }