moving and resizing windows works with the new clipping code. scrolling BViews also works.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13311 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
3b3a60ad5a
commit
ecf3bc3eb4
@ -891,6 +891,7 @@ Layer::Draw(const BRect &rect)
|
||||
fDriver->FillRect(rect, ViewColor());
|
||||
}
|
||||
|
||||
#ifndef NEW_CLIPPING
|
||||
// EmptyGlobals
|
||||
void
|
||||
Layer::EmptyGlobals()
|
||||
@ -907,6 +908,7 @@ Layer::EmptyGlobals()
|
||||
delete (BPoint*)fRootLayer->fCopyList.ItemAt(i);
|
||||
fRootLayer->fCopyList.MakeEmpty();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\brief Shows the layer
|
||||
@ -1056,6 +1058,22 @@ Layer::ResizeBy(float x, float y)
|
||||
STRACE(("Layer(%s)::ResizeBy() END\n", Name()));
|
||||
}
|
||||
|
||||
//! scrolls the layer by the specified amount, complete with redraw
|
||||
void
|
||||
Layer::ScrollBy(float x, float y)
|
||||
{
|
||||
STRACE(("Layer(%s)::ScrollBy() START\n", Name()));
|
||||
|
||||
BPrivate::PortLink msg(-1, -1);
|
||||
msg.StartMessage(AS_ROOTLAYER_LAYER_SCROLL);
|
||||
msg.Attach<Layer*>(this);
|
||||
msg.Attach<float>(x);
|
||||
msg.Attach<float>(y);
|
||||
GetRootLayer()->EnqueueMessage(msg);
|
||||
|
||||
STRACE(("Layer(%s)::ScrollBy() END\n", Name()));
|
||||
}
|
||||
|
||||
// BoundsOrigin
|
||||
BPoint
|
||||
Layer::BoundsOrigin() const
|
||||
@ -1835,9 +1853,9 @@ Layer::do_Invalidate(const BRegion &invalid, const Layer *startFrom)
|
||||
startFrom? startFrom: BottomChild());
|
||||
|
||||
// add localVisible to our RootLayer's redraw region.
|
||||
GetRootLayer()->fRedrawReg.Include(&localVisible);
|
||||
// TODO: ---
|
||||
GetRootLayer()->RequestDraw(GetRootLayer()->fRedrawReg, BottomChild());
|
||||
// GetRootLayer()->fRedrawReg.Include(&localVisible);
|
||||
GetRootLayer()->fRedrawReg = localVisible;
|
||||
GetRootLayer()->RequestDraw(GetRootLayer()->fRedrawReg, NULL);
|
||||
// GetRootLayer()->RequestRedraw(); // TODO: what if we pass (fParent, startFromTHIS, &redrawReg)?
|
||||
}
|
||||
|
||||
@ -1848,9 +1866,9 @@ Layer::do_Redraw(const BRegion &invalid, const Layer *startFrom)
|
||||
localVisible.IntersectWith(&invalid);
|
||||
|
||||
// add localVisible to our RootLayer's redraw region.
|
||||
GetRootLayer()->fRedrawReg.Include(&localVisible);
|
||||
// TODO: ---
|
||||
GetRootLayer()->RequestDraw(GetRootLayer()->fRedrawReg, BottomChild());
|
||||
// GetRootLayer()->fRedrawReg.Include(&localVisible);
|
||||
GetRootLayer()->fRedrawReg = localVisible;
|
||||
GetRootLayer()->RequestDraw(GetRootLayer()->fRedrawReg, NULL);
|
||||
// GetRootLayer()->RequestRedraw(); // TODO: what if we pass (fParent, startFromTHIS, &redrawReg)?
|
||||
}
|
||||
|
||||
@ -2029,7 +2047,8 @@ Layer::do_ResizeBy(float dx, float dy)
|
||||
rezize_layer_redraw_more(redrawReg, dx, dy);
|
||||
|
||||
// add redrawReg to our RootLayer's redraw region.
|
||||
GetRootLayer()->fRedrawReg.Include(&redrawReg);
|
||||
// GetRootLayer()->fRedrawReg.Include(&redrawReg);
|
||||
GetRootLayer()->fRedrawReg = redrawReg;
|
||||
// include layer's visible region in case we want a full update on resize
|
||||
if (fFlags & B_FULL_UPDATE_ON_RESIZE && fVisible2.Frame().IsValid()) {
|
||||
resize_layer_full_update_on_resize(GetRootLayer()->fRedrawReg, dx, dy);
|
||||
@ -2038,8 +2057,7 @@ Layer::do_ResizeBy(float dx, float dy)
|
||||
GetRootLayer()->fRedrawReg.Include(&oldVisible);
|
||||
}
|
||||
// clear canvas and set invalid regions for affected WinBorders
|
||||
// TODO: ---
|
||||
GetRootLayer()->RequestDraw(GetRootLayer()->fRedrawReg, BottomChild());
|
||||
GetRootLayer()->RequestDraw(GetRootLayer()->fRedrawReg, NULL);
|
||||
// GetRootLayer()->RequestRedraw(); // TODO: what if we pass (fParent, startFromTHIS, &redrawReg)?
|
||||
}
|
||||
}
|
||||
@ -2085,13 +2103,12 @@ void Layer::do_MoveBy(float dx, float dy)
|
||||
|
||||
// offset back and instruct the HW to do the actual copying.
|
||||
oldFullVisible.OffsetBy(-dx, -dy);
|
||||
// TODO: uncomment!!!
|
||||
// GetRootLayer()->CopyRegion(&oldFullVisible, dx, dy);
|
||||
GetDisplayDriver()->CopyRegion(&oldFullVisible, dx, dy);
|
||||
|
||||
// add redrawReg to our RootLayer's redraw region.
|
||||
GetRootLayer()->fRedrawReg.Include(&redrawReg);
|
||||
// TODO: ---
|
||||
GetRootLayer()->RequestDraw(GetRootLayer()->fRedrawReg, BottomChild());
|
||||
// GetRootLayer()->fRedrawReg.Include(&redrawReg);
|
||||
GetRootLayer()->fRedrawReg = redrawReg;
|
||||
GetRootLayer()->RequestDraw(GetRootLayer()->fRedrawReg, NULL);
|
||||
// GetRootLayer()->RequestRedraw(); // TODO: what if we pass (fParent, startFromTHIS, &redrawReg)?
|
||||
}
|
||||
}
|
||||
@ -2118,17 +2135,16 @@ Layer::do_ScrollBy(float dx, float dy)
|
||||
|
||||
// compute the common region. we'll use HW acc to copy this to the new location.
|
||||
invalid.IntersectWith(&fFullVisible2);
|
||||
// TODO: uncomment!!!
|
||||
// GetRootLayer()->CopyRegion(&invalid, -dx, -dy);
|
||||
GetDisplayDriver()->CopyRegion(&invalid, -dx, -dy);
|
||||
|
||||
// common region goes back to its original location. then, by excluding
|
||||
// it from curent fullVisible we'll obtain the region that needs to be redrawn.
|
||||
invalid.OffsetBy(-dx, -dy);
|
||||
redrawReg.Exclude(&invalid);
|
||||
|
||||
GetRootLayer()->fRedrawReg.Include(&redrawReg);
|
||||
// TODO: ---
|
||||
GetRootLayer()->RequestDraw(GetRootLayer()->fRedrawReg, BottomChild());
|
||||
// GetRootLayer()->fRedrawReg.Include(&redrawReg);
|
||||
GetRootLayer()->fRedrawReg = redrawReg;
|
||||
GetRootLayer()->RequestDraw(GetRootLayer()->fRedrawReg, NULL);
|
||||
// GetRootLayer()->RequestRedraw(); // TODO: what if we pass (fParent, startFromTHIS, &redrawReg)?
|
||||
}
|
||||
|
||||
|
@ -110,14 +110,15 @@ class Layer {
|
||||
uint32 ResizeOthers(float x, float y,
|
||||
BPoint coords[],
|
||||
BPoint* ptOffset);
|
||||
|
||||
void EmptyGlobals();
|
||||
|
||||
#endif
|
||||
void Redraw(const BRegion& reg,
|
||||
Layer* startFrom = NULL);
|
||||
|
||||
virtual void Draw(const BRect& r);
|
||||
|
||||
void EmptyGlobals();
|
||||
|
||||
void Show(bool invalidate = true);
|
||||
void Hide(bool invalidate = true);
|
||||
bool IsHidden() const;
|
||||
@ -132,6 +133,7 @@ class Layer {
|
||||
|
||||
virtual void MoveBy(float x, float y);
|
||||
virtual void ResizeBy(float x, float y);
|
||||
virtual void ScrollBy(float x, float y);
|
||||
|
||||
BPoint BoundsOrigin() const; // BoundsFrameDiff()?
|
||||
float Scale() const;
|
||||
|
@ -338,6 +338,20 @@ RootLayer::WorkingThread(void *data)
|
||||
layer->resize_layer(x, y);
|
||||
#else
|
||||
layer->do_ResizeBy(x, y);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case AS_ROOTLAYER_LAYER_SCROLL:
|
||||
{
|
||||
Layer *layer = NULL;
|
||||
float x, y;
|
||||
messageQueue.Read<Layer*>(&layer);
|
||||
messageQueue.Read<float>(&x);
|
||||
messageQueue.Read<float>(&y);
|
||||
#ifndef NEW_CLIPPING
|
||||
// nothing
|
||||
#else
|
||||
layer->do_ScrollBy(x, y);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
@ -1417,7 +1431,6 @@ fprintf(stderr, "mouse position changed in B_MOUSE_UP (%.1f, %.1f) from last B_M
|
||||
wheelmsg.AddInt64("when", evt.when);
|
||||
wheelmsg.AddFloat("be:wheel_delta_x",evt.wheel_delta_x);
|
||||
wheelmsg.AddFloat("be:wheel_delta_y",evt.wheel_delta_y);
|
||||
|
||||
fLastMouseMoved->Window()->SendMessageToClient(&wheelmsg, fLastMouseMoved->fViewToken, false);
|
||||
}
|
||||
} else {
|
||||
|
@ -72,6 +72,9 @@ public:
|
||||
|
||||
virtual void MoveBy(float x, float y);
|
||||
virtual void ResizeBy(float x, float y);
|
||||
virtual void ScrollBy(float x, float y)
|
||||
{ // not allowed
|
||||
}
|
||||
|
||||
// For the active workspaces
|
||||
virtual Layer* TopChild(void) const;
|
||||
|
@ -413,7 +413,7 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
|
||||
link.Read<float>(&dh);
|
||||
link.Read<float>(&dv);
|
||||
|
||||
#ifndef NEW_CLIPPING
|
||||
// scroll visually by using the CopyBits() implementation
|
||||
// this will also take care of invalidating previously invisible
|
||||
// areas (areas scrolled into view)
|
||||
@ -436,7 +436,9 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
fCurrentLayer->fLayerData->OffsetOrigin(BPoint(dh, dv));
|
||||
|
||||
_CopyBits(myRootLayer, fCurrentLayer, src, dst, xOffset, yOffset);
|
||||
|
||||
#else
|
||||
fCurrentLayer->ScrollBy(dh, dv);
|
||||
#endif
|
||||
|
||||
break;
|
||||
}
|
||||
|
@ -171,6 +171,8 @@ WinBorder::Draw(const BRect &r)
|
||||
void
|
||||
WinBorder::MoveBy(float x, float y)
|
||||
{
|
||||
#ifndef NEW_CLIPPING
|
||||
|
||||
x = (float)int32(x);
|
||||
y = (float)int32(y);
|
||||
|
||||
@ -181,8 +183,6 @@ y = (float)int32(y);
|
||||
if (fDecorator)
|
||||
fDecorator->MoveBy(x,y);
|
||||
|
||||
#ifndef NEW_CLIPPING
|
||||
|
||||
// NOTE: I moved this here from Layer::move_layer()
|
||||
// Should this have any bad consequences I'm not aware of?
|
||||
fCumulativeRegion.OffsetBy(x, y);
|
||||
@ -213,16 +213,16 @@ fInUpdateRegion.OffsetBy(x, y);
|
||||
move_layer(x, y);
|
||||
}
|
||||
|
||||
#else
|
||||
// implement. maybe...
|
||||
#endif
|
||||
|
||||
if (Window()) {
|
||||
// dispatch a message to the client informing about the changed size
|
||||
BMessage msg(B_WINDOW_MOVED);
|
||||
msg.AddPoint("where", fFrame.LeftTop());
|
||||
Window()->SendMessageToClient(&msg, B_NULL_TOKEN, false);
|
||||
}
|
||||
|
||||
#else
|
||||
Layer::MoveBy(x, y);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -234,6 +234,7 @@ WinBorder::ResizeBy(float x, float y)
|
||||
if (!_ResizeBy(x, y))
|
||||
return;
|
||||
|
||||
#ifndef NEW_CLIPPING
|
||||
if (Window()) {
|
||||
// send a message to the client informing about the changed size
|
||||
BMessage msg(B_WINDOW_RESIZED);
|
||||
@ -245,6 +246,7 @@ WinBorder::ResizeBy(float x, float y)
|
||||
|
||||
Window()->SendMessageToClient(&msg, B_NULL_TOKEN, false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -252,10 +254,6 @@ WinBorder::ResizeBy(float x, float y)
|
||||
bool
|
||||
WinBorder::_ResizeBy(float x, float y)
|
||||
{
|
||||
// ToDo: remove/fix these?
|
||||
x = (float)int32(x);
|
||||
y = (float)int32(y);
|
||||
|
||||
float wantWidth = fFrame.Width() + x;
|
||||
float wantHeight = fFrame.Height() + y;
|
||||
|
||||
@ -276,10 +274,10 @@ y = (float)int32(y);
|
||||
if (x == 0.0 && y == 0.0)
|
||||
return false;
|
||||
|
||||
#ifndef NEW_CLIPPING
|
||||
if (fDecorator)
|
||||
fDecorator->ResizeBy(x, y);
|
||||
|
||||
#ifndef NEW_CLIPPING
|
||||
if (IsHidden()) {
|
||||
// TODO: See large comment in MoveBy()
|
||||
fFrame.right += x;
|
||||
@ -292,7 +290,7 @@ y = (float)int32(y);
|
||||
}
|
||||
|
||||
#else
|
||||
// Do? I don't think so. The new move/resize/scroll hooks should handle these
|
||||
Layer::ResizeBy(x, y);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
@ -396,6 +394,7 @@ WinBorder::SetSizeLimits(float minWidth, float maxWidth,
|
||||
else if (maxHeightDiff < 0.0) // we're currently larger than maxHeight
|
||||
yDiff = maxHeightDiff;
|
||||
|
||||
// Layer::ResizeBy(xDiff, yDiff);
|
||||
ResizeBy(xDiff, yDiff);
|
||||
}
|
||||
|
||||
@ -498,13 +497,21 @@ WinBorder::MouseMoved(const PointerEvent& event)
|
||||
fBringToFrontOnRelease = false;
|
||||
|
||||
BPoint delta = event.where - fLastMousePosition;
|
||||
#ifndef NEW_CLIPPING
|
||||
MoveBy(delta.x, delta.y);
|
||||
#else
|
||||
do_MoveBy(delta.x, delta.y);
|
||||
#endif
|
||||
}
|
||||
if (fIsResizing) {
|
||||
BRect frame(fFrame.LeftTop(), event.where - fResizingClickOffset);
|
||||
|
||||
BPoint delta = frame.RightBottom() - fFrame.RightBottom();
|
||||
#ifndef NEW_CLIPPING
|
||||
ResizeBy(delta.x, delta.y);
|
||||
#else
|
||||
do_ResizeBy(delta.x, delta.y);
|
||||
#endif
|
||||
}
|
||||
if (fIsSlidingTab) {
|
||||
}
|
||||
@ -585,17 +592,6 @@ WinBorder::HighlightDecorator(bool active)
|
||||
fDecorator->SetFocus(active);
|
||||
}
|
||||
|
||||
//! Returns true if the point is in the WinBorder's screen area
|
||||
bool
|
||||
WinBorder::HasPoint(const BPoint& pt) const
|
||||
{
|
||||
#ifndef NEW_CLIPPING
|
||||
return fFullVisible.Contains(pt);
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Unimplemented. Hook function for handling when system GUI colors change
|
||||
void
|
||||
WinBorder::UpdateColors()
|
||||
@ -695,6 +691,10 @@ WinBorder::_ActionFor(const PointerEvent& event) const
|
||||
if (fTopLayer->fFullVisible.Contains(event.where))
|
||||
return DEC_NONE;
|
||||
else
|
||||
#else
|
||||
if (fTopLayer->fFullVisible2.Contains(event.where))
|
||||
return DEC_NONE;
|
||||
else
|
||||
#endif
|
||||
if (fDecorator)
|
||||
return fDecorator->Clicked(event.where, event.buttons, event.modifiers);
|
||||
@ -705,12 +705,38 @@ WinBorder::_ActionFor(const PointerEvent& event) const
|
||||
#ifdef NEW_CLIPPING
|
||||
void WinBorder::MovedByHook(float dx, float dy)
|
||||
{
|
||||
STRACE(("WinBorder(%s)::MovedByHook(%.1f, %.1f) fDecorator: %p\n", GetName(), x, y, fDecorator));
|
||||
|
||||
fDecRegion.OffsetBy(dx, dy);
|
||||
|
||||
if (fDecorator)
|
||||
fDecorator->MoveBy(dx, dy);
|
||||
|
||||
fCumulativeRegion.OffsetBy(dx, dy);
|
||||
fInUpdateRegion.OffsetBy(dx, dy);
|
||||
|
||||
// dispatch a message to the client informing about the changed size
|
||||
BMessage msg(B_WINDOW_MOVED);
|
||||
msg.AddInt64("when", system_time());
|
||||
msg.AddPoint("where", Frame().LeftTop());
|
||||
Window()->SendMessageToClient(&msg, B_NULL_TOKEN, false);
|
||||
}
|
||||
|
||||
void WinBorder::ResizedByHook(float dx, float dy, bool automatic)
|
||||
{
|
||||
STRACE(("WinBorder(%s)::ResizedByHook(%.1f, %.1f, %s) fDecorator: %p\n", GetName(), x, y, automatic?"true":"false", fDecorator));
|
||||
fRebuildDecRegion = true;
|
||||
|
||||
if (fDecorator)
|
||||
fDecorator->ResizeBy(dx, dy);
|
||||
|
||||
// send a message to the client informing about the changed size
|
||||
BRect frame(fTopLayer->Frame());
|
||||
BMessage msg(B_WINDOW_RESIZED);
|
||||
msg.AddInt64("when", system_time());
|
||||
msg.AddInt32("width", frame.IntegerWidth());
|
||||
msg.AddInt32("height", frame.IntegerHeight());
|
||||
Window()->SendMessageToClient(&msg, B_NULL_TOKEN, false);
|
||||
}
|
||||
|
||||
void WinBorder::set_decorator_region(BRect bounds)
|
||||
|
@ -63,6 +63,9 @@ class WinBorder : public Layer {
|
||||
|
||||
virtual void MoveBy(float x, float y);
|
||||
virtual void ResizeBy(float x, float y);
|
||||
virtual void ScrollBy(float x, float y)
|
||||
{ // not allowed
|
||||
}
|
||||
#ifndef NEW_CLIPPING
|
||||
virtual void RebuildFullRegion();
|
||||
#endif
|
||||
@ -108,8 +111,6 @@ class WinBorder : public Layer {
|
||||
|
||||
void HighlightDecorator(bool active);
|
||||
|
||||
bool HasPoint(const BPoint &pt) const;
|
||||
|
||||
inline void QuietlySetWorkspaces(uint32 wks) { fWorkspaces = wks; }
|
||||
void QuietlySetFeel(int32 feel);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user