From 07bde8ab8985517f250e62767c035835bb30e8b0 Mon Sep 17 00:00:00 2001 From: Adi Oanca Date: Sat, 19 Mar 2005 18:58:47 +0000 Subject: [PATCH] * solved that damn bug that run me into debugger. yuppyyy. * removed some comments * mouse down messages go only to the view that has focus. Yeah, they didn't. :p * solved a bug where some windows did not redraw when hiding a modal. * another bug where a floating window would not come in front for gaining focus. * added client's team_id into window title. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@11918 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/server/Desktop.cpp | 10 ----- src/servers/app/server/Desktop.h | 1 - src/servers/app/server/RootLayer.cpp | 49 +++++++------------------ src/servers/app/server/ServerWindow.cpp | 9 ++++- src/servers/app/server/Workspace.cpp | 4 +- 5 files changed, 23 insertions(+), 50 deletions(-) diff --git a/src/servers/app/server/Desktop.cpp b/src/servers/app/server/Desktop.cpp index 993bd8191e..43f50cc54a 100644 --- a/src/servers/app/server/Desktop.cpp +++ b/src/servers/app/server/Desktop.cpp @@ -424,16 +424,6 @@ void Desktop::RemoveWinBorderFromSubset(WinBorder *winBorder, WinBorder *fromWin Unlock(); } -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; diff --git a/src/servers/app/server/Desktop.h b/src/servers/app/server/Desktop.h index 2dad7c58d7..54319916dc 100644 --- a/src/servers/app/server/Desktop.h +++ b/src/servers/app/server/Desktop.h @@ -69,7 +69,6 @@ public: void RemoveWinBorder(WinBorder *winBorder); void AddWinBorderToSubset(WinBorder *winBorder, WinBorder *toWinBorder); void RemoveWinBorderFromSubset(WinBorder *winBorder, WinBorder *fromWinBorder); - bool HasWinBorder(WinBorder *winBorder); WinBorder* FindWinBorderByServerWindowTokenAndTeamID(int32 token, team_id teamID); // get list of registed windows diff --git a/src/servers/app/server/RootLayer.cpp b/src/servers/app/server/RootLayer.cpp index bb5e54d336..eff18862c9 100644 --- a/src/servers/app/server/RootLayer.cpp +++ b/src/servers/app/server/RootLayer.cpp @@ -344,13 +344,7 @@ Layer* RootLayer::VirtualTopChild() const fWinBorderIndex = fWinBorderCount-1; if (fWinBorderIndex < fWinBorderCount && fWinBorderIndex >= 0) -{ - WinBorder *wb = fWinBorderList[fWinBorderIndex]; - fWinBorderIndex--; -//printf("Adi: VTC: %p.\n", wb); -// return fWinBorderList[fWinBorderIndex--]; - return wb; -} + return fWinBorderList[fWinBorderIndex--]; return NULL; } @@ -358,13 +352,7 @@ Layer* RootLayer::VirtualTopChild() const Layer* RootLayer::VirtualLowerSibling() const { if (fWinBorderIndex < fWinBorderCount && fWinBorderIndex > 0) -{ - WinBorder *wb = fWinBorderList[fWinBorderIndex]; - fWinBorderIndex--; -//printf("Adi: VLS: %p.\n", wb); - return wb; -// return fWinBorderList[fWinBorderIndex--]; -} + return fWinBorderList[fWinBorderIndex--]; return NULL; } @@ -372,13 +360,7 @@ Layer* RootLayer::VirtualLowerSibling() const Layer* RootLayer::VirtualUpperSibling() const { if (fWinBorderIndex < fWinBorderCount && fWinBorderIndex > 0) -{ - WinBorder *wb = fWinBorderList[fWinBorderIndex]; - fWinBorderIndex++; -//printf("Adi: VUS: %p.\n", wb); - return wb; -// return fWinBorderList[fWinBorderIndex++]; -} + return fWinBorderList[fWinBorderIndex++]; return NULL; } @@ -388,13 +370,7 @@ Layer* RootLayer::VirtualBottomChild() const fWinBorderIndex = 0; if (fWinBorderIndex < fWinBorderCount && fWinBorderIndex >= 0) -{ - WinBorder *wb = fWinBorderList[fWinBorderIndex]; - fWinBorderIndex++; -//printf("Adi: VBC: %p.\n", wb); - return wb; -// return fWinBorderList[fWinBorderIndex++]; -} + return fWinBorderList[fWinBorderIndex++]; return NULL; } @@ -966,8 +942,10 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg) } else { - if (exFocus != FocusWinBorder() - && !(target->Window()->Flags() & B_WILL_ACCEPT_FIRST_CLICK)) + if (target != FocusWinBorder()) + sendMessage = false; + else if (exFocus != FocusWinBorder() + && !(target->Window()->Flags() & B_WILL_ACCEPT_FIRST_CLICK)) sendMessage = false; target->MouseDown(evt, sendMessage); @@ -1000,7 +978,8 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg) // currently mouse up goes to the same window which received mouse down if (fMouseTarget) { - fMouseTarget->MouseUp(evt); + if (fMouseTarget == FocusWinBorder()) + fMouseTarget->MouseUp(evt); fMouseTarget = NULL; } @@ -1562,6 +1541,10 @@ void RootLayer::show_winBorder(WinBorder *winBorder) if (fWorkspace[i] && (fWorkspace[i]->HasWinBorder(winBorder) || + // subset modals are a bit like floating windows, they are being added + // and removed from workspace when there's at least a normal window + // that uses them. + winBorder->Level() == B_MODAL_APP || // floating windows are inserted/removed on-the-fly so this window, // although needed may not be in workspace's list. winBorder->Level() == B_FLOATING_APP)) @@ -1649,10 +1632,6 @@ void RootLayer::get_workspace_windows() if (!present) empty_visible_regions(fWinBorderList2[i]); -// { -// fWinBorderList2[i]->fVisible.MakeEmpty(); -// fWinBorderList2[i]->fFullVisible.MakeEmpty(); -// } } // enlarge 2nd buffer also diff --git a/src/servers/app/server/ServerWindow.cpp b/src/servers/app/server/ServerWindow.cpp index b9d946f45d..ae1118b1fb 100644 --- a/src/servers/app/server/ServerWindow.cpp +++ b/src/servers/app/server/ServerWindow.cpp @@ -198,7 +198,9 @@ ServerWindow::ServerWindow(BRect rect, const char *string, uint32 wlook, //------------------------------------------------------------------------------ void ServerWindow::Init(void) { - fWinBorder = new WinBorder( fFrame, fTitle.String(), fLook, fFeel, 0UL, + char newName[256]; + sprintf(newName, "%ld: %s", fClientTeamID, fTitle.String()); + fWinBorder = new WinBorder( fFrame, newName, fLook, fFeel, 0UL, this, desktop->GetDisplayDriver()); // Spawn our message-monitoring thread @@ -1166,7 +1168,10 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link) case AS_LAYER_CLIP_TO_PICTURE: { DTRACE(("ServerWindow %s: Message AS_LAYER_CLIP_TO_PICTURE: Layer: %s\n",fTitle.String(), cl->fName->String())); - + + // TODO: you are not allowed to use Layer regions here!!! + // If there is no other way, then first lock RootLayer object first. + // TODO: Watch out for the coordinate system in AS_LAYER_CLIP_TO_PICTURE int32 pictureToken; BPoint where; diff --git a/src/servers/app/server/Workspace.cpp b/src/servers/app/server/Workspace.cpp index 8320db12a4..6acd230d16 100644 --- a/src/servers/app/server/Workspace.cpp +++ b/src/servers/app/server/Workspace.cpp @@ -251,7 +251,7 @@ bool Workspace::GetWinBorderList(void **list, int32 *itemCount ) const } } - return false; + return true; } //---------------------------------------------------------------------------------- @@ -589,7 +589,7 @@ STRACE(("W(%ld)::HideWinBorder(%s) \n", fID, winBorder? winBorder->GetName(): "N fFocusItem = NULL; newFront = findNextFront(); if (newFront) - MoveToFront(newFront->layerPtr); + returnValue = MoveToFront(newFront->layerPtr); } // floating windows can have focus state. what if this removed window is