* fixed case for WinBorder::MouseDown() if there is no layer below the mouse - might

not even be a valid condition, but seems to happen.
* style cleanup...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14841 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-11-10 22:30:43 +00:00
parent 51a2d41103
commit 8f5f0ec4b1

View File

@ -190,9 +190,8 @@ WinBorder::MoveBy(float x, float y)
Layer::MoveBy(x, y);
GetRootLayer()->Unlock();
}
} else {
// just offset to the new position
else {
if (fDecorator)
fDecorator->MoveBy(x, y);
@ -253,8 +252,7 @@ WinBorder::ResizeBy(float x, float y)
Layer::ResizeBy(x, y);
GetRootLayer()->Unlock();
}
else {
} else {
if (fDecorator)
fDecorator->ResizeBy(x, y);
@ -309,7 +307,7 @@ if (cnt != 0)
CRITICAL("Layer::UpdateStart(): wb->cnt != 0 -> Not Allowed!");
}
// UpdateEnd
void
WinBorder::UpdateEnd()
{
@ -324,8 +322,11 @@ WinBorder::UpdateEnd()
GetRootLayer()->TriggerRedraw();
}
}
void
WinBorder::EnableUpdateRequests() {
WinBorder::EnableUpdateRequests()
{
fUpdateRequestsEnabled = true;
if (fCumulativeRegion.CountRects() > 0) {
GetRootLayer()->MarkForRedraw(fCumulativeRegion);
@ -333,6 +334,7 @@ WinBorder::EnableUpdateRequests() {
}
}
//! Sets the minimum and maximum sizes of the window
void
WinBorder::SetSizeLimits(float minWidth, float maxWidth,
@ -414,20 +416,8 @@ WinBorder::MouseDown(const BMessage *msg)
// default action is to drag the WinBorder
click_type action = DEC_DRAG;
Layer *target = LayerAt(where);
// clicking a simple Layer.
if (target != this) {
if (GetRootLayer()->ActiveWorkspace()->Active() == this) {
target->MouseDown(msg);
}
else {
if (WindowFlags() & B_WILL_ACCEPT_FIRST_CLICK)
target->MouseDown(msg);
else
goto activateWindow;
}
}
if (target == this) {
// clicking WinBorder visible area
else {
winBorderAreaHandle:
if (fDecorator)
@ -483,26 +473,36 @@ WinBorder::MouseDown(const BMessage *msg)
// based on what the Decorator returned, properly place this window.
if (action == DEC_MOVETOBACK) {
GetRootLayer()->SetActive(this, false);
}
else {
} else {
GetRootLayer()->SetNotifyLayer(this, B_POINTER_EVENTS, 0UL);
activateWindow:
GetRootLayer()->SetActive(this);
}
}
}
// in FFM mode
else {
Layer *target = LayerAt(where);
// clicking a simple Layer; forward event.
if (target != this)
} else if (target != NULL) {
// clicking a simple Layer.
if (GetRootLayer()->ActiveWorkspace()->Active() == this) {
target->MouseDown(msg);
} else {
if (WindowFlags() & B_WILL_ACCEPT_FIRST_CLICK)
target->MouseDown(msg);
// clicking inside our visible area.
else
goto activateWindow;
}
}
} else {
// in FFM mode
Layer *target = LayerAt(where);
if (target == this) {
// clicking inside our visible area.
goto winBorderAreaHandle;
} else if (target != NULL) {
// clicking a simple Layer; forward event.
target->MouseDown(msg);
}
}
}
void
WinBorder::MouseUp(const BMessage *msg)
@ -545,6 +545,7 @@ WinBorder::MouseUp(const BMessage *msg)
fIsSlidingTab = false;
}
void
WinBorder::MouseMoved(const BMessage *msg)
{
@ -582,6 +583,7 @@ WinBorder::MouseMoved(const BMessage *msg)
fLastMousePosition = where;
}
void
WinBorder::WorkspaceActivated(int32 index, bool active)
{
@ -593,6 +595,7 @@ WinBorder::WorkspaceActivated(int32 index, bool active)
Window()->SendMessageToClient(&activatedMsg, B_NULL_TOKEN, false);
}
void
WinBorder::WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces)
{
@ -606,6 +609,7 @@ WinBorder::WorkspacesChanged(uint32 oldWorkspaces, uint32 newWorkspaces)
Window()->SendMessageToClient(&changedMsg, B_NULL_TOKEN, false);
}
void
WinBorder::Activated(bool active)
{
@ -614,6 +618,7 @@ WinBorder::Activated(bool active)
Window()->SendMessageToClient(&msg, B_NULL_TOKEN, false);
}
// SetTabLocation
void
WinBorder::SetTabLocation(float location)
@ -622,6 +627,7 @@ WinBorder::SetTabLocation(float location)
fDecorator->SetTabLocation(location);
}
// TabLocation
float
WinBorder::TabLocation() const
@ -631,6 +637,7 @@ WinBorder::TabLocation() const
return 0.0;
}
//! Sets the decorator focus to active or inactive colors
void
WinBorder::HighlightDecorator(bool active)
@ -640,35 +647,39 @@ WinBorder::HighlightDecorator(bool active)
fDecorator->SetFocus(active);
}
// Unimplemented. Hook function for handling when system GUI colors change
void
WinBorder::UpdateColors()
{
// Unimplemented. Hook function for handling when system GUI colors change
STRACE(("WinBorder %s: UpdateColors unimplemented\n", Name()));
}
// Unimplemented. Hook function for handling when the system decorator changes
void
WinBorder::UpdateDecorator()
{
// Unimplemented. Hook function for handling when the system decorator changes
STRACE(("WinBorder %s: UpdateDecorator unimplemented\n", Name()));
}
// Unimplemented. Hook function for handling when a system font changes
void
WinBorder::UpdateFont()
{
// Unimplemented. Hook function for handling when a system font changes
STRACE(("WinBorder %s: UpdateFont unimplemented\n", Name()));
}
// Unimplemented. Hook function for handling when the screen resolution changes
void
WinBorder::UpdateScreen()
{
// Unimplemented. Hook function for handling when the screen resolution changes
STRACE(("WinBorder %s: UpdateScreen unimplemented\n", Name()));
}
// QuietlySetFeel
void
WinBorder::QuietlySetFeel(int32 feel)
{
@ -753,17 +764,19 @@ WinBorder::_ActionFor(const BMessage *msg) const
return DEC_NONE;
}
void WinBorder::set_decorator_region(BRect bounds)
void
WinBorder::set_decorator_region(BRect bounds)
{
fRebuildDecRegion = false;
if (fDecorator)
{
if (fDecorator) {
fDecRegion.MakeEmpty();
fDecorator->GetFootprint(&fDecRegion);
}
}
void
WinBorder::_ReserveRegions(BRegion &reg)
{
@ -773,6 +786,7 @@ WinBorder::_ReserveRegions(BRegion &reg)
reg.Exclude(&reserve);
}
void
WinBorder::GetWantedRegion(BRegion &reg)
{
@ -790,6 +804,7 @@ WinBorder::GetWantedRegion(BRegion &reg)
reg.IntersectWith(&screenReg);
}
void
WinBorder::RequestClientRedraw(const BRegion &invalid)
{
@ -825,7 +840,7 @@ if (cnt != 1)
}
}
// SetTopLayer
void
WinBorder::SetTopLayer(Layer* layer)
{