Conversion to BSession API
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@4924 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -28,8 +28,6 @@
|
|||||||
#include <AppServerLink.h>
|
#include <AppServerLink.h>
|
||||||
#include <GraphicsDefs.h>
|
#include <GraphicsDefs.h>
|
||||||
#include <InterfaceDefs.h>
|
#include <InterfaceDefs.h>
|
||||||
#include <PortLink.h>
|
|
||||||
#include <PortMessage.h>
|
|
||||||
#include <ServerProtocol.h>
|
#include <ServerProtocol.h>
|
||||||
#include <Screen.h>
|
#include <Screen.h>
|
||||||
#include <Roster.h>
|
#include <Roster.h>
|
||||||
@@ -54,11 +52,11 @@ _IMPEXP_BE status_t
|
|||||||
set_screen_space(int32 index, uint32 res, bool stick)
|
set_screen_space(int32 index, uint32 res, bool stick)
|
||||||
{
|
{
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.SetOpCode(AS_SET_SCREEN_MODE);
|
link.WriteInt32(AS_SET_SCREEN_MODE);
|
||||||
link.Attach<int32>(index);
|
link.WriteInt32(index);
|
||||||
link.Attach<int32>((int32)res);
|
link.WriteInt32((int32)res);
|
||||||
link.Attach<bool>(stick);
|
link.WriteBool(stick);
|
||||||
link.Flush();
|
link.Sync();
|
||||||
|
|
||||||
//TODO: Read back the status from the app_server's reply
|
//TODO: Read back the status from the app_server's reply
|
||||||
return B_OK;
|
return B_OK;
|
||||||
@@ -68,14 +66,14 @@ set_screen_space(int32 index, uint32 res, bool stick)
|
|||||||
_IMPEXP_BE status_t
|
_IMPEXP_BE status_t
|
||||||
set_scroll_bar_info(scroll_bar_info *info)
|
set_scroll_bar_info(scroll_bar_info *info)
|
||||||
{
|
{
|
||||||
BAppServerLink link;
|
if(!info)
|
||||||
PortMessage msg;
|
return B_ERROR;
|
||||||
link.SetOpCode(AS_SET_SCROLLBAR_INFO);
|
|
||||||
link.Attach(info, sizeof(scroll_bar_info));
|
|
||||||
link.FlushWithReply(&msg);
|
|
||||||
|
|
||||||
//TODO: Read back the status from the app_server's reply
|
BAppServerLink link;
|
||||||
msg.Read(info,sizeof(scroll_bar_info));
|
link.WriteInt32(AS_SET_SCROLLBAR_INFO);
|
||||||
|
link.WriteData(info, sizeof(scroll_bar_info));
|
||||||
|
link.Sync();
|
||||||
|
link.ReadData(info,sizeof(scroll_bar_info));
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,15 +249,12 @@ keyboard_navigation_color()
|
|||||||
_IMPEXP_BE int32
|
_IMPEXP_BE int32
|
||||||
count_workspaces()
|
count_workspaces()
|
||||||
{
|
{
|
||||||
PortLink::ReplyData replydata;
|
|
||||||
int32 count;
|
int32 count;
|
||||||
|
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.SetOpCode(AS_COUNT_WORKSPACES);
|
link.WriteInt32(AS_COUNT_WORKSPACES);
|
||||||
link.FlushWithReply(&replydata);
|
link.Sync();
|
||||||
|
link.ReadInt32(&count);
|
||||||
count=*((int32*)replydata.buffer);
|
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,24 +263,21 @@ _IMPEXP_BE void
|
|||||||
set_workspace_count(int32 count)
|
set_workspace_count(int32 count)
|
||||||
{
|
{
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.SetOpCode(AS_SET_WORKSPACE_COUNT);
|
link.WriteInt32(AS_SET_WORKSPACE_COUNT);
|
||||||
link.Attach<int32>(count);
|
link.WriteInt32(count);
|
||||||
link.Flush();
|
link.Sync();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_IMPEXP_BE int32
|
_IMPEXP_BE int32
|
||||||
current_workspace()
|
current_workspace()
|
||||||
{
|
{
|
||||||
PortLink::ReplyData replydata;
|
|
||||||
int32 index;
|
int32 index;
|
||||||
|
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.SetOpCode(AS_CURRENT_WORKSPACE);
|
link.WriteInt32(AS_CURRENT_WORKSPACE);
|
||||||
link.FlushWithReply(&replydata);
|
link.Sync();
|
||||||
|
link.ReadInt32(&index);
|
||||||
index=*((int32*)replydata.buffer);
|
|
||||||
|
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
@@ -295,23 +287,21 @@ _IMPEXP_BE void
|
|||||||
activate_workspace(int32 workspace)
|
activate_workspace(int32 workspace)
|
||||||
{
|
{
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.SetOpCode(AS_ACTIVATE_WORKSPACE);
|
link.WriteInt32(AS_ACTIVATE_WORKSPACE);
|
||||||
link.Attach<int32>(workspace);
|
link.WriteInt32(workspace);
|
||||||
link.Flush();
|
link.Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_IMPEXP_BE bigtime_t
|
_IMPEXP_BE bigtime_t
|
||||||
idle_time()
|
idle_time()
|
||||||
{
|
{
|
||||||
PortLink::ReplyData replydata;
|
|
||||||
bigtime_t idletime;
|
bigtime_t idletime;
|
||||||
|
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.SetOpCode(AS_IDLE_TIME);
|
link.WriteInt32(AS_IDLE_TIME);
|
||||||
link.FlushWithReply(&replydata);
|
link.Sync();
|
||||||
|
link.ReadInt64(&idletime);
|
||||||
idletime=*((bigtime_t*)replydata.buffer);
|
|
||||||
|
|
||||||
return idletime;
|
return idletime;
|
||||||
}
|
}
|
||||||
@@ -346,24 +336,21 @@ _IMPEXP_BE void
|
|||||||
set_focus_follows_mouse(bool follow)
|
set_focus_follows_mouse(bool follow)
|
||||||
{
|
{
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.SetOpCode(AS_SET_FOCUS_FOLLOWS_MOUSE);
|
link.WriteInt32(AS_SET_FOCUS_FOLLOWS_MOUSE);
|
||||||
link.Attach<bool>(follow);
|
link.WriteBool(follow);
|
||||||
link.Flush();
|
link.Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_IMPEXP_BE bool
|
_IMPEXP_BE bool
|
||||||
focus_follows_mouse()
|
focus_follows_mouse()
|
||||||
{
|
{
|
||||||
PortMessage pmsg;
|
bool ffm;
|
||||||
|
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.SetOpCode(AS_FOCUS_FOLLOWS_MOUSE);
|
link.WriteInt32(AS_FOCUS_FOLLOWS_MOUSE);
|
||||||
link.FlushWithReply(&pmsg);
|
link.Sync();
|
||||||
|
link.ReadBool(&ffm);
|
||||||
bool ffm;
|
|
||||||
pmsg.Read<bool>(&ffm);
|
|
||||||
|
|
||||||
return ffm;
|
return ffm;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -372,24 +359,21 @@ _IMPEXP_BE void
|
|||||||
set_mouse_mode(mode_mouse mode)
|
set_mouse_mode(mode_mouse mode)
|
||||||
{
|
{
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.SetOpCode(AS_SET_MOUSE_MODE);
|
link.WriteInt32(AS_SET_MOUSE_MODE);
|
||||||
link.Attach(&mode,sizeof(mode_mouse));
|
link.WriteData(&mode,sizeof(mode_mouse));
|
||||||
link.Flush();
|
link.Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
_IMPEXP_BE mode_mouse
|
_IMPEXP_BE mode_mouse
|
||||||
mouse_mode()
|
mouse_mode()
|
||||||
{
|
{
|
||||||
PortLink::ReplyData replydata;
|
|
||||||
mode_mouse mode;
|
mode_mouse mode;
|
||||||
|
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.SetOpCode(AS_GET_MOUSE_MODE);
|
link.WriteInt32(AS_GET_MOUSE_MODE);
|
||||||
link.FlushWithReply(&replydata);
|
link.Sync();
|
||||||
|
link.ReadData(&mode,sizeof(mode_mouse));
|
||||||
mode=*((mode_mouse*)replydata.buffer);
|
|
||||||
|
|
||||||
return mode;
|
return mode;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,16 +381,13 @@ mouse_mode()
|
|||||||
_IMPEXP_BE rgb_color
|
_IMPEXP_BE rgb_color
|
||||||
ui_color(color_which which)
|
ui_color(color_which which)
|
||||||
{
|
{
|
||||||
PortLink::ReplyData replydata;
|
|
||||||
rgb_color color;
|
rgb_color color;
|
||||||
|
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.SetOpCode(AS_GET_UI_COLOR);
|
link.WriteInt32(AS_GET_UI_COLOR);
|
||||||
link.Attach(&which, sizeof(which));
|
link.WriteData(&which, sizeof(which));
|
||||||
link.FlushWithReply(&replydata);
|
link.Sync();
|
||||||
|
link.ReadData(&color,sizeof(rgb_color));
|
||||||
color=*((rgb_color*)replydata.buffer);
|
|
||||||
|
|
||||||
return color;
|
return color;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -467,7 +448,7 @@ bitmaps_support_space(color_space space, uint32 * support_flags)
|
|||||||
void __set_window_decor(int32 theme)
|
void __set_window_decor(int32 theme)
|
||||||
{
|
{
|
||||||
BAppServerLink link;
|
BAppServerLink link;
|
||||||
link.SetOpCode(AS_R5_SET_DECORATOR);
|
link.WriteInt32(AS_R5_SET_DECORATOR);
|
||||||
link.Attach(theme);
|
link.WriteInt32(theme);
|
||||||
link.Flush();
|
link.Sync();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,6 @@
|
|||||||
#include <Errors.h>
|
#include <Errors.h>
|
||||||
#include <List.h>
|
#include <List.h>
|
||||||
#include <AppServerLink.h>
|
#include <AppServerLink.h>
|
||||||
#include <PortLink.h>
|
|
||||||
#include <ServerProtocol.h>
|
#include <ServerProtocol.h>
|
||||||
|
|
||||||
// Project Includes ------------------------------------------------------------
|
// Project Includes ------------------------------------------------------------
|
||||||
@@ -85,12 +84,11 @@ BPicture::BPicture(const BPicture &picture)
|
|||||||
{
|
{
|
||||||
|
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
PortLink::ReplyData replydata;
|
|
||||||
|
|
||||||
link.SetOpCode(AS_CLONE_PICTURE);
|
link.WriteInt32(AS_CLONE_PICTURE);
|
||||||
link.Attach<int32>(picture.token);
|
link.WriteInt32(picture.token);
|
||||||
link.FlushWithReply(&replydata);
|
link.Sync();
|
||||||
token=*((int32*)replydata.buffer);
|
link.ReadInt32(&token);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (picture.extent->fNewData != NULL)
|
if (picture.extent->fNewData != NULL)
|
||||||
@@ -160,21 +158,20 @@ BPicture::BPicture(BMessage *archive)
|
|||||||
if (extent->fNewSize != 0 && extent->fNewData != 0)
|
if (extent->fNewSize != 0 && extent->fNewData != 0)
|
||||||
{
|
{
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
PortLink::ReplyData replydata;
|
|
||||||
BPicture *pic;
|
BPicture *pic;
|
||||||
|
|
||||||
link.SetOpCode(AS_CREATE_PICTURE);
|
link.WriteInt32(AS_CREATE_PICTURE);
|
||||||
link.Attach<int32>(extent->fPictures.CountItems());
|
link.WriteInt32(extent->fPictures.CountItems());
|
||||||
for (int32 i = 0; i < extent->fPictures.CountItems(); i++)
|
for (int32 i = 0; i < extent->fPictures.CountItems(); i++)
|
||||||
{
|
{
|
||||||
pic=(BPicture*)extent->fPictures.ItemAt(i);
|
pic=(BPicture*)extent->fPictures.ItemAt(i);
|
||||||
if(pic)
|
if(pic)
|
||||||
link.Attach<int32>(pic->token);
|
link.WriteInt32(pic->token);
|
||||||
}
|
}
|
||||||
link.Attach<int32>(extent->fNewSize);
|
link.WriteInt32(extent->fNewSize);
|
||||||
link.Attach(extent->fNewData,extent->fNewSize);
|
link.WriteData(extent->fNewData,extent->fNewSize);
|
||||||
link.FlushWithReply(&replydata);
|
link.Sync();
|
||||||
token=*((int32*)replydata.buffer);
|
link.ReadInt32(&token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,9 +202,9 @@ BPicture::~BPicture()
|
|||||||
{
|
{
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
|
|
||||||
link.SetOpCode(AS_DELETE_PICTURE);
|
link.WriteInt32(AS_DELETE_PICTURE);
|
||||||
link.Attach<int32>(token);
|
link.WriteInt32(token);
|
||||||
link.Flush();
|
link.Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extent->fNewData != NULL)
|
if (extent->fNewData != NULL)
|
||||||
@@ -341,21 +338,20 @@ status_t BPicture::Unflatten(BDataIO *stream)
|
|||||||
// swap_data(extent->fNewData, extent->fNewSize);
|
// swap_data(extent->fNewData, extent->fNewSize);
|
||||||
|
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
PortLink::ReplyData replydata;
|
|
||||||
BPicture *pic;
|
BPicture *pic;
|
||||||
|
|
||||||
link.SetOpCode(AS_CREATE_PICTURE);
|
link.WriteInt32(AS_CREATE_PICTURE);
|
||||||
link.Attach<int32>(extent->fPictures.CountItems());
|
link.WriteInt32(extent->fPictures.CountItems());
|
||||||
for (int32 i = 0; i < extent->fPictures.CountItems(); i++)
|
for (int32 i = 0; i < extent->fPictures.CountItems(); i++)
|
||||||
{
|
{
|
||||||
pic=(BPicture*)extent->fPictures.ItemAt(i);
|
pic=(BPicture*)extent->fPictures.ItemAt(i);
|
||||||
if(pic)
|
if(pic)
|
||||||
link.Attach<int32>(pic->token);
|
link.WriteInt32(pic->token);
|
||||||
}
|
}
|
||||||
link.Attach<int32>(extent->fNewSize);
|
link.WriteInt32(extent->fNewSize);
|
||||||
link.Attach(extent->fNewData, extent->fNewSize);
|
link.WriteData(extent->fNewData, extent->fNewSize);
|
||||||
link.FlushWithReply(&replydata);
|
link.Sync();
|
||||||
token=*((int32*)replydata.buffer);
|
link.ReadInt32(&token);
|
||||||
|
|
||||||
if (extent->fNewData)
|
if (extent->fNewData)
|
||||||
{
|
{
|
||||||
@@ -395,18 +391,17 @@ void BPicture::import_data(const void *data, int32 size, BPicture **subs,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
PortLink::ReplyData replydata;
|
|
||||||
|
|
||||||
link.SetOpCode(AS_CREATE_PICTURE);
|
link.WriteInt32(AS_CREATE_PICTURE);
|
||||||
link.Attach<int32>(subCount);
|
link.WriteInt32(subCount);
|
||||||
|
|
||||||
for (int32 i = 0; i < subCount; i++)
|
for (int32 i = 0; i < subCount; i++)
|
||||||
link.Attach<int32>(subs[i]->token);
|
link.WriteInt32(subs[i]->token);
|
||||||
|
|
||||||
link.Attach<int32>(size);
|
link.WriteInt32(size);
|
||||||
link.Attach(data, size);
|
link.WriteData(data, size);
|
||||||
link.FlushWithReply(&replydata);
|
link.Sync();
|
||||||
token=*((int32*)replydata.buffer);
|
link.ReadInt32(&token);
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
void BPicture::import_old_data(const void *data, int32 size)
|
void BPicture::import_old_data(const void *data, int32 size)
|
||||||
@@ -421,14 +416,12 @@ void BPicture::import_old_data(const void *data, int32 size)
|
|||||||
convert_old_to_new(data, size, &extent->fNewData, &extent->fNewSize);
|
convert_old_to_new(data, size, &extent->fNewData, &extent->fNewSize);
|
||||||
|
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
PortLink::ReplyData replydata;
|
link.WriteInt32(AS_CREATE_PICTURE);
|
||||||
|
link.WriteInt32(0L);
|
||||||
link.SetOpCode(AS_CREATE_PICTURE);
|
link.WriteInt32(extent->fNewSize);
|
||||||
link.Attach<int32>(0L);
|
link.WriteData(extent->fNewData,extent->fNewSize);
|
||||||
link.Attach<int32>(extent->fNewSize);
|
link.Sync();
|
||||||
link.Attach(extent->fNewData,extent->fNewSize);
|
link.ReadInt32(&token)
|
||||||
link.FlushWithReply(&replydata);
|
|
||||||
token=*((int32*)replydata.buffer);
|
|
||||||
|
|
||||||
// Do we free all data now?
|
// Do we free all data now?
|
||||||
free(extent->fNewData);
|
free(extent->fNewData);
|
||||||
@@ -453,12 +446,11 @@ bool BPicture::assert_local_copy()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* BPrivate::BAppServerLink link;
|
/* BPrivate::BAppServerLink link;
|
||||||
PortLink::ReplyData replydata;
|
|
||||||
int32 count;
|
int32 count;
|
||||||
|
|
||||||
link.SetOpCode(AS_DOWNLOAD_PICTURE);
|
link.WriteInt32(AS_DOWNLOAD_PICTURE);
|
||||||
link.Attach<int32>(token);
|
link.WriteInt32(token);
|
||||||
link.FlushWithReply(&replydata);
|
link.Sync();
|
||||||
count=*((int32*)replydata.buffer);
|
count=*((int32*)replydata.buffer);
|
||||||
|
|
||||||
// Read sub picture tokens
|
// Read sub picture tokens
|
||||||
@@ -504,16 +496,14 @@ bool BPicture::assert_server_copy()
|
|||||||
extent->fPictures.ItemAt(i)->assert_server_copy();
|
extent->fPictures.ItemAt(i)->assert_server_copy();
|
||||||
|
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
PortLink::ReplyData replydata;
|
link.WriteInt32(AS_CREATE_PICTURE);
|
||||||
|
link.WriteInt32(extent->fPictures.CountItems());
|
||||||
link.SetOpCode(AS_CREATE_PICTURE);
|
|
||||||
link.Attach<int32>(extent->fPictures.CountItems());
|
|
||||||
for (int32 i = 0; i < extent->fPictures.CountItems(); i++)
|
for (int32 i = 0; i < extent->fPictures.CountItems(); i++)
|
||||||
link.Attach<int32>(extent->fPictures.ItemAt(i)->token);
|
link.WriteInt32(extent->fPictures.ItemAt(i)->token);
|
||||||
link.Attach<int32>(extent->fNewSize);
|
link.WriteInt32(extent->fNewSize);
|
||||||
link.Attach(extent->fNewData,extent->fNewSize);
|
link.WriteData(extent->fNewData,extent->fNewSize);
|
||||||
link.FlushWithReply(&replydata);
|
link.Sync();
|
||||||
token=*((int32*)replydata.buffer);
|
link.ReadInt32(&token);
|
||||||
|
|
||||||
return token != -1;*/
|
return token != -1;*/
|
||||||
return true;
|
return true;
|
||||||
@@ -553,9 +543,9 @@ void BPicture::usurp(BPicture *lameDuck)
|
|||||||
{
|
{
|
||||||
BPrivate::BAppServerLink link;
|
BPrivate::BAppServerLink link;
|
||||||
|
|
||||||
link.SetOpCode(AS_DELETE_PICTURE);
|
link.WriteInt32(AS_DELETE_PICTURE);
|
||||||
link.Attach<int32>(token);
|
link.WriteInt32(token);
|
||||||
link.Flush();
|
link.Sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extent->fNewData != NULL)
|
if (extent->fNewData != NULL)
|
||||||
|
|||||||
Reference in New Issue
Block a user