Moved dw_sync_data to a private header DirectWindowPrivate.h and renamed it to direct_window_sync_data.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15469 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2005-12-10 15:36:38 +00:00
parent ab6a6bed3a
commit 71b550889e
3 changed files with 40 additions and 36 deletions

View File

@ -0,0 +1,19 @@
/*
* Copyright 2005, Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _DIRECT_WINDOW_PRIVATE_H
#define _DIRECT_WINDOW_PRIVATE_H
#include <OS.h>
struct direct_window_sync_data {
area_id area;
sem_id disable_sem;
sem_id disable_sem_ack;
};
#endif // _DIRECT_WINDOW_PRIVATE_H

View File

@ -9,7 +9,9 @@
#include <DirectWindow.h>
#include <clipping.h>
#include <DirectWindowPrivate.h>
#ifdef HAIKU_TARGET_PLATFORM_BEOS
# include <R5_AppServerLink.h>
@ -28,15 +30,6 @@
#endif
// TODO: We'll want to move this to a private header,
// accessible by the app server.
struct dw_sync_data {
area_id area;
sem_id disableSem;
sem_id disableSemAck;
};
// We don't need this kind of locking, since the directDeamonFunc
// doesn't access critical shared data.
#define DW_NEEDS_LOCKING 0
@ -447,35 +440,34 @@ BDirectWindow::InitData()
if (!Lock())
return;
struct dw_sync_data sync_data;
struct direct_window_sync_data syncData;
status_t status = B_ERROR;
#ifdef HAIKU_TARGET_PLATFORM_BEOS
a_session->swrite_l(DW_GET_SYNC_DATA);
a_session->swrite_l(server_token);
Flush();
a_session->sread(sizeof(sync_data), &sync_data);
a_session->sread(sizeof(syncData), &syncData);
a_session->sread(sizeof(status), &status);
#else
fLink->StartMessage(AS_DIRECT_WINDOW_GET_SYNC_DATA);
fLink->Attach<int32>(server_token);
int32 reply;
if (fLink->FlushWithReply(reply) == B_OK
&& reply == B_OK) {
fLink->Read<dw_sync_data>(&sync_data);
fLink->Read<direct_window_sync_data>(&syncData);
status = B_OK;
}
#endif
Unlock();
if (status < B_OK)
return;
#if DW_NEEDS_LOCKING
direct_lock = 0;
direct_lock_count = 0;
@ -485,20 +477,20 @@ BDirectWindow::InitData()
if (direct_sem > 0)
dw_init_status |= DW_STATUS_SEM_CREATED;
#endif
source_clipping_area = sync_data.area;
disable_sem = sync_data.disableSem;
disable_sem_ack = sync_data.disableSemAck;
source_clipping_area = syncData.area;
disable_sem = syncData.disable_sem;
disable_sem_ack = syncData.disable_sem_ack;
cloned_clipping_area = clone_area("Clone direct area", (void**)&buffer_desc,
B_ANY_ADDRESS, B_READ_AREA, source_clipping_area);
if (cloned_clipping_area > 0) {
dw_init_status |= DW_STATUS_AREA_CLONED;
direct_deamon_id = spawn_thread(DirectDeamonFunc, "direct deamon",
B_DISPLAY_PRIORITY, this);
if (direct_deamon_id > 0) {
deamon_killer = false;
if (resume_thread(direct_deamon_id) == B_OK)

View File

@ -35,6 +35,7 @@
#include <WindowInfo.h>
#include <WindowPrivate.h>
#include <DirectWindowPrivate.h>
#include <MessagePrivate.h>
#include "AppServer.h"
@ -119,14 +120,6 @@ struct dw_data {
};
// TODO: Copied from DirectWindow.cpp: Move to a common header
struct dw_sync_data {
area_id area;
sem_id disableSem;
sem_id disableSemAck;
};
/*!
Sets up the basic BWindow counterpart - you have to call Init() before
you can actually use it, though.
@ -1696,7 +1689,7 @@ ServerWindow::_DispatchViewMessage(int32 code,
{
if (_EnableDirectWindowMode() == B_OK) {
fLink.StartMessage(B_OK);
struct dw_sync_data syncData = {
struct direct_window_sync_data syncData = {
fDirectWindowData->direct_area,
fDirectWindowData->direct_sem,
fDirectWindowData->direct_sem_ack