* The app_server no longer uses workspace counts internally, but only columns,
and rows. * set_workspace_count() now uses the logic formerly found in WorkspacesView::_GetGrid() to determine the layout. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31958 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -178,9 +178,9 @@ enum {
|
|||||||
AS_GET_DECORATOR_NAME,
|
AS_GET_DECORATOR_NAME,
|
||||||
|
|
||||||
AS_COUNT_WORKSPACES,
|
AS_COUNT_WORKSPACES,
|
||||||
AS_SET_WORKSPACE_COUNT,
|
|
||||||
AS_CURRENT_WORKSPACE,
|
AS_CURRENT_WORKSPACE,
|
||||||
AS_ACTIVATE_WORKSPACE,
|
AS_ACTIVATE_WORKSPACE,
|
||||||
|
AS_SET_WORKSPACE_LAYOUT,
|
||||||
AS_GET_WORKSPACE_LAYOUT,
|
AS_GET_WORKSPACE_LAYOUT,
|
||||||
AS_GET_SCROLLBAR_INFO,
|
AS_GET_SCROLLBAR_INFO,
|
||||||
AS_SET_SCROLLBAR_INFO,
|
AS_SET_SCROLLBAR_INFO,
|
||||||
|
|||||||
@@ -717,25 +717,39 @@ keyboard_navigation_color()
|
|||||||
int32
|
int32
|
||||||
count_workspaces()
|
count_workspaces()
|
||||||
{
|
{
|
||||||
int32 count = 1;
|
int32 columns = 1;
|
||||||
|
int32 rows = 1;
|
||||||
|
|
||||||
BPrivate::AppServerLink link;
|
BPrivate::AppServerLink link;
|
||||||
link.StartMessage(AS_COUNT_WORKSPACES);
|
link.StartMessage(AS_GET_WORKSPACE_LAYOUT);
|
||||||
|
|
||||||
status_t status;
|
status_t status;
|
||||||
if (link.FlushWithReply(status) == B_OK && status == B_OK)
|
if (link.FlushWithReply(status) == B_OK && status == B_OK) {
|
||||||
link.Read<int32>(&count);
|
link.Read<int32>(&columns);
|
||||||
|
link.Read<int32>(&rows);
|
||||||
|
}
|
||||||
|
|
||||||
return count;
|
return columns * rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
set_workspace_count(int32 count)
|
set_workspace_count(int32 count)
|
||||||
{
|
{
|
||||||
|
int32 squareRoot = (int32)sqrt(count);
|
||||||
|
|
||||||
|
int32 rows = 1;
|
||||||
|
for (int32 i = 2; i <= squareRoot; i++) {
|
||||||
|
if (count % i == 0)
|
||||||
|
rows = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 columns = count / rows;
|
||||||
|
|
||||||
BPrivate::AppServerLink link;
|
BPrivate::AppServerLink link;
|
||||||
link.StartMessage(AS_SET_WORKSPACE_COUNT);
|
link.StartMessage(AS_SET_WORKSPACE_LAYOUT);
|
||||||
link.Attach<int32>(count);
|
link.Attach<int32>(columns);
|
||||||
|
link.Attach<int32>(rows);
|
||||||
link.Flush();
|
link.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -147,7 +147,7 @@ KeyboardFilter::Filter(BMessage* message, EventTarget** _target,
|
|||||||
&& message->FindInt32("key", &key) == B_OK
|
&& message->FindInt32("key", &key) == B_OK
|
||||||
&& message->FindInt32("modifiers", &modifiers) == B_OK) {
|
&& message->FindInt32("modifiers", &modifiers) == B_OK) {
|
||||||
// Check for safe video mode (cmd + ctrl + escape)
|
// Check for safe video mode (cmd + ctrl + escape)
|
||||||
if (key == 0x01 && (modifiers & B_COMMAND_KEY) != 0
|
if (key == 0x01 && (modifiers & B_COMMAND_KEY) != 0
|
||||||
&& (modifiers & B_CONTROL_KEY) != 0) {
|
&& (modifiers & B_CONTROL_KEY) != 0) {
|
||||||
system("screenmode --fall-back &");
|
system("screenmode --fall-back &");
|
||||||
return B_SKIP_MESSAGE;
|
return B_SKIP_MESSAGE;
|
||||||
@@ -844,15 +844,16 @@ Desktop::StoreWorkspaceConfiguration(int32 index)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
Desktop::SetWorkspacesCount(int32 newCount)
|
Desktop::SetWorkspacesLayout(int32 newColumns, int32 newRows)
|
||||||
{
|
{
|
||||||
|
int32 newCount = newColumns * newRows;
|
||||||
if (newCount < 1 || newCount > kMaxWorkspaces)
|
if (newCount < 1 || newCount > kMaxWorkspaces)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
if (!LockAllWindows())
|
if (!LockAllWindows())
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
fSettings->SetWorkspacesCount(newCount);
|
fSettings->SetWorkspacesLayout(newColumns, newRows);
|
||||||
|
|
||||||
// either update the workspaces window, or switch to
|
// either update the workspaces window, or switch to
|
||||||
// the last available workspace - which will update
|
// the last available workspace - which will update
|
||||||
@@ -895,8 +896,7 @@ Desktop::WorkspaceFrame(int32 index) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*! Changes the current workspace to the one specified by \a index.
|
||||||
Changes the current workspace to the one specified by \a index.
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Desktop::SetWorkspaceAsync(int32 index)
|
Desktop::SetWorkspaceAsync(int32 index)
|
||||||
@@ -908,8 +908,7 @@ Desktop::SetWorkspaceAsync(int32 index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*! Changes the current workspace to the one specified by \a index.
|
||||||
Changes the current workspace to the one specified by \a index.
|
|
||||||
You must not hold any window lock when calling this method.
|
You must not hold any window lock when calling this method.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -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:
|
||||||
@@ -111,7 +111,7 @@ class Desktop : public MessageLooper, public ScreenOwner {
|
|||||||
{ return fCurrentWorkspace; }
|
{ return fCurrentWorkspace; }
|
||||||
Workspace::Private& WorkspaceAt(int32 index)
|
Workspace::Private& WorkspaceAt(int32 index)
|
||||||
{ return fWorkspaces[index]; }
|
{ return fWorkspaces[index]; }
|
||||||
status_t SetWorkspacesCount(int32 newCount);
|
status_t SetWorkspacesLayout(int32 columns, int32 rows);
|
||||||
BRect WorkspaceFrame(int32 index) const;
|
BRect WorkspaceFrame(int32 index) const;
|
||||||
|
|
||||||
// Window methods
|
// Window methods
|
||||||
|
|||||||
@@ -70,9 +70,11 @@ DesktopSettingsPrivate::_SetDefaults()
|
|||||||
fMenuInfo.click_to_open = true; // always true
|
fMenuInfo.click_to_open = true; // always true
|
||||||
fMenuInfo.triggers_always_shown = false;
|
fMenuInfo.triggers_always_shown = false;
|
||||||
|
|
||||||
fWorkspacesCount = 4;
|
fWorkspacesColumns = 2;
|
||||||
|
fWorkspacesRows = 2;
|
||||||
|
|
||||||
memcpy(fShared.colors, BPrivate::kDefaultColors, sizeof(rgb_color) * kNumColors);
|
memcpy(fShared.colors, BPrivate::kDefaultColors,
|
||||||
|
sizeof(rgb_color) * kNumColors);
|
||||||
|
|
||||||
gSubpixelAntialiasing = false;
|
gSubpixelAntialiasing = false;
|
||||||
gDefaultHintingMode = HINTING_MODE_ON;
|
gDefaultHintingMode = HINTING_MODE_ON;
|
||||||
@@ -117,16 +119,18 @@ DesktopSettingsPrivate::_Load()
|
|||||||
BMessage settings;
|
BMessage settings;
|
||||||
status = settings.Unflatten(&file);
|
status = settings.Unflatten(&file);
|
||||||
if (status == B_OK) {
|
if (status == B_OK) {
|
||||||
int32 count;
|
int32 columns;
|
||||||
if (settings.FindInt32("count", &count) == B_OK) {
|
int32 rows;
|
||||||
fWorkspacesCount = count;
|
if (settings.FindInt32("columns", &columns) == B_OK
|
||||||
if (fWorkspacesCount < 1 || fWorkspacesCount > 32)
|
&& settings.FindInt32("rows", &rows) == B_OK) {
|
||||||
fWorkspacesCount = 4;
|
_ValidateWorkspacesLayout(columns, rows);
|
||||||
|
fWorkspacesColumns = columns;
|
||||||
|
fWorkspacesRows = rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 i = 0;
|
int32 i = 0;
|
||||||
while (i < kMaxWorkspaces
|
while (i < kMaxWorkspaces && settings.FindMessage("workspace",
|
||||||
&& settings.FindMessage("workspace", i, &fWorkspaceMessages[i]) == B_OK) {
|
i, &fWorkspaceMessages[i]) == B_OK) {
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -293,7 +297,8 @@ DesktopSettingsPrivate::Save(uint32 mask)
|
|||||||
BPath path(basePath);
|
BPath path(basePath);
|
||||||
if (path.Append("workspaces") == B_OK) {
|
if (path.Append("workspaces") == B_OK) {
|
||||||
BMessage settings('asws');
|
BMessage settings('asws');
|
||||||
settings.AddInt32("count", fWorkspacesCount);
|
settings.AddInt32("columns", fWorkspacesColumns);
|
||||||
|
settings.AddInt32("rows", fWorkspacesRows);
|
||||||
|
|
||||||
for (int32 i = 0; i < kMaxWorkspaces; i++) {
|
for (int32 i = 0; i < kMaxWorkspaces; i++) {
|
||||||
settings.AddMessage("workspace", &fWorkspaceMessages[i]);
|
settings.AddMessage("workspace", &fWorkspaceMessages[i]);
|
||||||
@@ -519,14 +524,12 @@ DesktopSettingsPrivate::ShowAllDraggers() const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
DesktopSettingsPrivate::SetWorkspacesCount(int32 number)
|
DesktopSettingsPrivate::SetWorkspacesLayout(int32 columns, int32 rows)
|
||||||
{
|
{
|
||||||
if (number < 1)
|
_ValidateWorkspacesLayout(columns, rows);
|
||||||
number = 1;
|
fWorkspacesColumns = columns;
|
||||||
else if (number > kMaxWorkspaces)
|
fWorkspacesRows = rows;
|
||||||
number = kMaxWorkspaces;
|
|
||||||
|
|
||||||
fWorkspacesCount = number;
|
|
||||||
Save(kWorkspacesSettings);
|
Save(kWorkspacesSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -534,7 +537,21 @@ DesktopSettingsPrivate::SetWorkspacesCount(int32 number)
|
|||||||
int32
|
int32
|
||||||
DesktopSettingsPrivate::WorkspacesCount() const
|
DesktopSettingsPrivate::WorkspacesCount() const
|
||||||
{
|
{
|
||||||
return fWorkspacesCount;
|
return fWorkspacesColumns * fWorkspacesRows;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32
|
||||||
|
DesktopSettingsPrivate::WorkspacesColumns() const
|
||||||
|
{
|
||||||
|
return fWorkspacesColumns;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32
|
||||||
|
DesktopSettingsPrivate::WorkspacesRows() const
|
||||||
|
{
|
||||||
|
return fWorkspacesRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -644,6 +661,24 @@ DesktopSettingsPrivate::IsSubpixelOrderingRegular() const
|
|||||||
return gSubpixelOrderingRGB;
|
return gSubpixelOrderingRGB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
DesktopSettingsPrivate::_ValidateWorkspacesLayout(int32& columns,
|
||||||
|
int32& rows) const
|
||||||
|
{
|
||||||
|
if (columns < 1)
|
||||||
|
columns = 1;
|
||||||
|
if (rows < 1)
|
||||||
|
rows = 1;
|
||||||
|
|
||||||
|
if (columns * rows > kMaxWorkspaces) {
|
||||||
|
// Revert to defaults in case of invalid settings
|
||||||
|
columns = 2;
|
||||||
|
rows = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark - read access
|
// #pragma mark - read access
|
||||||
|
|
||||||
|
|
||||||
@@ -722,6 +757,20 @@ DesktopSettings::WorkspacesCount() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32
|
||||||
|
DesktopSettings::WorkspacesColumns() const
|
||||||
|
{
|
||||||
|
return fSettings->WorkspacesColumns();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int32
|
||||||
|
DesktopSettings::WorkspacesRows() const
|
||||||
|
{
|
||||||
|
return fSettings->WorkspacesRows();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const BMessage*
|
const BMessage*
|
||||||
DesktopSettings::WorkspacesMessage(int32 index) const
|
DesktopSettings::WorkspacesMessage(int32 index) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ class DesktopSettings {
|
|||||||
bool ShowAllDraggers() const;
|
bool ShowAllDraggers() const;
|
||||||
|
|
||||||
int32 WorkspacesCount() const;
|
int32 WorkspacesCount() const;
|
||||||
|
int32 WorkspacesColumns() const;
|
||||||
|
int32 WorkspacesRows() const;
|
||||||
const BMessage* WorkspacesMessage(int32 index) const;
|
const BMessage* WorkspacesMessage(int32 index) const;
|
||||||
|
|
||||||
rgb_color UIColor(color_which which) const;
|
rgb_color UIColor(color_which which) const;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005-2008, Haiku.
|
* Copyright 2005-2009, Haiku.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -48,8 +48,10 @@ public:
|
|||||||
void SetShowAllDraggers(bool show);
|
void SetShowAllDraggers(bool show);
|
||||||
bool ShowAllDraggers() const;
|
bool ShowAllDraggers() const;
|
||||||
|
|
||||||
void SetWorkspacesCount(int32 number);
|
void SetWorkspacesLayout(int32 columns, int32 rows);
|
||||||
int32 WorkspacesCount() const;
|
int32 WorkspacesCount() const;
|
||||||
|
int32 WorkspacesColumns() const;
|
||||||
|
int32 WorkspacesRows() const;
|
||||||
|
|
||||||
void SetWorkspacesMessage(int32 index,
|
void SetWorkspacesMessage(int32 index,
|
||||||
BMessage& message);
|
BMessage& message);
|
||||||
@@ -73,6 +75,8 @@ private:
|
|||||||
void _SetDefaults();
|
void _SetDefaults();
|
||||||
status_t _Load();
|
status_t _Load();
|
||||||
status_t _GetPath(BPath& path);
|
status_t _GetPath(BPath& path);
|
||||||
|
void _ValidateWorkspacesLayout(int32& columns,
|
||||||
|
int32& rows) const;
|
||||||
|
|
||||||
ServerFont fPlainFont;
|
ServerFont fPlainFont;
|
||||||
ServerFont fBoldFont;
|
ServerFont fBoldFont;
|
||||||
@@ -82,7 +86,8 @@ private:
|
|||||||
menu_info fMenuInfo;
|
menu_info fMenuInfo;
|
||||||
mode_mouse fMouseMode;
|
mode_mouse fMouseMode;
|
||||||
bool fShowAllDraggers;
|
bool fShowAllDraggers;
|
||||||
int32 fWorkspacesCount;
|
int32 fWorkspacesColumns;
|
||||||
|
int32 fWorkspacesRows;
|
||||||
BMessage fWorkspaceMessages[kMaxWorkspaces];
|
BMessage fWorkspaceMessages[kMaxWorkspaces];
|
||||||
|
|
||||||
server_read_only_memory& fShared;
|
server_read_only_memory& fShared;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2007-2008, Haiku Inc. All rights reserved.
|
* Copyright 2007-2009, Haiku Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -18,9 +18,12 @@ string_for_message_code(uint32 code, BString& string)
|
|||||||
string = "";
|
string = "";
|
||||||
|
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case AS_GET_DESKTOP: string = "AS_GET_DESKTOP"; break;
|
// Return the exact name for each constant
|
||||||
case AS_REGISTER_INPUT_SERVER: string = "AS_REGISTER_INPUT_SERVER"; break;
|
#define CODE(x) case x: string = #x; break
|
||||||
case AS_EVENT_STREAM_CLOSED: string = "AS_EVENT_STREAM_CLOSED"; break;
|
|
||||||
|
CODE(AS_GET_DESKTOP);
|
||||||
|
CODE(AS_REGISTER_INPUT_SERVER);
|
||||||
|
CODE(AS_EVENT_STREAM_CLOSED);
|
||||||
|
|
||||||
// Desktop definitions (through the ServerApp, though)
|
// Desktop definitions (through the ServerApp, though)
|
||||||
case AS_GET_WINDOW_LIST: string = "AS_GET_WINDOW_LIST"; break;
|
case AS_GET_WINDOW_LIST: string = "AS_GET_WINDOW_LIST"; break;
|
||||||
@@ -160,8 +163,8 @@ string_for_message_code(uint32 code, BString& string)
|
|||||||
case AS_COUNT_DECORATORS: string = "AS_COUNT_DECORATORS"; break;
|
case AS_COUNT_DECORATORS: string = "AS_COUNT_DECORATORS"; break;
|
||||||
case AS_GET_DECORATOR_NAME: string = "AS_GET_DECORATOR_NAME"; break;
|
case AS_GET_DECORATOR_NAME: string = "AS_GET_DECORATOR_NAME"; break;
|
||||||
|
|
||||||
case AS_COUNT_WORKSPACES: string = "AS_COUNT_WORKSPACES"; break;
|
CODE(AS_SET_WORKSPACE_LAYOUT);
|
||||||
case AS_SET_WORKSPACE_COUNT: string = "AS_SET_WORKSPACE_COUNT"; break;
|
CODE(AS_GET_WORKSPACE_LAYOUT);
|
||||||
case AS_CURRENT_WORKSPACE: string = "AS_CURRENT_WORKSPACE"; break;
|
case AS_CURRENT_WORKSPACE: string = "AS_CURRENT_WORKSPACE"; break;
|
||||||
case AS_ACTIVATE_WORKSPACE: string = "AS_ACTIVATE_WORKSPACE"; break;
|
case AS_ACTIVATE_WORKSPACE: string = "AS_ACTIVATE_WORKSPACE"; break;
|
||||||
case AS_GET_SCROLLBAR_INFO: string = "AS_GET_SCROLLBAR_INFO"; break;
|
case AS_GET_SCROLLBAR_INFO: string = "AS_GET_SCROLLBAR_INFO"; break;
|
||||||
|
|||||||
@@ -797,29 +797,6 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case AS_COUNT_WORKSPACES:
|
|
||||||
{
|
|
||||||
if (fDesktop->LockSingleWindow()) {
|
|
||||||
DesktopSettings settings(fDesktop);
|
|
||||||
|
|
||||||
fLink.StartMessage(B_OK);
|
|
||||||
fLink.Attach<int32>(settings.WorkspacesCount());
|
|
||||||
fDesktop->UnlockSingleWindow();
|
|
||||||
} else
|
|
||||||
fLink.StartMessage(B_ERROR);
|
|
||||||
|
|
||||||
fLink.Flush();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case AS_SET_WORKSPACE_COUNT:
|
|
||||||
{
|
|
||||||
int32 newCount;
|
|
||||||
if (link.Read<int32>(&newCount) == B_OK)
|
|
||||||
fDesktop->SetWorkspacesCount(newCount);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case AS_CURRENT_WORKSPACE:
|
case AS_CURRENT_WORKSPACE:
|
||||||
STRACE(("ServerApp %s: get current workspace\n", Signature()));
|
STRACE(("ServerApp %s: get current workspace\n", Signature()));
|
||||||
|
|
||||||
@@ -845,26 +822,29 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case AS_SET_WORKSPACE_LAYOUT:
|
||||||
|
{
|
||||||
|
int32 newColumns;
|
||||||
|
int32 newRows;
|
||||||
|
if (link.Read<int32>(&newColumns) == B_OK
|
||||||
|
&& link.Read<int32>(&newRows) == B_OK)
|
||||||
|
fDesktop->SetWorkspacesLayout(newColumns, newRows);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case AS_GET_WORKSPACE_LAYOUT:
|
case AS_GET_WORKSPACE_LAYOUT:
|
||||||
{
|
{
|
||||||
// TODO: this is taken from WorkspacesView::_GetGrid() - this is
|
if (fDesktop->LockSingleWindow()) {
|
||||||
// only a temporary solution
|
DesktopSettings settings(fDesktop);
|
||||||
DesktopSettings settings(fDesktop);
|
|
||||||
|
|
||||||
int32 count = settings.WorkspacesCount();
|
fLink.StartMessage(B_OK);
|
||||||
int32 squareRoot = (int32)sqrt(count);
|
fLink.Attach<int32>(settings.WorkspacesColumns());
|
||||||
|
fLink.Attach<int32>(settings.WorkspacesRows());
|
||||||
|
|
||||||
int32 rows = 1;
|
fDesktop->UnlockSingleWindow();
|
||||||
for (int32 i = 2; i <= squareRoot; i++) {
|
} else
|
||||||
if (count % i == 0)
|
fLink.StartMessage(B_ERROR);
|
||||||
rows = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32 columns = count / rows;
|
|
||||||
|
|
||||||
fLink.StartMessage(B_OK);
|
|
||||||
fLink.Attach<int32>(columns);
|
|
||||||
fLink.Attach<int32>(rows);
|
|
||||||
fLink.Flush();
|
fLink.Flush();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005-2008, Haiku Inc.
|
* Copyright 2005-2009, Haiku Inc.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -62,21 +62,12 @@ WorkspacesView::_GetGrid(int32& columns, int32& rows)
|
|||||||
{
|
{
|
||||||
DesktopSettings settings(Window()->Desktop());
|
DesktopSettings settings(Window()->Desktop());
|
||||||
|
|
||||||
int32 count = settings.WorkspacesCount();
|
columns = settings.WorkspacesColumns();
|
||||||
int32 squareRoot = (int32)sqrt(count);
|
rows = settings.WorkspacesRows();
|
||||||
|
|
||||||
rows = 1;
|
|
||||||
for (int32 i = 2; i <= squareRoot; i++) {
|
|
||||||
if (count % i == 0)
|
|
||||||
rows = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
columns = count / rows;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*! \brief Returns the frame of the screen for the specified workspace.
|
||||||
\brief Returns the frame of the screen for the specified workspace.
|
|
||||||
*/
|
*/
|
||||||
BRect
|
BRect
|
||||||
WorkspacesView::_ScreenFrame(int32 i)
|
WorkspacesView::_ScreenFrame(int32 i)
|
||||||
@@ -85,8 +76,7 @@ WorkspacesView::_ScreenFrame(int32 i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*! \brief Returns the frame of the specified workspace within the
|
||||||
\brief Returns the frame of the specified workspace within the
|
|
||||||
workspaces view.
|
workspaces view.
|
||||||
*/
|
*/
|
||||||
BRect
|
BRect
|
||||||
@@ -119,8 +109,7 @@ WorkspacesView::_WorkspaceAt(int32 i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*! \brief Returns the workspace frame and index of the workspace
|
||||||
\brief Returns the workspace frame and index of the workspace
|
|
||||||
under \a where.
|
under \a where.
|
||||||
|
|
||||||
If, for some reason, there is no workspace located under \where,
|
If, for some reason, there is no workspace located under \where,
|
||||||
|
|||||||
Reference in New Issue
Block a user