Moving/resizing is now routed over the desktop as well.

This also allows the workspaces layer for these actions, which is now done as well.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15258 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-12-01 10:31:30 +00:00
parent b22fc00fa8
commit 19d801a6b6
6 changed files with 71 additions and 11 deletions
+14
View File
@@ -663,6 +663,20 @@ Desktop::HideWindow(WindowLayer* window)
} }
void
Desktop::MoveWindowBy(WindowLayer* window, float x, float y)
{
fRootLayer->MoveWindowBy(window, x, y);
}
void
Desktop::ResizeWindowBy(WindowLayer* window, float x, float y)
{
fRootLayer->ResizeWindowBy(window, x, y);
}
/*! /*!
\brief Adds or removes the window to or from the workspaces it's on. \brief Adds or removes the window to or from the workspaces it's on.
*/ */
+3
View File
@@ -93,6 +93,9 @@ class Desktop : public MessageLooper, public ScreenOwner {
void ShowWindow(WindowLayer* window); void ShowWindow(WindowLayer* window);
void HideWindow(WindowLayer* window); void HideWindow(WindowLayer* window);
void MoveWindowBy(WindowLayer* window, float x, float y);
void ResizeWindowBy(WindowLayer* window, float x, float y);
void SetWindowWorkspaces(WindowLayer* window, void SetWindowWorkspaces(WindowLayer* window,
uint32 workspaces); uint32 workspaces);
+40
View File
@@ -519,6 +519,46 @@ RootLayer::ShowWindowLayer(WindowLayer* windowLayer, bool toFront)
} }
void
RootLayer::MoveWindowBy(WindowLayer* window, float x, float y)
{
BAutolock _(fAllRegionsLock);
// TODO: the MoveBy() should just return a dirty region
window->MoveBy(x, y);
if (window->Parent() == NULL)
return;
BRegion changed;
_WindowsChanged(changed);
if (changed.CountRects() > 0) {
MarkForRedraw(changed);
TriggerRedraw();
}
}
void
RootLayer::ResizeWindowBy(WindowLayer* window, float x, float y)
{
BAutolock _(fAllRegionsLock);
// TODO: the MoveBy() should just return a dirty region
window->ResizeBy(x, y);
if (window->Parent() == NULL)
return;
BRegion changed;
_WindowsChanged(changed);
if (changed.CountRects() > 0) {
MarkForRedraw(changed);
TriggerRedraw();
}
}
void void
RootLayer::SetWindowLayerFeel(WindowLayer *windowLayer, int32 newFeel) RootLayer::SetWindowLayerFeel(WindowLayer *windowLayer, int32 newFeel)
{ {
+3
View File
@@ -57,6 +57,9 @@ class RootLayer : public Layer {
void HideWindowLayer(WindowLayer* windowLayer); void HideWindowLayer(WindowLayer* windowLayer);
void ShowWindowLayer(WindowLayer* windowLayer, bool toFront = true); void ShowWindowLayer(WindowLayer* windowLayer, bool toFront = true);
void MoveWindowBy(WindowLayer* window, float x, float y);
void ResizeWindowBy(WindowLayer* window, float x, float y);
bool SetFocus(WindowLayer* focus); bool SetFocus(WindowLayer* focus);
WindowLayer* Focus() const { return fFocus; } WindowLayer* Focus() const { return fFocus; }
WindowLayer* Front() const { return fFront; } WindowLayer* Front() const { return fFront; }
+8 -8
View File
@@ -1373,26 +1373,24 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
{ {
float xResizeBy; float xResizeBy;
float yResizeBy; float yResizeBy;
link.Read<float>(&xResizeBy); link.Read<float>(&xResizeBy);
link.Read<float>(&yResizeBy); link.Read<float>(&yResizeBy);
STRACE(("ServerWindow %s: Message AS_WINDOW_RESIZE %.1f, %.1f\n", Title(), xResizeBy, yResizeBy)); STRACE(("ServerWindow %s: Message AS_WINDOW_RESIZE %.1f, %.1f\n", Title(), xResizeBy, yResizeBy));
fWindowLayer->ResizeBy(xResizeBy, yResizeBy); fDesktop->ResizeWindowBy(fWindowLayer, xResizeBy, yResizeBy);
break; break;
} }
case AS_WINDOW_MOVE: case AS_WINDOW_MOVE:
{ {
float xMoveBy; float xMoveBy;
float yMoveBy; float yMoveBy;
link.Read<float>(&xMoveBy); link.Read<float>(&xMoveBy);
link.Read<float>(&yMoveBy); link.Read<float>(&yMoveBy);
STRACE(("ServerWindow %s: Message AS_WINDOW_MOVE: %.1f, %.1f\n", Title(), xMoveBy, yMoveBy)); STRACE(("ServerWindow %s: Message AS_WINDOW_MOVE: %.1f, %.1f\n", Title(), xMoveBy, yMoveBy));
fWindowLayer->MoveBy(xMoveBy, yMoveBy); fDesktop->MoveWindowBy(fWindowLayer, xMoveBy, yMoveBy);
break; break;
} }
case AS_SET_SIZE_LIMITS: case AS_SET_SIZE_LIMITS:
@@ -1402,17 +1400,19 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
// 2) float maximum width // 2) float maximum width
// 3) float minimum height // 3) float minimum height
// 4) float maximum height // 4) float maximum height
float minWidth; float minWidth;
float maxWidth; float maxWidth;
float minHeight; float minHeight;
float maxHeight; float maxHeight;
link.Read<float>(&minWidth); link.Read<float>(&minWidth);
link.Read<float>(&maxWidth); link.Read<float>(&maxWidth);
link.Read<float>(&minHeight); link.Read<float>(&minHeight);
link.Read<float>(&maxHeight); link.Read<float>(&maxHeight);
// TODO: setting size limits can change the window size, and therefore,
// it should be done by the Desktop class as well.
fWindowLayer->SetSizeLimits(minWidth, maxWidth, minHeight, maxHeight); fWindowLayer->SetSizeLimits(minWidth, maxWidth, minHeight, maxHeight);
// and now, sync the client to the limits that we were able to enforce // and now, sync the client to the limits that we were able to enforce
+3 -3
View File
@@ -543,11 +543,11 @@ WindowLayer::MouseMoved(BMessage *msg, BPoint where, int32* _viewToken)
if (fIsDragging) { if (fIsDragging) {
BPoint delta = where - fLastMousePosition; BPoint delta = where - fLastMousePosition;
MoveBy(delta.x, delta.y); Window()->Desktop()->MoveWindowBy(this, delta.x, delta.y);
} }
if (fIsResizing) { if (fIsResizing) {
BPoint delta = where - fLastMousePosition; BPoint delta = where - fLastMousePosition;
ResizeBy(delta.x, delta.y); Window()->Desktop()->ResizeWindowBy(this, delta.x, delta.y);
} }
if (fIsSlidingTab) { if (fIsSlidingTab) {
// TODO: implement // TODO: implement
@@ -556,7 +556,7 @@ WindowLayer::MouseMoved(BMessage *msg, BPoint where, int32* _viewToken)
fLastMousePosition = where; fLastMousePosition = where;
// change focus in FFM mode // change focus in FFM mode
Desktop* desktop = Window()->App()->GetDesktop(); Desktop* desktop = Window()->Desktop();
DesktopSettings desktopSettings(desktop); DesktopSettings desktopSettings(desktop);
if (desktopSettings.MouseMode() != B_NORMAL_MOUSE && !IsFocus()) if (desktopSettings.MouseMode() != B_NORMAL_MOUSE && !IsFocus())