* 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

View File

@ -7,35 +7,30 @@
* 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 <clipping.h>
#ifdef COMPILE_FOR_R5
#include <R5_AppServerLink.h>
#include <R5_Session.h>
#define DW_GET_SYNC_DATA 0x880
#define DW_SET_FULLSCREEN 0x881
#define DW_SUPPORTS_WINDOW_MODE 0xF2C
#ifdef HAIKU_TARGET_PLATFORM_BEOS
# include <R5_AppServerLink.h>
# include <R5_Session.h>
# define DW_GET_SYNC_DATA 0x880
# define DW_SET_FULLSCREEN 0x881
# define DW_SUPPORTS_WINDOW_MODE 0xF2C
#else
# include <AppServerLink.h>
# include <ServerProtocol.h>
#endif
// Compiling for DANO/Zeta is broken as it doesn't have BRegion::set_size()
#ifdef COMPILE_FOR_DANO
#warning "##### Building BDirectWindow for TARGET_PLATFORM=dano (DANO/Zeta) is broken #####"
// Compiling for Dano/Zeta is broken as it doesn't have BRegion::set_size()
#ifdef HAIKU_TARGET_PLATFORM_DANO
# warning "##### Building BDirectWindow for TARGET_PLATFORM=dano (DANO/Zeta) is broken #####"
#endif
#ifdef __HAIKU__
#include <AppServerLink.h>
#include <ServerProtocol.h>
#endif
// TODO: We'll want to move this to a private header,
// accessible by the app server.
struct dw_sync_data
{
struct dw_sync_data {
area_id area;
sem_id disableSem;
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)
:BWindow(frame, title, type, flags, workspace)
BDirectWindow::BDirectWindow(BRect frame, const char *title, window_type type,
uint32 flags, uint32 workspace)
: BWindow(frame, title, type, flags, workspace)
{
InitData();
}
BDirectWindow::BDirectWindow(BRect frame, const char *title, window_look look, window_feel feel, uint32 flags, uint32 workspace)
:BWindow(frame, title, look, feel, flags, workspace)
BDirectWindow::BDirectWindow(BRect frame, const char *title, window_look look,
window_feel feel, uint32 flags, uint32 workspace)
: BWindow(frame, title, look, feel, flags, workspace)
{
InitData();
}
@ -195,7 +192,7 @@ BDirectWindow::Hide()
BHandler *
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);
}
@ -227,14 +224,15 @@ BDirectWindow::ConvertToMessage(void *raw, int32 code)
{
return inherited::ConvertToMessage(raw, code);
}
// end of BWindow API
// BDirectWindow specific API
// #pragma mark - BDirectWindow specific API
void
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;
}
#ifndef COMPILE_FOR_DANO
#ifndef HAIKU_TARGET_PLATFORM_DANO
// Since we are friend of BRegion, we can access its private members.
// Otherwise, we would need to call BRegion::Include(clipping_rect)
// 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;
if (Lock()) {
#ifdef COMPILE_FOR_R5
#ifdef HAIKU_TARGET_PLATFORM_BEOS
a_session->swrite_l(DW_SET_FULLSCREEN);
a_session->swrite_l(server_token);
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), &status);
full_screen_enable = enable;
#endif
#ifdef __HAIKU__
#else
fLink->StartMessage(AS_DW_SET_FULLSCREEN);
fLink->Attach<int32>(server_token); // useless ?
fLink->Attach<bool>(enable);
int32 code;
if (fLink->FlushWithReply(code) == B_OK
&& code == SERVER_TRUE) {
@ -332,7 +327,7 @@ BDirectWindow::IsFullScreen() const
bool
BDirectWindow::SupportsWindowMode(screen_id id)
{
#ifdef COMPILE_FOR_R5
#ifdef HAIKU_TARGET_PLATFORM_BEOS
int32 result = 0;
_BAppServerLink_ link;
link.fSession->swrite_l(DW_SUPPORTS_WINDOW_MODE);
@ -340,9 +335,7 @@ BDirectWindow::SupportsWindowMode(screen_id id)
link.fSession->sync();
link.fSession->sread(sizeof(result), &result);
return result & true;
#endif
#ifdef __HAIKU__
#else
BPrivate::AppServerLink link;
link.StartMessage(AS_DW_SUPPORTS_WINDOW_MODE);
link.Attach<screen_id>(id);
@ -459,7 +452,7 @@ BDirectWindow::InitData()
struct dw_sync_data sync_data;
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(server_token);
@ -467,15 +460,13 @@ BDirectWindow::InitData()
a_session->sread(sizeof(sync_data), &sync_data);
a_session->sread(sizeof(status), &status);
#endif
#ifdef __HAIKU__
#else
fLink->StartMessage(AS_DW_GET_SYNC_DATA);
fLink->Attach<int32>(server_token);
int32 reply;
if (fLink->FlushWithReply(reply) == B_OK
&& reply == SERVER_TRUE) {
&& reply == B_OK) {
fLink->Read<dw_sync_data>(&sync_data);
status = B_OK;
}

View File

@ -1,44 +1,41 @@
SubDir HAIKU_TOP src kits game ;
AddSubDirSupportedPlatforms libbe_test ;
UsePrivateHeaders app ;
UsePrivateHeaders interface ;
UsePrivateHeaders input ;
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 :
# Public Game Kit
DirectWindow.cpp
WindowScreen.cpp
GameSound.cpp
SimpleGameSound.cpp
FileGameSound.cpp
PushGameSound.cpp
StreamingGameSound.cpp
# Internal Functionality
GameProducer.cpp
GameSoundBuffer.cpp
GameSoundDevice.cpp
GSUtility.cpp
;
if $(HAIKU_COMPATIBLE) {
LinkAgainst libgame.so :
libbe.so libmedia.so
SharedLibrary libgame.so :
# Public Game Kit
DirectWindow.cpp
WindowScreen.cpp
GameSound.cpp
SimpleGameSound.cpp
FileGameSound.cpp
PushGameSound.cpp
StreamingGameSound.cpp
# Internal Functionality
GameProducer.cpp
GameSoundBuffer.cpp
GameSoundDevice.cpp
GSUtility.cpp
: be media
;
} else {
LinkAgainst libgame.so :
be libmedia.so
} else if $(TARGET_PLATFORM) = libbe_test {
SharedLibrary libgame.so :
DirectWindow.cpp
WindowScreen.cpp
: be
;
HaikuInstall install-test-apps : $(HAIKU_APP_TEST_LIB_DIR) : libgame.so
: tests!apps ;
}

View File

@ -7,9 +7,6 @@
* 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 <Screen.h>
@ -24,10 +21,6 @@
#include <WindowPrivate.h>
#ifdef COMPILE_FOR_R5
#include <R5_AppServerLink.h>
#endif
// WindowScreen commands
#define WS_MOVE_DISPLAY 0x00000108
#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
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)
:
BWindow(BScreen().Frame(), title, B_TITLED_WINDOW,
kWindowScreenFlag | B_NOT_MINIMIZABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_MOVABLE | B_NOT_RESIZABLE,
// #pragma mark -
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)
{
CALLED();
uint32 attributes = 0;
if (debug_enable)
attributes |= B_ENABLE_DEBUGGER;
status_t status = InitData(space, attributes);
if (error)
*error = status;
}
BWindowScreen::BWindowScreen(const char *title, uint32 space, uint32 attributes, status_t *error)
:
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,
uint32 attributes, status_t *error)
: 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)
{
CALLED();
@ -454,7 +454,7 @@ BWindowScreen::SetColorList(rgb_color *list, int32 first_index, int32 last_index
colorList[x] = list[x];
// Tell the app_server about our changes
#ifdef COMPILE_FOR_R5
#ifdef HAIKU_TARGET_PLATFORM_BEOS
_BAppServerLink_ link;
link.fSession->swrite_l(WS_SET_PALETTE);
link.fSession->swrite_l(screen_index);
@ -517,7 +517,7 @@ BWindowScreen::MoveDisplayArea(int32 x, int32 y)
{
status_t status = B_ERROR;
#ifdef COMPILE_FOR_R5
#ifdef HAIKU_TARGET_PLATFORM_BEOS
_BAppServerLink_ link;
link.fSession->swrite_l(WS_DISPLAY_UTILS);
link.fSession->swrite_l(screen_index);
@ -697,7 +697,7 @@ BWindowScreen::SetFullscreen(int32 enable)
{
int32 retval = -1;
#ifdef COMPILE_FOR_R5
#ifdef HAIKU_TARGET_PLATFORM_BEOS
int32 result = -1;
a_session->swrite_l(WS_SET_FULLSCREEN);
@ -802,7 +802,7 @@ BWindowScreen::SetActiveState(int32 state)
if (status == B_OK) {
be_app->ShowCursor();
if (activate_state) {
#ifdef COMPILE_FOR_R5
#ifdef HAIKU_TARGET_PLATFORM_BEOS
const color_map *colorMap = system_colors();
_BAppServerLink_ link;
@ -838,7 +838,7 @@ BWindowScreen::SetLockState(int32 state)
status_t status = B_ERROR;
#ifdef COMPILE_FOR_R5
#ifdef HAIKU_TARGET_PLATFORM_BEOS
_BAppServerLink_ link;
link.fSession->swrite_l(WS_SET_LOCK_STATE);
link.fSession->swrite_l(screen_index);
@ -931,7 +931,7 @@ BWindowScreen::GetCardInfo()
frame_buffer_config config;
#ifdef COMPILE_FOR_R5
#ifdef HAIKU_TARGET_PLATFORM_BEOS
_BAppServerLink_ link;
link.fSession->swrite_l(WS_GET_FRAMEBUFFER);
link.fSession->swrite_l(id.id);
@ -1025,7 +1025,7 @@ status_t
BWindowScreen::InitClone()
{
CALLED();
#ifndef COMPILE_FOR_R5
#ifndef HAIKU_TARGET_PLATFORM_BEOS
// TODO: Too much stuff to change, I'll just
return B_ERROR;
// for now
@ -1101,8 +1101,8 @@ status_t
BWindowScreen::AssertDisplayMode(display_mode *dmode)
{
status_t result = B_ERROR;
#ifdef COMPILE_FOR_R5
#ifdef HAIKU_TARGET_PLATFORM_BEOS
_BAppServerLink_ link;
link.fSession->swrite_l(WS_SET_DISPLAY_MODE); // check display_mode valid command
link.fSession->swrite_l(screen_index);