Skip to content
Permalink
Browse files
haiku: Rename internal functions from BE_* to HAIKU_*
Fixes Bugzilla #2349.
  • Loading branch information
icculus committed Aug 7, 2018
1 parent c0ac09e commit 941c5b47605693412635a6376d4268fc40881134
@@ -231,7 +231,7 @@ class SDL_BApp : public BApplication {
SDL_SendMouseMotion(win, 0, 0, x, y);

/* Tell the application that the mouse passed over, redraw needed */
BE_UpdateWindowFramebuffer(NULL,win,NULL,-1);
HAIKU_UpdateWindowFramebuffer(NULL,win,NULL,-1);
}

void _HandleMouseButton(BMessage *msg) {
@@ -274,11 +274,11 @@ class SDL_BApp : public BApplication {
}

/* Make sure this isn't a repeated event (key pressed and held) */
if(state == SDL_PRESSED && BE_GetKeyState(scancode) == SDL_PRESSED) {
if(state == SDL_PRESSED && HAIKU_GetKeyState(scancode) == SDL_PRESSED) {
return;
}
BE_SetKeyState(scancode, state);
SDL_SendKeyboardKey(state, BE_GetScancodeFromBeKey(scancode));
HAIKU_SetKeyState(scancode, state);
SDL_SendKeyboardKey(state, HAIKU_GetScancodeFromBeKey(scancode));

if (state == SDL_PRESSED && SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) {
const int8 *keyUtf8;
@@ -88,7 +88,7 @@ class SDL_BWin:public BDirectWindow
_clips = NULL;

#ifdef DRAWTHREAD
_draw_thread_id = spawn_thread(BE_DrawThread, "drawing_thread",
_draw_thread_id = spawn_thread(HAIKU_DrawThread, "drawing_thread",
B_NORMAL_PRIORITY, (void*) this);
resume_thread(_draw_thread_id);
#endif
@@ -35,7 +35,7 @@
extern "C" {
#endif

int BE_SetClipboardText(_THIS, const char *text) {
int HAIKU_SetClipboardText(_THIS, const char *text) {
BMessage *clip = NULL;
if(be_clipboard->Lock()) {
be_clipboard->Clear();
@@ -51,7 +51,7 @@ int BE_SetClipboardText(_THIS, const char *text) {
return 0;
}

char *BE_GetClipboardText(_THIS) {
char *HAIKU_GetClipboardText(_THIS) {
BMessage *clip = NULL;
const char *text = NULL;
ssize_t length;
@@ -76,9 +76,9 @@ char *BE_GetClipboardText(_THIS) {
return result;
}

SDL_bool BE_HasClipboardText(_THIS) {
SDL_bool HAIKU_HasClipboardText(_THIS) {
SDL_bool result = SDL_FALSE;
char *text = BE_GetClipboardText(_this);
char *text = HAIKU_GetClipboardText(_this);
if (text) {
result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE;
SDL_free(text);
@@ -24,9 +24,9 @@
#ifndef SDL_BCLIPBOARD_H
#define SDL_BCLIPBOARD_H

extern int BE_SetClipboardText(_THIS, const char *text);
extern char *BE_GetClipboardText(_THIS);
extern SDL_bool BE_HasClipboardText(_THIS);
extern int HAIKU_SetClipboardText(_THIS, const char *text);
extern char *HAIKU_GetClipboardText(_THIS);
extern SDL_bool HAIKU_HasClipboardText(_THIS);

#endif

@@ -28,7 +28,7 @@
extern "C" {
#endif

void BE_PumpEvents(_THIS) {
void HAIKU_PumpEvents(_THIS) {
/* Since the event thread is its own thread, this isn't really necessary */
}

@@ -28,7 +28,7 @@
extern "C" {
#endif

extern void BE_PumpEvents(_THIS);
extern void HAIKU_PumpEvents(_THIS);

#ifdef __cplusplus
}
@@ -36,7 +36,7 @@ extern "C" {
#endif

#ifndef DRAWTHREAD
static int32 BE_UpdateOnce(SDL_Window *window);
static int32 HAIKU_UpdateOnce(SDL_Window *window);
#endif

static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
@@ -47,7 +47,7 @@ static SDL_INLINE SDL_BApp *_GetBeApp() {
return ((SDL_BApp*)be_app);
}

int BE_CreateWindowFramebuffer(_THIS, SDL_Window * window,
int HAIKU_CreateWindowFramebuffer(_THIS, SDL_Window * window,
Uint32 * format,
void ** pixels, int *pitch) {
SDL_BWin *bwin = _ToBeWin(window);
@@ -64,8 +64,8 @@ int BE_CreateWindowFramebuffer(_THIS, SDL_Window * window,
/* format */
display_mode bmode;
bscreen.GetMode(&bmode);
int32 bpp = BE_ColorSpaceToBitsPerPixel(bmode.space);
*format = BE_BPPToSDLPxFormat(bpp);
int32 bpp = HAIKU_ColorSpaceToBitsPerPixel(bmode.space);
*format = HAIKU_BPPToSDLPxFormat(bpp);

/* Create the new bitmap object */
BBitmap *bitmap = bwin->GetBitmap();
@@ -99,7 +99,7 @@ int BE_CreateWindowFramebuffer(_THIS, SDL_Window * window,



int BE_UpdateWindowFramebuffer(_THIS, SDL_Window * window,
int HAIKU_UpdateWindowFramebuffer(_THIS, SDL_Window * window,
const SDL_Rect * rects, int numrects) {
if(!window)
return 0;
@@ -112,13 +112,13 @@ int BE_UpdateWindowFramebuffer(_THIS, SDL_Window * window,
bwin->UnlockBuffer();
#else
bwin->SetBufferDirty(true);
BE_UpdateOnce(window);
HAIKU_UpdateOnce(window);
#endif

return 0;
}

int32 BE_DrawThread(void *data) {
int32 HAIKU_DrawThread(void *data) {
SDL_BWin *bwin = (SDL_BWin*)data;

BScreen bscreen;
@@ -181,7 +181,7 @@ int32 BE_DrawThread(void *data) {
return B_OK;
}

void BE_DestroyWindowFramebuffer(_THIS, SDL_Window * window) {
void HAIKU_DestroyWindowFramebuffer(_THIS, SDL_Window * window) {
SDL_BWin *bwin = _ToBeWin(window);

bwin->LockBuffer();
@@ -202,7 +202,7 @@ void BE_DestroyWindowFramebuffer(_THIS, SDL_Window * window) {
* solved, but I doubt it- they were pretty sporadic before now.
*/
#ifndef DRAWTHREAD
static int32 BE_UpdateOnce(SDL_Window *window) {
static int32 HAIKU_UpdateOnce(SDL_Window *window) {
SDL_BWin *bwin = _ToBeWin(window);
BScreen bscreen;
if(!bscreen.IsValid()) {
@@ -30,13 +30,13 @@ extern "C" {

#include "../SDL_sysvideo.h"

extern int BE_CreateWindowFramebuffer(_THIS, SDL_Window * window,
extern int HAIKU_CreateWindowFramebuffer(_THIS, SDL_Window * window,
Uint32 * format,
void ** pixels, int *pitch);
extern int BE_UpdateWindowFramebuffer(_THIS, SDL_Window * window,
extern int HAIKU_UpdateWindowFramebuffer(_THIS, SDL_Window * window,
const SDL_Rect * rects, int numrects);
extern void BE_DestroyWindowFramebuffer(_THIS, SDL_Window * window);
extern int32 BE_DrawThread(void *data);
extern void HAIKU_DestroyWindowFramebuffer(_THIS, SDL_Window * window);
extern int32 HAIKU_DrawThread(void *data);

#ifdef __cplusplus
}
@@ -41,7 +41,7 @@ extern "C" {
static SDL_Scancode keymap[KEYMAP_SIZE];
static int8 keystate[KEYMAP_SIZE];

void BE_InitOSKeymap(void) {
void HAIKU_InitOSKeymap(void) {
for( uint i = 0; i < SDL_TABLESIZE(keymap); ++i ) {
keymap[i] = SDL_SCANCODE_UNKNOWN;
}
@@ -159,23 +159,23 @@ void BE_InitOSKeymap(void) {
keymap[0x6b] = SDL_GetScancodeFromKey(SDLK_POWER);
}

SDL_Scancode BE_GetScancodeFromBeKey(int32 bkey) {
SDL_Scancode HAIKU_GetScancodeFromBeKey(int32 bkey) {
if(bkey > 0 && bkey < (int32)SDL_TABLESIZE(keymap)) {
return keymap[bkey];
} else {
return SDL_SCANCODE_UNKNOWN;
}
}

int8 BE_GetKeyState(int32 bkey) {
int8 HAIKU_GetKeyState(int32 bkey) {
if(bkey > 0 && bkey < KEYMAP_SIZE) {
return keystate[bkey];
} else {
return SDL_RELEASED;
}
}

void BE_SetKeyState(int32 bkey, int8 state) {
void HAIKU_SetKeyState(int32 bkey, int8 state) {
if(bkey > 0 && bkey < KEYMAP_SIZE) {
keystate[bkey] = state;
}
@@ -30,10 +30,10 @@ extern "C" {

#include "../../../include/SDL_keyboard.h"

extern void BE_InitOSKeymap(void);
extern SDL_Scancode BE_GetScancodeFromBeKey(int32 bkey);
extern int8 BE_GetKeyState(int32 bkey);
extern void BE_SetKeyState(int32 bkey, int8 state);
extern void HAIKU_InitOSKeymap(void);
extern SDL_Scancode HAIKU_GetScancodeFromBeKey(int32 bkey);
extern int8 HAIKU_GetKeyState(int32 bkey);
extern void HAIKU_SetKeyState(int32 bkey, int8 state);

#ifdef __cplusplus
}
@@ -132,7 +132,7 @@ void _SpoutModeData(display_mode *bmode) {



int32 BE_ColorSpaceToBitsPerPixel(uint32 colorspace)
int32 HAIKU_ColorSpaceToBitsPerPixel(uint32 colorspace)
{
int bitsperpixel;

@@ -163,7 +163,7 @@ int32 BE_ColorSpaceToBitsPerPixel(uint32 colorspace)
return(bitsperpixel);
}

int32 BE_BPPToSDLPxFormat(int32 bpp) {
int32 HAIKU_BPPToSDLPxFormat(int32 bpp) {
/* Translation taken from SDL_windowsmodes.c */
switch (bpp) {
case 32:
@@ -210,8 +210,8 @@ static void _BDisplayModeToSdlDisplayMode(display_mode *bmode,
#endif

/* Set the format */
int32 bpp = BE_ColorSpaceToBitsPerPixel(bmode->space);
mode->format = BE_BPPToSDLPxFormat(bpp);
int32 bpp = HAIKU_ColorSpaceToBitsPerPixel(bmode->space);
mode->format = HAIKU_BPPToSDLPxFormat(bpp);
}

/* Later, there may be more than one monitor available */
@@ -235,7 +235,7 @@ static void _AddDisplay(BScreen *screen) {
* Functions called by SDL
*/

int BE_InitModes(_THIS) {
int HAIKU_InitModes(_THIS) {
BScreen screen;

/* TODO: When Haiku supports multiple display screens, call
@@ -244,13 +244,13 @@ int BE_InitModes(_THIS) {
return 0;
}

int BE_QuitModes(_THIS) {
int HAIKU_QuitModes(_THIS) {
/* FIXME: Nothing really needs to be done here at the moment? */
return 0;
}


int BE_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect) {
int HAIKU_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect) {
BScreen bscreen;
BRect rc = bscreen.Frame();
rect->x = (int)rc.left;
@@ -260,7 +260,7 @@ int BE_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect) {
return 0;
}

void BE_GetDisplayModes(_THIS, SDL_VideoDisplay *display) {
void HAIKU_GetDisplayModes(_THIS, SDL_VideoDisplay *display) {
/* Get the current screen */
BScreen bscreen;

@@ -285,7 +285,7 @@ void BE_GetDisplayModes(_THIS, SDL_VideoDisplay *display) {
}


int BE_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode){
int HAIKU_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode){
/* Get the current screen */
BScreen bscreen;
if(!bscreen.IsValid()) {
@@ -318,7 +318,7 @@ int BE_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode){
#if SDL_VIDEO_OPENGL
/* FIXME: Is there some way to reboot the OpenGL context? This doesn't
help */
// BE_GL_RebootContexts(_this);
// HAIKU_GL_RebootContexts(_this);
#endif

return 0;
@@ -28,15 +28,15 @@ extern "C" {

#include "../SDL_sysvideo.h"

extern int32 BE_ColorSpaceToBitsPerPixel(uint32 colorspace);
extern int32 BE_BPPToSDLPxFormat(int32 bpp);
extern int32 HAIKU_ColorSpaceToBitsPerPixel(uint32 colorspace);
extern int32 HAIKU_BPPToSDLPxFormat(int32 bpp);

extern int BE_InitModes(_THIS);
extern int BE_QuitModes(_THIS);
extern int BE_GetDisplayBounds(_THIS, SDL_VideoDisplay *display,
extern int HAIKU_InitModes(_THIS);
extern int HAIKU_QuitModes(_THIS);
extern int HAIKU_GetDisplayBounds(_THIS, SDL_VideoDisplay *display,
SDL_Rect *rect);
extern void BE_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
extern int BE_SetDisplayMode(_THIS, SDL_VideoDisplay *display,
extern void HAIKU_GetDisplayModes(_THIS, SDL_VideoDisplay *display);
extern int HAIKU_SetDisplayMode(_THIS, SDL_VideoDisplay *display,
SDL_DisplayMode *mode);

#ifdef __cplusplus

0 comments on commit 941c5b4

Please sign in to comment.