diff --git a/headers/private/app/ServerProtocol.h b/headers/private/app/ServerProtocol.h index 12b733429a..b4b1c2c3eb 100644 --- a/headers/private/app/ServerProtocol.h +++ b/headers/private/app/ServerProtocol.h @@ -312,6 +312,11 @@ enum { AS_LAYER_SET_PATTERN, AS_SET_CURRENT_LAYER, + // BDirectWindow codes + AS_DW_GET_SYNC_DATA, + AS_DW_SUPPORTS_WINDOW_MODE, + AS_DW_SET_FULLSCREEN, + // TODO: Move these elsewhere. They don't need to // be shared with libbe // app_server internal communication diff --git a/src/kits/game/DirectWindow.cpp b/src/kits/game/DirectWindow.cpp index d306d0692f..bac6efab6e 100644 --- a/src/kits/game/DirectWindow.cpp +++ b/src/kits/game/DirectWindow.cpp @@ -17,6 +17,9 @@ #ifdef COMPILE_FOR_R5 #include #include +#define DW_GET_SYNC_DATA 0x880 +#define DW_SET_FULLSCREEN 0x881 +#define DW_SUPPORTS_WINDOW_MODE 0xF2C #endif // Compiling for DANO/Zeta is broken as it doesn't have BRegion::set_size() @@ -24,6 +27,10 @@ #warning "##### Building BDirectWindow for TARGET_PLATFORM=dano (DANO/Zeta) is broken #####" #endif +#ifdef __HAIKU__ +#include +#include +#endif // TODO: We'll want to move this to a private header, // accessible by the app server. @@ -35,13 +42,6 @@ struct dw_sync_data }; -// TODO: These commands are used by the BeOS R5 app_server. -// Change this when our app_server supports BDirectWindow -#define DW_GET_SYNC_DATA 0x880 -#define DW_SET_FULLSCREEN 0x881 -#define DW_SUPPORTS_WINDOW_MODE 0xF2C - - // We don't need this kind of locking, since the directDeamonFunc // doesn't access critical shared data. #define DW_NEEDS_LOCKING 0 @@ -307,13 +307,23 @@ BDirectWindow::SetFullScreen(bool enable) status_t fullScreen; a_session->sread(sizeof(status_t), &fullScreen); a_session->sread(sizeof(status_t), &status); + full_screen_enable = enable; +#endif +#ifdef __HAIKU__ + + fLink->StartMessage(AS_DW_SET_FULLSCREEN); + fLink->Attach(server_token); // useless ? + fLink->Attach(enable); + + int32 code; + if (fLink->FlushWithReply(code) == B_OK + && code == SERVER_TRUE) { + status = B_OK; + full_screen_enable = enable; + } #endif Unlock(); - - // TODO: Revisit this when we move to our app_server - // Currently the full screen/window status is set - // even if something goes wrong - full_screen_enable = enable; + } return status; } @@ -329,17 +339,27 @@ BDirectWindow::IsFullScreen() const bool BDirectWindow::SupportsWindowMode(screen_id id) { - int32 result = 0; - #ifdef COMPILE_FOR_R5 + int32 result = 0; _BAppServerLink_ link; link.fSession->swrite_l(DW_SUPPORTS_WINDOW_MODE); link.fSession->swrite_l(id.id); link.fSession->sync(); link.fSession->sread(sizeof(result), &result); + return result & true; #endif - return result & true; +#ifdef __HAIKU__ + BPrivate::AppServerLink link; + link.StartMessage(AS_DW_SUPPORTS_WINDOW_MODE); + link.Attach(id); + int32 reply; + if (link.FlushWithReply(reply) == B_OK + && reply == SERVER_TRUE) + return true; +#endif + + return false; } @@ -454,7 +474,19 @@ BDirectWindow::InitData() a_session->sread(sizeof(sync_data), &sync_data); a_session->sread(sizeof(status), &status); -#endif +#endif + +#ifdef __HAIKU__ + fLink->StartMessage(AS_DW_GET_SYNC_DATA); + fLink->Attach(server_token); + + int32 reply; + if (fLink->FlushWithReply(reply) == B_OK + && reply == SERVER_TRUE) { + fLink->Read(&sync_data); + status = B_OK; + } +#endif Unlock(); diff --git a/src/kits/game/Jamfile b/src/kits/game/Jamfile index 9d85826688..7a2db5e50e 100644 --- a/src/kits/game/Jamfile +++ b/src/kits/game/Jamfile @@ -1,5 +1,6 @@ SubDir OBOS_TOP src kits game ; +UsePrivateHeaders app ; UsePrivateHeaders interface ; UsePrivateHeaders input ;