* A stripped down libgame.so is now added to the app_server test environment - it

contains code for BDirectWindow and BWindowScreen only.
* Updated BDirectWindow and BWindowScreen to no longer require the COMPILE_FOR_x
  defines - compilation for R5 is not likely to work anymore, though (the Jamfile
  didn't allow this anymore, anyway)


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15465 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-12-10 14:58:39 +00:00
parent 2b98735f6d
commit 764ac9e5aa
3 changed files with 88 additions and 100 deletions
+34 -43
View File
@@ -7,35 +7,30 @@
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifdef COMPILE_FOR_R5
#include "/boot/develop/headers/be/interface/Window.h"
#endif
#include <DirectWindow.h> #include <DirectWindow.h>
#include <clipping.h> #include <clipping.h>
#ifdef COMPILE_FOR_R5 #ifdef HAIKU_TARGET_PLATFORM_BEOS
#include <R5_AppServerLink.h> # include <R5_AppServerLink.h>
#include <R5_Session.h> # include <R5_Session.h>
#define DW_GET_SYNC_DATA 0x880 # define DW_GET_SYNC_DATA 0x880
#define DW_SET_FULLSCREEN 0x881 # define DW_SET_FULLSCREEN 0x881
#define DW_SUPPORTS_WINDOW_MODE 0xF2C # define DW_SUPPORTS_WINDOW_MODE 0xF2C
#else
# include <AppServerLink.h>
# include <ServerProtocol.h>
#endif #endif
// Compiling for DANO/Zeta is broken as it doesn't have BRegion::set_size() // Compiling for Dano/Zeta is broken as it doesn't have BRegion::set_size()
#ifdef COMPILE_FOR_DANO #ifdef HAIKU_TARGET_PLATFORM_DANO
#warning "##### Building BDirectWindow for TARGET_PLATFORM=dano (DANO/Zeta) is broken #####" # warning "##### Building BDirectWindow for TARGET_PLATFORM=dano (DANO/Zeta) is broken #####"
#endif #endif
#ifdef __HAIKU__
#include <AppServerLink.h>
#include <ServerProtocol.h>
#endif
// TODO: We'll want to move this to a private header, // TODO: We'll want to move this to a private header,
// accessible by the app server. // accessible by the app server.
struct dw_sync_data struct dw_sync_data {
{
area_id area; area_id area;
sem_id disableSem; sem_id disableSem;
sem_id disableSemAck; sem_id disableSemAck;
@@ -53,15 +48,17 @@ enum dw_status_bits {
}; };
BDirectWindow::BDirectWindow(BRect frame, const char *title, window_type type, uint32 flags, uint32 workspace) BDirectWindow::BDirectWindow(BRect frame, const char *title, window_type type,
:BWindow(frame, title, type, flags, workspace) uint32 flags, uint32 workspace)
: BWindow(frame, title, type, flags, workspace)
{ {
InitData(); InitData();
} }
BDirectWindow::BDirectWindow(BRect frame, const char *title, window_look look, window_feel feel, uint32 flags, uint32 workspace) BDirectWindow::BDirectWindow(BRect frame, const char *title, window_look look,
:BWindow(frame, title, look, feel, flags, workspace) window_feel feel, uint32 flags, uint32 workspace)
: BWindow(frame, title, look, feel, flags, workspace)
{ {
InitData(); InitData();
} }
@@ -195,7 +192,7 @@ BDirectWindow::Hide()
BHandler * BHandler *
BDirectWindow::ResolveSpecifier(BMessage *msg, int32 index, BDirectWindow::ResolveSpecifier(BMessage *msg, int32 index,
BMessage *specifier, int32 form, const char *property) BMessage *specifier, int32 form, const char *property)
{ {
return inherited::ResolveSpecifier(msg, index, specifier, form, property); return inherited::ResolveSpecifier(msg, index, specifier, form, property);
} }
@@ -227,14 +224,15 @@ BDirectWindow::ConvertToMessage(void *raw, int32 code)
{ {
return inherited::ConvertToMessage(raw, code); return inherited::ConvertToMessage(raw, code);
} }
// end of BWindow API
// BDirectWindow specific API // #pragma mark - BDirectWindow specific API
void void
BDirectWindow::DirectConnected(direct_buffer_info *info) BDirectWindow::DirectConnected(direct_buffer_info *info)
{ {
//implemented in subclasses // implemented in subclasses
} }
@@ -263,7 +261,7 @@ BDirectWindow::GetClippingRegion(BRegion *region, BPoint *origin) const
originY = (int32)origin->y; originY = (int32)origin->y;
} }
#ifndef COMPILE_FOR_DANO #ifndef HAIKU_TARGET_PLATFORM_DANO
// Since we are friend of BRegion, we can access its private members. // Since we are friend of BRegion, we can access its private members.
// Otherwise, we would need to call BRegion::Include(clipping_rect) // Otherwise, we would need to call BRegion::Include(clipping_rect)
// for every clipping_rect in our clip_list, and that would be much // for every clipping_rect in our clip_list, and that would be much
@@ -290,8 +288,7 @@ BDirectWindow::SetFullScreen(bool enable)
{ {
status_t status = B_ERROR; status_t status = B_ERROR;
if (Lock()) { if (Lock()) {
#ifdef HAIKU_TARGET_PLATFORM_BEOS
#ifdef COMPILE_FOR_R5
a_session->swrite_l(DW_SET_FULLSCREEN); a_session->swrite_l(DW_SET_FULLSCREEN);
a_session->swrite_l(server_token); a_session->swrite_l(server_token);
a_session->swrite_l((int32)enable); a_session->swrite_l((int32)enable);
@@ -301,13 +298,11 @@ BDirectWindow::SetFullScreen(bool enable)
a_session->sread(sizeof(status_t), &fullScreen); a_session->sread(sizeof(status_t), &fullScreen);
a_session->sread(sizeof(status_t), &status); a_session->sread(sizeof(status_t), &status);
full_screen_enable = enable; full_screen_enable = enable;
#endif #else
#ifdef __HAIKU__
fLink->StartMessage(AS_DW_SET_FULLSCREEN); fLink->StartMessage(AS_DW_SET_FULLSCREEN);
fLink->Attach<int32>(server_token); // useless ? fLink->Attach<int32>(server_token); // useless ?
fLink->Attach<bool>(enable); fLink->Attach<bool>(enable);
int32 code; int32 code;
if (fLink->FlushWithReply(code) == B_OK if (fLink->FlushWithReply(code) == B_OK
&& code == SERVER_TRUE) { && code == SERVER_TRUE) {
@@ -332,7 +327,7 @@ BDirectWindow::IsFullScreen() const
bool bool
BDirectWindow::SupportsWindowMode(screen_id id) BDirectWindow::SupportsWindowMode(screen_id id)
{ {
#ifdef COMPILE_FOR_R5 #ifdef HAIKU_TARGET_PLATFORM_BEOS
int32 result = 0; int32 result = 0;
_BAppServerLink_ link; _BAppServerLink_ link;
link.fSession->swrite_l(DW_SUPPORTS_WINDOW_MODE); link.fSession->swrite_l(DW_SUPPORTS_WINDOW_MODE);
@@ -340,9 +335,7 @@ BDirectWindow::SupportsWindowMode(screen_id id)
link.fSession->sync(); link.fSession->sync();
link.fSession->sread(sizeof(result), &result); link.fSession->sread(sizeof(result), &result);
return result & true; return result & true;
#endif #else
#ifdef __HAIKU__
BPrivate::AppServerLink link; BPrivate::AppServerLink link;
link.StartMessage(AS_DW_SUPPORTS_WINDOW_MODE); link.StartMessage(AS_DW_SUPPORTS_WINDOW_MODE);
link.Attach<screen_id>(id); link.Attach<screen_id>(id);
@@ -459,7 +452,7 @@ BDirectWindow::InitData()
struct dw_sync_data sync_data; struct dw_sync_data sync_data;
status_t status = B_ERROR; status_t status = B_ERROR;
#ifdef COMPILE_FOR_R5 #ifdef HAIKU_TARGET_PLATFORM_BEOS
a_session->swrite_l(DW_GET_SYNC_DATA); a_session->swrite_l(DW_GET_SYNC_DATA);
a_session->swrite_l(server_token); a_session->swrite_l(server_token);
@@ -467,15 +460,13 @@ BDirectWindow::InitData()
a_session->sread(sizeof(sync_data), &sync_data); a_session->sread(sizeof(sync_data), &sync_data);
a_session->sread(sizeof(status), &status); a_session->sread(sizeof(status), &status);
#endif #else
#ifdef __HAIKU__
fLink->StartMessage(AS_DW_GET_SYNC_DATA); fLink->StartMessage(AS_DW_GET_SYNC_DATA);
fLink->Attach<int32>(server_token); fLink->Attach<int32>(server_token);
int32 reply; int32 reply;
if (fLink->FlushWithReply(reply) == B_OK if (fLink->FlushWithReply(reply) == B_OK
&& reply == SERVER_TRUE) { && reply == B_OK) {
fLink->Read<dw_sync_data>(&sync_data); fLink->Read<dw_sync_data>(&sync_data);
status = B_OK; status = B_OK;
} }
+28 -31
View File
@@ -1,44 +1,41 @@
SubDir HAIKU_TOP src kits game ; SubDir HAIKU_TOP src kits game ;
AddSubDirSupportedPlatforms libbe_test ;
UsePrivateHeaders app ; UsePrivateHeaders app ;
UsePrivateHeaders interface ; UsePrivateHeaders interface ;
UsePrivateHeaders input ; UsePrivateHeaders input ;
SubDirSysHdrs $(SUBDIR) ; SubDirSysHdrs $(SUBDIR) ;
if ! $(HAIKU_COMPATIBLE) {
if $(DANO_COMPATIBLE) {
SubDirC++Flags -DCOMPILE_FOR_DANO ;
} else {
SubDirC++Flags -DCOMPILE_FOR_R5 ;
}
}
if $(TARGET_PLATFORM) = haiku {
SharedLibrary libgame.so : SharedLibrary libgame.so :
# Public Game Kit # Public Game Kit
DirectWindow.cpp DirectWindow.cpp
WindowScreen.cpp WindowScreen.cpp
GameSound.cpp GameSound.cpp
SimpleGameSound.cpp SimpleGameSound.cpp
FileGameSound.cpp FileGameSound.cpp
PushGameSound.cpp PushGameSound.cpp
StreamingGameSound.cpp StreamingGameSound.cpp
# Internal Functionality # Internal Functionality
GameProducer.cpp GameProducer.cpp
GameSoundBuffer.cpp GameSoundBuffer.cpp
GameSoundDevice.cpp GameSoundDevice.cpp
GSUtility.cpp GSUtility.cpp
; : be media
if $(HAIKU_COMPATIBLE) {
LinkAgainst libgame.so :
libbe.so libmedia.so
; ;
} else { } else if $(TARGET_PLATFORM) = libbe_test {
LinkAgainst libgame.so :
be libmedia.so SharedLibrary libgame.so :
DirectWindow.cpp
WindowScreen.cpp
: be
; ;
HaikuInstall install-test-apps : $(HAIKU_APP_TEST_LIB_DIR) : libgame.so
: tests!apps ;
} }
+26 -26
View File
@@ -7,9 +7,6 @@
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
*/ */
#ifdef COMPILE_FOR_R5
#include "/boot/develop/headers/be/interface/Window.h"
#endif
#include <Application.h> #include <Application.h>
#include <Screen.h> #include <Screen.h>
@@ -24,10 +21,6 @@
#include <WindowPrivate.h> #include <WindowPrivate.h>
#ifdef COMPILE_FOR_R5
#include <R5_AppServerLink.h>
#endif
// WindowScreen commands // WindowScreen commands
#define WS_MOVE_DISPLAY 0x00000108 #define WS_MOVE_DISPLAY 0x00000108
#define WS_SET_FULLSCREEN 0x00000881 #define WS_SET_FULLSCREEN 0x00000881
@@ -278,7 +271,9 @@ mode2parms(uint32 space, uint32 *out_space, int32 *width, int32 *height)
} }
// BWindowScreen public API // #pragma mark - public API calls
void void
set_mouse_position(int32 x, int32 y) set_mouse_position(int32 x, int32 y)
{ {
@@ -290,27 +285,32 @@ set_mouse_position(int32 x, int32 y)
} }
BWindowScreen::BWindowScreen(const char *title, uint32 space, status_t *error, bool debug_enable) // #pragma mark -
:
BWindow(BScreen().Frame(), title, B_TITLED_WINDOW,
kWindowScreenFlag | B_NOT_MINIMIZABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_MOVABLE | B_NOT_RESIZABLE, BWindowScreen::BWindowScreen(const char *title, uint32 space,
status_t *error, bool debug_enable)
: BWindow(BScreen().Frame(), title, B_TITLED_WINDOW,
kWindowScreenFlag | B_NOT_MINIMIZABLE | B_NOT_CLOSABLE
| B_NOT_ZOOMABLE | B_NOT_MOVABLE | B_NOT_RESIZABLE,
B_CURRENT_WORKSPACE) B_CURRENT_WORKSPACE)
{ {
CALLED(); CALLED();
uint32 attributes = 0; uint32 attributes = 0;
if (debug_enable) if (debug_enable)
attributes |= B_ENABLE_DEBUGGER; attributes |= B_ENABLE_DEBUGGER;
status_t status = InitData(space, attributes); status_t status = InitData(space, attributes);
if (error) if (error)
*error = status; *error = status;
} }
BWindowScreen::BWindowScreen(const char *title, uint32 space, uint32 attributes, status_t *error) BWindowScreen::BWindowScreen(const char *title, uint32 space,
: uint32 attributes, status_t *error)
BWindow(BScreen().Frame(), title, B_TITLED_WINDOW, : BWindow(BScreen().Frame(), title, B_TITLED_WINDOW,
kWindowScreenFlag | B_NOT_MINIMIZABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_MOVABLE | B_NOT_RESIZABLE, kWindowScreenFlag | B_NOT_MINIMIZABLE | B_NOT_CLOSABLE
| B_NOT_ZOOMABLE | B_NOT_MOVABLE | B_NOT_RESIZABLE,
B_CURRENT_WORKSPACE) B_CURRENT_WORKSPACE)
{ {
CALLED(); CALLED();
@@ -454,7 +454,7 @@ BWindowScreen::SetColorList(rgb_color *list, int32 first_index, int32 last_index
colorList[x] = list[x]; colorList[x] = list[x];
// Tell the app_server about our changes // Tell the app_server about our changes
#ifdef COMPILE_FOR_R5 #ifdef HAIKU_TARGET_PLATFORM_BEOS
_BAppServerLink_ link; _BAppServerLink_ link;
link.fSession->swrite_l(WS_SET_PALETTE); link.fSession->swrite_l(WS_SET_PALETTE);
link.fSession->swrite_l(screen_index); link.fSession->swrite_l(screen_index);
@@ -517,7 +517,7 @@ BWindowScreen::MoveDisplayArea(int32 x, int32 y)
{ {
status_t status = B_ERROR; status_t status = B_ERROR;
#ifdef COMPILE_FOR_R5 #ifdef HAIKU_TARGET_PLATFORM_BEOS
_BAppServerLink_ link; _BAppServerLink_ link;
link.fSession->swrite_l(WS_DISPLAY_UTILS); link.fSession->swrite_l(WS_DISPLAY_UTILS);
link.fSession->swrite_l(screen_index); link.fSession->swrite_l(screen_index);
@@ -697,7 +697,7 @@ BWindowScreen::SetFullscreen(int32 enable)
{ {
int32 retval = -1; int32 retval = -1;
#ifdef COMPILE_FOR_R5 #ifdef HAIKU_TARGET_PLATFORM_BEOS
int32 result = -1; int32 result = -1;
a_session->swrite_l(WS_SET_FULLSCREEN); a_session->swrite_l(WS_SET_FULLSCREEN);
@@ -802,7 +802,7 @@ BWindowScreen::SetActiveState(int32 state)
if (status == B_OK) { if (status == B_OK) {
be_app->ShowCursor(); be_app->ShowCursor();
if (activate_state) { if (activate_state) {
#ifdef COMPILE_FOR_R5 #ifdef HAIKU_TARGET_PLATFORM_BEOS
const color_map *colorMap = system_colors(); const color_map *colorMap = system_colors();
_BAppServerLink_ link; _BAppServerLink_ link;
@@ -838,7 +838,7 @@ BWindowScreen::SetLockState(int32 state)
status_t status = B_ERROR; status_t status = B_ERROR;
#ifdef COMPILE_FOR_R5 #ifdef HAIKU_TARGET_PLATFORM_BEOS
_BAppServerLink_ link; _BAppServerLink_ link;
link.fSession->swrite_l(WS_SET_LOCK_STATE); link.fSession->swrite_l(WS_SET_LOCK_STATE);
link.fSession->swrite_l(screen_index); link.fSession->swrite_l(screen_index);
@@ -931,7 +931,7 @@ BWindowScreen::GetCardInfo()
frame_buffer_config config; frame_buffer_config config;
#ifdef COMPILE_FOR_R5 #ifdef HAIKU_TARGET_PLATFORM_BEOS
_BAppServerLink_ link; _BAppServerLink_ link;
link.fSession->swrite_l(WS_GET_FRAMEBUFFER); link.fSession->swrite_l(WS_GET_FRAMEBUFFER);
link.fSession->swrite_l(id.id); link.fSession->swrite_l(id.id);
@@ -1025,7 +1025,7 @@ status_t
BWindowScreen::InitClone() BWindowScreen::InitClone()
{ {
CALLED(); CALLED();
#ifndef COMPILE_FOR_R5 #ifndef HAIKU_TARGET_PLATFORM_BEOS
// TODO: Too much stuff to change, I'll just // TODO: Too much stuff to change, I'll just
return B_ERROR; return B_ERROR;
// for now // for now
@@ -1101,8 +1101,8 @@ status_t
BWindowScreen::AssertDisplayMode(display_mode *dmode) BWindowScreen::AssertDisplayMode(display_mode *dmode)
{ {
status_t result = B_ERROR; status_t result = B_ERROR;
#ifdef COMPILE_FOR_R5 #ifdef HAIKU_TARGET_PLATFORM_BEOS
_BAppServerLink_ link; _BAppServerLink_ link;
link.fSession->swrite_l(WS_SET_DISPLAY_MODE); // check display_mode valid command link.fSession->swrite_l(WS_SET_DISPLAY_MODE); // check display_mode valid command
link.fSession->swrite_l(screen_index); link.fSession->swrite_l(screen_index);