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