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
@@ -6,6 +6,7 @@
* Clemens Zeidler <[email protected]> * Clemens Zeidler <[email protected]>
*/ */
#include "SATGroup.h" #include "SATGroup.h"
#include <Debug.h> #include <Debug.h>
+21 -11
View File
@@ -8,6 +8,7 @@
#ifndef SAT_GROUP_H #ifndef SAT_GROUP_H
#define SAT_GROUP_H #define SAT_GROUP_H
#include <Rect.h> #include <Rect.h>
#include "ObjectList.h" #include "ObjectList.h"
@@ -54,7 +55,8 @@ public:
~Crossing(); ~Crossing();
Corner* GetCorner(Corner::position_t corner) const; 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* LeftTopCorner() { return &fLeftTop; }
Corner* RightTopCorner() { return &fRightTop; } Corner* RightTopCorner() { return &fRightTop; }
@@ -112,7 +114,8 @@ public:
const CrossingList* GetCrossingList() const; const CrossingList* GetCrossingList() const;
static int CompareFunction(const Tab* tab1, const Tab* tab2); static int CompareFunction(const Tab* tab1,
const Tab* tab2);
private: private:
SATGroup* fGroup; SATGroup* fGroup;
@@ -163,8 +166,8 @@ private:
/*! SATGroup adds new windows to the area. */ /*! SATGroup adds new windows to the area. */
bool _AddWindow(SATWindow* window, bool _AddWindow(SATWindow* window,
SATWindow* after = NULL); SATWindow* after = NULL);
/*! After the last window has been removed the WindowArea delete himself /*! After the last window has been removed the WindowArea delete
and clean up all crossings. */ himself and clean up all crossings. */
bool _RemoveWindow(SATWindow* window); bool _RemoveWindow(SATWindow* window);
inline void _InitCorners(); inline void _InitCorners();
@@ -176,7 +179,8 @@ private:
inline void _UnsetNeighbourCorner(Corner* neighbour, inline void _UnsetNeighbourCorner(Corner* neighbour,
Corner* opponent); 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, BReference<Crossing> _CrossingByPosition(Crossing* crossing,
SATGroup* group); SATGroup* group);
@@ -238,16 +242,22 @@ private:
Tab* _FindTab(const TabList& list, float position); Tab* _FindTab(const TabList& list, float position);
void _SplitGroupIfNecessary(SATWindow* removedWindow); void _SplitGroupIfNecessary(
void _FillNeighbourList(WindowAreaList& neighbourWindows, SATWindow* removedWindow);
void _FillNeighbourList(
WindowAreaList& neighbourWindows,
WindowArea* area); WindowArea* area);
void _LeftNeighbours(WindowAreaList& neighbourWindows, void _LeftNeighbours(
WindowAreaList& neighbourWindows,
WindowArea* window); WindowArea* window);
void _TopNeighbours(WindowAreaList& neighbourWindows, void _TopNeighbours(
WindowAreaList& neighbourWindows,
WindowArea* window); WindowArea* window);
void _RightNeighbours(WindowAreaList& neighbourWindows, void _RightNeighbours(
WindowAreaList& neighbourWindows,
WindowArea* window); WindowArea* window);
void _BottomNeighbours(WindowAreaList& neighbourWindows, void _BottomNeighbours(
WindowAreaList& neighbourWindows,
WindowArea* window); WindowArea* window);
bool _FindConnectedGroup(WindowAreaList& seedList, bool _FindConnectedGroup(WindowAreaList& seedList,
SATWindow* removedWindow, SATWindow* removedWindow,
@@ -6,6 +6,7 @@
* Clemens Zeidler <[email protected]> * Clemens Zeidler <[email protected]>
*/ */
#include "SATWindow.h" #include "SATWindow.h"
#include <Debug.h> #include <Debug.h>
@@ -118,14 +119,14 @@ GroupCookie::MoveWindow(int32 workspace)
Desktop* desktop = window->Desktop(); Desktop* desktop = window->Desktop();
BRect frame = fSATWindow->CompleteWindowFrame(); BRect frame = fSATWindow->CompleteWindowFrame();
desktop->MoveWindowBy(window, fLeftBorder->Value() - frame.left, desktop->MoveWindowBy(window, round(fLeftBorder->Value() - frame.left),
fTopBorder->Value() - frame.top, workspace); round(fTopBorder->Value() - frame.top), workspace);
// Update frame to the new position // Update frame to the new position
frame.OffsetBy(fLeftBorder->Value() - frame.left, frame.OffsetBy(round(fLeftBorder->Value() - frame.left),
fTopBorder->Value() - frame.top); round(fTopBorder->Value() - frame.top));
desktop->ResizeWindowBy(window, fRightBorder->Value() - frame.right, desktop->ResizeWindowBy(window, round(fRightBorder->Value() - frame.right),
fBottomBorder->Value() - frame.bottom); round(fBottomBorder->Value() - frame.bottom));
_UpdateWindowSize(frame); _UpdateWindowSize(frame);
} }
@@ -39,7 +39,8 @@ public:
WindowArea* GetWindowArea() { return fWindowArea; } WindowArea* GetWindowArea() { return fWindowArea; }
bool PropagateToGroup(SATGroup* group, WindowArea* area); bool PropagateToGroup(SATGroup* group,
WindowArea* area);
private: private:
void _UpdateWindowSize(const BRect& frame); void _UpdateWindowSize(const BRect& frame);
@@ -88,7 +89,8 @@ public:
bool HandleMessage(SATWindow* sender, bool HandleMessage(SATWindow* sender,
BPrivate::ServerLink& link); BPrivate::ServerLink& link);
bool PropagateToGroup(SATGroup* group, WindowArea* area); bool PropagateToGroup(SATGroup* group,
WindowArea* area);
//! Move the window to the tab's position. //! Move the window to the tab's position.
void MoveWindowToSAT(int32 workspace); void MoveWindowToSAT(int32 workspace);
@@ -6,6 +6,7 @@
* Clemens Zeidler <haiku@clemens-zeidler.de> * Clemens Zeidler <haiku@clemens-zeidler.de>
*/ */
#include "StackAndTile.h" #include "StackAndTile.h"
#include <Debug.h> #include <Debug.h>
@@ -8,6 +8,7 @@
#ifndef STACK_AND_TILE_H #ifndef STACK_AND_TILE_H
#define STACK_AND_TILE_H #define STACK_AND_TILE_H
#include <map> #include <map>
#include <Message.h> #include <Message.h>
@@ -107,7 +108,8 @@ private:
class GroupIterator { class GroupIterator {
public: public:
GroupIterator(StackAndTile* sat, Desktop* desktop); GroupIterator(StackAndTile* sat,
Desktop* desktop);
void RewindToFront(); void RewindToFront();
SATGroup* NextGroup(); SATGroup* NextGroup();
@@ -126,9 +128,10 @@ public:
bool reverseLayerOrder = false); bool reverseLayerOrder = false);
void Rewind(); void Rewind();
/*! Iterates over all areas in the group and return the windows in the /*! Iterates over all areas in the group and return the windows in
areas. Within one area the windows are ordered by their layer position. the areas. Within one area the windows are ordered by their layer
If reverseLayerOrder is false the bottommost window comes first. */ position. If reverseLayerOrder is false the bottommost window comes
first. */
SATWindow* NextWindow(); SATWindow* NextWindow();
@@ -160,7 +163,8 @@ public:
the group accordantly. */ the group accordantly. */
virtual void DoWindowLayout() = 0; virtual void DoWindowLayout() = 0;
virtual void RemovedFromArea(WindowArea* area) {} virtual void RemovedFromArea(WindowArea* area) {}
virtual void TabLocationMoved(float location, bool shifting) {} virtual void TabLocationMoved(float location, bool shifting)
{}
}; };