Removed a redundant BMessage when mouse button was pressed. This message is already sent by WinBorder::MouseDown(). Window content was redraw when a window became active. Removed some code that anyway was not used. It will be replaced by the new window manager which is comming soon.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11012 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca
2005-01-24 21:04:23 +00:00
parent c4e214743d
commit 574540edd2
+13 -66
View File
@@ -707,9 +707,6 @@ void RootLayer::SetScreens(Screen *screen[], int32 rows, int32 columns)
fColumns = columns; fColumns = columns;
fScreenXResolution = (int32)(screen[0]->Resolution().x); fScreenXResolution = (int32)(screen[0]->Resolution().x);
fScreenYResolution = (int32)(screen[0]->Resolution().y); fScreenYResolution = (int32)(screen[0]->Resolution().y);
// NOTE: a RebuildFullRegion() followed by FullInvalidate() are required after calling
// this method!
} }
Screen **RootLayer::Screens() Screen **RootLayer::Screens()
@@ -948,13 +945,6 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg)
// helps the window determine the target view. Testing so far has revealed // helps the window determine the target view. Testing so far has revealed
// that it has the same value as the "where" field // that it has the same value as the "where" field
BMessage downmsg(B_MOUSE_DOWN);
downmsg.AddInt64("when",evt.when);
downmsg.AddPoint("where",evt.where);
downmsg.AddInt32("modifiers",evt.modifiers);
downmsg.AddInt32("buttons",evt.buttons);
downmsg.AddInt32("clicks",evt.clicks);
if (target!=ws->FrontLayer()) if (target!=ws->FrontLayer())
{ {
ws->BringToFrontANormalWindow(target); ws->BringToFrontANormalWindow(target);
@@ -964,6 +954,7 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg)
activeFocus = ws->FocusLayer(); activeFocus = ws->FocusLayer();
activeFocus->Window()->Lock(); activeFocus->Window()->Lock();
previousFocus->Window()->Lock();
if (target == activeFocus && target->Window()->Flags() & B_WILL_ACCEPT_FIRST_CLICK) if (target == activeFocus && target->Window()->Flags() & B_WILL_ACCEPT_FIRST_CLICK)
target->MouseDown(evt, true); target->MouseDown(evt, true);
@@ -975,17 +966,12 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg)
// TODO: B_MOUSE_DOWN: what if modal of floating windows are in front of us? // TODO: B_MOUSE_DOWN: what if modal of floating windows are in front of us?
invalidRegion.Include(&(activeFocus->fFull)); invalidRegion.Include(&(activeFocus->fFull));
invalidRegion.Include(&(activeFocus->fTopLayer->fFull)); invalidRegion.Include(&(activeFocus->fTopLayer->fFull));
activeFocus->fParent->RebuildAndForceRedraw(invalidRegion, activeFocus); // allow previous window's decorator to lowlight
redraw_layer(previousFocus, previousFocus->fVisible);
if (previousFocus != activeFocus && previousFocus) // highlight the visible part of the new focus window
{ redraw_layer(activeFocus, activeFocus->fVisible);
if (previousFocus->fVisible.CountRects() > 0) // rebuild regions and redraw the hidden parts of activeFocus
{ invalidate_layer(activeFocus, invalidRegion);
invalidRegion.MakeEmpty();
invalidRegion.Include(&(previousFocus->fVisible));
activeFocus->fParent->Invalidate(invalidRegion);
}
}
fMouseTarget = target; fMouseTarget = target;
@@ -993,52 +979,14 @@ void RootLayer::MouseEventHandler(int32 code, BPortLink& msg)
STRACE(("2Front: %s\n", ws->FrontLayer()->GetName())); STRACE(("2Front: %s\n", ws->FrontLayer()->GetName()));
STRACE(("2Focus: %s\n", ws->FocusLayer()->GetName())); STRACE(("2Focus: %s\n", ws->FocusLayer()->GetName()));
fMouseTarget->Window()->SendMessageToClient(&downmsg); previousFocus->Window()->Unlock();
activeFocus->Window()->Unlock(); activeFocus->Window()->Unlock();
} }
else // target == ws->FrontLayer() else // target == ws->FrontLayer()
{ {
// only if target has the focus! target->Window()->Lock();
if (target == ws->FocusLayer()) target->MouseDown(evt, true);
{ target->Window()->Unlock();
target->Window()->Lock();
target->MouseDown(evt, true);
target->Window()->Unlock();
}
else
{
previousFocus = ws->FocusLayer();
ws->SearchAndSetNewFocus(target);
activeFocus = ws->FocusLayer();
activeFocus->Window()->Lock();
if (target == activeFocus && target->Window()->Flags() & B_WILL_ACCEPT_FIRST_CLICK)
target->MouseDown(evt, true);
else
target->MouseDown(evt, false);
// may or may not be empty.
// TODO: B_MOUSE_DOWN: what if modal of floating windows are in front of us?
invalidRegion.Include(&(activeFocus->fFull));
invalidRegion.Include(&(activeFocus->fTopLayer->fFull));
activeFocus->fParent->RebuildAndForceRedraw(invalidRegion, activeFocus);
if (previousFocus != activeFocus && previousFocus)
{
if (previousFocus->fVisible.CountRects() > 0)
{
invalidRegion.MakeEmpty();
invalidRegion.Include(&(previousFocus->fVisible));
activeFocus->fParent->Invalidate(invalidRegion);
}
}
fMouseTarget = target;
fMouseTarget->Window()->SendMessageToClient(&downmsg);
activeFocus->Window()->Unlock();
}
} }
fMainLock.Unlock(); fMainLock.Unlock();
@@ -1662,8 +1610,7 @@ void RootLayer::show_winBorder(WinBorder *winBorder)
// first redraw previous window's decorator. It has lost focus state. // first redraw previous window's decorator. It has lost focus state.
if (previousFocus) if (previousFocus)
if (previousFocus->fDecorator) redraw_layer(winBorder, previousFocus->fVisible);
winBorder->fParent->Invalidate(previousFocus->fVisible);
// we must build the rebuild region. we have nowhere to take it from. // we must build the rebuild region. we have nowhere to take it from.
// include decorator's(if any) and fTopLayer's full regions. // include decorator's(if any) and fTopLayer's full regions.
@@ -1673,7 +1620,7 @@ void RootLayer::show_winBorder(WinBorder *winBorder)
if (winBorder->fDecorator) if (winBorder->fDecorator)
invalidRegion.Include(&(winBorder->fFull)); invalidRegion.Include(&(winBorder->fFull));
winBorder->fParent->FullInvalidate(invalidRegion); invalidate_layer(winBorder, invalidRegion);
} }
} }
} }