diff --git a/headers/private/interface/DirectWindowPrivate.h b/headers/private/interface/DirectWindowPrivate.h new file mode 100644 index 0000000000..e4706f7d31 --- /dev/null +++ b/headers/private/interface/DirectWindowPrivate.h @@ -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 + + +struct direct_window_sync_data { + area_id area; + sem_id disable_sem; + sem_id disable_sem_ack; +}; + + +#endif // _DIRECT_WINDOW_PRIVATE_H diff --git a/src/kits/game/DirectWindow.cpp b/src/kits/game/DirectWindow.cpp index c924aa9379..b64414190d 100644 --- a/src/kits/game/DirectWindow.cpp +++ b/src/kits/game/DirectWindow.cpp @@ -9,7 +9,9 @@ #include + #include +#include #ifdef HAIKU_TARGET_PLATFORM_BEOS # include @@ -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(server_token); int32 reply; if (fLink->FlushWithReply(reply) == B_OK && reply == B_OK) { - fLink->Read(&sync_data); + fLink->Read(&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) diff --git a/src/servers/app/ServerWindow.cpp b/src/servers/app/ServerWindow.cpp index 54559f72f0..fbe3d18804 100644 --- a/src/servers/app/ServerWindow.cpp +++ b/src/servers/app/ServerWindow.cpp @@ -35,6 +35,7 @@ #include #include +#include #include #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