Tried to separate active WinBorder from front, but failed - it's now always

the focus border, and therefore, I probably broke floating windows (but that's
not that important right now).
Workspace::HideWinBorder() now sets focus to the next WinBorder, not always
the top one.
Workspace::MoveToFront() no longer changes focus, no longer calls ShowWinBorder()
when the window doesn't have to be moved (ie. for the desktop window).
Added Workspace::SetFocus() to change the focus explicetly.
Some other cleanup. This is an ugly patch, but refactoring/rewriting is coming
soon.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13509 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-07-06 20:19:22 +00:00
parent 9c910f9e80
commit 189ba7a9dc
4 changed files with 405 additions and 457 deletions

View File

@ -290,7 +290,6 @@ RootLayer::WorkingThread(void *data)
} }
case AS_ROOTLAYER_DO_INVALIDATE: case AS_ROOTLAYER_DO_INVALIDATE:
{ {
//printf("Adi: new message\n");
BRegion invalidRegion; BRegion invalidRegion;
Layer *layer = NULL; Layer *layer = NULL;
messageQueue.Read<Layer*>(&layer); messageQueue.Read<Layer*>(&layer);
@ -577,7 +576,9 @@ void RootLayer::AddWinBorder(WinBorder* winBorder)
winBorder->fParent = this; winBorder->fParent = this;
} }
void RootLayer::RemoveWinBorder(WinBorder* winBorder)
void
RootLayer::RemoveWinBorder(WinBorder* winBorder)
{ {
// Note: removing a subset window is also permited/performed. // Note: removing a subset window is also permited/performed.
@ -601,7 +602,8 @@ void RootLayer::RemoveWinBorder(WinBorder* winBorder)
winBorder->fParent = NULL; winBorder->fParent = NULL;
} }
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->Workspaces() != 0UL) if (winBorder->Workspaces() != 0UL)
@ -617,16 +619,15 @@ void RootLayer::AddSubsetWinBorder(WinBorder *winBorder, WinBorder *toWinBorder)
return; return;
} }
bool invalidate = false; bool invalidate = false;
bool invalid; bool invalid;
WinBorder *exFocus = FocusWinBorder(); WinBorder* exFocus = FocusWinBorder();
WinBorder *exActive = ActiveWinBorder(); WinBorder* exActive = ActiveWinBorder();
// we try to add WinBorders to all workspaces. If they are not needed, nothing will be done. // we try to add WinBorders to all workspaces. If they are not needed, nothing will be done.
// If they are needed, Workspace automaticaly allocates space and inserts them. // If they are needed, Workspace automaticaly allocates space and inserts them.
for (int32 i = 0; i < fWsCount; i++) for (int32 i = 0; i < fWsCount; i++) {
{ invalid = false;
invalid = false;
if (fWorkspace[i] && fWorkspace[i]->HasWinBorder(toWinBorder)) if (fWorkspace[i] && fWorkspace[i]->HasWinBorder(toWinBorder))
invalid = fWorkspace[i]->ShowWinBorder(winBorder, false); invalid = fWorkspace[i]->ShowWinBorder(winBorder, false);
@ -639,24 +640,23 @@ void RootLayer::AddSubsetWinBorder(WinBorder *winBorder, WinBorder *toWinBorder)
show_final_scene(exFocus, exActive); show_final_scene(exFocus, exActive);
} }
void RootLayer::RemoveSubsetWinBorder(WinBorder *winBorder, WinBorder *fromWinBorder)
void
RootLayer::RemoveSubsetWinBorder(WinBorder *winBorder, WinBorder *fromWinBorder)
{ {
// there is no point in continuing - this subset window is not visible // there is no point in continuing - this subset window is not visible
// at least not visible from 'fromWinBorder's point of view. // at least not visible from 'fromWinBorder's point of view.
if (winBorder->IsHidden() || fromWinBorder->IsHidden()) if (winBorder->IsHidden() || fromWinBorder->IsHidden())
{
return; return;
}
bool invalidate = false; bool invalidate = false;
bool invalid; bool invalid;
WinBorder *exFocus = FocusWinBorder(); WinBorder* exFocus = FocusWinBorder();
WinBorder *exActive = ActiveWinBorder(); WinBorder* exActive = ActiveWinBorder();
// we try to remove from all workspaces. If winBorder is not in there, nothing will be done. // we try to remove from all workspaces. If winBorder is not in there, nothing will be done.
for (int32 i = 0; i < fWsCount; i++) for (int32 i = 0; i < fWsCount; i++) {
{ invalid = false;
invalid = false;
if (fWorkspace[i] && fWorkspace[i]->HasWinBorder(fromWinBorder)) if (fWorkspace[i] && fWorkspace[i]->HasWinBorder(fromWinBorder))
invalid = fWorkspace[i]->HideWinBorder(winBorder); invalid = fWorkspace[i]->HideWinBorder(winBorder);
@ -807,46 +807,39 @@ bool RootLayer::SetActiveWorkspace(int32 index)
return true; return true;
} }
void RootLayer::SetWinBorderWorskpaces(WinBorder *winBorder, uint32 oldWksIndex, uint32 newWksIndex)
void
RootLayer::SetWinBorderWorskpaces(WinBorder *winBorder, uint32 oldWksIndex, uint32 newWksIndex)
{ {
// 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->Feel() != B_NORMAL_WINDOW_FEEL) if (winBorder->Feel() != B_NORMAL_WINDOW_FEEL)
return; return;
bool invalidate = false; bool invalidate = false;
bool invalid; bool invalid;
WinBorder *exFocus = FocusWinBorder(); WinBorder* exFocus = FocusWinBorder();
WinBorder *exActive = ActiveWinBorder(); WinBorder* exActive = ActiveWinBorder();
for (int32 i = 0; i < 32; i++) for (int32 i = 0; i < 32; i++) {
{ if (fWorkspace[i]) {
if (fWorkspace[i])
{
invalid = false; invalid = false;
if (fWorkspace[i]->HasWinBorder(winBorder) if (fWorkspace[i]->HasWinBorder(winBorder)
&& !(newWksIndex & (0x00000001UL << i))) && !(newWksIndex & (0x00000001UL << i))) {
{ if (!winBorder->IsHidden()) {
if (!winBorder->IsHidden())
{
// a little trick to force Workspace to properly pick the next front. // a little trick to force Workspace to properly pick the next front.
winBorder->fHidden = true; winBorder->fHidden = true;
invalid = fWorkspace[i]->HideWinBorder(winBorder); invalid = fWorkspace[i]->HideWinBorder(winBorder);
winBorder->fHidden = false; winBorder->fHidden = false;
} }
fWorkspace[i]->RemoveWinBorder(winBorder); fWorkspace[i]->RemoveWinBorder(winBorder);
} } else if (newWksIndex & (0x00000001UL << i)
else && !(oldWksIndex & (0x00000001UL << i))) {
if (newWksIndex & (0x00000001UL << i) &&
!(oldWksIndex & (0x00000001UL << i)))
{
fWorkspace[i]->AddWinBorder(winBorder); fWorkspace[i]->AddWinBorder(winBorder);
if (!winBorder->IsHidden()) if (!winBorder->IsHidden())
invalid = fWorkspace[i]->ShowWinBorder(winBorder); invalid = fWorkspace[i]->ShowWinBorder(winBorder);
} } else {
else
{
// do nothing. winBorder was, and it still is a member of this workspace // do nothing. winBorder was, and it still is a member of this workspace
// OR, winBorder wasn't and it will not be in this workspace // OR, winBorder wasn't and it will not be in this workspace
} }
@ -857,13 +850,11 @@ void RootLayer::SetWinBorderWorskpaces(WinBorder *winBorder, uint32 oldWksIndex,
} }
// TODO: look into this... // TODO: look into this...
if (fEventMaskLayer) if (fEventMaskLayer) {
{ WinBorder* wb = fEventMaskLayer->fOwner ?
WinBorder *wb = fEventMaskLayer->fOwner? fEventMaskLayer->fOwner : (WinBorder*)fEventMaskLayer;
fEventMaskLayer->fOwner:
(WinBorder*)fEventMaskLayer; if (!fWorkspace[fActiveWksIndex]->HasWinBorder(wb)) {
if (!fWorkspace[fActiveWksIndex]->HasWinBorder(wb))
{
/* if (wb == fEventMaskLayer) /* if (wb == fEventMaskLayer)
{ {
fMovingWindow = false; fMovingWindow = false;
@ -874,7 +865,7 @@ void RootLayer::SetWinBorderWorskpaces(WinBorder *winBorder, uint32 oldWksIndex,
} }
} }
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", oldWksIndex); changedMsg.AddInt32("old", oldWksIndex);
changedMsg.AddInt32("new", newWksIndex); changedMsg.AddInt32("new", newWksIndex);
@ -885,6 +876,7 @@ void RootLayer::SetWinBorderWorskpaces(WinBorder *winBorder, uint32 oldWksIndex,
show_final_scene(exFocus, exActive); show_final_scene(exFocus, exActive);
} }
void void
RootLayer::SetWorkspaceCount(int32 wksCount) RootLayer::SetWorkspaceCount(int32 wksCount)
{ {
@ -901,54 +893,51 @@ RootLayer::SetWorkspaceCount(int32 wksCount)
fWsCount = wksCount; fWsCount = wksCount;
} }
void RootLayer::ReadWorkspaceData(const char *path)
void
RootLayer::ReadWorkspaceData(const char *path)
{ {
BMessage msg, settings; BMessage msg, settings;
BFile file(path,B_READ_ONLY); BFile file(path,B_READ_ONLY);
char string[20]; char string[20];
if(file.InitCheck()==B_OK && msg.Unflatten(&file)==B_OK) if (file.InitCheck() == B_OK && msg.Unflatten(&file) == B_OK) {
{
int32 count; int32 count;
if(msg.FindInt32("workspace_count",&count)!=B_OK) if (msg.FindInt32("workspace_count", &count)!=B_OK)
count=9; count = 9;
SetWorkspaceCount(count); SetWorkspaceCount(count);
for(int32 i=0; i<count; i++) for (int32 i = 0; i < count; i++) {
{
Workspace *ws=(Workspace*)fWorkspace[i]; Workspace *ws=(Workspace*)fWorkspace[i];
if(!ws) if (!ws)
continue; continue;
sprintf(string,"workspace %ld",i); sprintf(string,"workspace %ld",i);
if(msg.FindMessage(string,&settings)==B_OK) if (msg.FindMessage(string,&settings) == B_OK) {
{
ws->GetSettings(settings); ws->GetSettings(settings);
settings.MakeEmpty(); settings.MakeEmpty();
} } else
else
ws->GetDefaultSettings(); ws->GetDefaultSettings();
} }
} } else {
else
{
SetWorkspaceCount(9); SetWorkspaceCount(9);
for(int32 i=0; i<9; i++) for (int32 i = 0; i < 9; i++) {
{
Workspace *ws=(Workspace*)fWorkspace[i]; Workspace *ws=(Workspace*)fWorkspace[i];
if(!ws) if (!ws)
continue; continue;
ws->GetDefaultSettings(); ws->GetDefaultSettings();
} }
} }
} }
void RootLayer::SaveWorkspaceData(const char *path)
void
RootLayer::SaveWorkspaceData(const char *path)
{ {
BMessage msg,dummy; BMessage msg,dummy;
BFile file(path,B_READ_WRITE | B_CREATE_FILE); BFile file(path,B_READ_WRITE | B_CREATE_FILE);
@ -1103,12 +1092,13 @@ RootLayer::SetScreenMode(int32 width, int32 height, uint32 colorSpace, float fre
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// Input related methods // Input related methods
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void void
RootLayer::MouseEventHandler(int32 code, BPrivate::PortLink& msg) RootLayer::MouseEventHandler(int32 code, BPrivate::PortLink& msg)
{ {
switch(code) { switch (code) {
case B_MOUSE_DOWN: { case B_MOUSE_DOWN: {
//printf("RootLayer::MouseEventHandler(B_MOUSE_DOWN)\n"); //printf("RootLayer::MouseEventHandler(B_MOUSE_DOWN)\n");
// Attached data: // Attached data:
// 1) int64 - time of mouse click // 1) int64 - time of mouse click
// 2) float - x coordinate of mouse click // 2) float - x coordinate of mouse click
@ -1134,7 +1124,7 @@ RootLayer::MouseEventHandler(int32 code, BPrivate::PortLink& msg)
// CRITICAL("mouse position changed in B_MOUSE_DOWN from last B_MOUSE_MOVED\n"); // CRITICAL("mouse position changed in B_MOUSE_DOWN from last B_MOUSE_MOVED\n");
// update on screen mouse pos // update on screen mouse pos
GetHWInterface()->MoveCursorTo(evt.where.x, evt.where.y); GetHWInterface()->MoveCursorTo(evt.where.x, evt.where.y);
fLastMousePosition = evt.where; fLastMousePosition = evt.where;
} }
// We'll need this so that GetMouse can query for which buttons // We'll need this so that GetMouse can query for which buttons
@ -1152,15 +1142,17 @@ RootLayer::MouseEventHandler(int32 code, BPrivate::PortLink& msg)
// we are clicking a WinBorder // we are clicking a WinBorder
WinBorder* exActive = ActiveWinBorder(); WinBorder* exActive = ActiveWinBorder();
WinBorder* exFocus = FocusWinBorder(); WinBorder* exFocus = FocusWinBorder();
WinBorder* target = fLastMouseMoved->fOwner ? fLastMouseMoved->fOwner WinBorder* target = fLastMouseMoved->fOwner ? fLastMouseMoved->fOwner
: (WinBorder*)fLastMouseMoved; : (WinBorder*)fLastMouseMoved;
click_type action = target->MouseDown(evt); click_type action = target->MouseDown(evt);
bool invalidate = ActiveWorkspace()->SetFocus(target);
// TODO: only move to front if *not* in Focus Follows Mouse mode! // TODO: only move to front if *not* in Focus Follows Mouse mode!
bool invalidate = action == DEC_MOVETOBACK ? ActiveWorkspace()->MoveToBack(target) invalidate |= action == DEC_MOVETOBACK ? ActiveWorkspace()->MoveToBack(target)
: ActiveWorkspace()->MoveToFront(target); : ActiveWorkspace()->MoveToFront(target);
// Performance: MoveToFront() often returns true although it shouldn't do that. // Performance: MoveToFront() often returns true although it shouldn't do that.
// This is because internaly it calls Workspace::ShowWinBorder() and this imposes // This is because internaly it calls Workspace::ShowWinBorder() and this imposes
@ -1188,8 +1180,7 @@ RootLayer::MouseEventHandler(int32 code, BPrivate::PortLink& msg)
else if (exFocus != FocusWinBorder() else if (exFocus != FocusWinBorder()
&& !(target->WindowFlags() & B_WILL_ACCEPT_FIRST_CLICK)) && !(target->WindowFlags() & B_WILL_ACCEPT_FIRST_CLICK))
sendMessage = false; sendMessage = false;
if (target->Feel() == 1024)
sendMessage = true;
if (sendMessage && fLastMouseMoved != target->fTopLayer) { if (sendMessage && fLastMouseMoved != target->fTopLayer) {
BMessage msg; BMessage msg;
msg.what = B_MOUSE_DOWN; msg.what = B_MOUSE_DOWN;
@ -1198,13 +1189,12 @@ if (target->Feel() == 1024)
msg.AddInt32("modifiers", evt.modifiers); msg.AddInt32("modifiers", evt.modifiers);
msg.AddInt32("buttons", evt.buttons); msg.AddInt32("buttons", evt.buttons);
msg.AddInt32("clicks", evt.clicks); msg.AddInt32("clicks", evt.clicks);
target->Window()->SendMessageToClient(&msg, fLastMouseMoved->fViewToken, false); target->Window()->SendMessageToClient(&msg, fLastMouseMoved->fViewToken, false);
} }
if (fLastMouseMoved->EventMask() & B_POINTER_EVENTS) { if (fLastMouseMoved->EventMask() & B_POINTER_EVENTS)
fEventMaskLayer = fLastMouseMoved; fEventMaskLayer = fLastMouseMoved;
}
break; break;
} }
@ -1216,11 +1206,10 @@ if (target->Feel() == 1024)
fMouseTargetWinBorder = target; fMouseTargetWinBorder = target;
break; break;
} }
break; break;
} }
case B_MOUSE_UP: { case B_MOUSE_UP: {
//printf("RootLayer::MouseEventHandler(B_MOUSE_UP)\n"); //printf("RootLayer::MouseEventHandler(B_MOUSE_UP)\n");
// Attached data: // Attached data:
// 1) int64 - time of mouse click // 1) int64 - time of mouse click
// 2) float - x coordinate of mouse click // 2) float - x coordinate of mouse click
@ -1344,18 +1333,13 @@ fprintf(stderr, "mouse position changed in B_MOUSE_UP (%.1f, %.1f) from last B_M
// fEventMaskLayer is always != this // fEventMaskLayer is always != this
if (fEventMaskLayer) { if (fEventMaskLayer) {
if (fEventMaskLayer == target) { if (fEventMaskLayer == target) {
if (target == fLastMouseMoved) if (target == fLastMouseMoved)
fViewAction = B_INSIDE_VIEW; fViewAction = B_INSIDE_VIEW;
else else
fViewAction = B_ENTERED_VIEW; fViewAction = B_ENTERED_VIEW;
} else if (fEventMaskLayer == fLastMouseMoved) { } else if (fEventMaskLayer == fLastMouseMoved) {
fViewAction = B_EXITED_VIEW; fViewAction = B_EXITED_VIEW;
} else { } else {
fViewAction = B_OUTSIDE_VIEW; fViewAction = B_OUTSIDE_VIEW;
} }
@ -1369,7 +1353,7 @@ fprintf(stderr, "mouse position changed in B_MOUSE_UP (%.1f, %.1f) from last B_M
fEventMaskLayer->Window()->SendMessageToClient(&movemsg, fEventMaskLayer->fViewToken, false); fEventMaskLayer->Window()->SendMessageToClient(&movemsg, fEventMaskLayer->fViewToken, false);
} else { } else {
winBorderUnder = (WinBorder*)fEventMaskLayer; winBorderUnder = (WinBorder*)fEventMaskLayer;
} }
} else { } else {
if (fLastMouseMoved != target) { if (fLastMouseMoved != target) {
@ -1401,7 +1385,7 @@ fprintf(stderr, "mouse position changed in B_MOUSE_UP (%.1f, %.1f) from last B_M
target->Window()->SendMessageToClient(&movemsg, target->fViewToken, false); target->Window()->SendMessageToClient(&movemsg, target->fViewToken, false);
} }
} else if (target != this) { } else if (target != this) {
winBorderUnder = (WinBorder*)target; winBorderUnder = (WinBorder*)target;
} }
} }
@ -1566,8 +1550,8 @@ RootLayer::KeyboardEventHandler(int32 code, BPrivate::PortLink& msg)
//ServerApp *deskbar = app_server->FindApp("application/x-vnd.Be-TSKB"); //ServerApp *deskbar = app_server->FindApp("application/x-vnd.Be-TSKB");
//if(deskbar) //if(deskbar)
//{ //{
WinBorder *exActive = ActiveWinBorder(); WinBorder* exActive = ActiveWinBorder();
WinBorder *exFocus = FocusWinBorder(); WinBorder* exFocus = FocusWinBorder();
if (ActiveWorkspace()->MoveToBack(exActive)) if (ActiveWorkspace()->MoveToBack(exActive))
show_final_scene(exFocus, exActive); show_final_scene(exFocus, exActive);
@ -1893,16 +1877,15 @@ RootLayer::PrintToStream()
void void
RootLayer::show_winBorder(WinBorder *winBorder) RootLayer::show_winBorder(WinBorder *winBorder)
{ {
bool invalidate = false; bool invalidate = false;
bool invalid; bool invalid;
WinBorder *exFocus = FocusWinBorder(); WinBorder* exFocus = FocusWinBorder();
WinBorder *exActive = ActiveWinBorder(); WinBorder* exActive = ActiveWinBorder();
winBorder->Show(false); winBorder->Show(false);
for (int32 i = 0; i < fWsCount; i++) for (int32 i = 0; i < fWsCount; i++) {
{ invalid = false;
invalid = false;
if (fWorkspace[i] && if (fWorkspace[i] &&
(fWorkspace[i]->HasWinBorder(winBorder) || (fWorkspace[i]->HasWinBorder(winBorder) ||
@ -1940,16 +1923,15 @@ RootLayer::show_winBorder(WinBorder *winBorder)
void void
RootLayer::hide_winBorder(WinBorder *winBorder) RootLayer::hide_winBorder(WinBorder *winBorder)
{ {
bool invalidate = false; bool invalidate = false;
bool invalid; bool invalid;
WinBorder *exFocus = FocusWinBorder(); WinBorder* exFocus = FocusWinBorder();
WinBorder *exActive = ActiveWinBorder(); WinBorder* exActive = ActiveWinBorder();
winBorder->Hide(false); winBorder->Hide(false);
for (int32 i = 0; i < fWsCount; i++) for (int32 i = 0; i < fWsCount; i++) {
{ invalid = false;
invalid = false;
if (fWorkspace[i] && fWorkspace[i]->HasWinBorder(winBorder)) if (fWorkspace[i] && fWorkspace[i]->HasWinBorder(winBorder))
invalid = fWorkspace[i]->HideWinBorder(winBorder); invalid = fWorkspace[i]->HideWinBorder(winBorder);
@ -1980,11 +1962,10 @@ RootLayer::change_winBorder_feel(WinBorder *winBorder, int32 newFeel)
bool isVisible = false; bool isVisible = false;
bool wasVisibleInActiveWorkspace = false; bool wasVisibleInActiveWorkspace = false;
WinBorder *exFocus = FocusWinBorder(); WinBorder* exFocus = FocusWinBorder();
WinBorder *exActive = ActiveWinBorder(); WinBorder* exActive = ActiveWinBorder();
if (!winBorder->IsHidden()) if (!winBorder->IsHidden()) {
{
isVisible = true; isVisible = true;
wasVisibleInActiveWorkspace = ActiveWorkspace()->HasWinBorder(winBorder); wasVisibleInActiveWorkspace = ActiveWorkspace()->HasWinBorder(winBorder);
winBorder->Hide(false); winBorder->Hide(false);
@ -2095,7 +2076,7 @@ RootLayer::draw_window_tab(WinBorder *exFocus)
if (exFocus && focus != exFocus) { if (exFocus && focus != exFocus) {
// TODO: this line is a hack, decorator is drawn twice. // TODO: this line is a hack, decorator is drawn twice.
#ifndef NEW_CLIPPING #ifndef NEW_CLIPPING
BRegion reg(exFocus->fVisible); BRegion reg(exFocus->fVisible);
if (focus) if (focus)
reg.Include(&focus->fVisible); reg.Include(&focus->fVisible);
redraw_layer(this, reg); redraw_layer(this, reg);
@ -2110,13 +2091,11 @@ RootLayer::empty_visible_regions(Layer *layer)
{ {
// TODO: optimize by avoiding recursion? // TODO: optimize by avoiding recursion?
// NOTE: first 'layer' must be a WinBorder // NOTE: first 'layer' must be a WinBorder
Layer *child;
layer->fFullVisible.MakeEmpty(); layer->fFullVisible.MakeEmpty();
layer->fVisible.MakeEmpty(); layer->fVisible.MakeEmpty();
child = layer->BottomChild();
while(child) { Layer* child = layer->BottomChild();
while (child) {
empty_visible_regions(child); empty_visible_regions(child);
child = layer->UpperSibling(); child = layer->UpperSibling();
} }
@ -2126,19 +2105,20 @@ RootLayer::empty_visible_regions(Layer *layer)
inline void inline void
RootLayer::winborder_activation(WinBorder* exActive) RootLayer::winborder_activation(WinBorder* exActive)
{ {
if (exActive && (FocusWinBorder() != exActive || FrontWinBorder() != exActive)) { // ToDo: not sure if this is correct - do floating windows get WindowActivated() events?
if (exActive && FocusWinBorder() != exActive) {
BMessage msg(B_WINDOW_ACTIVATED); BMessage msg(B_WINDOW_ACTIVATED);
msg.AddBool("active", false); msg.AddBool("active", false);
exActive->Window()->SendMessageToClient(&msg, B_NULL_TOKEN, false); exActive->Window()->SendMessageToClient(&msg, B_NULL_TOKEN, false);
} }
if (FocusWinBorder() == FrontWinBorder() if (FocusWinBorder() && FocusWinBorder() != exActive) {
&& FrontWinBorder() != NULL && FrontWinBorder() != exActive) {
BMessage msg(B_WINDOW_ACTIVATED); BMessage msg(B_WINDOW_ACTIVATED);
msg.AddBool("active", true); msg.AddBool("active", true);
FrontWinBorder()->Window()->SendMessageToClient(&msg, B_NULL_TOKEN, false); FocusWinBorder()->Window()->SendMessageToClient(&msg, B_NULL_TOKEN, false);
} }
} }
inline void inline void
RootLayer::show_final_scene(WinBorder *exFocus, WinBorder *exActive) RootLayer::show_final_scene(WinBorder *exFocus, WinBorder *exActive)
{ {
@ -2156,7 +2136,6 @@ RootLayer::show_final_scene(WinBorder *exFocus, WinBorder *exActive)
} }
draw_window_tab(exFocus); draw_window_tab(exFocus);
winborder_activation(exActive); winborder_activation(exActive);
// TODO: MoveEventHandler::B_MOUSE_DOWN may not need this. Investigate. // TODO: MoveEventHandler::B_MOUSE_DOWN may not need this. Investigate.
@ -2173,6 +2152,7 @@ RootLayer::show_final_scene(WinBorder *exFocus, WinBorder *exActive)
} }
} }
void void
RootLayer::Draw(const BRect &r) RootLayer::Draw(const BRect &r)
{ {

View File

@ -88,14 +88,10 @@ public:
uint32 oldWksIndex, uint32 oldWksIndex,
uint32 newWksIndex); uint32 newWksIndex);
WinBorder* WinBorderAt(const BPoint& pt) const; WinBorder* WinBorderAt(const BPoint& pt) const;
inline WinBorder* FocusWinBorder() const { return fWorkspace[fActiveWksIndex]->Focus(); }
inline WinBorder* FrontWinBorder() const { return fWorkspace[fActiveWksIndex]->Front(); } inline WinBorder* FocusWinBorder() const { return ActiveWorkspace()->Focus(); }
inline WinBorder* ActiveWinBorder() const { inline WinBorder* FrontWinBorder() const { return ActiveWorkspace()->Front(); }
return (fWorkspace[fActiveWksIndex]->Focus() == inline WinBorder* ActiveWinBorder() const { return ActiveWorkspace()->Active(); }
fWorkspace[fActiveWksIndex]->Front()
&& fWorkspace[fActiveWksIndex]->Front() != NULL)?
fWorkspace[fActiveWksIndex]->Front(): NULL;
}
inline void SetWorkspaceCount(int32 wksCount); inline void SetWorkspaceCount(int32 wksCount);
inline int32 WorkspaceCount() const { return fWsCount; } inline int32 WorkspaceCount() const { return fWsCount; }

File diff suppressed because it is too large Load Diff

View File

@ -47,24 +47,26 @@ struct ListData
ListData *lowerItem; ListData *lowerItem;
}; };
class Workspace class Workspace {
{ public:
public:
Workspace( const int32 ID, Workspace( const int32 ID,
const uint32 colorspace, const uint32 colorspace,
const RGBColor& BGColor); const RGBColor& BGColor);
~Workspace(void); ~Workspace();
int32 ID() const { return fID; }
int32 ID(void) const { return fID; }
void AddWinBorder(WinBorder *winBorder); void AddWinBorder(WinBorder *winBorder);
void RemoveWinBorder(WinBorder *winBorder); void RemoveWinBorder(WinBorder *winBorder);
bool HasWinBorder(const WinBorder *winBorder) const; bool HasWinBorder(const WinBorder *winBorder) const;
WinBorder* Focus(void) const; WinBorder* Focus() const;
WinBorder* Front(void) const; WinBorder* Front() const;
WinBorder* Active() const;
bool GetWinBorderList(void **list, int32 *itemCount ) const; bool GetWinBorderList(void **list, int32 *itemCount ) const;
bool SetFocus(WinBorder* newFocus);
bool MoveToBack(WinBorder *newLast); bool MoveToBack(WinBorder *newLast);
bool MoveToFront(WinBorder *newFront, bool doNotDisturb = false); bool MoveToFront(WinBorder *newFront, bool doNotDisturb = false);
@ -130,16 +132,17 @@ private:
// first visible onscreen // first visible onscreen
ListData *fBottomItem; ListData *fBottomItem;
// the last visible(or covered by other Layers) // the last visible(or covered by other Layers)
ListData *fTopItem; ListData *fTopItem;
// the focus WinBorder - for keyboard events // the focus WinBorder - for keyboard events
ListData *fFocusItem; ListData *fFocusItem;
// pointer for which "big" actions are intended // pointer for which "big" actions are intended
ListData *fFrontItem; ListData *fFrontItem;
ListData* fActiveItem;
// settings for each workspace -- example taken from R5's app_server_settings file // settings for each workspace -- example taken from R5's app_server_settings file
display_timing fDisplayTiming; display_timing fDisplayTiming;
int16 fVirtualWidth; int16 fVirtualWidth;