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:
@@ -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.
|
||||
*/
|
||||
|
||||
@@ -93,6 +93,9 @@ class Desktop : public MessageLooper, public ScreenOwner {
|
||||
void ShowWindow(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,
|
||||
uint32 workspaces);
|
||||
|
||||
|
||||
@@ -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
|
||||
RootLayer::SetWindowLayerFeel(WindowLayer *windowLayer, int32 newFeel)
|
||||
{
|
||||
|
||||
@@ -57,6 +57,9 @@ class RootLayer : public Layer {
|
||||
void HideWindowLayer(WindowLayer* windowLayer);
|
||||
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);
|
||||
WindowLayer* Focus() const { return fFocus; }
|
||||
WindowLayer* Front() const { return fFront; }
|
||||
|
||||
@@ -1373,26 +1373,24 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
{
|
||||
float xResizeBy;
|
||||
float yResizeBy;
|
||||
|
||||
link.Read<float>(&xResizeBy);
|
||||
link.Read<float>(&yResizeBy);
|
||||
|
||||
STRACE(("ServerWindow %s: Message AS_WINDOW_RESIZE %.1f, %.1f\n", Title(), xResizeBy, yResizeBy));
|
||||
|
||||
fWindowLayer->ResizeBy(xResizeBy, yResizeBy);
|
||||
|
||||
fDesktop->ResizeWindowBy(fWindowLayer, xResizeBy, yResizeBy);
|
||||
break;
|
||||
}
|
||||
case AS_WINDOW_MOVE:
|
||||
{
|
||||
float xMoveBy;
|
||||
float yMoveBy;
|
||||
|
||||
link.Read<float>(&xMoveBy);
|
||||
link.Read<float>(&yMoveBy);
|
||||
|
||||
STRACE(("ServerWindow %s: Message AS_WINDOW_MOVE: %.1f, %.1f\n", Title(), xMoveBy, yMoveBy));
|
||||
|
||||
fWindowLayer->MoveBy(xMoveBy, yMoveBy);
|
||||
fDesktop->MoveWindowBy(fWindowLayer, xMoveBy, yMoveBy);
|
||||
break;
|
||||
}
|
||||
case AS_SET_SIZE_LIMITS:
|
||||
@@ -1402,17 +1400,19 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
||||
// 2) float maximum width
|
||||
// 3) float minimum height
|
||||
// 4) float maximum height
|
||||
|
||||
|
||||
float minWidth;
|
||||
float maxWidth;
|
||||
float minHeight;
|
||||
float maxHeight;
|
||||
|
||||
|
||||
link.Read<float>(&minWidth);
|
||||
link.Read<float>(&maxWidth);
|
||||
link.Read<float>(&minHeight);
|
||||
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);
|
||||
|
||||
// and now, sync the client to the limits that we were able to enforce
|
||||
|
||||
@@ -543,11 +543,11 @@ WindowLayer::MouseMoved(BMessage *msg, BPoint where, int32* _viewToken)
|
||||
|
||||
if (fIsDragging) {
|
||||
BPoint delta = where - fLastMousePosition;
|
||||
MoveBy(delta.x, delta.y);
|
||||
Window()->Desktop()->MoveWindowBy(this, delta.x, delta.y);
|
||||
}
|
||||
if (fIsResizing) {
|
||||
BPoint delta = where - fLastMousePosition;
|
||||
ResizeBy(delta.x, delta.y);
|
||||
Window()->Desktop()->ResizeWindowBy(this, delta.x, delta.y);
|
||||
}
|
||||
if (fIsSlidingTab) {
|
||||
// TODO: implement
|
||||
@@ -556,7 +556,7 @@ WindowLayer::MouseMoved(BMessage *msg, BPoint where, int32* _viewToken)
|
||||
fLastMousePosition = where;
|
||||
|
||||
// change focus in FFM mode
|
||||
Desktop* desktop = Window()->App()->GetDesktop();
|
||||
Desktop* desktop = Window()->Desktop();
|
||||
DesktopSettings desktopSettings(desktop);
|
||||
|
||||
if (desktopSettings.MouseMode() != B_NORMAL_MOUSE && !IsFocus())
|
||||
|
||||
Reference in New Issue
Block a user