* Fixed millions of coding style violations introduced by the stack & tile
patch. Grmbl. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33824 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
8cd9a52477
commit
23e00a25e2
@ -45,7 +45,6 @@ enum click_type {
|
|||||||
CLICK_RESIZE_RB
|
CLICK_RESIZE_RB
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "Window.h"
|
|
||||||
|
|
||||||
class Decorator {
|
class Decorator {
|
||||||
public:
|
public:
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2008, Haiku.
|
* Copyright 2001-2009, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@ -8,6 +8,7 @@
|
|||||||
* Philippe Saint-Pierre, stpere@gmail.com
|
* Philippe Saint-Pierre, stpere@gmail.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/*! Default and fallback decorator for the app_server - the yellow tabs */
|
/*! Default and fallback decorator for the app_server - the yellow tabs */
|
||||||
|
|
||||||
|
|
||||||
@ -458,8 +459,8 @@ DefaultDecorator::SetSettings(const BMessage& settings, BRegion* updateRegion)
|
|||||||
if (typeFound == B_INT32_TYPE && countFound > 0) {
|
if (typeFound == B_INT32_TYPE && countFound > 0) {
|
||||||
Window* windowToStackUnder = NULL;
|
Window* windowToStackUnder = NULL;
|
||||||
|
|
||||||
//This list contains all window id's that are supposed to be
|
// This list contains all window id's that are supposed to be
|
||||||
//stacked with current window but aren't open
|
// stacked with current window but aren't open
|
||||||
BList* persistentIdsToAdd = new BList();
|
BList* persistentIdsToAdd = new BList();
|
||||||
|
|
||||||
for (int i = 0; i < countFound; i++) {
|
for (int i = 0; i < countFound; i++) {
|
||||||
@ -475,21 +476,20 @@ DefaultDecorator::SetSettings(const BMessage& settings, BRegion* updateRegion)
|
|||||||
Window* window = fWindow->Desktop()->FindWindow(id);
|
Window* window = fWindow->Desktop()->FindWindow(id);
|
||||||
if (window && window != fWindow && window->StackedWindowIds()) {
|
if (window && window != fWindow && window->StackedWindowIds()) {
|
||||||
bool idExists = false;
|
bool idExists = false;
|
||||||
for (int j = 0; !idExists &&
|
for (int j = 0; !idExists
|
||||||
j < window->StackedWindowIds()->CountItems(); j++) {
|
&& j < window->StackedWindowIds()->CountItems(); j++) {
|
||||||
int32* stackedId =
|
int32* stackedId = static_cast<int32*>(
|
||||||
static_cast<int32*>(window->StackedWindowIds()->ItemAt(j));
|
window->StackedWindowIds()->ItemAt(j));
|
||||||
idExists = windowId == *stackedId;
|
idExists = windowId == *stackedId;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (idExists) {
|
if (idExists) {
|
||||||
if (!windowToStackUnder) {
|
if (!windowToStackUnder) {
|
||||||
//note this will execute only once during loop
|
//note this will execute only once during loop
|
||||||
windowToStackUnder = window;
|
windowToStackUnder = window;
|
||||||
}
|
}
|
||||||
}
|
} else
|
||||||
else {
|
|
||||||
persist = false;
|
persist = false;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (persist) {
|
if (persist) {
|
||||||
@ -502,39 +502,37 @@ DefaultDecorator::SetSettings(const BMessage& settings, BRegion* updateRegion)
|
|||||||
if (windowToStackUnder) {
|
if (windowToStackUnder) {
|
||||||
fWindow->StackWindowBefore(windowToStackUnder);
|
fWindow->StackWindowBefore(windowToStackUnder);
|
||||||
windowToStackUnder->StackAndTile();
|
windowToStackUnder->StackAndTile();
|
||||||
}
|
} else
|
||||||
else {
|
|
||||||
fWindow->InitStackedWindowIds();
|
fWindow->InitStackedWindowIds();
|
||||||
}
|
|
||||||
|
|
||||||
|
#ifdef DEBUG_STACK_AND_TILE
|
||||||
for (int i = 0; i < fWindow->StackedWindowIds()->CountItems(); i++) {
|
for (int i = 0; i < fWindow->StackedWindowIds()->CountItems(); i++) {
|
||||||
int32* stackedId =
|
int32* stackedId
|
||||||
static_cast<int32*>(fWindow->StackedWindowIds()->ItemAt(i));
|
= static_cast<int32*>(fWindow->StackedWindowIds()->ItemAt(i));
|
||||||
STRACE_SAT(("\tstackedWindowIds[%d]=%x\n", i, *stackedId));
|
STRACE_SAT(("\tstackedWindowIds[%d]=%x\n", i, *stackedId));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//Add the remaining window id's to the persistent stacking list
|
// Add the remaining window id's to the persistent stacking list
|
||||||
//These are the ones that belong to currently unopened windows
|
// These are the ones that belong to currently unopened windows
|
||||||
for (int i = 0; i < persistentIdsToAdd->CountItems(); i++) {
|
for (int i = 0; i < persistentIdsToAdd->CountItems(); i++) {
|
||||||
int32* idRef =
|
int32* idRef = static_cast<int32*>(persistentIdsToAdd->ItemAt(i));
|
||||||
static_cast<int32*>(persistentIdsToAdd->ItemAt(i));
|
|
||||||
bool idExists = false;
|
bool idExists = false;
|
||||||
for (int j = 0; !idExists &&
|
for (int j = 0; !idExists
|
||||||
j < fWindow->StackedWindowIds()->CountItems(); j++) {
|
&& j < fWindow->StackedWindowIds()->CountItems(); j++) {
|
||||||
int32* stackedId =
|
int32* stackedId = static_cast<int32*>(
|
||||||
static_cast<int32*>(fWindow->StackedWindowIds()->ItemAt(j));
|
fWindow->StackedWindowIds()->ItemAt(j));
|
||||||
idExists = *idRef == *stackedId;
|
idExists = *idRef == *stackedId;
|
||||||
}
|
}
|
||||||
if (!idExists) {
|
if (!idExists) {
|
||||||
STRACE_SAT(("\t** window %x isn't open - but stacked\n",
|
STRACE_SAT(("\t** window %x isn't open - but stacked\n",
|
||||||
*idRef));
|
*idRef));
|
||||||
fWindow->StackedWindowIds()->AddItem(idRef);
|
fWindow->StackedWindowIds()->AddItem(idRef);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_SnapWindowFromSettings("snap left2left", SNAP_LEFT, SNAP_LEFT,
|
_SnapWindowFromSettings("snap left2left", SNAP_LEFT, SNAP_LEFT, &settings);
|
||||||
&settings);
|
|
||||||
_SnapWindowFromSettings("snap left2right", SNAP_LEFT, SNAP_RIGHT,
|
_SnapWindowFromSettings("snap left2right", SNAP_LEFT, SNAP_RIGHT,
|
||||||
&settings);
|
&settings);
|
||||||
_SnapWindowFromSettings("snap right2left", SNAP_RIGHT, SNAP_LEFT,
|
_SnapWindowFromSettings("snap right2left", SNAP_RIGHT, SNAP_LEFT,
|
||||||
@ -559,9 +557,8 @@ DefaultDecorator::SetSettings(const BMessage& settings, BRegion* updateRegion)
|
|||||||
|
|
||||||
void
|
void
|
||||||
DefaultDecorator::_SnapWindowFromSettings(const char* label,
|
DefaultDecorator::_SnapWindowFromSettings(const char* label,
|
||||||
SnapOrientation thisSnapOrientation,
|
SnapOrientation thisSnapOrientation, SnapOrientation otherSnapOrientation,
|
||||||
SnapOrientation otherSnapOrientation,
|
const BMessage* settings)
|
||||||
const BMessage* settings)
|
|
||||||
{
|
{
|
||||||
type_code typeFound;
|
type_code typeFound;
|
||||||
int32 countFound;
|
int32 countFound;
|
||||||
@ -572,43 +569,43 @@ DefaultDecorator::_SnapWindowFromSettings(const char* label,
|
|||||||
settings->FindInt32(label, i, &id);
|
settings->FindInt32(label, i, &id);
|
||||||
|
|
||||||
Window* window = fWindow->Desktop()->FindWindow(id);
|
Window* window = fWindow->Desktop()->FindWindow(id);
|
||||||
if (window == fWindow) {
|
if (window == fWindow)
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
char* debug_suffix = "... NOT!";
|
char* debugSuffix = "... NOT!";
|
||||||
|
|
||||||
if (window) {
|
if (window != NULL) {
|
||||||
//There can be cases where the other window to which this
|
// There can be cases where the other window to which this
|
||||||
//window's snapped doesn't contain a reference to this window
|
// window's snapped doesn't contain a reference to this window
|
||||||
//in its snapping list. This would happen when the other window
|
// in its snapping list. This would happen when the other window
|
||||||
//was de-snapped while this window was hidden. So only add the
|
// was de-snapped while this window was hidden. So only add the
|
||||||
//other window to this window's snapping list when such is not
|
// other window to this window's snapping list when such is not
|
||||||
//the case.
|
// the case.
|
||||||
BList* otherList = window->GetSnappingList(otherSnapOrientation,
|
BList* otherList = window->GetSnappingList(otherSnapOrientation,
|
||||||
thisSnapOrientation, false);
|
thisSnapOrientation, false);
|
||||||
if (!otherList) {
|
if (!otherList) {
|
||||||
debug_suffix = "\n";
|
debugSuffix = "\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < otherList->CountItems(); i++) {
|
for (int i = 0; i < otherList->CountItems(); i++) {
|
||||||
int32* snappedId = static_cast<int32*>(otherList->ItemAt(i));
|
int32* snappedId
|
||||||
|
= static_cast<int32*>(otherList->ItemAt(i));
|
||||||
if (*snappedId == fWindow->WindowId()) {
|
if (*snappedId == fWindow->WindowId()) {
|
||||||
fWindow->SnapToWindow(window, thisSnapOrientation,
|
fWindow->SnapToWindow(window, thisSnapOrientation,
|
||||||
otherSnapOrientation);
|
otherSnapOrientation);
|
||||||
debug_suffix = "";
|
debugSuffix = "";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else { //window isn't open - still retain snap id
|
||||||
else { //window isn't open - still retain snap id
|
|
||||||
fWindow->AddToSnappingList(id, thisSnapOrientation,
|
fWindow->AddToSnappingList(id, thisSnapOrientation,
|
||||||
otherSnapOrientation);
|
otherSnapOrientation);
|
||||||
debug_suffix = "... ?";
|
debugSuffix = "... ?";
|
||||||
}
|
}
|
||||||
|
|
||||||
STRACE_SAT(("\t%s[%d]=%x", label, i, id));
|
STRACE_SAT(("\t%s[%d]=%x", label, i, id));
|
||||||
STRACE_SAT(("%s\n", debug_suffix));
|
STRACE_SAT(("%s\n", debugSuffix));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -619,19 +616,11 @@ DefaultDecorator::GetSettings(BMessage* settings) const
|
|||||||
{
|
{
|
||||||
STRACE_SAT(("DefaultDecorator::GetSettings() on %s\n", fWindow->Title()));
|
STRACE_SAT(("DefaultDecorator::GetSettings() on %s\n", fWindow->Title()));
|
||||||
|
|
||||||
if (!fTabRect.IsValid())
|
if (!fTabRect.IsValid()
|
||||||
return false;
|
|| settings->AddRect("tab frame", fTabRect) != B_OK
|
||||||
|
|| settings->AddFloat("border width", fBorderWidth) != B_OK
|
||||||
if (settings->AddRect("tab frame", fTabRect) != B_OK)
|
|| settings->AddFloat("tab location", (float)fTabOffset) != B_OK
|
||||||
return false;
|
|| settings->AddInt32("window id", fWindow->WindowId()) != B_OK)
|
||||||
|
|
||||||
if (settings->AddFloat("border width", fBorderWidth) != B_OK)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (settings->AddFloat("tab location", (float)fTabOffset) != B_OK)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (settings->AddInt32("window id", fWindow->WindowId()) != B_OK)
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// store id's of stacked windows
|
// store id's of stacked windows
|
||||||
@ -641,27 +630,20 @@ DefaultDecorator::GetSettings(BMessage* settings) const
|
|||||||
|
|
||||||
// store id's of snapped windows
|
// store id's of snapped windows
|
||||||
if (!_StoreIntsInSettings("snap left2left",
|
if (!_StoreIntsInSettings("snap left2left",
|
||||||
fWindow->Left2LeftSnappingWindowIds(), settings))
|
fWindow->Left2LeftSnappingWindowIds(), settings)
|
||||||
return false;
|
|| !_StoreIntsInSettings("snap left2right",
|
||||||
if (!_StoreIntsInSettings("snap left2right",
|
fWindow->Left2RightSnappingWindowIds(), settings)
|
||||||
fWindow->Left2RightSnappingWindowIds(), settings))
|
|| !_StoreIntsInSettings("snap right2right",
|
||||||
return false;
|
fWindow->Right2RightSnappingWindowIds(), settings)
|
||||||
if (!_StoreIntsInSettings("snap right2right",
|
|| !_StoreIntsInSettings("snap right2left",
|
||||||
fWindow->Right2RightSnappingWindowIds(), settings))
|
fWindow->Right2LeftSnappingWindowIds(), settings)
|
||||||
return false;
|
|| !_StoreIntsInSettings("snap top2top",
|
||||||
if (!_StoreIntsInSettings("snap right2left",
|
fWindow->Top2TopSnappingWindowIds(), settings)
|
||||||
fWindow->Right2LeftSnappingWindowIds(), settings))
|
|| !_StoreIntsInSettings("snap top2bottom",
|
||||||
return false;
|
fWindow->Top2BottomSnappingWindowIds(), settings)
|
||||||
if (!_StoreIntsInSettings("snap top2top",
|
|| !_StoreIntsInSettings("snap bottom2top",
|
||||||
fWindow->Top2TopSnappingWindowIds(), settings))
|
fWindow->Bottom2TopSnappingWindowIds(), settings)
|
||||||
return false;
|
|| !_StoreIntsInSettings("snap bottom2bottom",
|
||||||
if (!_StoreIntsInSettings("snap top2bottom",
|
|
||||||
fWindow->Top2BottomSnappingWindowIds(), settings))
|
|
||||||
return false;
|
|
||||||
if (!_StoreIntsInSettings("snap bottom2top",
|
|
||||||
fWindow->Bottom2TopSnappingWindowIds(), settings))
|
|
||||||
return false;
|
|
||||||
if (!_StoreIntsInSettings("snap bottom2bottom",
|
|
||||||
fWindow->Bottom2BottomSnappingWindowIds(), settings))
|
fWindow->Bottom2BottomSnappingWindowIds(), settings))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -675,7 +657,7 @@ bool
|
|||||||
DefaultDecorator::_StoreIntsInSettings(const char* label,
|
DefaultDecorator::_StoreIntsInSettings(const char* label,
|
||||||
BList* ids, BMessage* settings) const
|
BList* ids, BMessage* settings) const
|
||||||
{
|
{
|
||||||
if (ids) {
|
if (ids != NULL) {
|
||||||
for (int i = 0; i < ids->CountItems(); i++) {
|
for (int i = 0; i < ids->CountItems(); i++) {
|
||||||
int32* id = static_cast<int32*>(ids->ItemAt(i));
|
int32* id = static_cast<int32*>(ids->ItemAt(i));
|
||||||
if (settings->AddInt32(label, *id) != B_OK)
|
if (settings->AddInt32(label, *id) != B_OK)
|
||||||
@ -689,6 +671,7 @@ DefaultDecorator::_StoreIntsInSettings(const char* label,
|
|||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DefaultDecorator::Draw(BRect update)
|
DefaultDecorator::Draw(BRect update)
|
||||||
{
|
{
|
||||||
@ -1632,6 +1615,7 @@ DefaultDecorator::HighlightTab(bool active, BRegion* dirty)
|
|||||||
fTabColor = fFocusTabColor;
|
fTabColor = fFocusTabColor;
|
||||||
else
|
else
|
||||||
fTabColor = fNonFocusTabColor;
|
fTabColor = fNonFocusTabColor;
|
||||||
|
|
||||||
dirty->Include(fTabRect);
|
dirty->Include(fTabRect);
|
||||||
fTabHighlighted = active;
|
fTabHighlighted = active;
|
||||||
}
|
}
|
||||||
@ -1641,12 +1625,7 @@ void
|
|||||||
DefaultDecorator::HighlightBorders(bool active, BRegion* dirty)
|
DefaultDecorator::HighlightBorders(bool active, BRegion* dirty)
|
||||||
{
|
{
|
||||||
if (active) {
|
if (active) {
|
||||||
fFrameColors[0] = fHighlightFrameColors[0];
|
fFrameColors = fHighlightFrameColors;
|
||||||
fFrameColors[1] = fHighlightFrameColors[1];
|
|
||||||
fFrameColors[2] = fHighlightFrameColors[2];
|
|
||||||
fFrameColors[3] = fHighlightFrameColors[3];
|
|
||||||
fFrameColors[4] = fHighlightFrameColors[4];
|
|
||||||
fFrameColors[5] = fHighlightFrameColors[5];
|
|
||||||
} else if (IsFocus()) {
|
} else if (IsFocus()) {
|
||||||
fFrameColors[0] = fNonHighlightFrameColors[0];
|
fFrameColors[0] = fNonHighlightFrameColors[0];
|
||||||
fFrameColors[1] = fNonHighlightFrameColors[1];
|
fFrameColors[1] = fNonHighlightFrameColors[1];
|
||||||
|
@ -12,11 +12,15 @@
|
|||||||
|
|
||||||
#include "Decorator.h"
|
#include "Decorator.h"
|
||||||
#include "Desktop.h"
|
#include "Desktop.h"
|
||||||
|
#include "Window.h"
|
||||||
|
|
||||||
#include <Region.h>
|
#include <Region.h>
|
||||||
|
|
||||||
|
|
||||||
class Desktop;
|
class Desktop;
|
||||||
class ServerBitmap;
|
class ServerBitmap;
|
||||||
|
|
||||||
|
|
||||||
class DefaultDecorator: public Decorator {
|
class DefaultDecorator: public Decorator {
|
||||||
public:
|
public:
|
||||||
DefaultDecorator(DesktopSettings& settings,
|
DefaultDecorator(DesktopSettings& settings,
|
||||||
@ -89,6 +93,15 @@ private:
|
|||||||
bool focus, int32 width, int32 height,
|
bool focus, int32 width, int32 height,
|
||||||
DefaultDecorator* object);
|
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 fButtonHighColor;
|
||||||
rgb_color fButtonLowColor;
|
rgb_color fButtonLowColor;
|
||||||
rgb_color fTabColor;
|
rgb_color fTabColor;
|
||||||
@ -133,14 +146,6 @@ private:
|
|||||||
|
|
||||||
bigtime_t fLastClicked;
|
bigtime_t fLastClicked;
|
||||||
bool fWasDoubleClick;
|
bool fWasDoubleClick;
|
||||||
|
|
||||||
//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);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DEFAULT_DECORATOR_H
|
#endif // DEFAULT_DECORATOR_H
|
||||||
|
@ -50,22 +50,6 @@
|
|||||||
#include "Workspace.h"
|
#include "Workspace.h"
|
||||||
#include "WorkspacesView.h"
|
#include "WorkspacesView.h"
|
||||||
|
|
||||||
#include <ViewPrivate.h>
|
|
||||||
#include <WindowInfo.h>
|
|
||||||
#include <ServerProtocol.h>
|
|
||||||
|
|
||||||
#include <Debug.h>
|
|
||||||
#include <DirectWindow.h>
|
|
||||||
#include <Entry.h>
|
|
||||||
#include <Message.h>
|
|
||||||
#include <MessageFilter.h>
|
|
||||||
#include <Region.h>
|
|
||||||
#include <Roster.h>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <syslog.h>
|
|
||||||
|
|
||||||
#if TEST_MODE
|
#if TEST_MODE
|
||||||
# include "EventStream.h"
|
# include "EventStream.h"
|
||||||
#endif
|
#endif
|
||||||
@ -82,6 +66,7 @@
|
|||||||
# define AutoWriteLocker BAutolock
|
# define AutoWriteLocker BAutolock
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
class KeyboardFilter : public EventFilter {
|
class KeyboardFilter : public EventFilter {
|
||||||
public:
|
public:
|
||||||
KeyboardFilter(Desktop* desktop);
|
KeyboardFilter(Desktop* desktop);
|
||||||
@ -204,23 +189,23 @@ KeyboardFilter::Filter(BMessage* message, EventTarget** _target,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// switch between stacked windows
|
// switch between stacked windows
|
||||||
if (modifiers & B_OPTION_KEY) {
|
if ((modifiers & B_OPTION_KEY) != 0) {
|
||||||
BList* stackedWindows = fDesktop->FocusWindow()->StackedWindows();
|
BList* stackedWindows = fDesktop->FocusWindow()->StackedWindows();
|
||||||
if (key == 0x61 && stackedWindows) {
|
if (key == 0x61 && stackedWindows) {
|
||||||
int32 oldIndex =
|
// option key + cursor left
|
||||||
stackedWindows->IndexOf(fDesktop->FocusWindow());
|
int32 oldIndex
|
||||||
int32 newIndex =
|
= stackedWindows->IndexOf(fDesktop->FocusWindow());
|
||||||
(oldIndex - 1 >= 0)?
|
int32 newIndex = (oldIndex - 1 >= 0)
|
||||||
oldIndex - 1 : stackedWindows->CountItems() - 1;
|
? oldIndex - 1 : stackedWindows->CountItems() - 1;
|
||||||
fDesktop->ActivateWindow(
|
fDesktop->ActivateWindow(
|
||||||
static_cast<Window*>(stackedWindows->ItemAt(newIndex)));
|
static_cast<Window*>(stackedWindows->ItemAt(newIndex)));
|
||||||
return B_SKIP_MESSAGE;
|
return B_SKIP_MESSAGE;
|
||||||
} else if (key == 0x63 && stackedWindows) {
|
} else if (key == 0x63 && stackedWindows) {
|
||||||
int32 oldIndex =
|
// option key + cursor right
|
||||||
stackedWindows->IndexOf(fDesktop->FocusWindow());
|
int32 oldIndex
|
||||||
int32 newIndex =
|
= stackedWindows->IndexOf(fDesktop->FocusWindow());
|
||||||
(oldIndex + 1 < stackedWindows->CountItems())?
|
int32 newIndex = (oldIndex + 1 < stackedWindows->CountItems())
|
||||||
oldIndex + 1 : 0;
|
? oldIndex + 1 : 0;
|
||||||
fDesktop->ActivateWindow(
|
fDesktop->ActivateWindow(
|
||||||
static_cast<Window*>(stackedWindows->ItemAt(newIndex)));
|
static_cast<Window*>(stackedWindows->ItemAt(newIndex)));
|
||||||
return B_SKIP_MESSAGE;
|
return B_SKIP_MESSAGE;
|
||||||
@ -240,7 +225,7 @@ KeyboardFilter::Filter(BMessage* message, EventTarget** _target,
|
|||||||
// disable highlights if the stacking and snapping mode was just left
|
// disable highlights if the stacking and snapping mode was just left
|
||||||
if (fDesktop->fIsStackingAndSnapping && !(modifiers & B_OPTION_KEY))
|
if (fDesktop->fIsStackingAndSnapping && !(modifiers & B_OPTION_KEY))
|
||||||
fDesktop->FinishStackingAndSnapping();
|
fDesktop->FinishStackingAndSnapping();
|
||||||
fDesktop->fIsStackingAndSnapping = modifiers & B_OPTION_KEY;
|
fDesktop->fIsStackingAndSnapping = (modifiers & B_OPTION_KEY) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return B_DISPATCH_MESSAGE;
|
return B_DISPATCH_MESSAGE;
|
||||||
@ -1016,7 +1001,7 @@ Desktop::ActivateWindow(Window* window)
|
|||||||
|
|
||||||
BList* stackedAndTiledWindows = new BList();
|
BList* stackedAndTiledWindows = new BList();
|
||||||
|
|
||||||
//Prepare to move tiled windows to the front as well
|
// Prepare to move tiled windows to the front as well
|
||||||
_AddWindowsByIdsToList(window->Left2LeftSnappingWindowIds(),
|
_AddWindowsByIdsToList(window->Left2LeftSnappingWindowIds(),
|
||||||
stackedAndTiledWindows);
|
stackedAndTiledWindows);
|
||||||
_AddWindowsByIdsToList(window->Left2RightSnappingWindowIds(),
|
_AddWindowsByIdsToList(window->Left2RightSnappingWindowIds(),
|
||||||
@ -1036,29 +1021,30 @@ Desktop::ActivateWindow(Window* window)
|
|||||||
|
|
||||||
bool forceDirty = false;
|
bool forceDirty = false;
|
||||||
|
|
||||||
//And then prepare to move stacked windows to the front
|
// And then prepare to move stacked windows to the front
|
||||||
BList* stackedWindows = window->StackedWindows();
|
BList* stackedWindows = window->StackedWindows();
|
||||||
if (stackedWindows) {
|
if (stackedWindows != NULL) {
|
||||||
for (int i = 0; i < stackedWindows->CountItems(); i++) {
|
for (int i = 0; i < stackedWindows->CountItems(); i++) {
|
||||||
Window* stackedWindow =
|
Window* stackedWindow
|
||||||
static_cast<Window*>(stackedWindows->ItemAt(i));
|
= static_cast<Window*>(stackedWindows->ItemAt(i));
|
||||||
if (stackedWindow != window
|
if (stackedWindow != window
|
||||||
&& !stackedAndTiledWindows->HasItem(stackedWindow)) {
|
&& !stackedAndTiledWindows->HasItem(stackedWindow)) {
|
||||||
stackedAndTiledWindows->AddItem(stackedWindow);
|
stackedAndTiledWindows->AddItem(stackedWindow);
|
||||||
|
|
||||||
//Basically if there are any stacked windows associated with
|
// Basically if there are any stacked windows associated with
|
||||||
//this window, then designate this window as "dirty" so it is
|
// this window, then designate this window as "dirty" so it is
|
||||||
//forced to repaint
|
// forced to repaint
|
||||||
forceDirty = true;
|
forceDirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Do the actual moving here
|
// Do the actual moving here
|
||||||
for (int i = 0; i < stackedAndTiledWindows->CountItems(); i ++) {
|
for (int i = 0; i < stackedAndTiledWindows->CountItems(); i ++) {
|
||||||
Window* win = static_cast<Window*>(stackedAndTiledWindows->ItemAt(i));
|
Window* window
|
||||||
_CurrentWindows().RemoveWindow(win);
|
= static_cast<Window*>(stackedAndTiledWindows->ItemAt(i));
|
||||||
windows.AddWindow(win);
|
_CurrentWindows().RemoveWindow(window);
|
||||||
|
windows.AddWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete stackedAndTiledWindows;
|
delete stackedAndTiledWindows;
|
||||||
@ -1098,6 +1084,7 @@ Desktop::_AddWindowsByIdsToList(BList* windowIdsToAdd, BList* windows)
|
|||||||
{
|
{
|
||||||
if (!windowIdsToAdd || !windows)
|
if (!windowIdsToAdd || !windows)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
bool added = false;
|
bool added = false;
|
||||||
for (int i = 0; i < windowIdsToAdd->CountItems(); i++) {
|
for (int i = 0; i < windowIdsToAdd->CountItems(); i++) {
|
||||||
int32* id = static_cast<int32*>(windowIdsToAdd->ItemAt(i));
|
int32* id = static_cast<int32*>(windowIdsToAdd->ItemAt(i));
|
||||||
@ -3440,4 +3427,4 @@ Desktop::FindWindow(int32 windowId)
|
|||||||
return window;
|
return window;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
#include "LinearSpec.h"
|
#include "LinearSpec.h"
|
||||||
|
|
||||||
|
|
||||||
#define USE_MULTI_LOCKER 1
|
#define USE_MULTI_LOCKER 1
|
||||||
|
|
||||||
#if USE_MULTI_LOCKER
|
#if USE_MULTI_LOCKER
|
||||||
|
@ -895,8 +895,9 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
fDesktop->ResizeWindowBy(fWindow,
|
fDesktop->ResizeWindowBy(fWindow,
|
||||||
xResizeTo - fWindow->Frame().Width(),
|
xResizeTo - fWindow->Frame().Width(),
|
||||||
yResizeTo - fWindow->Frame().Height());
|
yResizeTo - fWindow->Frame().Height());
|
||||||
//Re-apply stack & tile constraints so that any other windows
|
// Re-apply stack & tile constraints so that any other windows
|
||||||
//that are stacked/snapped against this window can be re-adjusted
|
// that are stacked/snapped against this window can be
|
||||||
|
// re-adjusted
|
||||||
fWindow->StackAndTile();
|
fWindow->StackAndTile();
|
||||||
fLink.StartMessage(B_OK);
|
fLink.StartMessage(B_OK);
|
||||||
// }
|
// }
|
||||||
@ -922,8 +923,9 @@ ServerWindow::_DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
|
|||||||
} else {
|
} else {
|
||||||
fDesktop->MoveWindowBy(fWindow, xMoveTo - fWindow->Frame().left,
|
fDesktop->MoveWindowBy(fWindow, xMoveTo - fWindow->Frame().left,
|
||||||
yMoveTo - fWindow->Frame().top);
|
yMoveTo - fWindow->Frame().top);
|
||||||
//Re-apply stack & tile constraints so that any other windows
|
// Re-apply stack & tile constraints so that any other windows
|
||||||
//that are stacked/snapped against this window can be re-adjusted
|
// that are stacked/snapped against this window can be
|
||||||
|
// re-adjusted
|
||||||
fWindow->StackAndTile();
|
fWindow->StackAndTile();
|
||||||
fLink.StartMessage(B_OK);
|
fLink.StartMessage(B_OK);
|
||||||
}
|
}
|
||||||
|
@ -229,7 +229,7 @@ Window::~Window()
|
|||||||
// clean up the stackedWindowIds (they are not used by other windows
|
// clean up the stackedWindowIds (they are not used by other windows
|
||||||
// anymore)
|
// anymore)
|
||||||
if (fStackedWindowIds
|
if (fStackedWindowIds
|
||||||
&& (!fStackedWindows || fStackedWindows->CountItems()==1)) {
|
&& (!fStackedWindows || fStackedWindows->CountItems() == 1)) {
|
||||||
for (int i = 0; i < fStackedWindowIds->CountItems(); i++) {
|
for (int i = 0; i < fStackedWindowIds->CountItems(); i++) {
|
||||||
int32* id = static_cast<int32*>(fStackedWindowIds->ItemAt(i));
|
int32* id = static_cast<int32*>(fStackedWindowIds->ItemAt(i));
|
||||||
free(id);
|
free(id);
|
||||||
@ -2467,6 +2467,9 @@ Window::UpdateSession::Exclude(BRegion* dirtyInNextSession)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - Stack & Tile
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
Window::HighlightTab(bool active, BRegion& dirty)
|
Window::HighlightTab(bool active, BRegion& dirty)
|
||||||
{
|
{
|
||||||
@ -2526,8 +2529,8 @@ Window::_EnsureWindowWithinScreenBounds(Window* window, Window* detached)
|
|||||||
|| windowsToRight->CountItems() == 1
|
|| windowsToRight->CountItems() == 1
|
||||||
&& *static_cast<int32*>(windowsToRight->ItemAt(0))
|
&& *static_cast<int32*>(windowsToRight->ItemAt(0))
|
||||||
== detached->WindowId())) {
|
== detached->WindowId())) {
|
||||||
//If window is off-screen to the left and there's no window tiled
|
// If window is off-screen to the left and there's no window tiled
|
||||||
//to its right that can still "save" it from going totally off-screen
|
// to its right that can still "save" it from going totally off-screen
|
||||||
deltaX = 6 - window->Frame().left;
|
deltaX = 6 - window->Frame().left;
|
||||||
}
|
}
|
||||||
else if (window->Frame().right > screenFrame.right
|
else if (window->Frame().right > screenFrame.right
|
||||||
@ -2536,8 +2539,8 @@ Window::_EnsureWindowWithinScreenBounds(Window* window, Window* detached)
|
|||||||
|| windowsToLeft->CountItems() == 1
|
|| windowsToLeft->CountItems() == 1
|
||||||
&& *static_cast<int32*>(windowsToLeft->ItemAt(0))
|
&& *static_cast<int32*>(windowsToLeft->ItemAt(0))
|
||||||
== detached->WindowId())) {
|
== detached->WindowId())) {
|
||||||
//If window is off-screen to the right and there's no window tiled
|
// If window is off-screen to the right and there's no window tiled
|
||||||
//to its left that can still "save" it from going totally off-screen
|
// to its left that can still "save" it from going totally off-screen
|
||||||
deltaX = screenFrame.right - window->Frame().right - 6;
|
deltaX = screenFrame.right - window->Frame().right - 6;
|
||||||
}
|
}
|
||||||
if (window->Frame().top < 0
|
if (window->Frame().top < 0
|
||||||
@ -2546,8 +2549,8 @@ Window::_EnsureWindowWithinScreenBounds(Window* window, Window* detached)
|
|||||||
|| windowsToTop->CountItems() == 1
|
|| windowsToTop->CountItems() == 1
|
||||||
&& *static_cast<int32*>(windowsToTop->ItemAt(0))
|
&& *static_cast<int32*>(windowsToTop->ItemAt(0))
|
||||||
== detached->WindowId())) {
|
== detached->WindowId())) {
|
||||||
//If window is off-screen to the top and there's no window tiled
|
// If window is off-screen to the top and there's no window tiled
|
||||||
//to its bottom that can still "save" it from going totally off-screen
|
// to its bottom that can still "save" it from going totally off-screen
|
||||||
deltaY = 27 - window->Frame().top;
|
deltaY = 27 - window->Frame().top;
|
||||||
}
|
}
|
||||||
else if (window->Frame().bottom > screenFrame.bottom
|
else if (window->Frame().bottom > screenFrame.bottom
|
||||||
@ -2556,8 +2559,8 @@ Window::_EnsureWindowWithinScreenBounds(Window* window, Window* detached)
|
|||||||
|| windowsToBottom->CountItems() == 1
|
|| windowsToBottom->CountItems() == 1
|
||||||
&& *static_cast<int32*>(windowsToBottom->ItemAt(0))
|
&& *static_cast<int32*>(windowsToBottom->ItemAt(0))
|
||||||
== detached->WindowId())) {
|
== detached->WindowId())) {
|
||||||
//If window is off-screen to the bottom and there's no window tiled
|
// If window is off-screen to the bottom and there's no window tiled
|
||||||
//to its top that can still "save" it from going totally off-screen
|
// to its top that can still "save" it from going totally off-screen
|
||||||
deltaY = screenFrame.bottom - window->Frame().bottom - 6;
|
deltaY = screenFrame.bottom - window->Frame().bottom - 6;
|
||||||
}
|
}
|
||||||
if (deltaX != 0 || deltaY != 0)
|
if (deltaX != 0 || deltaY != 0)
|
||||||
@ -2610,11 +2613,11 @@ Window::_InitStackingAndSnapping()
|
|||||||
fRightVar->SetRange(-DBL_MAX, DBL_MAX);
|
fRightVar->SetRange(-DBL_MAX, DBL_MAX);
|
||||||
fBottomVar->SetRange(-DBL_MAX, DBL_MAX);
|
fBottomVar->SetRange(-DBL_MAX, DBL_MAX);
|
||||||
|
|
||||||
fLeftConstraint = fDesktop->fStackAndTileSpec
|
fLeftConstraint
|
||||||
->AddConstraint(1.0, fLeftVar,
|
= fDesktop->fStackAndTileSpec->AddConstraint(1.0, fLeftVar,
|
||||||
OperatorType(EQ), fFrame.left, 1, 1);
|
OperatorType(EQ), fFrame.left, 1, 1);
|
||||||
fTopConstraint = fDesktop->fStackAndTileSpec
|
fTopConstraint
|
||||||
->AddConstraint(1.0, fTopVar,
|
= fDesktop->fStackAndTileSpec->AddConstraint(1.0, fTopVar,
|
||||||
OperatorType(EQ), fFrame.top, 1, 1);
|
OperatorType(EQ), fFrame.top, 1, 1);
|
||||||
label = Title();
|
label = Title();
|
||||||
label << ".fLeftConstraint";
|
label << ".fLeftConstraint";
|
||||||
@ -2625,12 +2628,12 @@ Window::_InitStackingAndSnapping()
|
|||||||
|
|
||||||
int32 minWidth, maxWidth, minHeight, maxHeight;
|
int32 minWidth, maxWidth, minHeight, maxHeight;
|
||||||
GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
|
GetSizeLimits(&minWidth, &maxWidth, &minHeight, &maxHeight);
|
||||||
fMinWidthConstraint = fDesktop->fStackAndTileSpec
|
fMinWidthConstraint
|
||||||
->AddConstraint(1.0, fLeftVar, -1.0, fRightVar,
|
= fDesktop->fStackAndTileSpec->AddConstraint(1.0, fLeftVar, -1.0,
|
||||||
OperatorType(LE), -minWidth);
|
fRightVar, OperatorType(LE), -minWidth);
|
||||||
fMinHeightConstraint = fDesktop->fStackAndTileSpec
|
fMinHeightConstraint
|
||||||
->AddConstraint(1.0, fTopVar, -1.0, fBottomVar,
|
= fDesktop->fStackAndTileSpec->AddConstraint(1.0, fTopVar, -1.0,
|
||||||
OperatorType(LE), -minHeight);
|
fBottomVar, OperatorType(LE), -minHeight);
|
||||||
label = Title();
|
label = Title();
|
||||||
label << ".fMinWidthConstraint";
|
label << ".fMinWidthConstraint";
|
||||||
fMinWidthConstraint->SetLabel(label.String());
|
fMinWidthConstraint->SetLabel(label.String());
|
||||||
@ -2641,12 +2644,12 @@ Window::_InitStackingAndSnapping()
|
|||||||
// The width and height constraints have higher penalties than the
|
// The width and height constraints have higher penalties than the
|
||||||
// position constraints (left, top), so a window will keep its size
|
// position constraints (left, top), so a window will keep its size
|
||||||
// unless explicitly resized.
|
// unless explicitly resized.
|
||||||
fWidthConstraint = fDesktop->fStackAndTileSpec
|
fWidthConstraint
|
||||||
->AddConstraint(-1.0, fLeftVar, 1.0, fRightVar,
|
= fDesktop->fStackAndTileSpec->AddConstraint(-1.0, fLeftVar, 1.0,
|
||||||
OperatorType(EQ), fFrame.Width(), 10, 10);
|
fRightVar, OperatorType(EQ), fFrame.Width(), 10, 10);
|
||||||
fHeightConstraint = fDesktop->fStackAndTileSpec
|
fHeightConstraint
|
||||||
->AddConstraint(-1.0, fTopVar, 1.0, fBottomVar,
|
= fDesktop->fStackAndTileSpec->AddConstraint(-1.0, fTopVar, 1.0,
|
||||||
OperatorType(EQ), fFrame.Height(), 10, 10);
|
fBottomVar, OperatorType(EQ), fFrame.Height(), 10, 10);
|
||||||
label = Title();
|
label = Title();
|
||||||
label << ".fWidthConstraint";
|
label << ".fWidthConstraint";
|
||||||
fWidthConstraint->SetLabel(label.String());
|
fWidthConstraint->SetLabel(label.String());
|
||||||
@ -2871,14 +2874,17 @@ Window::_CheckIfReadyToStack()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if the stacking candidate has changed, change tab highlights
|
// if the stacking candidate has changed, change tab highlights
|
||||||
if(prevWindowUnder != fWindowUnder) {
|
if (prevWindowUnder != fWindowUnder) {
|
||||||
if(!prevWindowUnder) { // candidate found for the first time
|
if (!prevWindowUnder) {
|
||||||
|
// candidate found for the first time
|
||||||
fDesktop->HighlightTab(this, true);
|
fDesktop->HighlightTab(this, true);
|
||||||
fDesktop->HighlightTab(fWindowUnder, true);
|
fDesktop->HighlightTab(fWindowUnder, true);
|
||||||
} else if(!fWindowUnder) { // no candidate after there was one
|
} else if (!fWindowUnder) {
|
||||||
|
// no candidate after there was one
|
||||||
fDesktop->HighlightTab(this, false);
|
fDesktop->HighlightTab(this, false);
|
||||||
fDesktop->HighlightTab(prevWindowUnder, false);
|
fDesktop->HighlightTab(prevWindowUnder, false);
|
||||||
} else { // changing from one to another candidate
|
} else {
|
||||||
|
// changing from one to another candidate
|
||||||
fDesktop->HighlightTab(prevWindowUnder, false);
|
fDesktop->HighlightTab(prevWindowUnder, false);
|
||||||
fDesktop->HighlightTab(fWindowUnder, true);
|
fDesktop->HighlightTab(fWindowUnder, true);
|
||||||
}
|
}
|
||||||
@ -3181,7 +3187,8 @@ Window::_CheckIfReadyToSnap()
|
|||||||
/*! \brief Snaps this window to the current candidate windows for snapping
|
/*! \brief Snaps this window to the current candidate windows for snapping
|
||||||
on each side. Afterwards snapping candidates are cleared.
|
on each side. Afterwards snapping candidates are cleared.
|
||||||
*/
|
*/
|
||||||
void Window::_SnapWindow()
|
void
|
||||||
|
Window::_SnapWindow()
|
||||||
{
|
{
|
||||||
BRect bounds;
|
BRect bounds;
|
||||||
Window* leftmostWindow;
|
Window* leftmostWindow;
|
||||||
@ -3216,8 +3223,8 @@ void Window::_SnapWindow()
|
|||||||
topmostWindow->AddToSnappingList(this, SNAP_RIGHT, SNAP_LEFT);
|
topmostWindow->AddToSnappingList(this, SNAP_RIGHT, SNAP_LEFT);
|
||||||
|
|
||||||
STRACE_SAT(("Adding %s[%d] to %s[%d]'s T2T & L2R list\n",
|
STRACE_SAT(("Adding %s[%d] to %s[%d]'s T2T & L2R list\n",
|
||||||
topmostWindow->Title(), topmostWindow->WindowId(),
|
topmostWindow->Title(), topmostWindow->WindowId(),
|
||||||
Title(), WindowId()));
|
Title(), WindowId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// adjust bottom border
|
// adjust bottom border
|
||||||
@ -3236,8 +3243,8 @@ void Window::_SnapWindow()
|
|||||||
bottommostWindow->AddToSnappingList(this, SNAP_RIGHT, SNAP_LEFT);
|
bottommostWindow->AddToSnappingList(this, SNAP_RIGHT, SNAP_LEFT);
|
||||||
|
|
||||||
STRACE_SAT(("Adding %s[%d] to %s[%d]'s B2B & L2R list\n",
|
STRACE_SAT(("Adding %s[%d] to %s[%d]'s B2B & L2R list\n",
|
||||||
bottommostWindow->Title(), bottommostWindow->WindowId(),
|
bottommostWindow->Title(), bottommostWindow->WindowId(),
|
||||||
Title(), WindowId()));
|
Title(), WindowId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// adjust other windows
|
// adjust other windows
|
||||||
@ -3258,8 +3265,7 @@ void Window::_SnapWindow()
|
|||||||
window->AddToSnappingList(this, SNAP_RIGHT, SNAP_LEFT);
|
window->AddToSnappingList(this, SNAP_RIGHT, SNAP_LEFT);
|
||||||
|
|
||||||
STRACE_SAT(("Adding %s[%d] to %s[%d]'s L2R list\n",
|
STRACE_SAT(("Adding %s[%d] to %s[%d]'s L2R list\n",
|
||||||
window->Title(), window->WindowId(), Title(),
|
window->Title(), window->WindowId(), Title(), WindowId()));
|
||||||
WindowId()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3291,8 +3297,8 @@ void Window::_SnapWindow()
|
|||||||
leftmostWindow->AddToSnappingList(this, SNAP_BOTTOM, SNAP_TOP);
|
leftmostWindow->AddToSnappingList(this, SNAP_BOTTOM, SNAP_TOP);
|
||||||
|
|
||||||
STRACE_SAT(("Adding %s[%d] to %s[%d]'s L2L & T2B list\n",
|
STRACE_SAT(("Adding %s[%d] to %s[%d]'s L2L & T2B list\n",
|
||||||
leftmostWindow->Title(), leftmostWindow->WindowId(),
|
leftmostWindow->Title(), leftmostWindow->WindowId(),
|
||||||
Title(), WindowId()));
|
Title(), WindowId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// adjust right border
|
// adjust right border
|
||||||
@ -3311,8 +3317,8 @@ void Window::_SnapWindow()
|
|||||||
rightmostWindow->AddToSnappingList(this, SNAP_BOTTOM, SNAP_TOP);
|
rightmostWindow->AddToSnappingList(this, SNAP_BOTTOM, SNAP_TOP);
|
||||||
|
|
||||||
STRACE_SAT(("Adding %s[%d] to %s[%d]'s R2R & T2B list\n",
|
STRACE_SAT(("Adding %s[%d] to %s[%d]'s R2R & T2B list\n",
|
||||||
rightmostWindow->Title(), rightmostWindow->WindowId(),
|
rightmostWindow->Title(), rightmostWindow->WindowId(),
|
||||||
Title(), WindowId()));
|
Title(), WindowId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// adjust other windows
|
// adjust other windows
|
||||||
@ -3320,10 +3326,9 @@ void Window::_SnapWindow()
|
|||||||
Window* window = static_cast<Window*>(
|
Window* window = static_cast<Window*>(
|
||||||
fTopAdjacentWindows->ItemAt(i));
|
fTopAdjacentWindows->ItemAt(i));
|
||||||
window->_InitStackingAndSnapping();
|
window->_InitStackingAndSnapping();
|
||||||
Constraint* topSnapping =
|
Constraint* topSnapping
|
||||||
fDesktop->fStackAndTileSpec->AddConstraint(
|
= fDesktop->fStackAndTileSpec->AddConstraint(
|
||||||
-1, window->fBottomVar, 1, fTopVar,
|
-1, window->fBottomVar, 1, fTopVar, OperatorType(EQ), 32);
|
||||||
OperatorType(EQ), 32);
|
|
||||||
BString label("topSnapping of ");
|
BString label("topSnapping of ");
|
||||||
label << Title();
|
label << Title();
|
||||||
topSnapping->SetLabel(label.String());
|
topSnapping->SetLabel(label.String());
|
||||||
@ -3333,8 +3338,7 @@ void Window::_SnapWindow()
|
|||||||
window->AddToSnappingList(this, SNAP_BOTTOM, SNAP_TOP);
|
window->AddToSnappingList(this, SNAP_BOTTOM, SNAP_TOP);
|
||||||
|
|
||||||
STRACE_SAT(("Adding %s[%d] to %s[%d]'s T2B list\n",
|
STRACE_SAT(("Adding %s[%d] to %s[%d]'s T2B list\n",
|
||||||
window->Title(), window->WindowId(), Title(),
|
window->Title(), window->WindowId(), Title(), WindowId()));
|
||||||
WindowId()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3366,8 +3370,8 @@ void Window::_SnapWindow()
|
|||||||
topmostWindow->AddToSnappingList(this, SNAP_LEFT, SNAP_RIGHT);
|
topmostWindow->AddToSnappingList(this, SNAP_LEFT, SNAP_RIGHT);
|
||||||
|
|
||||||
STRACE_SAT(("Adding %s[%d] to %s[%d]'s T2T & R2L list\n",
|
STRACE_SAT(("Adding %s[%d] to %s[%d]'s T2T & R2L list\n",
|
||||||
topmostWindow->Title(), topmostWindow->WindowId(),
|
topmostWindow->Title(), topmostWindow->WindowId(),
|
||||||
Title(), WindowId()));
|
Title(), WindowId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// adjust bottom border
|
// adjust bottom border
|
||||||
@ -3386,8 +3390,8 @@ void Window::_SnapWindow()
|
|||||||
bottommostWindow->AddToSnappingList(this, SNAP_LEFT, SNAP_RIGHT);
|
bottommostWindow->AddToSnappingList(this, SNAP_LEFT, SNAP_RIGHT);
|
||||||
|
|
||||||
STRACE_SAT(("Adding %s[%d] to %s[%d]'s B2B & R2L list\n",
|
STRACE_SAT(("Adding %s[%d] to %s[%d]'s B2B & R2L list\n",
|
||||||
bottommostWindow->Title(), bottommostWindow->WindowId(),
|
bottommostWindow->Title(), bottommostWindow->WindowId(),
|
||||||
Title(), WindowId()));
|
Title(), WindowId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// adjust other windows
|
// adjust other windows
|
||||||
@ -3395,10 +3399,9 @@ void Window::_SnapWindow()
|
|||||||
Window* window = static_cast<Window*>(
|
Window* window = static_cast<Window*>(
|
||||||
fRightAdjacentWindows->ItemAt(i));
|
fRightAdjacentWindows->ItemAt(i));
|
||||||
window->_InitStackingAndSnapping();
|
window->_InitStackingAndSnapping();
|
||||||
Constraint* rightSnapping =
|
Constraint* rightSnapping
|
||||||
fDesktop->fStackAndTileSpec->AddConstraint(
|
= fDesktop->fStackAndTileSpec->AddConstraint(
|
||||||
-1, fRightVar, 1, window->fLeftVar,
|
-1, fRightVar, 1, window->fLeftVar, OperatorType(EQ), 11);
|
||||||
OperatorType(EQ), 11);
|
|
||||||
BString label("rightSnapping of ");
|
BString label("rightSnapping of ");
|
||||||
label << Title();
|
label << Title();
|
||||||
rightSnapping->SetLabel(label.String());
|
rightSnapping->SetLabel(label.String());
|
||||||
@ -3408,8 +3411,7 @@ void Window::_SnapWindow()
|
|||||||
window->AddToSnappingList(this, SNAP_LEFT, SNAP_RIGHT);
|
window->AddToSnappingList(this, SNAP_LEFT, SNAP_RIGHT);
|
||||||
|
|
||||||
STRACE_SAT(("Adding %s[%d] to %s[%d]'s R2L list\n",
|
STRACE_SAT(("Adding %s[%d] to %s[%d]'s R2L list\n",
|
||||||
window->Title(), window->WindowId(), Title(),
|
window->Title(), window->WindowId(), Title(), WindowId()));
|
||||||
WindowId()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3441,8 +3443,8 @@ void Window::_SnapWindow()
|
|||||||
leftmostWindow->AddToSnappingList(this, SNAP_TOP, SNAP_BOTTOM);
|
leftmostWindow->AddToSnappingList(this, SNAP_TOP, SNAP_BOTTOM);
|
||||||
|
|
||||||
STRACE_SAT(("Adding %s[%d] to %s[%d]'s L2L & B2T list\n",
|
STRACE_SAT(("Adding %s[%d] to %s[%d]'s L2L & B2T list\n",
|
||||||
leftmostWindow->Title(), leftmostWindow->WindowId(),
|
leftmostWindow->Title(), leftmostWindow->WindowId(),
|
||||||
Title(), WindowId()));
|
Title(), WindowId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// adjust right border
|
// adjust right border
|
||||||
@ -3461,8 +3463,8 @@ void Window::_SnapWindow()
|
|||||||
rightmostWindow->AddToSnappingList(this, SNAP_TOP, SNAP_BOTTOM);
|
rightmostWindow->AddToSnappingList(this, SNAP_TOP, SNAP_BOTTOM);
|
||||||
|
|
||||||
STRACE_SAT(("Adding %s[%d] to %s[%d]'s R2R & B2T list\n",
|
STRACE_SAT(("Adding %s[%d] to %s[%d]'s R2R & B2T list\n",
|
||||||
rightmostWindow->Title(), rightmostWindow->WindowId(),
|
rightmostWindow->Title(), rightmostWindow->WindowId(),
|
||||||
Title(), WindowId()));
|
Title(), WindowId()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// adjust other windows
|
// adjust other windows
|
||||||
@ -3470,10 +3472,9 @@ void Window::_SnapWindow()
|
|||||||
Window* window = static_cast<Window*>(
|
Window* window = static_cast<Window*>(
|
||||||
fBottomAdjacentWindows->ItemAt(i));
|
fBottomAdjacentWindows->ItemAt(i));
|
||||||
window->_InitStackingAndSnapping();
|
window->_InitStackingAndSnapping();
|
||||||
Constraint* bottomSnapping =
|
Constraint* bottomSnapping
|
||||||
fDesktop->fStackAndTileSpec->AddConstraint(
|
= fDesktop->fStackAndTileSpec->AddConstraint(
|
||||||
-1, fBottomVar, 1, window->fTopVar,
|
-1, fBottomVar, 1, window->fTopVar, OperatorType(EQ), 32);
|
||||||
OperatorType(EQ), 32);
|
|
||||||
BString label("bottomSnapping of ");
|
BString label("bottomSnapping of ");
|
||||||
label << Title();
|
label << Title();
|
||||||
bottomSnapping->SetLabel(label.String());
|
bottomSnapping->SetLabel(label.String());
|
||||||
@ -3483,8 +3484,7 @@ void Window::_SnapWindow()
|
|||||||
window->AddToSnappingList(this, SNAP_TOP, SNAP_BOTTOM);
|
window->AddToSnappingList(this, SNAP_TOP, SNAP_BOTTOM);
|
||||||
|
|
||||||
STRACE_SAT(("Adding %s[%d] to %s[%d]'s B2T list\n",
|
STRACE_SAT(("Adding %s[%d] to %s[%d]'s B2T list\n",
|
||||||
window->Title(), window->WindowId(), Title(),
|
window->Title(), window->WindowId(), Title(), WindowId()));
|
||||||
WindowId()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3501,11 +3501,11 @@ void Window::_SnapWindow()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Window::AddToSnappingList(Window* window,
|
Window::AddToSnappingList(Window* window, SnapOrientation thisSnapOrientation,
|
||||||
SnapOrientation thisSnapOrientation,
|
SnapOrientation otherSnapOrientation)
|
||||||
SnapOrientation otherSnapOrientation) {
|
{
|
||||||
AddToSnappingList(window->WindowId(), thisSnapOrientation,
|
AddToSnappingList(window->WindowId(), thisSnapOrientation,
|
||||||
otherSnapOrientation);
|
otherSnapOrientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3519,18 +3519,17 @@ Window::AddToSnappingList(Window* window,
|
|||||||
\param otherSnapOrientation snapping orientation for given window
|
\param otherSnapOrientation snapping orientation for given window
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Window::AddToSnappingList(int32 windowId,
|
Window::AddToSnappingList(int32 windowId, SnapOrientation thisSnapOrientation,
|
||||||
SnapOrientation thisSnapOrientation,
|
SnapOrientation otherSnapOrientation)
|
||||||
SnapOrientation otherSnapOrientation) {
|
{
|
||||||
|
|
||||||
BList* windowIdList = GetSnappingList(thisSnapOrientation,
|
BList* windowIdList = GetSnappingList(thisSnapOrientation,
|
||||||
otherSnapOrientation, true);
|
otherSnapOrientation, true);
|
||||||
//This may be the case if invalid snap orientation combo is given
|
// This may be the case if invalid snap orientation combo is given
|
||||||
//(e.g. top to left)
|
// (e.g. top to left)
|
||||||
if (!windowIdList)
|
if (!windowIdList)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//don't add id if already contained
|
// don't add id if already contained
|
||||||
for (int i = 0; i < windowIdList->CountItems(); i++) {
|
for (int i = 0; i < windowIdList->CountItems(); i++) {
|
||||||
int32* id = static_cast<int32*>(windowIdList->ItemAt(i));
|
int32* id = static_cast<int32*>(windowIdList->ItemAt(i));
|
||||||
if (*id == windowId) {
|
if (*id == windowId) {
|
||||||
@ -3541,11 +3540,12 @@ Window::AddToSnappingList(int32 windowId,
|
|||||||
*id = windowId;
|
*id = windowId;
|
||||||
windowIdList->AddItem(id);
|
windowIdList->AddItem(id);
|
||||||
|
|
||||||
|
#ifdef DEBUG_STACK_AND_TILE
|
||||||
char snapStr[][7] = {"left", "right", "top", "bottom"};
|
char snapStr[][7] = {"left", "right", "top", "bottom"};
|
||||||
STRACE_SAT(("\tAdded %s to %s's %s 2 %s list\n",
|
STRACE_SAT(("\tAdded %s to %s's %s 2 %s list\n",
|
||||||
windowId, Title(),
|
windowId, Title(), snapStr[thisSnapOrientation],
|
||||||
snapStr[thisSnapOrientation],
|
snapStr[otherSnapOrientation]));
|
||||||
snapStr[otherSnapOrientation]));
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3559,8 +3559,8 @@ Window::AddToSnappingList(int32 windowId,
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Window::RemoveFromSnappingList(int32 windowId,
|
Window::RemoveFromSnappingList(int32 windowId,
|
||||||
SnapOrientation thisSnapOrientation,
|
SnapOrientation thisSnapOrientation, SnapOrientation otherSnapOrientation)
|
||||||
SnapOrientation otherSnapOrientation) {
|
{
|
||||||
BList* windowIdList = GetSnappingList(thisSnapOrientation,
|
BList* windowIdList = GetSnappingList(thisSnapOrientation,
|
||||||
otherSnapOrientation, false);
|
otherSnapOrientation, false);
|
||||||
|
|
||||||
@ -3575,11 +3575,13 @@ Window::RemoveFromSnappingList(int32 windowId,
|
|||||||
windowIdList->RemoveItem(i);
|
windowIdList->RemoveItem(i);
|
||||||
free(id);
|
free(id);
|
||||||
|
|
||||||
|
#ifdef DEBUG_STACK_AND_TILE
|
||||||
char snapStr[][7] = {"left", "right", "top", "bottom"};
|
char snapStr[][7] = {"left", "right", "top", "bottom"};
|
||||||
STRACE_SAT(("\tRemoved %x from %s's %s 2 %s list\n",
|
STRACE_SAT(("\tRemoved %x from %s's %s 2 %s list\n",
|
||||||
windowId, Title(),
|
windowId, Title(),
|
||||||
snapStr[thisSnapOrientation],
|
snapStr[thisSnapOrientation],
|
||||||
snapStr[otherSnapOrientation]));
|
snapStr[otherSnapOrientation]));
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3597,11 +3599,10 @@ Window::RemoveFromSnappingList(int32 windowId,
|
|||||||
*/
|
*/
|
||||||
BList*
|
BList*
|
||||||
Window::GetSnappingList(SnapOrientation thisSnapOrientation,
|
Window::GetSnappingList(SnapOrientation thisSnapOrientation,
|
||||||
SnapOrientation otherSnapOrientation,
|
SnapOrientation otherSnapOrientation, bool createIfNull)
|
||||||
bool createIfNull)
|
|
||||||
{
|
{
|
||||||
BList** windowIdListRef = _GetSnappingListRef(thisSnapOrientation,
|
BList** windowIdListRef = _GetSnappingListRef(thisSnapOrientation,
|
||||||
otherSnapOrientation, createIfNull);
|
otherSnapOrientation, createIfNull);
|
||||||
|
|
||||||
if (windowIdListRef)
|
if (windowIdListRef)
|
||||||
return *windowIdListRef;
|
return *windowIdListRef;
|
||||||
@ -3611,8 +3612,7 @@ Window::GetSnappingList(SnapOrientation thisSnapOrientation,
|
|||||||
|
|
||||||
BList**
|
BList**
|
||||||
Window::_GetSnappingListRef(SnapOrientation thisSnapOrientation,
|
Window::_GetSnappingListRef(SnapOrientation thisSnapOrientation,
|
||||||
SnapOrientation otherSnapOrientation,
|
SnapOrientation otherSnapOrientation, bool createIfNull)
|
||||||
bool createIfNull)
|
|
||||||
{
|
{
|
||||||
BList** windowIdListRef = NULL;
|
BList** windowIdListRef = NULL;
|
||||||
if (thisSnapOrientation == SNAP_LEFT
|
if (thisSnapOrientation == SNAP_LEFT
|
||||||
@ -3640,13 +3640,13 @@ Window::_GetSnappingListRef(SnapOrientation thisSnapOrientation,
|
|||||||
&& otherSnapOrientation == SNAP_BOTTOM)
|
&& otherSnapOrientation == SNAP_BOTTOM)
|
||||||
windowIdListRef = &fBottom2BottomSnappingWindowIds;
|
windowIdListRef = &fBottom2BottomSnappingWindowIds;
|
||||||
|
|
||||||
//This will be the case if invalid snap orientation combo is given
|
// This will be the case if invalid snap orientation combo is given
|
||||||
//(e.g. top to left)
|
// (e.g. top to left)
|
||||||
if (!windowIdListRef) {
|
if (!windowIdListRef) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Create snapping list if not already initialised.
|
// Create snapping list if not already initialised.
|
||||||
if (!(*windowIdListRef) && createIfNull) {
|
if (!(*windowIdListRef) && createIfNull) {
|
||||||
*windowIdListRef = new BList();
|
*windowIdListRef = new BList();
|
||||||
}
|
}
|
||||||
@ -3660,16 +3660,15 @@ Window::_GetSnappingListRef(SnapOrientation thisSnapOrientation,
|
|||||||
according to given orientation). Returns the object representing
|
according to given orientation). Returns the object representing
|
||||||
this snapping constraint.
|
this snapping constraint.
|
||||||
|
|
||||||
TODO some of the logic is duplicative w.r.t _SnapWindow - consider
|
TODO some of the logic is duplicative w.r.t _SnapWindow - consider
|
||||||
refactoring
|
refactoring
|
||||||
|
|
||||||
\param otherWindow the window to snap to
|
\param otherWindow the window to snap to
|
||||||
\param thisSnap snapping orientation for current window
|
\param thisSnap snapping orientation for current window
|
||||||
\param otherSnap snapping orientation for given window
|
\param otherSnap snapping orientation for given window
|
||||||
*/
|
*/
|
||||||
Constraint*
|
Constraint*
|
||||||
Window::SnapToWindow(Window* otherWindow,
|
Window::SnapToWindow(Window* otherWindow, SnapOrientation thisSnap,
|
||||||
SnapOrientation thisSnap,
|
|
||||||
SnapOrientation otherSnap)
|
SnapOrientation otherSnap)
|
||||||
{
|
{
|
||||||
Variable* thisSnappingVar;
|
Variable* thisSnappingVar;
|
||||||
@ -3688,75 +3687,80 @@ Window::SnapToWindow(Window* otherWindow,
|
|||||||
|
|
||||||
//For each possible pair of snapping orientations, work out the
|
//For each possible pair of snapping orientations, work out the
|
||||||
//necessary updates to make to the linear constraints
|
//necessary updates to make to the linear constraints
|
||||||
switch(thisSnap) {
|
switch (thisSnap) {
|
||||||
case SNAP_LEFT:
|
|
||||||
thisSnappingVar = fLeftVar;
|
|
||||||
snappingLabel << "leftSnapping of ";
|
|
||||||
switch(otherSnap) {
|
|
||||||
case SNAP_LEFT:
|
case SNAP_LEFT:
|
||||||
moveDeltaX = otherFrame.left - thisFrame.left;
|
thisSnappingVar = fLeftVar;
|
||||||
otherSnappingVar = otherWindow->fLeftVar;
|
snappingLabel << "leftSnapping of ";
|
||||||
|
switch (otherSnap) {
|
||||||
|
case SNAP_LEFT:
|
||||||
|
moveDeltaX = otherFrame.left - thisFrame.left;
|
||||||
|
otherSnappingVar = otherWindow->fLeftVar;
|
||||||
|
break;
|
||||||
|
case SNAP_RIGHT:
|
||||||
|
snapDistance = -11;
|
||||||
|
moveDeltaX
|
||||||
|
= otherFrame.right - thisFrame.left - snapDistance;
|
||||||
|
otherSnappingVar = otherWindow->fRightVar;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SNAP_RIGHT:
|
case SNAP_RIGHT:
|
||||||
snapDistance = -11;
|
thisSnappingVar = fRightVar;
|
||||||
moveDeltaX = otherFrame.right - thisFrame.left - snapDistance;
|
snappingLabel << "rightSnapping of ";
|
||||||
otherSnappingVar = otherWindow->fRightVar;
|
|
||||||
|
switch (otherSnap) {
|
||||||
|
case SNAP_LEFT:
|
||||||
|
snapDistance = 11;
|
||||||
|
moveDeltaX
|
||||||
|
= otherFrame.left - thisFrame.right - snapDistance;
|
||||||
|
otherSnappingVar = otherWindow->fLeftVar;
|
||||||
|
break;
|
||||||
|
case SNAP_RIGHT:
|
||||||
|
moveDeltaX = otherFrame.right - thisFrame.right;
|
||||||
|
otherSnappingVar = otherWindow->fRightVar;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SNAP_RIGHT:
|
|
||||||
thisSnappingVar = fRightVar;
|
|
||||||
snappingLabel << "rightSnapping of ";
|
|
||||||
switch(otherSnap) {
|
|
||||||
case SNAP_LEFT:
|
|
||||||
snapDistance = 11;
|
|
||||||
moveDeltaX = otherFrame.left - thisFrame.right - snapDistance;
|
|
||||||
otherSnappingVar = otherWindow->fLeftVar;
|
|
||||||
break;
|
|
||||||
case SNAP_RIGHT:
|
|
||||||
moveDeltaX = otherFrame.right - thisFrame.right;
|
|
||||||
otherSnappingVar = otherWindow->fRightVar;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case SNAP_TOP:
|
|
||||||
thisSnappingVar = fTopVar;
|
|
||||||
snappingLabel << "topSnapping of ";
|
|
||||||
switch(otherSnap) {
|
|
||||||
case SNAP_TOP:
|
case SNAP_TOP:
|
||||||
moveDeltaY = otherFrame.top - thisFrame.top;
|
thisSnappingVar = fTopVar;
|
||||||
otherSnappingVar = otherWindow->fTopVar;
|
snappingLabel << "topSnapping of ";
|
||||||
|
switch (otherSnap) {
|
||||||
|
case SNAP_TOP:
|
||||||
|
moveDeltaY = otherFrame.top - thisFrame.top;
|
||||||
|
otherSnappingVar = otherWindow->fTopVar;
|
||||||
|
break;
|
||||||
|
case SNAP_BOTTOM:
|
||||||
|
snapDistance = -32;
|
||||||
|
moveDeltaY
|
||||||
|
= otherFrame.bottom - thisFrame.top - snapDistance;
|
||||||
|
otherSnappingVar = otherWindow->fBottomVar;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case SNAP_BOTTOM:
|
default: // SNAP_BOTTOM
|
||||||
snapDistance = -32;
|
thisSnappingVar = fBottomVar;
|
||||||
moveDeltaY = otherFrame.bottom - thisFrame.top - snapDistance;
|
snappingLabel << "bottomSnapping of ";
|
||||||
otherSnappingVar = otherWindow->fBottomVar;
|
switch (otherSnap) {
|
||||||
|
case SNAP_TOP:
|
||||||
|
snapDistance = 32;
|
||||||
|
moveDeltaY
|
||||||
|
= otherFrame.top - thisFrame.bottom - snapDistance;
|
||||||
|
otherSnappingVar = otherWindow->fTopVar;
|
||||||
|
break;
|
||||||
|
case SNAP_BOTTOM:
|
||||||
|
moveDeltaY = otherFrame.bottom - thisFrame.bottom;
|
||||||
|
otherSnappingVar = otherWindow->fBottomVar;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default: //SNAP_BOTTOM
|
|
||||||
thisSnappingVar = fBottomVar;
|
|
||||||
snappingLabel << "bottomSnapping of ";
|
|
||||||
switch(otherSnap) {
|
|
||||||
case SNAP_TOP:
|
|
||||||
snapDistance = 32;
|
|
||||||
moveDeltaY = otherFrame.top - thisFrame.bottom - snapDistance;
|
|
||||||
otherSnappingVar = otherWindow->fTopVar;
|
|
||||||
break;
|
|
||||||
case SNAP_BOTTOM:
|
|
||||||
moveDeltaY = otherFrame.bottom - thisFrame.bottom;
|
|
||||||
otherSnappingVar = otherWindow->fBottomVar;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fDesktop->MoveWindowBy(this, moveDeltaX, moveDeltaY, 0);
|
fDesktop->MoveWindowBy(this, moveDeltaX, moveDeltaY, 0);
|
||||||
@ -3764,10 +3768,11 @@ Window::SnapToWindow(Window* otherWindow,
|
|||||||
Constraint* snappingConstraint;
|
Constraint* snappingConstraint;
|
||||||
if (snapDistance == 0)
|
if (snapDistance == 0)
|
||||||
snappingConstraint = thisSnappingVar->IsEqual(otherSnappingVar);
|
snappingConstraint = thisSnappingVar->IsEqual(otherSnappingVar);
|
||||||
else
|
else {
|
||||||
snappingConstraint = fDesktop->fStackAndTileSpec->AddConstraint(
|
snappingConstraint = fDesktop->fStackAndTileSpec->AddConstraint(
|
||||||
-1, thisSnappingVar, 1, otherSnappingVar,
|
-1, thisSnappingVar, 1, otherSnappingVar, OperatorType(EQ),
|
||||||
OperatorType(EQ), snapDistance);
|
snapDistance);
|
||||||
|
}
|
||||||
|
|
||||||
snappingLabel << Title();
|
snappingLabel << Title();
|
||||||
snappingConstraint->SetLabel(snappingLabel.String());
|
snappingConstraint->SetLabel(snappingLabel.String());
|
||||||
@ -3795,9 +3800,8 @@ Window::SnapToWindow(Window* otherWindow,
|
|||||||
should be stored.
|
should be stored.
|
||||||
*/
|
*/
|
||||||
BRect
|
BRect
|
||||||
Window::_BoundingRectAndWindows(BList* windows,
|
Window::_BoundingRectAndWindows(BList* windows, Window** leftmostWindow,
|
||||||
Window** leftmostWindow, Window** topmostWindow,
|
Window** topmostWindow, Window** rightmostWindow, Window** bottommostWindow)
|
||||||
Window** rightmostWindow, Window** bottommostWindow)
|
|
||||||
{
|
{
|
||||||
ASSERT(!windows->IsEmpty());
|
ASSERT(!windows->IsEmpty());
|
||||||
|
|
||||||
@ -3916,10 +3920,8 @@ Window::StackAndTile()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set window locations and sizes
|
// set window locations and sizes
|
||||||
for (Window* window = fDesktop->GetWindows().LastWindow();
|
for (Window* window = fDesktop->GetWindows().LastWindow(); window != NULL;
|
||||||
window;
|
window = window->PreviousWindow(fCurrentWorkspace)) {
|
||||||
window = window->PreviousWindow(fCurrentWorkspace)) {
|
|
||||||
|
|
||||||
if (window->fLeftVar) {
|
if (window->fLeftVar) {
|
||||||
fDesktop->MoveWindowBy(window,
|
fDesktop->MoveWindowBy(window,
|
||||||
window->fLeftVar->Value() - window->fFrame.left,
|
window->fLeftVar->Value() - window->fFrame.left,
|
||||||
@ -3942,7 +3944,7 @@ Window::StackAndTile()
|
|||||||
|
|
||||||
_ArrangeStackedWindowTabs();
|
_ArrangeStackedWindowTabs();
|
||||||
|
|
||||||
#ifdef DEBUG_STACK_AND_TILE
|
#ifdef DEBUG_STACK_AND_TILE
|
||||||
// debug_printf crashes if given too large strings
|
// debug_printf crashes if given too large strings
|
||||||
// therefore we cut our specification string up into smaller chunks
|
// therefore we cut our specification string up into smaller chunks
|
||||||
BString* specStr = fDesktop->fStackAndTileSpec->ToBString();
|
BString* specStr = fDesktop->fStackAndTileSpec->ToBString();
|
||||||
@ -3972,8 +3974,8 @@ Window::StackAndTile()
|
|||||||
}
|
}
|
||||||
debug_printf("\n");
|
debug_printf("\n");
|
||||||
delete specStr;
|
delete specStr;
|
||||||
#endif
|
|
||||||
STRACE_SAT(("Finished Window::StackAndTile() on %s\n", Title()));
|
STRACE_SAT(("Finished Window::StackAndTile() on %s\n", Title()));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -4009,7 +4011,7 @@ Window::_UnboundWindowByWorkspace()
|
|||||||
int32
|
int32
|
||||||
Window::WindowId()
|
Window::WindowId()
|
||||||
{
|
{
|
||||||
if(!fId)
|
if (!fId)
|
||||||
fId = rand() + 1;
|
fId = rand() + 1;
|
||||||
|
|
||||||
return fId;
|
return fId;
|
||||||
@ -4030,8 +4032,8 @@ Window::SetWindowId(int32 windowId)
|
|||||||
void
|
void
|
||||||
Window::_RemoveStackingPersistently()
|
Window::_RemoveStackingPersistently()
|
||||||
{
|
{
|
||||||
STRACE_SAT(("Window::_RemoveStackingPersistently() on %s, fStackedWindowIds=%x\n",
|
STRACE_SAT(("Window::_RemoveStackingPersistently() on %s, "
|
||||||
Title(), fStackedWindowIds));
|
"fStackedWindowIds=%x\n", Title(), fStackedWindowIds));
|
||||||
if (!fStackedWindowIds)
|
if (!fStackedWindowIds)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -4083,9 +4085,9 @@ Window::_RemoveSnappingPersistently()
|
|||||||
id from the snapping list of other relevant windows
|
id from the snapping list of other relevant windows
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Window::_FreeUpSnappingList(SnapOrientation thisSnap,
|
Window::_FreeUpSnappingList(SnapOrientation thisSnap, SnapOrientation otherSnap,
|
||||||
SnapOrientation otherSnap,
|
bool deleteFromOtherWindowsList)
|
||||||
bool deleteFromOtherWindowsList) {
|
{
|
||||||
BList** idListRef = _GetSnappingListRef(thisSnap, otherSnap, false);
|
BList** idListRef = _GetSnappingListRef(thisSnap, otherSnap, false);
|
||||||
|
|
||||||
if (!idListRef)
|
if (!idListRef)
|
||||||
@ -4099,10 +4101,12 @@ Window::_FreeUpSnappingList(SnapOrientation thisSnap,
|
|||||||
int32* id = static_cast<int32*>(idList->ItemAt(i));
|
int32* id = static_cast<int32*>(idList->ItemAt(i));
|
||||||
if (deleteFromOtherWindowsList) {
|
if (deleteFromOtherWindowsList) {
|
||||||
Window* otherWindow = fDesktop->FindWindow(*id);
|
Window* otherWindow = fDesktop->FindWindow(*id);
|
||||||
//Remove this window from the other window's snapping list.
|
// Remove this window from the other window's snapping list.
|
||||||
//Note the order of orientation is reversed.
|
// Note the order of orientation is reversed.
|
||||||
if (otherWindow)
|
if (otherWindow) {
|
||||||
otherWindow->RemoveFromSnappingList(WindowId(), otherSnap, thisSnap);
|
otherWindow->RemoveFromSnappingList(WindowId(), otherSnap,
|
||||||
|
thisSnap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
free(id);
|
free(id);
|
||||||
}
|
}
|
||||||
@ -4134,5 +4138,3 @@ Window::UpdateSession::AddCause(uint8 cause)
|
|||||||
{
|
{
|
||||||
fCause |= cause;
|
fCause |= cause;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ enum SnapOrientation {
|
|||||||
SNAP_LEFT, SNAP_RIGHT, SNAP_TOP, SNAP_BOTTOM
|
SNAP_LEFT, SNAP_RIGHT, SNAP_TOP, SNAP_BOTTOM
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Window {
|
class Window {
|
||||||
public:
|
public:
|
||||||
Window(const BRect& frame, const char *name,
|
Window(const BRect& frame, const char *name,
|
||||||
@ -191,7 +192,7 @@ public:
|
|||||||
float TabLocation() const;
|
float TabLocation() const;
|
||||||
|
|
||||||
bool SetDecoratorSettings(const BMessage& settings,
|
bool SetDecoratorSettings(const BMessage& settings,
|
||||||
BRegion& dirty);
|
BRegion& dirty);
|
||||||
bool GetDecoratorSettings(BMessage* settings);
|
bool GetDecoratorSettings(BMessage* settings);
|
||||||
|
|
||||||
void HighlightDecorator(bool active);
|
void HighlightDecorator(bool active);
|
||||||
@ -333,6 +334,39 @@ protected:
|
|||||||
void _AlterDeltaForSnap(BPoint& delta,
|
void _AlterDeltaForSnap(BPoint& delta,
|
||||||
bigtime_t now);
|
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;
|
BString fTitle;
|
||||||
// TODO: no fp rects anywhere
|
// TODO: no fp rects anywhere
|
||||||
BRect fFrame;
|
BRect fFrame;
|
||||||
@ -454,37 +488,6 @@ protected:
|
|||||||
int32 fWorkspacesViewCount;
|
int32 fWorkspacesViewCount;
|
||||||
|
|
||||||
// Stack & Tile specific members
|
// 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);
|
|
||||||
|
|
||||||
Variable* fLeftVar;
|
Variable* fLeftVar;
|
||||||
Variable* fTopVar;
|
Variable* fTopVar;
|
||||||
Variable* fRightVar;
|
Variable* fRightVar;
|
||||||
|
@ -135,8 +135,7 @@ WorkspacesView::_WorkspaceAt(BPoint where, int32& index)
|
|||||||
|
|
||||||
BRect
|
BRect
|
||||||
WorkspacesView::_WindowFrame(const BRect& workspaceFrame,
|
WorkspacesView::_WindowFrame(const BRect& workspaceFrame,
|
||||||
const BRect& screenFrame, const BRect& windowFrame,
|
const BRect& screenFrame, const BRect& windowFrame, BPoint windowPosition)
|
||||||
BPoint windowPosition)
|
|
||||||
{
|
{
|
||||||
BRect frame = windowFrame;
|
BRect frame = windowFrame;
|
||||||
frame.OffsetTo(windowPosition);
|
frame.OffsetTo(windowPosition);
|
||||||
@ -568,10 +567,10 @@ WorkspacesView::MouseMoved(BMessage* message, BPoint where)
|
|||||||
if (fHasMoved) {
|
if (fHasMoved) {
|
||||||
Window()->Desktop()->MoveWindowBy(fSelectedWindow, left - leftTop.x,
|
Window()->Desktop()->MoveWindowBy(fSelectedWindow, left - leftTop.x,
|
||||||
top - leftTop.y, fSelectedWorkspace);
|
top - leftTop.y, fSelectedWorkspace);
|
||||||
//TODO Re-apply stack & tile constraints so that any other windows
|
// TODO: Re-apply stack & tile constraints so that any other windows
|
||||||
//that are stacked/snapped against this window can be re-adjusted.
|
// that are stacked/snapped against this window can be re-adjusted.
|
||||||
//Must smartly call stack and tile after workspace shifting has
|
// Must smartly call stack and tile after workspace shifting has
|
||||||
//finalised. How?
|
// finalised. How?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user