Revert Stack & Tile patch (r33814) and first fixes done by axel (r33824, r33826)

The stack & tile feature developement & fixes would be done in 
branches/features/stack-and-tile branch, until it's ready enough to be merge 
into trunk.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33840 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Houdoin
2009-10-30 06:22:52 +00:00
parent b4c6a820b9
commit 85d512ed65
11 changed files with 27 additions and 2470 deletions
-23
View File
@@ -44,10 +44,6 @@ Decorator::Decorator(DesktopSettings& settings, BRect rect, window_look look,
fFrame(rect),
fResizeRect(),
fBorderRect(),
fTabHighlighted(false),
fBordersHighlighted(false),
fWindow(NULL),
fClosePressed(false),
fZoomPressed(false),
@@ -584,22 +580,3 @@ void
Decorator::_SetFocus()
{
}
void
Decorator::HighlightTab(bool active, BRegion* dirty)
{
}
void
Decorator::HighlightBorders(bool active, BRegion* dirty)
{
}
void
Decorator::SetWindow(Window* window)
{
fWindow = window;
}
-17
View File
@@ -21,7 +21,6 @@ class DesktopSettings;
class DrawingEngine;
class ServerFont;
class BRegion;
class Window;
enum click_type {
@@ -45,7 +44,6 @@ enum click_type {
CLICK_RESIZE_RB
};
class Decorator {
public:
Decorator(DesktopSettings& settings, BRect rect,
@@ -70,14 +68,6 @@ public:
virtual void SetTitle(const char* string,
BRegion* updateRegion = NULL);
virtual void HighlightTab(bool active, BRegion* dirty);
virtual void HighlightBorders(bool active, BRegion* dirty);
bool IsTabHighlighted()
{ return fTabHighlighted; }
bool IsBordersHighlighted()
{ return fBordersHighlighted; }
window_look Look() const;
uint32 Flags() const;
@@ -131,8 +121,6 @@ public:
rgb_color UIColor(color_which which);
void SetWindow(Window* window);
protected:
int32 _TitleWidth() const
{ return fTitle.CountChars(); }
@@ -163,11 +151,6 @@ protected:
BRect fResizeRect;
BRect fBorderRect;
bool fTabHighlighted;
bool fBordersHighlighted;
Window* fWindow;
private:
bool fClosePressed : 1;
bool fZoomPressed : 1;
+13 -289
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2001-2009, Haiku.
* Copyright 2001-2008, Haiku.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -8,7 +8,6 @@
* Philippe Saint-Pierre, [email protected]
*/
/*! Default and fallback decorator for the app_server - the yellow tabs */
@@ -33,22 +32,13 @@
#include "ServerBitmap.h"
// Toggle debug output
//#define DEBUG_DECORATOR
//#define DEBUG_STACK_AND_TILE
#ifdef DEBUG_DECORATOR
# define STRACE(x) printf x
#else
# define STRACE(x) ;
#endif
#ifdef DEBUG_STACK_AND_TILE
# define STRACE_SAT(x) debug_printf x
#else
# define STRACE_SAT(x) ;
#endif
static inline uint8
blend_color_value(uint8 a, uint8 b, float position)
@@ -79,35 +69,22 @@ DefaultDecorator::DefaultDecorator(DesktopSettings& settings, BRect rect,
{
_UpdateFont(settings);
// all colors are state based
fNonHighlightFrameColors[0] = (rgb_color){ 152, 152, 152, 255 };
fNonHighlightFrameColors[1] = (rgb_color){ 240, 240, 240, 255 };
fNonHighlightFrameColors[2] = (rgb_color){ 152, 152, 152, 255 };
fNonHighlightFrameColors[3] = (rgb_color){ 108, 108, 108, 255 };
// common colors to both focus and non focus state
fFrameColors[0] = (rgb_color){ 152, 152, 152, 255 };
fFrameColors[1] = (rgb_color){ 240, 240, 240, 255 };
fFrameColors[4] = (rgb_color){ 152, 152, 152, 255 };
fFrameColors[5] = (rgb_color){ 108, 108, 108, 255 };
// state based colors
fFocusFrameColors[0] = (rgb_color){ 224, 224, 224, 255 };
fFocusFrameColors[1] = (rgb_color){ 208, 208, 208, 255 };
fNonFocusFrameColors[0] = (rgb_color){ 232, 232, 232, 255 };
fNonFocusFrameColors[1] = (rgb_color){ 216, 216, 216, 255 };
fNonFocusFrameColors[1] = fNonFocusFrameColors[0];
fHighlightFrameColors[0] = (rgb_color){ 152, 0, 0, 255 };
fHighlightFrameColors[1] = (rgb_color){ 240, 0, 0, 255 };
fHighlightFrameColors[2] = (rgb_color){ 224, 0, 0, 255 };
fHighlightFrameColors[3] = (rgb_color){ 208, 0, 0, 255 };
fHighlightFrameColors[4] = (rgb_color){ 152, 0, 0, 255 };
fHighlightFrameColors[5] = (rgb_color){ 108, 0, 0, 255 };
// initial colors
fFrameColors[0] = fNonHighlightFrameColors[0];
fFrameColors[1] = fNonHighlightFrameColors[1];
fFrameColors[4] = fNonHighlightFrameColors[2];
fFrameColors[5] = fNonHighlightFrameColors[3];
fFocusTabColor = settings.UIColor(B_WINDOW_TAB_COLOR);
fFocusTextColor = settings.UIColor(B_WINDOW_TEXT_COLOR);
fNonFocusTabColor = settings.UIColor(B_WINDOW_INACTIVE_TAB_COLOR);
fHighlightTabColor = (rgb_color){ 255, 0, 0, 255 };
fNonFocusTextColor = settings.UIColor(B_WINDOW_INACTIVE_TEXT_COLOR);
fCloseBitmaps[0] = fCloseBitmaps[1] = fCloseBitmaps[2] = fCloseBitmaps[3]
@@ -436,236 +413,27 @@ DefaultDecorator::SetTabLocation(float location, BRegion* updateRegion)
bool
DefaultDecorator::SetSettings(const BMessage& settings, BRegion* updateRegion)
{
STRACE_SAT(("DefaultDecorator::SetSettings() on %s\n", fWindow->Title()));
float tabLocation;
if (settings.FindFloat("tab location", &tabLocation) == B_OK)
SetTabLocation(tabLocation, updateRegion);
return SetTabLocation(tabLocation, updateRegion);
int32 windowId = 0;
if (settings.FindInt32("window id", &windowId) != B_OK)
return false;
fWindow->SetWindowId(windowId);
STRACE_SAT(("\twindow id = %x\n", windowId));
// find id's of stacked windows and do the stacking
type_code typeFound;
int32 countFound;
settings.GetInfo("window id", &typeFound, &countFound);
settings.GetInfo("stacked windows", &typeFound, &countFound);
// if stacked window ids are found, then use them to stack this window
if (typeFound == B_INT32_TYPE && countFound > 0) {
Window* windowToStackUnder = NULL;
// This list contains all window id's that are supposed to be
// stacked with current window but aren't open
BList* persistentIdsToAdd = new BList();
for (int i = 0; i < countFound; i++) {
int32 id;
settings.FindInt32("stacked windows", i, &id);
bool persist = true;
// find a window (W) from the stack with an id from the list.
// if it is not this window itself, then stack it with this window
// UNLESS the W's stacking list doesn't contain this window,
// which implies W's been unstacked while this window was hidden
Window* window = fWindow->Desktop()->FindWindow(id);
if (window && window != fWindow && window->StackedWindowIds()) {
bool idExists = false;
for (int j = 0; !idExists
&& j < window->StackedWindowIds()->CountItems(); j++) {
int32* stackedId = static_cast<int32*>(
window->StackedWindowIds()->ItemAt(j));
idExists = windowId == *stackedId;
}
if (idExists) {
if (!windowToStackUnder) {
//note this will execute only once during loop
windowToStackUnder = window;
}
} else
persist = false;
}
if (persist) {
int32* idRef = static_cast<int32*>(malloc(sizeof(int32)));
*idRef = id;
persistentIdsToAdd->AddItem(idRef);
}
}
if (windowToStackUnder) {
fWindow->StackWindowBefore(windowToStackUnder);
windowToStackUnder->StackAndTile();
} else
fWindow->InitStackedWindowIds();
#ifdef DEBUG_STACK_AND_TILE
for (int i = 0; i < fWindow->StackedWindowIds()->CountItems(); i++) {
int32* stackedId
= static_cast<int32*>(fWindow->StackedWindowIds()->ItemAt(i));
STRACE_SAT(("\tstackedWindowIds[%d]=%x\n", i, *stackedId));
}
#endif
// Add the remaining window id's to the persistent stacking list
// These are the ones that belong to currently unopened windows
for (int i = 0; i < persistentIdsToAdd->CountItems(); i++) {
int32* idRef = static_cast<int32*>(persistentIdsToAdd->ItemAt(i));
bool idExists = false;
for (int j = 0; !idExists
&& j < fWindow->StackedWindowIds()->CountItems(); j++) {
int32* stackedId = static_cast<int32*>(
fWindow->StackedWindowIds()->ItemAt(j));
idExists = *idRef == *stackedId;
}
if (!idExists) {
STRACE_SAT(("\t** window %x isn't open - but stacked\n",
*idRef));
fWindow->StackedWindowIds()->AddItem(idRef);
}
}
}
_SnapWindowFromSettings("snap left2left", SNAP_LEFT, SNAP_LEFT, &settings);
_SnapWindowFromSettings("snap left2right", SNAP_LEFT, SNAP_RIGHT,
&settings);
_SnapWindowFromSettings("snap right2left", SNAP_RIGHT, SNAP_LEFT,
&settings);
_SnapWindowFromSettings("snap right2right", SNAP_RIGHT, SNAP_RIGHT,
&settings);
_SnapWindowFromSettings("snap top2top", SNAP_TOP, SNAP_TOP, &settings);
_SnapWindowFromSettings("snap top2bottom", SNAP_TOP, SNAP_BOTTOM,
&settings);
_SnapWindowFromSettings("snap bottom2top", SNAP_BOTTOM, SNAP_TOP,
&settings);
_SnapWindowFromSettings("snap bottom2bottom", SNAP_BOTTOM, SNAP_BOTTOM,
&settings);
fWindow->StackAndTile();
STRACE_SAT(("Finished DefaultDecorator::SetSettings() on %s\n",
fWindow->Title()));
return true;
}
void
DefaultDecorator::_SnapWindowFromSettings(const char* label,
SnapOrientation thisSnapOrientation, SnapOrientation otherSnapOrientation,
const BMessage* settings)
{
type_code typeFound;
int32 countFound;
settings->GetInfo(label, &typeFound, &countFound);
if (typeFound == B_INT32_TYPE && countFound > 0) {
for (int i = 0; i < countFound; i++) {
int32 id;
settings->FindInt32(label, i, &id);
Window* window = fWindow->Desktop()->FindWindow(id);
if (window == fWindow)
continue;
const char* debugSuffix = "... NOT!";
if (window != NULL) {
// There can be cases where the other window to which this
// window's snapped doesn't contain a reference to this window
// in its snapping list. This would happen when the other window
// was de-snapped while this window was hidden. So only add the
// other window to this window's snapping list when such is not
// the case.
BList* otherList = window->GetSnappingList(otherSnapOrientation,
thisSnapOrientation, false);
if (!otherList) {
debugSuffix = "\n";
continue;
}
for (int i = 0; i < otherList->CountItems(); i++) {
int32* snappedId
= static_cast<int32*>(otherList->ItemAt(i));
if (*snappedId == fWindow->WindowId()) {
fWindow->SnapToWindow(window, thisSnapOrientation,
otherSnapOrientation);
debugSuffix = "";
break;
}
}
} else { //window isn't open - still retain snap id
fWindow->AddToSnappingList(id, thisSnapOrientation,
otherSnapOrientation);
debugSuffix = "... ?";
}
STRACE_SAT(("\t%s[%d]=%x", label, i, id));
STRACE_SAT(("%s\n", debugSuffix));
}
}
return false;
}
bool
DefaultDecorator::GetSettings(BMessage* settings) const
{
STRACE_SAT(("DefaultDecorator::GetSettings() on %s\n", fWindow->Title()));
if (!fTabRect.IsValid()
|| settings->AddRect("tab frame", fTabRect) != B_OK
|| settings->AddFloat("border width", fBorderWidth) != B_OK
|| settings->AddFloat("tab location", (float)fTabOffset) != B_OK
|| settings->AddInt32("window id", fWindow->WindowId()) != B_OK)
if (!fTabRect.IsValid())
return false;
// store id's of stacked windows
if (!_StoreIntsInSettings("stacked windows", fWindow->StackedWindowIds(),
settings))
if (settings->AddRect("tab frame", fTabRect) != B_OK)
return false;
// store id's of snapped windows
if (!_StoreIntsInSettings("snap left2left",
fWindow->Left2LeftSnappingWindowIds(), settings)
|| !_StoreIntsInSettings("snap left2right",
fWindow->Left2RightSnappingWindowIds(), settings)
|| !_StoreIntsInSettings("snap right2right",
fWindow->Right2RightSnappingWindowIds(), settings)
|| !_StoreIntsInSettings("snap right2left",
fWindow->Right2LeftSnappingWindowIds(), settings)
|| !_StoreIntsInSettings("snap top2top",
fWindow->Top2TopSnappingWindowIds(), settings)
|| !_StoreIntsInSettings("snap top2bottom",
fWindow->Top2BottomSnappingWindowIds(), settings)
|| !_StoreIntsInSettings("snap bottom2top",
fWindow->Bottom2TopSnappingWindowIds(), settings)
|| !_StoreIntsInSettings("snap bottom2bottom",
fWindow->Bottom2BottomSnappingWindowIds(), settings))
if (settings->AddFloat("border width", fBorderWidth) != B_OK)
return false;
STRACE_SAT(("Finished DefaultDecorator::GetSettings() on %s\n",
fWindow->Title()));
return true;
}
bool
DefaultDecorator::_StoreIntsInSettings(const char* label,
BList* ids, BMessage* settings) const
{
if (ids != NULL) {
for (int i = 0; i < ids->CountItems(); i++) {
int32* id = static_cast<int32*>(ids->ItemAt(i));
if (settings->AddInt32(label, *id) != B_OK)
return false;
STRACE_SAT(("\t%s[%d]=%x\n", label, i, *id));
}
}
return true;
return settings->AddFloat("tab location", (float)fTabOffset) == B_OK;
}
@@ -1604,47 +1372,3 @@ DefaultDecorator::_GetBitmapForButton(int32 item, bool down, bool focus,
sBitmapList = entry;
return bitmap;
}
void
DefaultDecorator::HighlightTab(bool active, BRegion* dirty)
{
if (active)
fTabColor = fHighlightTabColor;
else if (IsFocus())
fTabColor = fFocusTabColor;
else
fTabColor = fNonFocusTabColor;
dirty->Include(fTabRect);
fTabHighlighted = active;
}
void
DefaultDecorator::HighlightBorders(bool active, BRegion* dirty)
{
if (active) {
memcpy(fFrameColors, fHighlightFrameColors, sizeof(fFrameColors));
} else if (IsFocus()) {
fFrameColors[0] = fNonHighlightFrameColors[0];
fFrameColors[1] = fNonHighlightFrameColors[1];
fFrameColors[2] = fFocusFrameColors[0];
fFrameColors[3] = fFocusFrameColors[1];
fFrameColors[4] = fNonHighlightFrameColors[2];
fFrameColors[5] = fNonHighlightFrameColors[3];
} else {
fFrameColors[0] = fNonHighlightFrameColors[0];
fFrameColors[1] = fNonHighlightFrameColors[1];
fFrameColors[2] = fNonFocusFrameColors[0];
fFrameColors[3] = fNonFocusFrameColors[1];
fFrameColors[4] = fNonHighlightFrameColors[2];
fFrameColors[5] = fNonHighlightFrameColors[3];
}
dirty->Include(fLeftBorder);
dirty->Include(fRightBorder);
dirty->Include(fTopBorder);
dirty->Include(fBottomBorder);
dirty->Include(fResizeRect);
fBordersHighlighted = active;
}
+2 -20
View File
@@ -10,17 +10,14 @@
#define DEFAULT_DECORATOR_H
#include "Decorator.h"
#include "Desktop.h"
#include "Window.h"
#include <Region.h>
#include "Decorator.h"
class Desktop;
class ServerBitmap;
class DefaultDecorator: public Decorator {
public:
DefaultDecorator(DesktopSettings& settings,
@@ -61,9 +58,6 @@ public:
virtual click_type Clicked(BPoint pt, int32 buttons,
int32 modifiers);
virtual void HighlightTab(bool active, BRegion* dirty);
virtual void HighlightBorders(bool active, BRegion* dirty);
protected:
virtual void _DoLayout();
@@ -93,21 +87,11 @@ private:
bool focus, int32 width, int32 height,
DefaultDecorator* object);
// Stack & Tile specific private methods
bool _StoreIntsInSettings(const char* label,
BList* ids, BMessage* settings) const;
void _SnapWindowFromSettings(const char* label,
SnapOrientation thisSnapOrientation,
SnapOrientation otherSnapOrientation,
const BMessage* settings);
private:
rgb_color fButtonHighColor;
rgb_color fButtonLowColor;
rgb_color fTabColor;
rgb_color fFocusTabColor;
rgb_color fNonFocusTabColor;
rgb_color fHighlightTabColor;
rgb_color fTextColor;
rgb_color fFocusTextColor;
rgb_color fNonFocusTextColor;
@@ -119,8 +103,6 @@ private:
rgb_color fFrameColors[6];
rgb_color fFocusFrameColors[2];
rgb_color fNonFocusFrameColors[2];
rgb_color fNonHighlightFrameColors[4];
rgb_color fHighlightFrameColors[6];
bool fButtonFocus;
ServerBitmap* fCloseBitmaps[4];
+2 -173
View File
@@ -66,7 +66,6 @@
# define AutoWriteLocker BAutolock
#endif
class KeyboardFilter : public EventFilter {
public:
KeyboardFilter(Desktop* desktop);
@@ -187,30 +186,6 @@ KeyboardFilter::Filter(BMessage* message, EventTarget** _target,
fDesktop->SetWorkspaceAsync(-1);
return B_SKIP_MESSAGE;
}
// switch between stacked windows
if ((modifiers & B_OPTION_KEY) != 0) {
BList* stackedWindows = fDesktop->FocusWindow()->StackedWindows();
if (key == 0x61 && stackedWindows) {
// option key + cursor left
int32 oldIndex
= stackedWindows->IndexOf(fDesktop->FocusWindow());
int32 newIndex = (oldIndex - 1 >= 0)
? oldIndex - 1 : stackedWindows->CountItems() - 1;
fDesktop->ActivateWindow(
static_cast<Window*>(stackedWindows->ItemAt(newIndex)));
return B_SKIP_MESSAGE;
} else if (key == 0x63 && stackedWindows) {
// option key + cursor right
int32 oldIndex
= stackedWindows->IndexOf(fDesktop->FocusWindow());
int32 newIndex = (oldIndex + 1 < stackedWindows->CountItems())
? oldIndex + 1 : 0;
fDesktop->ActivateWindow(
static_cast<Window*>(stackedWindows->ItemAt(newIndex)));
return B_SKIP_MESSAGE;
}
}
}
if (message->what == B_KEY_DOWN
@@ -219,15 +194,6 @@ KeyboardFilter::Filter(BMessage* message, EventTarget** _target,
|| message->what == B_INPUT_METHOD_EVENT)
_UpdateFocus(key, modifiers, _target);
// switch to and from stacking and snapping mode
if (message->what == B_MODIFIERS_CHANGED
&& message->FindInt32("modifiers", &modifiers) == B_OK) {
// disable highlights if the stacking and snapping mode was just left
if (fDesktop->fIsStackingAndSnapping && !(modifiers & B_OPTION_KEY))
fDesktop->FinishStackingAndSnapping();
fDesktop->fIsStackingAndSnapping = (modifiers & B_OPTION_KEY) != 0;
}
return B_DISPATCH_MESSAGE;
}
@@ -339,9 +305,6 @@ Desktop::Desktop(uid_t userID, const char* targetScreen)
:
MessageLooper("desktop"),
fIsStackingAndSnapping(false),
fStackAndTileSpec(new LinearSpec()),
fUserID(userID),
fTargetScreen(strdup(targetScreen)),
fSettings(NULL),
@@ -385,7 +348,6 @@ Desktop::Desktop(uid_t userID, const char* targetScreen)
Desktop::~Desktop()
{
delete fStackAndTileSpec;
delete fSettings;
delete_area(fSharedReadOnlyArea);
@@ -975,7 +937,7 @@ Desktop::ActivateWindow(Window* window)
ShowWindow(window);
}
if (window == FrontWindow() && !window->ForceActivate()) {
if (window == FrontWindow()) {
// see if there is a normal B_AVOID_FRONT window still in front of us
Window* avoidsFront = window->NextWindow(fCurrentWorkspace);
while (avoidsFront && avoidsFront->IsNormal()
@@ -999,56 +961,6 @@ Desktop::ActivateWindow(Window* window)
Window* frontmost = window->Frontmost();
BList* stackedAndTiledWindows = new BList();
// Prepare to move tiled windows to the front as well
_AddWindowsByIdsToList(window->Left2LeftSnappingWindowIds(),
stackedAndTiledWindows);
_AddWindowsByIdsToList(window->Left2RightSnappingWindowIds(),
stackedAndTiledWindows);
_AddWindowsByIdsToList(window->Right2RightSnappingWindowIds(),
stackedAndTiledWindows);
_AddWindowsByIdsToList(window->Right2LeftSnappingWindowIds(),
stackedAndTiledWindows);
_AddWindowsByIdsToList(window->Top2TopSnappingWindowIds(),
stackedAndTiledWindows);
_AddWindowsByIdsToList(window->Top2BottomSnappingWindowIds(),
stackedAndTiledWindows);
_AddWindowsByIdsToList(window->Bottom2TopSnappingWindowIds(),
stackedAndTiledWindows);
_AddWindowsByIdsToList(window->Bottom2BottomSnappingWindowIds(),
stackedAndTiledWindows);
bool forceDirty = false;
// And then prepare to move stacked windows to the front
BList* stackedWindows = window->StackedWindows();
if (stackedWindows != NULL) {
for (int i = 0; i < stackedWindows->CountItems(); i++) {
Window* stackedWindow
= static_cast<Window*>(stackedWindows->ItemAt(i));
if (stackedWindow != window
&& !stackedAndTiledWindows->HasItem(stackedWindow)) {
stackedAndTiledWindows->AddItem(stackedWindow);
// Basically if there are any stacked windows associated with
// this window, then designate this window as "dirty" so it is
// forced to repaint
forceDirty = true;
}
}
}
// Do the actual moving here
for (int i = 0; i < stackedAndTiledWindows->CountItems(); i ++) {
Window* window
= static_cast<Window*>(stackedAndTiledWindows->ItemAt(i));
_CurrentWindows().RemoveWindow(window);
windows.AddWindow(window);
}
delete stackedAndTiledWindows;
_CurrentWindows().RemoveWindow(window);
windows.AddWindow(window);
@@ -1072,30 +984,13 @@ Desktop::ActivateWindow(Window* window)
}
}
_BringWindowsToFront(windows, kWorkingList, !forceDirty);
_BringWindowsToFront(windows, kWorkingList, true);
if ((window->Flags() & B_AVOID_FOCUS) == 0)
SetFocusWindow(window);
}
bool
Desktop::_AddWindowsByIdsToList(BList* windowIdsToAdd, BList* windows)
{
if (!windowIdsToAdd || !windows)
return false;
bool added = false;
for (int i = 0; i < windowIdsToAdd->CountItems(); i++) {
int32* id = static_cast<int32*>(windowIdsToAdd->ItemAt(i));
Window* windowToAdd = FindWindow(*id);
if (windowToAdd && !windows->HasItem(windowToAdd))
windows->AddItem(windowToAdd);
}
return added;
}
void
Desktop::SendWindowBehind(Window* window, Window* behindOf)
{
@@ -3362,69 +3257,3 @@ Desktop::_SetWorkspace(int32 index)
if (previousColor != fWorkspaces[fCurrentWorkspace].Color())
RedrawBackground();
}
WindowList&
Desktop::GetWindows()
{
return _CurrentWindows();
}
bool
Desktop::HighlightTab(Window* window, bool active)
{
AutoWriteLocker _(fWindowLock);
if (window->IsTabHighlighted() == active)
return false;
BRegion dirty;
bool changed = window->HighlightTab(active, dirty);
if (changed)
_RebuildAndRedrawAfterWindowChange(window, dirty);
return changed;
}
bool
Desktop::HighlightBorders(Window* window, bool active)
{
AutoWriteLocker _(fWindowLock);
if (window->IsBordersHighlighted() == active)
return false;
BRegion dirty;
bool changed = window->HighlightBorders(active, dirty);
if (changed)
_RebuildAndRedrawAfterWindowChange(window, dirty);
return changed;
}
void
Desktop::FinishStackingAndSnapping()
{
for (Window* window = _CurrentWindows().LastWindow(); window != NULL;
window = window->PreviousWindow(fCurrentWorkspace)) {
HighlightTab(window, false);
HighlightBorders(window, false);
window->FinishStackingAndSnapping();
}
fIsStackingAndSnapping = false;
}
Window*
Desktop::FindWindow(int32 windowId)
{
for (Window* window = _CurrentWindows().LastWindow(); window != NULL;
window = window->PreviousWindow(fCurrentWorkspace)) {
if (window->WindowId() == windowId)
return window;
}
return NULL;
}
-14
View File
@@ -34,8 +34,6 @@
#include <Region.h>
#include <Window.h>
#include "LinearSpec.h"
#define USE_MULTI_LOCKER 1
@@ -243,15 +241,6 @@ public:
void WriteWindowOrder(int32 workspace,
BPrivate::LinkSender& sender);
WindowList& GetWindows();
bool HighlightTab(Window* window, bool active);
bool HighlightBorders(Window* window, bool active);
void FinishStackingAndSnapping();
Window* FindWindow(int32 windowId);
bool fIsStackingAndSnapping;
LinearSpec* fStackAndTileSpec;
private:
void _LaunchInputServer();
void _GetLooperName(char* name, size_t size);
@@ -305,9 +294,6 @@ private:
void _SetCurrentWorkspaceConfiguration();
void _SetWorkspace(int32 index);
bool _AddWindowsByIdsToList(BList* windowIdsToAdd,
BList* windows);
private:
friend class DesktopSettings;
friend class LockedDesktopSettings;
+1 -2
View File
@@ -1,6 +1,6 @@
SubDir HAIKU_TOP src servers app ;
UseLibraryHeaders agg lp_solve linprog ;
UseLibraryHeaders agg ;
UsePrivateHeaders app graphics input interface kernel shared storage ;
UseHeaders [ FDirName $(HAIKU_TOP) src servers app drawing ] ;
@@ -66,7 +66,6 @@ Server app_server :
libtranslation.so libbe.so libbnetapi.so
libasdrawing.a libasremote.a libpainter.a libagg.a libfreetype.so
libtextencoding.so libshared.a $(TARGET_LIBSTDC++)
liblpsolve55.so liblinprog.so
: app_server.rdef
;
-8
View File
@@ -895,10 +895,6 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
fDesktop->ResizeWindowBy(fWindow,
xResizeTo - fWindow->Frame().Width(),
yResizeTo - fWindow->Frame().Height());
// Re-apply stack & tile constraints so that any other windows
// that are stacked/snapped against this window can be
// re-adjusted
fWindow->StackAndTile();
fLink.StartMessage(B_OK);
// }
fLink.Flush();
@@ -923,10 +919,6 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
} else {
fDesktop->MoveWindowBy(fWindow, xMoveTo - fWindow->Frame().left,
yMoveTo - fWindow->Frame().top);
// Re-apply stack & tile constraints so that any other windows
// that are stacked/snapped against this window can be
// re-adjusted
fWindow->StackAndTile();
fLink.StartMessage(B_OK);
}
fLink.Flush();
File diff suppressed because it is too large Load Diff
+1 -135
View File
@@ -23,8 +23,6 @@
#include <Region.h>
#include <String.h>
#include "LinearSpec.h"
namespace BPrivate {
class PortLink;
};
@@ -45,11 +43,6 @@ enum {
UPDATE_EXPOSE = 0x02,
};
// Used for Stack & Tile
enum SnapOrientation {
SNAP_LEFT, SNAP_RIGHT, SNAP_TOP, SNAP_BOTTOM
};
class Window {
public:
@@ -192,7 +185,7 @@ public:
float TabLocation() const;
bool SetDecoratorSettings(const BMessage& settings,
BRegion& dirty);
BRegion& dirty);
bool GetDecoratorSettings(BMessage* settings);
void HighlightDecorator(bool active);
@@ -251,59 +244,6 @@ public:
static uint32 ValidWindowFlags();
static uint32 ValidWindowFlags(window_feel feel);
bool HighlightTab(bool active, BRegion& dirty);
bool HighlightBorders(bool active, BRegion& dirty);
bool IsTabHighlighted();
bool IsBordersHighlighted();
void StackAndTile();
void StackWindowBefore(Window* window);
void FinishStackingAndSnapping();
BList* StackedWindows() const
{ return fStackedWindows; }
int32 WindowId();
void SetWindowId(int32 windowId);
BList* StackedWindowIds() const
{ return fStackedWindowIds; }
void InitStackedWindowIds();
Constraint* SnapToWindow(Window* otherWindow,
SnapOrientation thisSnap,
SnapOrientation otherSnap);
void AddToSnappingList(int32 windowId,
SnapOrientation thisSnapOrientation,
SnapOrientation otherSnapOrientation);
void AddToSnappingList(Window* window,
SnapOrientation thisSnapOrientation,
SnapOrientation otherSnapOrientation);
void RemoveFromSnappingList(int32 windowId,
SnapOrientation thisSnapOrientation,
SnapOrientation otherSnapOrientation);
BList* GetSnappingList(
SnapOrientation thisSnapOrientation,
SnapOrientation otherSnapOrientation,
bool createIfNull);
BList* Left2LeftSnappingWindowIds() const
{ return fLeft2LeftSnappingWindowIds; }
BList* Left2RightSnappingWindowIds() const
{ return fLeft2RightSnappingWindowIds; }
BList* Right2RightSnappingWindowIds() const
{ return fRight2RightSnappingWindowIds; }
BList* Right2LeftSnappingWindowIds() const
{ return fRight2LeftSnappingWindowIds; }
BList* Top2TopSnappingWindowIds() const
{ return fTop2TopSnappingWindowIds; }
BList* Top2BottomSnappingWindowIds() const
{ return fTop2BottomSnappingWindowIds; }
BList* Bottom2BottomSnappingWindowIds() const
{ return fBottom2BottomSnappingWindowIds; }
BList* Bottom2TopSnappingWindowIds() const
{ return fBottom2TopSnappingWindowIds; }
bool ForceActivate() { return fForceActivate; }
protected:
void _ShiftPartOfRegion(BRegion* region,
BRegion* regionToShift, int32 xOffset,
@@ -334,39 +274,6 @@ protected:
void _AlterDeltaForSnap(BPoint& delta,
bigtime_t now);
// Stack & Tile specific members
void _InitStackingAndSnapping();
void _RemoveStackingAndSnapping();
void _CheckIfReadyToStack();
void _StackWindow();
void _ArrangeStackedWindowTabs();
void _CheckIfReadyToSnap();
void _SnapWindow();
BRect _BoundingRectAndWindows(BList* windows,
Window** leftmostWindow,
Window** topmostWindow,
Window** rightmostWindow,
Window** bottommostWindow);
void _BoundWindowByWorkspace();
void _UnboundWindowByWorkspace();
void _RemoveStackingPersistently();
void _RemoveSnappingPersistently();
void _FreeUpSnappingList(SnapOrientation thisSnap,
SnapOrientation otherSnap,
bool deleteFromOtherWindowsList);
BList** _GetSnappingListRef(
SnapOrientation thisSnapOrientation,
SnapOrientation otherSnapOrientation,
bool createIfNull);
void _EnsureWindowWithinScreenBounds(Window* window, Window* detached);
protected:
BString fTitle;
// TODO: no fp rects anywhere
BRect fFrame;
@@ -486,47 +393,6 @@ protected:
int32 fMaxHeight;
int32 fWorkspacesViewCount;
// Stack & Tile specific members
Variable* fLeftVar;
Variable* fTopVar;
Variable* fRightVar;
Variable* fBottomVar;
Constraint* fLeftConstraint;
Constraint* fTopConstraint;
Constraint* fMinWidthConstraint;
Constraint* fMinHeightConstraint;
Constraint* fWidthConstraint;
Constraint* fHeightConstraint;
BList* fLeftAdjacentWindows;
BList* fTopAdjacentWindows;
BList* fRightAdjacentWindows;
BList* fBottomAdjacentWindows;
BList* fSnappingConstraints;
BList* fLeft2LeftSnappingWindowIds;
BList* fLeft2RightSnappingWindowIds;
BList* fRight2RightSnappingWindowIds;
BList* fRight2LeftSnappingWindowIds;
BList* fTop2TopSnappingWindowIds;
BList* fTop2BottomSnappingWindowIds;
BList* fBottom2BottomSnappingWindowIds;
BList* fBottom2TopSnappingWindowIds;
//True means activate this window even if it's already at the front
bool fForceActivate;
Window* fWindowUnder;
BList* fStackedWindows;
BList* fPrevStackedWindows;
Constraint* fLeftStackingConstraint;
Constraint* fTopStackingConstraint;
Constraint* fRightStackingConstraint;
Constraint* fBottomStackingConstraint;
int32 fId;
BList* fStackedWindowIds;
};
#endif // WINDOW_H
+2 -5
View File
@@ -135,7 +135,8 @@ WorkspacesView::_WorkspaceAt(BPoint where, int32& index)
BRect
WorkspacesView::_WindowFrame(const BRect& workspaceFrame,
const BRect& screenFrame, const BRect& windowFrame, BPoint windowPosition)
const BRect& screenFrame, const BRect& windowFrame,
BPoint windowPosition)
{
BRect frame = windowFrame;
frame.OffsetTo(windowPosition);
@@ -567,10 +568,6 @@ WorkspacesView::MouseMoved(BMessage* message, BPoint where)
if (fHasMoved) {
Window()->Desktop()->MoveWindowBy(fSelectedWindow, left - leftTop.x,
top - leftTop.y, fSelectedWorkspace);
// TODO: Re-apply stack & tile constraints so that any other windows
// that are stacked/snapped against this window can be re-adjusted.
// Must smartly call stack and tile after workspace shifting has
// finalised. How?
}
}