Added the scrolling offset when a view is created.

This lightens the problem in bug #98 a bit, but doesn't completely fix it; you
still don't see any items in that list on the switch, but they now appear again
when you scroll around there.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16997 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2006-04-04 01:51:16 +00:00
parent 31dc79a18b
commit 903936bcec
6 changed files with 19 additions and 12 deletions
+3
View File
@@ -3463,6 +3463,8 @@ BView::MoveTo(float x, float y)
void void
BView::ResizeBy(float deltaWidth, float deltaHeight) BView::ResizeBy(float deltaWidth, float deltaHeight)
{ {
// TODO: this doesn't look like it would work correctly with scrolled views
// NOTE: I think this check makes sense, but I didn't // NOTE: I think this check makes sense, but I didn't
// test what R5 does. // test what R5 does.
if (fBounds.right + deltaWidth < 0) if (fBounds.right + deltaWidth < 0)
@@ -3972,6 +3974,7 @@ BView::_CreateSelf()
fOwner->fLink->Attach<int32>(_get_object_token_(this)); fOwner->fLink->Attach<int32>(_get_object_token_(this));
fOwner->fLink->AttachString(Name()); fOwner->fLink->AttachString(Name());
fOwner->fLink->Attach<BRect>(Frame()); fOwner->fLink->Attach<BRect>(Frame());
fOwner->fLink->Attach<BPoint>(LeftTop());
fOwner->fLink->Attach<uint32>(ResizingMode()); fOwner->fLink->Attach<uint32>(ResizingMode());
fOwner->fLink->Attach<uint32>(fEventMask); fOwner->fLink->Attach<uint32>(fEventMask);
fOwner->fLink->Attach<uint32>(fEventOptions); fOwner->fLink->Attach<uint32>(fEventOptions);
+6 -3
View File
@@ -476,10 +476,12 @@ ServerWindow::_CreateLayerTree(BPrivate::LinkReceiver &link, ViewLayer **_parent
int32 parentToken; int32 parentToken;
char* name = NULL; char* name = NULL;
rgb_color viewColor; rgb_color viewColor;
BPoint scrollingOffset;
link.Read<int32>(&token); link.Read<int32>(&token);
link.ReadString(&name); link.ReadString(&name);
link.Read<BRect>(&frame); link.Read<BRect>(&frame);
link.Read<BPoint>(&scrollingOffset);
link.Read<uint32>(&resizeMask); link.Read<uint32>(&resizeMask);
link.Read<uint32>(&eventMask); link.Read<uint32>(&eventMask);
link.Read<uint32>(&eventOptions); link.Read<uint32>(&eventOptions);
@@ -496,10 +498,11 @@ ServerWindow::_CreateLayerTree(BPrivate::LinkReceiver &link, ViewLayer **_parent
if (link.Code() == AS_LAYER_CREATE_ROOT if (link.Code() == AS_LAYER_CREATE_ROOT
&& (fWindowLayer->Flags() & kWorkspacesWindowFlag) != 0) { && (fWindowLayer->Flags() & kWorkspacesWindowFlag) != 0) {
// this is a workspaces window! // this is a workspaces window!
newLayer = new (nothrow) WorkspacesLayer(frame, name, token, resizeMask, newLayer = new (nothrow) WorkspacesLayer(frame, scrollingOffset, name,
flags); token, resizeMask, flags);
} else { } else {
newLayer = new (nothrow) ViewLayer(frame, name, token, resizeMask, flags); newLayer = new (nothrow) ViewLayer(frame, scrollingOffset, name, token,
resizeMask, flags);
} }
free(name); free(name);
+3 -2
View File
@@ -34,14 +34,15 @@
using std::nothrow; using std::nothrow;
ViewLayer::ViewLayer(BRect frame, const char* name,
ViewLayer::ViewLayer(BRect frame, BPoint scrollingOffset, const char* name,
int32 token, uint32 resizeMode, uint32 flags) int32 token, uint32 resizeMode, uint32 flags)
: :
fName(name), fName(name),
fToken(token), fToken(token),
fFrame(frame), fFrame(frame),
fScrollingOffset(0.0, 0.0), fScrollingOffset(scrollingOffset),
fViewColor(RGBColor(255, 255, 255)), fViewColor(RGBColor(255, 255, 255)),
fDrawState(new (nothrow) DrawState), fDrawState(new (nothrow) DrawState),
+2 -2
View File
@@ -33,8 +33,8 @@ class ServerPicture;
class ViewLayer { class ViewLayer {
public: public:
ViewLayer(BRect frame, const char* name, ViewLayer(BRect frame, BPoint scrollingOffset,
int32 token, uint32 resizeMode, const char* name, int32 token, uint32 resizeMode,
uint32 flags); uint32 flags);
virtual ~ViewLayer(); virtual ~ViewLayer();
+3 -3
View File
@@ -19,9 +19,9 @@
#include <WindowPrivate.h> #include <WindowPrivate.h>
WorkspacesLayer::WorkspacesLayer(BRect frame, const char* name, WorkspacesLayer::WorkspacesLayer(BRect frame, BPoint scrollingOffset,
int32 token, uint32 resizeMode, uint32 flags) const char* name, int32 token, uint32 resizeMode, uint32 flags)
: ViewLayer(frame, name, token, resizeMode, flags), : ViewLayer(frame, scrollingOffset, name, token, resizeMode, flags),
fSelectedWindow(NULL), fSelectedWindow(NULL),
fSelectedWorkspace(-1), fSelectedWorkspace(-1),
fHasMoved(false) fHasMoved(false)
+2 -2
View File
@@ -16,8 +16,8 @@ class WindowLayer;
class WorkspacesLayer : public ViewLayer { class WorkspacesLayer : public ViewLayer {
public: public:
WorkspacesLayer(BRect frame, const char* name, int32 token, WorkspacesLayer(BRect frame, BPoint scrollingOffset, const char* name,
uint32 resize, uint32 flags); int32 token, uint32 resize, uint32 flags);
virtual ~WorkspacesLayer(); virtual ~WorkspacesLayer();
virtual void Draw(DrawingEngine* drawingEngine, virtual void Draw(DrawingEngine* drawingEngine,