Simplified BAppServerLink interface
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3934 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
faa6a27319
commit
87048db9e0
@ -45,12 +45,11 @@ _IMPEXP_BE const color_map *system_colors()
|
||||
_IMPEXP_BE status_t set_screen_space(int32 index, uint32 res, bool stick = true)
|
||||
{
|
||||
BPrivate::BAppServerLink *link=new BPrivate::BAppServerLink();
|
||||
link->Init();
|
||||
link->portlink->SetOpCode(AS_SET_SCREEN_MODE);
|
||||
link->portlink->Attach(index);
|
||||
link->portlink->Attach((int32)res);
|
||||
link->portlink->Attach(stick);
|
||||
link->portlink->Flush();
|
||||
link->SetOpCode(AS_SET_SCREEN_MODE);
|
||||
link->Attach(index);
|
||||
link->Attach((int32)res);
|
||||
link->Attach(stick);
|
||||
link->Flush();
|
||||
delete link;
|
||||
}
|
||||
|
||||
@ -64,10 +63,9 @@ _IMPEXP_BE status_t get_scroll_bar_info(scroll_bar_info *info)
|
||||
_IMPEXP_BE status_t set_scroll_bar_info(scroll_bar_info *info)
|
||||
{
|
||||
BPrivate::BAppServerLink *link=new BPrivate::BAppServerLink();
|
||||
link->Init();
|
||||
link->portlink->SetOpCode(AS_SET_SCROLLBAR_INFO);
|
||||
link->portlink->Attach(info, sizeof(scroll_bar_info));
|
||||
link->portlink->Flush();
|
||||
link->SetOpCode(AS_SET_SCROLLBAR_INFO);
|
||||
link->Attach(info, sizeof(scroll_bar_info));
|
||||
link->Flush();
|
||||
delete link;
|
||||
}
|
||||
|
||||
@ -204,9 +202,8 @@ _IMPEXP_BE int32 count_workspaces()
|
||||
int32 count;
|
||||
|
||||
BPrivate::BAppServerLink *link=new BPrivate::BAppServerLink();
|
||||
link->Init();
|
||||
link->portlink->SetOpCode(AS_COUNT_WORKSPACES);
|
||||
link->portlink->FlushWithReply(&replydata);
|
||||
link->SetOpCode(AS_COUNT_WORKSPACES);
|
||||
link->FlushWithReply(&replydata);
|
||||
|
||||
count=*((int32*)replydata.buffer);
|
||||
|
||||
@ -217,10 +214,9 @@ _IMPEXP_BE int32 count_workspaces()
|
||||
_IMPEXP_BE void set_workspace_count(int32 count)
|
||||
{
|
||||
BPrivate::BAppServerLink *link=new BPrivate::BAppServerLink();
|
||||
link->Init();
|
||||
link->portlink->SetOpCode(AS_SET_WORKSPACE_COUNT);
|
||||
link->portlink->Attach(count);
|
||||
link->portlink->Flush();
|
||||
link->SetOpCode(AS_SET_WORKSPACE_COUNT);
|
||||
link->Attach(count);
|
||||
link->Flush();
|
||||
delete link;
|
||||
}
|
||||
|
||||
@ -230,9 +226,8 @@ _IMPEXP_BE int32 current_workspace()
|
||||
int32 index;
|
||||
|
||||
BPrivate::BAppServerLink *link=new BPrivate::BAppServerLink();
|
||||
link->Init();
|
||||
link->portlink->SetOpCode(AS_CURRENT_WORKSPACE);
|
||||
link->portlink->FlushWithReply(&replydata);
|
||||
link->SetOpCode(AS_CURRENT_WORKSPACE);
|
||||
link->FlushWithReply(&replydata);
|
||||
|
||||
index=*((int32*)replydata.buffer);
|
||||
|
||||
@ -243,10 +238,9 @@ _IMPEXP_BE int32 current_workspace()
|
||||
_IMPEXP_BE void activate_workspace(int32 workspace)
|
||||
{
|
||||
BPrivate::BAppServerLink *link=new BPrivate::BAppServerLink();
|
||||
link->Init();
|
||||
link->portlink->SetOpCode(AS_ACTIVATE_WORKSPACE);
|
||||
link->portlink->Attach(workspace);
|
||||
link->portlink->Flush();
|
||||
link->SetOpCode(AS_ACTIVATE_WORKSPACE);
|
||||
link->Attach(workspace);
|
||||
link->Flush();
|
||||
delete link;
|
||||
}
|
||||
|
||||
@ -256,9 +250,8 @@ _IMPEXP_BE bigtime_t idle_time()
|
||||
bigtime_t idletime;
|
||||
|
||||
BPrivate::BAppServerLink *link=new BPrivate::BAppServerLink();
|
||||
link->Init();
|
||||
link->portlink->SetOpCode(AS_IDLE_TIME);
|
||||
link->portlink->FlushWithReply(&replydata);
|
||||
link->SetOpCode(AS_IDLE_TIME);
|
||||
link->FlushWithReply(&replydata);
|
||||
|
||||
idletime=*((bigtime_t*)replydata.buffer);
|
||||
|
||||
@ -288,10 +281,9 @@ _IMPEXP_BE void run_be_about()
|
||||
_IMPEXP_BE void set_focus_follows_mouse(bool follow)
|
||||
{
|
||||
BPrivate::BAppServerLink *link=new BPrivate::BAppServerLink();
|
||||
link->Init();
|
||||
link->portlink->SetOpCode(AS_SET_FOCUS_FOLLOWS_MOUSE);
|
||||
link->portlink->Attach(follow);
|
||||
link->portlink->Flush();
|
||||
link->SetOpCode(AS_SET_FOCUS_FOLLOWS_MOUSE);
|
||||
link->Attach(follow);
|
||||
link->Flush();
|
||||
delete link;
|
||||
}
|
||||
|
||||
@ -302,10 +294,9 @@ _IMPEXP_BE bool focus_follows_mouse()
|
||||
_IMPEXP_BE void set_mouse_mode(mode_mouse mode)
|
||||
{
|
||||
BPrivate::BAppServerLink *link=new BPrivate::BAppServerLink();
|
||||
link->Init();
|
||||
link->portlink->SetOpCode(AS_SET_MOUSE_MODE);
|
||||
link->portlink->Attach((int32)mode);
|
||||
link->portlink->Flush();
|
||||
link->SetOpCode(AS_SET_MOUSE_MODE);
|
||||
link->Attach((int32)mode);
|
||||
link->Flush();
|
||||
delete link;
|
||||
}
|
||||
|
||||
@ -315,9 +306,8 @@ _IMPEXP_BE mode_mouse mouse_mode()
|
||||
mode_mouse mode;
|
||||
|
||||
BPrivate::BAppServerLink *link=new BPrivate::BAppServerLink();
|
||||
link->Init();
|
||||
link->portlink->SetOpCode(AS_GET_MOUSE_MODE);
|
||||
link->portlink->FlushWithReply(&replydata);
|
||||
link->SetOpCode(AS_GET_MOUSE_MODE);
|
||||
link->FlushWithReply(&replydata);
|
||||
|
||||
mode=*((mode_mouse*)replydata.buffer);
|
||||
|
||||
@ -331,9 +321,8 @@ _IMPEXP_BE rgb_color ui_color(color_which which)
|
||||
rgb_color color;
|
||||
|
||||
BPrivate::BAppServerLink *link=new BPrivate::BAppServerLink();
|
||||
link->Init();
|
||||
link->portlink->SetOpCode(AS_GET_UI_COLOR);
|
||||
link->portlink->FlushWithReply(&replydata);
|
||||
link->SetOpCode(AS_GET_UI_COLOR);
|
||||
link->FlushWithReply(&replydata);
|
||||
|
||||
color=*((rgb_color*)replydata.buffer);
|
||||
|
||||
|
@ -86,9 +86,9 @@ BPicture::BPicture(const BPicture &picture)
|
||||
BPrivate::BAppServerLink link;
|
||||
PortLink::ReplyData replydata;
|
||||
|
||||
link.portlink->SetOpCode(AS_CLONE_PICTURE);
|
||||
link.portlink->Attach(picture.token);
|
||||
link.portlink->FlushWithReply(&replydata);
|
||||
link.SetOpCode(AS_CLONE_PICTURE);
|
||||
link.Attach(picture.token);
|
||||
link.FlushWithReply(&replydata);
|
||||
token=*((int32*)replydata.buffer);
|
||||
|
||||
}
|
||||
@ -162,17 +162,17 @@ BPicture::BPicture(BMessage *archive)
|
||||
PortLink::ReplyData replydata;
|
||||
BPicture *pic;
|
||||
|
||||
link.portlink->SetOpCode(AS_CREATE_PICTURE);
|
||||
link.portlink->Attach(extent->fPictures.CountItems());
|
||||
link.SetOpCode(AS_CREATE_PICTURE);
|
||||
link.Attach(extent->fPictures.CountItems());
|
||||
for (int32 i = 0; i < extent->fPictures.CountItems(); i++)
|
||||
{
|
||||
pic=(BPicture*)extent->fPictures.ItemAt(i);
|
||||
if(pic)
|
||||
link.portlink->Attach(pic->token);
|
||||
link.Attach(pic->token);
|
||||
}
|
||||
link.portlink->Attach(extent->fNewSize);
|
||||
link.portlink->Attach(extent->fNewData,extent->fNewSize);
|
||||
link.portlink->FlushWithReply(&replydata);
|
||||
link.Attach(extent->fNewSize);
|
||||
link.Attach(extent->fNewData,extent->fNewSize);
|
||||
link.FlushWithReply(&replydata);
|
||||
token=*((int32*)replydata.buffer);
|
||||
}
|
||||
}
|
||||
@ -204,9 +204,9 @@ BPicture::~BPicture()
|
||||
{
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
link.portlink->SetOpCode(AS_DELETE_PICTURE);
|
||||
link.portlink->Attach(token);
|
||||
link.portlink->Flush();
|
||||
link.SetOpCode(AS_DELETE_PICTURE);
|
||||
link.Attach(token);
|
||||
link.Flush();
|
||||
}
|
||||
|
||||
if (extent->fNewData != NULL)
|
||||
@ -343,17 +343,17 @@ status_t BPicture::Unflatten(BDataIO *stream)
|
||||
PortLink::ReplyData replydata;
|
||||
BPicture *pic;
|
||||
|
||||
link.portlink->SetOpCode(AS_CREATE_PICTURE);
|
||||
link.portlink->Attach(extent->fPictures.CountItems());
|
||||
link.SetOpCode(AS_CREATE_PICTURE);
|
||||
link.Attach(extent->fPictures.CountItems());
|
||||
for (int32 i = 0; i < extent->fPictures.CountItems(); i++)
|
||||
{
|
||||
pic=(BPicture*)extent->fPictures.ItemAt(i);
|
||||
if(pic)
|
||||
link.portlink->Attach(pic->token);
|
||||
link.Attach(pic->token);
|
||||
}
|
||||
link.portlink->Attach(extent->fNewSize);
|
||||
link.portlink->Attach(extent->fNewData, extent->fNewSize);
|
||||
link.portlink->FlushWithReply(&replydata);
|
||||
link.Attach(extent->fNewSize);
|
||||
link.Attach(extent->fNewData, extent->fNewSize);
|
||||
link.FlushWithReply(&replydata);
|
||||
token=*((int32*)replydata.buffer);
|
||||
|
||||
if (extent->fNewData)
|
||||
@ -396,15 +396,15 @@ void BPicture::import_data(const void *data, int32 size, BPicture **subs,
|
||||
BPrivate::BAppServerLink link;
|
||||
PortLink::ReplyData replydata;
|
||||
|
||||
link.portlink->SetOpCode(AS_CREATE_PICTURE);
|
||||
link.portlink->Attach(subCount);
|
||||
link.SetOpCode(AS_CREATE_PICTURE);
|
||||
link.Attach(subCount);
|
||||
|
||||
for (int32 i = 0; i < subCount; i++)
|
||||
link.portlink->Attach(subs[i]->token);
|
||||
link.Attach(subs[i]->token);
|
||||
|
||||
link.portlink->Attach(size);
|
||||
link.portlink->Attach(data, size);
|
||||
link.portlink->FlushWithReply(&replydata);
|
||||
link.Attach(size);
|
||||
link.Attach(data, size);
|
||||
link.FlushWithReply(&replydata);
|
||||
token=*((int32*)replydata.buffer);
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
@ -422,11 +422,11 @@ void BPicture::import_old_data(const void *data, int32 size)
|
||||
BPrivate::BAppServerLink link;
|
||||
PortLink::ReplyData replydata;
|
||||
|
||||
link.portlink->SetOpCode(AS_CREATE_PICTURE);
|
||||
link.portlink->Attach(0L);
|
||||
link.portlink->Attach(extent->fNewSize);
|
||||
link.portlink->Attach(extent->fNewData,extent->fNewSize);
|
||||
link.portlink->FlushWithReply(&replydata);
|
||||
link.SetOpCode(AS_CREATE_PICTURE);
|
||||
link.Attach(0L);
|
||||
link.Attach(extent->fNewSize);
|
||||
link.Attach(extent->fNewData,extent->fNewSize);
|
||||
link.FlushWithReply(&replydata);
|
||||
token=*((int32*)replydata.buffer);
|
||||
|
||||
// Do we free all data now?
|
||||
@ -455,9 +455,9 @@ bool BPicture::assert_local_copy()
|
||||
PortLink::ReplyData replydata;
|
||||
int32 count;
|
||||
|
||||
link.portlink->SetOpCode(AS_DOWNLOAD_PICTURE);
|
||||
link.portlink->Attach(token);
|
||||
link.portlink->FlushWithReply(&replydata);
|
||||
link.SetOpCode(AS_DOWNLOAD_PICTURE);
|
||||
link.Attach(token);
|
||||
link.FlushWithReply(&replydata);
|
||||
count=*((int32*)replydata.buffer);
|
||||
|
||||
// Read sub picture tokens
|
||||
@ -505,13 +505,13 @@ bool BPicture::assert_server_copy()
|
||||
BPrivate::BAppServerLink link;
|
||||
PortLink::ReplyData replydata;
|
||||
|
||||
link.portlink->SetOpCode(AS_CREATE_PICTURE);
|
||||
link.portlink->Attach(extent->fPictures.CountItems());
|
||||
link.SetOpCode(AS_CREATE_PICTURE);
|
||||
link.Attach(extent->fPictures.CountItems());
|
||||
for (int32 i = 0; i < extent->fPictures.CountItems(); i++)
|
||||
link.portlink->Attach(extent->fPictures.ItemAt(i)->token);
|
||||
link.portlink->Attach(extent->fNewSize);
|
||||
link.portlink->Attach(extent->fNewData,extent->fNewSize);
|
||||
link.portlink->FlushWithReply(&replydata);
|
||||
link.Attach(extent->fPictures.ItemAt(i)->token);
|
||||
link.Attach(extent->fNewSize);
|
||||
link.Attach(extent->fNewData,extent->fNewSize);
|
||||
link.FlushWithReply(&replydata);
|
||||
token=*((int32*)replydata.buffer);
|
||||
|
||||
return token != -1;*/
|
||||
@ -552,9 +552,9 @@ void BPicture::usurp(BPicture *lameDuck)
|
||||
{
|
||||
BPrivate::BAppServerLink link;
|
||||
|
||||
link.portlink->SetOpCode(AS_DELETE_PICTURE);
|
||||
link.portlink->Attach(token);
|
||||
link.portlink->Flush();
|
||||
link.SetOpCode(AS_DELETE_PICTURE);
|
||||
link.Attach(token);
|
||||
link.Flush();
|
||||
}
|
||||
|
||||
if (extent->fNewData != NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user