diff --git a/headers/private/app/ServerProtocol.h b/headers/private/app/ServerProtocol.h index 8dcbefc9b2..c5be9d3c5f 100644 --- a/headers/private/app/ServerProtocol.h +++ b/headers/private/app/ServerProtocol.h @@ -1,6 +1,10 @@ #ifndef _APPSERVER_PROTOCOL_ #define _APPSERVER_PROTOCOL_ + +#include + + // Server port names. The input port is the port which is used to receive // input messages from the Input Server. The other is the "main" port for // the server and is utilized mostly by BApplication objects. @@ -9,14 +13,19 @@ enum { // Used for quick replies from the app_server - SERVER_TRUE='_srt', - SERVER_FALSE, - AS_SERVER_BMESSAGE, + SERVER_TRUE = B_OK, + SERVER_FALSE = B_ERROR, + + AS_SERVER_BMESSAGE = 1, AS_SERVER_AREALINK, AS_SERVER_SESSION, AS_SERVER_PORTLINK, AS_CLIENT_DEAD, + // Desktop definitions + AS_GET_WINDOW_LIST, + AS_GET_WINDOW_INFO, + // Application definitions AS_CREATE_APP, AS_DELETE_APP, diff --git a/headers/private/app/WindowInfo.h b/headers/private/app/WindowInfo.h new file mode 100644 index 0000000000..b7156d442b --- /dev/null +++ b/headers/private/app/WindowInfo.h @@ -0,0 +1,53 @@ +/* + * Copyright 2005, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Axel Dörfler, axeld@pinc-software.de + */ +#ifndef _WINDOW_INFO_H_ +#define _WINDOW_INFO_H_ + + +#include + + +struct window_info { + team_id team; + int32 server_token; + + int32 thread; + int32 client_token; + int32 client_port; + uint32 workspaces; + + int32 layer; // whatever this is... + uint32 type; // see below + uint32 flags; + int32 window_left; + int32 window_top; + int32 window_right; + int32 window_bottom; + + int32 show_hide_level; + bool is_mini; +} _PACKED; + +struct client_window_info : window_info { + char name[1]; +} _PACKED; + +enum { + // taken from Deskbar + kNormalWindow = 0, + kDesktopWindow = 1024, + kMenuWindow = 1025, + kWindowScreen = 1026, +}; + +enum window_action { + B_MINIMIZE_WINDOW, + B_BRING_TO_FRONT +}; + +#endif // _WINDOW_INFO_H_ diff --git a/src/kits/interface/InterfaceDefs.cpp b/src/kits/interface/InterfaceDefs.cpp index 4804f9e26f..14cf6ac1d6 100644 --- a/src/kits/interface/InterfaceDefs.cpp +++ b/src/kits/interface/InterfaceDefs.cpp @@ -37,11 +37,8 @@ // TODO: remove this header #include -// Private definitions not placed in public headers -extern "C" void _init_global_fonts(); -extern "C" status_t _fini_interface_kit_(); - #include +#include #include #include #include @@ -53,6 +50,10 @@ extern "C" status_t _fini_interface_kit_(); #include "moreUTF8.h" #include "truncate_string.h" +// Private definitions not placed in public headers +extern "C" void _init_global_fonts(); +extern "C" status_t _fini_interface_kit_(); + using namespace BPrivate; menu_info *_menu_info_ptr_; @@ -986,18 +987,51 @@ do_window_action(int32 window_id, int32 action, window_info * -get_window_info(int32 a_token) +get_window_info(int32 serverToken) { - // ToDo: implement me, needed for Deskbar! - return NULL; + BPrivate::AppServerLink link; + + link.StartMessage(AS_GET_WINDOW_INFO); + link.Attach(serverToken); + + int32 code; + if (link.FlushWithReply(code) != B_OK || code != B_OK) + return NULL; + + int32 size; + link.Read(&size); + + client_window_info* info = (client_window_info*)malloc(size); + if (info == NULL) + return NULL; + + link.Read(info, size); + return info; } int32 * -get_token_list(team_id app, int32 *count) +get_token_list(team_id team, int32 *_count) { - // ToDo: implement me, needed for Deskbar! - return NULL; + BPrivate::AppServerLink link; + + link.StartMessage(AS_GET_WINDOW_LIST); + link.Attach(team); + + int32 code; + if (link.FlushWithReply(code) != B_OK || code != B_OK) + return NULL; + + int32 count; + link.Read(&count); + + int32* tokens = (int32*)malloc(count * sizeof(int32)); + if (tokens == NULL) + return NULL; + + link.Read(tokens, count * sizeof(int32)); + *_count = count; + return tokens; }