* Added two more private InterfaceDefs functions: get_application_order(), and
get_window_order() will retrieve the application respectively window order on the selected workspace. * Moved private BeOS compatible functions (as used by the Deskbar) into the private WindowInfo.h header. * Whitespace cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26951 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
a8f4e1d0fd
commit
ae0606be74
@ -41,6 +41,8 @@ enum {
|
|||||||
AS_MINIMIZE_TEAM,
|
AS_MINIMIZE_TEAM,
|
||||||
AS_BRING_TEAM_TO_FRONT,
|
AS_BRING_TEAM_TO_FRONT,
|
||||||
AS_WINDOW_ACTION,
|
AS_WINDOW_ACTION,
|
||||||
|
AS_GET_APPLICATION_ORDER,
|
||||||
|
AS_GET_WINDOW_ORDER,
|
||||||
|
|
||||||
// Application definitions
|
// Application definitions
|
||||||
AS_CREATE_APP,
|
AS_CREATE_APP,
|
||||||
|
@ -42,4 +42,23 @@ enum window_action {
|
|||||||
B_BRING_TO_FRONT
|
B_BRING_TO_FRONT
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// Private BeOS compatible window API
|
||||||
|
|
||||||
|
void do_window_action(int32 window_id, int32 action, BRect zoomRect, bool zoom);
|
||||||
|
client_window_info* get_window_info(int32 token);
|
||||||
|
int32* get_token_list(team_id app, int32 *count);
|
||||||
|
void do_bring_to_front_team(BRect zoomRect, team_id app, bool zoom);
|
||||||
|
void do_minimize_team(BRect zoomRect, team_id app, bool zoom);
|
||||||
|
|
||||||
|
// Haiku additions
|
||||||
|
|
||||||
|
namespace BPrivate {
|
||||||
|
|
||||||
|
status_t get_application_order(int32 workspace, team_id** _apps, int32* _count);
|
||||||
|
status_t get_window_order(int32 workspace, int32** _tokens, int32* _count);
|
||||||
|
|
||||||
|
} // namespace BPrivate
|
||||||
|
|
||||||
|
|
||||||
#endif // _WINDOW_INFO_H_
|
#endif // _WINDOW_INFO_H_
|
||||||
|
@ -1067,6 +1067,63 @@ set_decorator(const int32 &index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
get_application_order(int32 workspace, team_id** _applications,
|
||||||
|
int32* _count)
|
||||||
|
{
|
||||||
|
BPrivate::AppServerLink link;
|
||||||
|
|
||||||
|
link.StartMessage(AS_GET_APPLICATION_ORDER);
|
||||||
|
link.Attach<int32>(workspace);
|
||||||
|
|
||||||
|
int32 code;
|
||||||
|
status_t status = link.FlushWithReply(code);
|
||||||
|
if (status != B_OK)
|
||||||
|
return status;
|
||||||
|
if (code != B_OK)
|
||||||
|
return code;
|
||||||
|
|
||||||
|
int32 count;
|
||||||
|
link.Read<int32>(&count);
|
||||||
|
|
||||||
|
*_applications = (team_id*)malloc(count * sizeof(team_id));
|
||||||
|
if (*_applications == NULL)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
link.Read(*_applications, count * sizeof(team_id));
|
||||||
|
*_count = count;
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
get_window_order(int32 workspace, int32** _tokens, int32* _count)
|
||||||
|
{
|
||||||
|
BPrivate::AppServerLink link;
|
||||||
|
|
||||||
|
link.StartMessage(AS_GET_WINDOW_ORDER);
|
||||||
|
link.Attach<int32>(workspace);
|
||||||
|
|
||||||
|
int32 code;
|
||||||
|
status_t status = link.FlushWithReply(code);
|
||||||
|
if (status != B_OK)
|
||||||
|
return status;
|
||||||
|
if (code != B_OK)
|
||||||
|
return code;
|
||||||
|
|
||||||
|
int32 count;
|
||||||
|
link.Read<int32>(&count);
|
||||||
|
|
||||||
|
*_tokens = (int32*)malloc(count * sizeof(int32));
|
||||||
|
if (*_tokens == NULL)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
link.Read(*_tokens, count * sizeof(int32));
|
||||||
|
*_count = count;
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace BPrivate
|
} // namespace BPrivate
|
||||||
|
|
||||||
// These methods were marked with "Danger, will Robinson!" in
|
// These methods were marked with "Danger, will Robinson!" in
|
||||||
@ -1074,23 +1131,9 @@ set_decorator(const int32 &index)
|
|||||||
// here.
|
// here.
|
||||||
// In any way, we would need to update Deskbar to use our
|
// In any way, we would need to update Deskbar to use our
|
||||||
// replacements, so we could as well just implement them...
|
// replacements, so we could as well just implement them...
|
||||||
//
|
|
||||||
// They are defined (also the complete window_info structure) in
|
|
||||||
// src/apps/deskbar/WindowMenuItem.h
|
|
||||||
|
|
||||||
struct window_info;
|
|
||||||
|
|
||||||
void do_window_action(int32 window_id, int32 action,
|
|
||||||
BRect zoomRect, bool zoom);
|
|
||||||
window_info *get_window_info(int32 a_token);
|
|
||||||
int32 *get_token_list(team_id app, int32 *count);
|
|
||||||
void do_bring_to_front_team(BRect zoomRect, team_id app, bool zoom);
|
|
||||||
void do_minimize_team(BRect zoomRect, team_id team, bool zoom);
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
do_window_action(int32 windowToken, int32 action,
|
do_window_action(int32 windowToken, int32 action, BRect zoomRect, bool zoom)
|
||||||
BRect zoomRect, bool zoom)
|
|
||||||
{
|
{
|
||||||
BPrivate::AppServerLink link;
|
BPrivate::AppServerLink link;
|
||||||
|
|
||||||
@ -1103,7 +1146,7 @@ do_window_action(int32 windowToken, int32 action,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
window_info *
|
client_window_info*
|
||||||
get_window_info(int32 serverToken)
|
get_window_info(int32 serverToken)
|
||||||
{
|
{
|
||||||
BPrivate::AppServerLink link;
|
BPrivate::AppServerLink link;
|
||||||
@ -1127,8 +1170,8 @@ get_window_info(int32 serverToken)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int32 *
|
int32*
|
||||||
get_token_list(team_id team, int32 *_count)
|
get_token_list(team_id team, int32* _count)
|
||||||
{
|
{
|
||||||
BPrivate::AppServerLink link;
|
BPrivate::AppServerLink link;
|
||||||
|
|
||||||
|
@ -2491,6 +2491,113 @@ Desktop::WriteWindowInfo(int32 serverToken, BPrivate::LinkSender& sender)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Desktop::WriteWindowOrder(int32 workspace, BPrivate::LinkSender& sender)
|
||||||
|
{
|
||||||
|
LockSingleWindow();
|
||||||
|
|
||||||
|
if (workspace < 0)
|
||||||
|
workspace = fCurrentWorkspace;
|
||||||
|
else if (workspace >= kMaxWorkspaces) {
|
||||||
|
sender.StartMessage(B_BAD_VALUE);
|
||||||
|
sender.Flush();
|
||||||
|
UnlockSingleWindow();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// compute the number of windows
|
||||||
|
|
||||||
|
int32 count = 0;
|
||||||
|
|
||||||
|
for (Window *window = _Windows(workspace).LastWindow(); window != NULL;
|
||||||
|
window = window->PreviousWindow(workspace)) {
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// write list
|
||||||
|
|
||||||
|
sender.StartMessage(B_OK);
|
||||||
|
sender.Attach<int32>(count);
|
||||||
|
|
||||||
|
for (Window *window = _Windows(workspace).LastWindow(); window != NULL;
|
||||||
|
window = window->PreviousWindow(workspace)) {
|
||||||
|
sender.Attach<int32>(window->ServerWindow()->ServerToken());
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.Flush();
|
||||||
|
|
||||||
|
UnlockSingleWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
Desktop::WriteApplicationOrder(int32 workspace, BPrivate::LinkSender& sender)
|
||||||
|
{
|
||||||
|
fApplicationsLock.Lock();
|
||||||
|
LockSingleWindow();
|
||||||
|
|
||||||
|
int32 maxCount = fApplications.CountItems();
|
||||||
|
|
||||||
|
fApplicationsLock.Unlock();
|
||||||
|
// as long as we hold the window lock, no new window can appear
|
||||||
|
|
||||||
|
if (workspace < 0)
|
||||||
|
workspace = fCurrentWorkspace;
|
||||||
|
else if (workspace >= kMaxWorkspaces) {
|
||||||
|
sender.StartMessage(B_BAD_VALUE);
|
||||||
|
sender.Flush();
|
||||||
|
UnlockSingleWindow();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// compute the list of applications on this workspace
|
||||||
|
|
||||||
|
team_id* teams = (team_id*)malloc(maxCount * sizeof(team_id));
|
||||||
|
if (teams == NULL) {
|
||||||
|
sender.StartMessage(B_NO_MEMORY);
|
||||||
|
sender.Flush();
|
||||||
|
UnlockSingleWindow();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 count = 0;
|
||||||
|
|
||||||
|
for (Window *window = _Windows(workspace).LastWindow(); window != NULL;
|
||||||
|
window = window->PreviousWindow(workspace)) {
|
||||||
|
team_id team = window->ServerWindow()->ClientTeam();
|
||||||
|
if (count > 1) {
|
||||||
|
// see if we already have this team
|
||||||
|
bool found = false;
|
||||||
|
for (int32 i = 0; i < count; i++) {
|
||||||
|
if (teams[i] == team) {
|
||||||
|
found = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (found)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ASSERT(count < maxCount);
|
||||||
|
teams[count++] = team;
|
||||||
|
}
|
||||||
|
|
||||||
|
UnlockSingleWindow();
|
||||||
|
|
||||||
|
// write list
|
||||||
|
|
||||||
|
sender.StartMessage(B_OK);
|
||||||
|
sender.Attach<int32>(count);
|
||||||
|
|
||||||
|
for (int32 i = 0; i < count; i++) {
|
||||||
|
sender.Attach<int32>(teams[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
sender.Flush();
|
||||||
|
free(teams);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Desktop::MarkDirty(BRegion& region)
|
Desktop::MarkDirty(BRegion& region)
|
||||||
{
|
{
|
||||||
|
@ -210,6 +210,10 @@ class Desktop : public MessageLooper, public ScreenOwner {
|
|||||||
BPrivate::LinkSender& sender);
|
BPrivate::LinkSender& sender);
|
||||||
void WriteWindowInfo(int32 serverToken,
|
void WriteWindowInfo(int32 serverToken,
|
||||||
BPrivate::LinkSender& sender);
|
BPrivate::LinkSender& sender);
|
||||||
|
void WriteApplicationOrder(int32 workspace,
|
||||||
|
BPrivate::LinkSender& sender);
|
||||||
|
void WriteWindowOrder(int32 workspace,
|
||||||
|
BPrivate::LinkSender& sender);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void _LaunchInputServer();
|
void _LaunchInputServer();
|
||||||
|
@ -470,6 +470,22 @@ ServerApp::_DispatchMessage(int32 code, BPrivate::LinkReceiver& link)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case AS_GET_WINDOW_ORDER:
|
||||||
|
{
|
||||||
|
int32 workspace;
|
||||||
|
if (link.Read<int32>(&workspace) == B_OK)
|
||||||
|
fDesktop->WriteWindowOrder(workspace, fLink.Sender());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case AS_GET_APPLICATION_ORDER:
|
||||||
|
{
|
||||||
|
int32 workspace;
|
||||||
|
if (link.Read<int32>(&workspace) == B_OK)
|
||||||
|
fDesktop->WriteApplicationOrder(workspace, fLink.Sender());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case AS_MINIMIZE_TEAM:
|
case AS_MINIMIZE_TEAM:
|
||||||
{
|
{
|
||||||
team_id team;
|
team_id team;
|
||||||
|
Loading…
Reference in New Issue
Block a user