Implemented support for BWindow::SetFeel()
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12456 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -419,6 +419,21 @@ void Desktop::RemoveWinBorderFromSubset(WinBorder *winBorder, WinBorder *fromWin
|
|||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Desktop::SetWinBorderFeel(WinBorder *winBorder, uint32 feel)
|
||||||
|
{
|
||||||
|
// NOTE: this method is called from RootLayer thread only
|
||||||
|
|
||||||
|
// we're playing with window list. lock first.
|
||||||
|
Lock();
|
||||||
|
|
||||||
|
RemoveWinBorder(winBorder);
|
||||||
|
winBorder->QuietlySetFeel(feel);
|
||||||
|
AddWinBorder(winBorder);
|
||||||
|
|
||||||
|
// unlock!
|
||||||
|
Unlock();
|
||||||
|
}
|
||||||
|
|
||||||
WinBorder* Desktop::FindWinBorderByServerWindowTokenAndTeamID(int32 token, team_id teamID)
|
WinBorder* Desktop::FindWinBorderByServerWindowTokenAndTeamID(int32 token, team_id teamID)
|
||||||
{
|
{
|
||||||
WinBorder* wb;
|
WinBorder* wb;
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ 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 SetWinBorderFeel(WinBorder *winBorder, uint32 feel);
|
||||||
void AddWinBorderToSubset(WinBorder *winBorder, WinBorder *toWinBorder);
|
void AddWinBorderToSubset(WinBorder *winBorder, WinBorder *toWinBorder);
|
||||||
void RemoveWinBorderFromSubset(WinBorder *winBorder, WinBorder *fromWinBorder);
|
void RemoveWinBorderFromSubset(WinBorder *winBorder, WinBorder *fromWinBorder);
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,6 @@ Layer::Layer(BRect frame, const char *name, int32 token, uint32 resize,
|
|||||||
fEventMask = 0UL;
|
fEventMask = 0UL;
|
||||||
fEventOptions = 0UL;
|
fEventOptions = 0UL;
|
||||||
fIsTopLayer = false;
|
fIsTopLayer = false;
|
||||||
fLevel = -100;
|
|
||||||
|
|
||||||
fViewToken = token;
|
fViewToken = token;
|
||||||
fServerWin = NULL;
|
fServerWin = NULL;
|
||||||
|
|||||||
@@ -131,7 +131,6 @@ public:
|
|||||||
ServerApp *App(void) const { return fServerWin? fServerWin->App(): NULL; }
|
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; }
|
|
||||||
uint32 EventMask(void) const { return fEventMask; }
|
uint32 EventMask(void) const { return fEventMask; }
|
||||||
uint32 EventOptions(void) const { return fEventOptions; }
|
uint32 EventOptions(void) const { return fEventOptions; }
|
||||||
|
|
||||||
@@ -184,7 +183,6 @@ protected:
|
|||||||
ServerWindow *fServerWin;
|
ServerWindow *fServerWin;
|
||||||
BString *fName;
|
BString *fName;
|
||||||
int32 fViewToken;
|
int32 fViewToken;
|
||||||
int32 fLevel;
|
|
||||||
uint32 fFlags;
|
uint32 fFlags;
|
||||||
uint32 fResizeMode;
|
uint32 fResizeMode;
|
||||||
uint32 fEventMask;
|
uint32 fEventMask;
|
||||||
|
|||||||
@@ -290,6 +290,16 @@ int32 RootLayer::WorkingThread(void *data)
|
|||||||
oneRootLayer->SetWinBorderWorskpaces(winBorder, oldWks, newWks);
|
oneRootLayer->SetWinBorderWorskpaces(winBorder, oldWks, newWks);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case AS_ROOTLAYER_DO_CHANGE_WINBORDER_FEEL:
|
||||||
|
{
|
||||||
|
WinBorder *winBorder = NULL;
|
||||||
|
int32 newFeel = 0;
|
||||||
|
|
||||||
|
messageQueue.Read<WinBorder*>(&winBorder);
|
||||||
|
messageQueue.Read<int32>(&newFeel);
|
||||||
|
oneRootLayer->change_winBorder_feel(winBorder, newFeel);
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
STRACE(("RootLayer(%s)::WorkingThread received unexpected code %lx\n",oneRootLayer->GetName(), code));
|
STRACE(("RootLayer(%s)::WorkingThread received unexpected code %lx\n",oneRootLayer->GetName(), code));
|
||||||
break;
|
break;
|
||||||
@@ -347,7 +357,14 @@ void RootLayer::redraw_layer(Layer *layer, const BRegion ®ion)
|
|||||||
layer->Invalidate(region);
|
layer->Invalidate(region);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RootLayer::GoChangeWinBorderFeel(const WinBorder *winBorder, int32 newFeel)
|
||||||
|
{
|
||||||
|
BPortLink msg(fListenPort, -1);
|
||||||
|
msg.StartMessage(AS_ROOTLAYER_DO_CHANGE_WINBORDER_FEEL);
|
||||||
|
msg.Attach<const WinBorder*>(winBorder);
|
||||||
|
msg.Attach<int32>(newFeel);
|
||||||
|
msg.Flush();
|
||||||
|
}
|
||||||
|
|
||||||
void RootLayer::MoveBy(float x, float y)
|
void RootLayer::MoveBy(float x, float y)
|
||||||
{
|
{
|
||||||
@@ -524,7 +541,6 @@ void RootLayer::RemoveSubsetWinBorder(WinBorder *winBorder, WinBorder *fromWinBo
|
|||||||
show_final_scene(exFocus, exActive);
|
show_final_scene(exFocus, exActive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// NOTE: This must be called by RootLayer's thread!!!!
|
// NOTE: This must be called by RootLayer's thread!!!!
|
||||||
bool RootLayer::SetActiveWorkspace(int32 index)
|
bool RootLayer::SetActiveWorkspace(int32 index)
|
||||||
{
|
{
|
||||||
@@ -1801,6 +1817,45 @@ void RootLayer::hide_winBorder(WinBorder *winBorder)
|
|||||||
show_final_scene(exFocus, exActive);
|
show_final_scene(exFocus, exActive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RootLayer::change_winBorder_feel(WinBorder *winBorder, int32 newFeel)
|
||||||
|
{
|
||||||
|
bool isVisible = false;
|
||||||
|
bool wasVisibleInActiveWorkspace = false;
|
||||||
|
|
||||||
|
WinBorder *exFocus = FocusWinBorder();
|
||||||
|
WinBorder *exActive = ActiveWinBorder();
|
||||||
|
|
||||||
|
if (!winBorder->IsHidden())
|
||||||
|
{
|
||||||
|
isVisible = true;
|
||||||
|
wasVisibleInActiveWorkspace = ActiveWorkspace()->HasWinBorder(winBorder);
|
||||||
|
winBorder->Hide(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
desktop->SetWinBorderFeel(winBorder, newFeel);
|
||||||
|
|
||||||
|
if (isVisible)
|
||||||
|
{
|
||||||
|
if (fEventMaskLayer)
|
||||||
|
{
|
||||||
|
WinBorder *wb = fEventMaskLayer->fOwner?
|
||||||
|
fEventMaskLayer->fOwner:
|
||||||
|
(WinBorder*)fEventMaskLayer;
|
||||||
|
if (wb == fEventMaskLayer)
|
||||||
|
{
|
||||||
|
fMovingWindow = false;
|
||||||
|
fResizingWindow = false;
|
||||||
|
wb->MouseUp(DEC_NONE);
|
||||||
|
}
|
||||||
|
fEventMaskLayer = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
winBorder->Show(false);
|
||||||
|
if (wasVisibleInActiveWorkspace || ActiveWorkspace()->HasWinBorder(winBorder))
|
||||||
|
show_final_scene(exFocus, exActive);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool RootLayer::get_workspace_windows()
|
bool RootLayer::get_workspace_windows()
|
||||||
{
|
{
|
||||||
int32 bufferSize = fWinBorderListLength;
|
int32 bufferSize = fWinBorderListLength;
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ public:
|
|||||||
status_t EnqueueMessage(BPortLink &message);
|
status_t EnqueueMessage(BPortLink &message);
|
||||||
void GoInvalidate(const Layer *layer, const BRegion ®ion);
|
void GoInvalidate(const Layer *layer, const BRegion ®ion);
|
||||||
void GoRedraw(const Layer *layer, const BRegion ®ion);
|
void GoRedraw(const Layer *layer, const BRegion ®ion);
|
||||||
|
void GoChangeWinBorderFeel(const WinBorder *winBorder, int32 newFeel);
|
||||||
|
|
||||||
// Debug methods
|
// Debug methods
|
||||||
void PrintToStream(void);
|
void PrintToStream(void);
|
||||||
@@ -140,6 +141,8 @@ friend class Desktop;
|
|||||||
void show_winBorder(WinBorder* winBorder);
|
void show_winBorder(WinBorder* winBorder);
|
||||||
void hide_winBorder(WinBorder* winBorder);
|
void hide_winBorder(WinBorder* winBorder);
|
||||||
|
|
||||||
|
void change_winBorder_feel(WinBorder *winBorder, int32 newFeel);
|
||||||
|
|
||||||
bool get_workspace_windows();
|
bool get_workspace_windows();
|
||||||
void draw_window_tab(WinBorder *exFocus);
|
void draw_window_tab(WinBorder *exFocus);
|
||||||
void empty_visible_regions(Layer *layer);
|
void empty_visible_regions(Layer *layer);
|
||||||
|
|||||||
@@ -1368,8 +1368,10 @@ cl->fBoundsLeftTop.PrintToStream();
|
|||||||
}
|
}
|
||||||
case AS_SET_FEEL:
|
case AS_SET_FEEL:
|
||||||
{
|
{
|
||||||
// TODO: Implement AS_SET_FEEL
|
STRACE(("ServerWindow %s: Message AS_SET_FEEL\n",fName));
|
||||||
STRACE(("ServerWindow %s: Message Set_Feel unimplemented\n",fName));
|
int32 newFeel;
|
||||||
|
link.Read<int32>(&newFeel);
|
||||||
|
myRootLayer->GoChangeWinBorderFeel(fWinBorder, newFeel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case AS_SET_ALIGNMENT:
|
case AS_SET_ALIGNMENT:
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ WinBorder::WinBorder( const BRect &r,
|
|||||||
DisplayDriver *driver)
|
DisplayDriver *driver)
|
||||||
: Layer(r, name, B_NULL_TOKEN, B_FOLLOW_NONE, 0UL, driver),
|
: Layer(r, name, B_NULL_TOKEN, B_FOLLOW_NONE, 0UL, driver),
|
||||||
fLook(wlook),
|
fLook(wlook),
|
||||||
fFeel(wfeel),
|
fLevel(-100),
|
||||||
fWindowFlags(wflags),
|
fWindowFlags(wflags),
|
||||||
fWorkspaces(wwksindex)
|
fWorkspaces(wwksindex)
|
||||||
{
|
{
|
||||||
@@ -110,30 +110,8 @@ 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();
|
QuietlySetFeel(wfeel);
|
||||||
|
|
||||||
if (fFeel != B_NO_BORDER_WINDOW_LOOK)
|
if (fFeel != B_NO_BORDER_WINDOW_LOOK)
|
||||||
fDecorator = new_decorator(r, name, fLook, fFeel, fWindowFlags, fDriver);
|
fDecorator = new_decorator(r, name, fLook, fFeel, fWindowFlags, fDriver);
|
||||||
@@ -401,9 +379,10 @@ 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::QuietlySetFeel(int32 feel)
|
||||||
void WinBorder::SetLevel()
|
|
||||||
{
|
{
|
||||||
|
fFeel = feel;
|
||||||
|
|
||||||
switch(fFeel)
|
switch(fFeel)
|
||||||
{
|
{
|
||||||
case B_FLOATING_SUBSET_WINDOW_FEEL:
|
case B_FLOATING_SUBSET_WINDOW_FEEL:
|
||||||
@@ -439,4 +418,26 @@ void WinBorder::SetLevel()
|
|||||||
default:
|
default:
|
||||||
fLevel = B_NORMAL;
|
fLevel = B_NORMAL;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
// 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)
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ public:
|
|||||||
|
|
||||||
inline int32 Look(void) const { return fLook; }
|
inline int32 Look(void) const { return fLook; }
|
||||||
inline int32 Feel(void) const { return fFeel; }
|
inline int32 Feel(void) const { return fFeel; }
|
||||||
|
inline int32 Level() const { return fLevel; }
|
||||||
inline uint32 WindowFlags(void) const { return fWindowFlags; }
|
inline uint32 WindowFlags(void) const { return fWindowFlags; }
|
||||||
inline uint32 Workspaces(void) const { return fWorkspaces; }
|
inline uint32 Workspaces(void) const { return fWorkspaces; }
|
||||||
|
|
||||||
@@ -113,12 +114,10 @@ public:
|
|||||||
bool HasPoint(const BPoint &pt) const;
|
bool HasPoint(const BPoint &pt) const;
|
||||||
|
|
||||||
inline void QuietlySetWorkspaces(uint32 wks) { fWorkspaces = wks; }
|
inline void QuietlySetWorkspaces(uint32 wks) { fWorkspaces = wks; }
|
||||||
|
void QuietlySetFeel(int32 feel);
|
||||||
|
|
||||||
FMWList fFMWList;
|
FMWList fFMWList;
|
||||||
|
|
||||||
private:
|
|
||||||
void SetLevel();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class Layer;
|
friend class Layer;
|
||||||
friend class ServerWindow;
|
friend class ServerWindow;
|
||||||
@@ -144,6 +143,7 @@ protected:
|
|||||||
|
|
||||||
int32 fLook;
|
int32 fLook;
|
||||||
int32 fFeel;
|
int32 fFeel;
|
||||||
|
int32 fLevel;
|
||||||
int32 fWindowFlags;
|
int32 fWindowFlags;
|
||||||
uint32 fWorkspaces;
|
uint32 fWorkspaces;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user