From cebad2e20f4fa15e4bb771621b56959e4f828120 Mon Sep 17 00:00:00 2001 From: Adi Oanca Date: Thu, 1 Jul 2004 20:01:32 +0000 Subject: [PATCH] Fixed window selection with the mouse. Works fine only for normal windows. Next: same thing for modal and floating windows. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8254 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/server/Desktop.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/servers/app/server/Desktop.cpp b/src/servers/app/server/Desktop.cpp index c9c447fba0..17d1011694 100644 --- a/src/servers/app/server/Desktop.cpp +++ b/src/servers/app/server/Desktop.cpp @@ -397,10 +397,12 @@ void Desktop::MouseEventHandler(PortMessage *msg) { fGeneralLock.Lock(); rl->fMainLock.Lock(); -// TODO: it's not that good to use fMouseTarget. -// (you have problems with B_MOUSE_UP, you know... :-))) -// Yes, I know. But it's too late tonight. :-))) - if (target != fMouseTarget) +#if 0 +printf("Target: %s\n", target->GetName()); +printf("Front: %s\n", ws->FrontLayer()->GetName()); +printf("Focus: %s\n", ws->FocusLayer()->GetName()); +#endif + if (target != ws->FrontLayer()) { WinBorder *previousFocus; WinBorder *activeFocus; @@ -415,6 +417,8 @@ void Desktop::MouseEventHandler(PortMessage *msg) if (target == activeFocus && target->Window()->Flags() & B_WILL_ACCEPT_FIRST_CLICK) target->MouseDown(msg, true); + else + target->MouseDown(msg, false); // may be or may be empty. // TODO: what if modal of floating windows are in front of us? @@ -432,11 +436,16 @@ void Desktop::MouseEventHandler(PortMessage *msg) } } - fMouseTarget = activeFocus; + fMouseTarget = target; +#if 0 +printf("2Target: %s\n", target->GetName()); +printf("2Front: %s\n", ws->FrontLayer()->GetName()); +printf("2Focus: %s\n", ws->FocusLayer()->GetName()); +#endif activeFocus->Window()->Unlock(); } - else // target == fMouseTarget + else // target == ws->FrontLayer() { // only if target has the focus! if (target == ws->FocusLayer())