Round the the window move target positions, this should fix jumping windows.

Coding style.



git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@38789 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Clemens Zeidler 2010-09-22 22:27:31 +00:00
parent 9503cf19be
commit a2336b86cc
6 changed files with 261 additions and 242 deletions

View File

@ -6,6 +6,7 @@
* Clemens Zeidler <haiku@clemens-zeidler.de>
*/
#include "SATGroup.h"
#include <Debug.h>

View File

@ -8,6 +8,7 @@
#ifndef SAT_GROUP_H
#define SAT_GROUP_H
#include <Rect.h>
#include "ObjectList.h"
@ -54,7 +55,8 @@ public:
~Crossing();
Corner* GetCorner(Corner::position_t corner) const;
Corner* GetOppositeCorner(Corner::position_t corner) const;
Corner* GetOppositeCorner(
Corner::position_t corner) const;
Corner* LeftTopCorner() { return &fLeftTop; }
Corner* RightTopCorner() { return &fRightTop; }
@ -112,7 +114,8 @@ public:
const CrossingList* GetCrossingList() const;
static int CompareFunction(const Tab* tab1, const Tab* tab2);
static int CompareFunction(const Tab* tab1,
const Tab* tab2);
private:
SATGroup* fGroup;
@ -163,8 +166,8 @@ private:
/*! SATGroup adds new windows to the area. */
bool _AddWindow(SATWindow* window,
SATWindow* after = NULL);
/*! After the last window has been removed the WindowArea delete himself
and clean up all crossings. */
/*! After the last window has been removed the WindowArea delete
himself and clean up all crossings. */
bool _RemoveWindow(SATWindow* window);
inline void _InitCorners();
@ -176,7 +179,8 @@ private:
inline void _UnsetNeighbourCorner(Corner* neighbour,
Corner* opponent);
// Find crossing by tab position in group and if not exist create it.
// Find crossing by tab position in group and if not exist create
// it.
BReference<Crossing> _CrossingByPosition(Crossing* crossing,
SATGroup* group);
@ -238,16 +242,22 @@ private:
Tab* _FindTab(const TabList& list, float position);
void _SplitGroupIfNecessary(SATWindow* removedWindow);
void _FillNeighbourList(WindowAreaList& neighbourWindows,
void _SplitGroupIfNecessary(
SATWindow* removedWindow);
void _FillNeighbourList(
WindowAreaList& neighbourWindows,
WindowArea* area);
void _LeftNeighbours(WindowAreaList& neighbourWindows,
void _LeftNeighbours(
WindowAreaList& neighbourWindows,
WindowArea* window);
void _TopNeighbours(WindowAreaList& neighbourWindows,
void _TopNeighbours(
WindowAreaList& neighbourWindows,
WindowArea* window);
void _RightNeighbours(WindowAreaList& neighbourWindows,
void _RightNeighbours(
WindowAreaList& neighbourWindows,
WindowArea* window);
void _BottomNeighbours(WindowAreaList& neighbourWindows,
void _BottomNeighbours(
WindowAreaList& neighbourWindows,
WindowArea* window);
bool _FindConnectedGroup(WindowAreaList& seedList,
SATWindow* removedWindow,

View File

@ -6,6 +6,7 @@
* Clemens Zeidler <haiku@clemens-zeidler.de>
*/
#include "SATWindow.h"
#include <Debug.h>
@ -118,14 +119,14 @@ GroupCookie::MoveWindow(int32 workspace)
Desktop* desktop = window->Desktop();
BRect frame = fSATWindow->CompleteWindowFrame();
desktop->MoveWindowBy(window, fLeftBorder->Value() - frame.left,
fTopBorder->Value() - frame.top, workspace);
desktop->MoveWindowBy(window, round(fLeftBorder->Value() - frame.left),
round(fTopBorder->Value() - frame.top), workspace);
// Update frame to the new position
frame.OffsetBy(fLeftBorder->Value() - frame.left,
fTopBorder->Value() - frame.top);
desktop->ResizeWindowBy(window, fRightBorder->Value() - frame.right,
fBottomBorder->Value() - frame.bottom);
frame.OffsetBy(round(fLeftBorder->Value() - frame.left),
round(fTopBorder->Value() - frame.top));
desktop->ResizeWindowBy(window, round(fRightBorder->Value() - frame.right),
round(fBottomBorder->Value() - frame.bottom));
_UpdateWindowSize(frame);
}

View File

@ -39,7 +39,8 @@ public:
WindowArea* GetWindowArea() { return fWindowArea; }
bool PropagateToGroup(SATGroup* group, WindowArea* area);
bool PropagateToGroup(SATGroup* group,
WindowArea* area);
private:
void _UpdateWindowSize(const BRect& frame);
@ -88,7 +89,8 @@ public:
bool HandleMessage(SATWindow* sender,
BPrivate::ServerLink& link);
bool PropagateToGroup(SATGroup* group, WindowArea* area);
bool PropagateToGroup(SATGroup* group,
WindowArea* area);
//! Move the window to the tab's position.
void MoveWindowToSAT(int32 workspace);

View File

@ -6,6 +6,7 @@
* Clemens Zeidler <haiku@clemens-zeidler.de>
*/
#include "StackAndTile.h"
#include <Debug.h>

View File

@ -8,6 +8,7 @@
#ifndef STACK_AND_TILE_H
#define STACK_AND_TILE_H
#include <map>
#include <Message.h>
@ -107,7 +108,8 @@ private:
class GroupIterator {
public:
GroupIterator(StackAndTile* sat, Desktop* desktop);
GroupIterator(StackAndTile* sat,
Desktop* desktop);
void RewindToFront();
SATGroup* NextGroup();
@ -126,9 +128,10 @@ public:
bool reverseLayerOrder = false);
void Rewind();
/*! Iterates over all areas in the group and return the windows in the
areas. Within one area the windows are ordered by their layer position.
If reverseLayerOrder is false the bottommost window comes first. */
/*! Iterates over all areas in the group and return the windows in
the areas. Within one area the windows are ordered by their layer
position. If reverseLayerOrder is false the bottommost window comes
first. */
SATWindow* NextWindow();
@ -160,7 +163,8 @@ public:
the group accordantly. */
virtual void DoWindowLayout() = 0;
virtual void RemovedFromArea(WindowArea* area) {}
virtual void TabLocationMoved(float location, bool shifting) {}
virtual void TabLocationMoved(float location, bool shifting)
{}
};