Fixed whitespace

This commit is contained in:
Sam Lantinga 2018-09-24 11:49:25 -07:00
parent 58021b3834
commit 5febdfcece
54 changed files with 1452 additions and 1483 deletions

View File

@ -124,11 +124,11 @@ SDL_InitSubSystem(Uint32 flags)
} }
#if SDL_VIDEO_DRIVER_WINDOWS #if SDL_VIDEO_DRIVER_WINDOWS
if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) { if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) {
if (SDL_HelperWindowCreate() < 0) { if (SDL_HelperWindowCreate() < 0) {
return -1; return -1;
} }
} }
#endif #endif
#if !SDL_TIMERS_DISABLED #if !SDL_TIMERS_DISABLED
@ -263,8 +263,8 @@ SDL_QuitSubSystem(Uint32 flags)
#if !SDL_SENSOR_DISABLED #if !SDL_SENSOR_DISABLED
if ((flags & SDL_INIT_SENSOR)) { if ((flags & SDL_INIT_SENSOR)) {
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_SENSOR)) { if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_SENSOR)) {
SDL_SensorQuit(); SDL_SensorQuit();
} }
SDL_PrivateSubsystemRefCountDecr(SDL_INIT_SENSOR); SDL_PrivateSubsystemRefCountDecr(SDL_INIT_SENSOR);
} }
#endif #endif

View File

@ -445,7 +445,7 @@ static void
ALSA_CloseDevice(_THIS) ALSA_CloseDevice(_THIS)
{ {
if (this->hidden->pcm_handle) { if (this->hidden->pcm_handle) {
/* Wait for the submitted audio to drain /* Wait for the submitted audio to drain
ALSA_snd_pcm_drop() can hang, so don't use that. ALSA_snd_pcm_drop() can hang, so don't use that.
*/ */
Uint32 delay = ((this->spec.samples * 1000) / this->spec.freq) * 2; Uint32 delay = ((this->spec.samples * 1000) / this->spec.freq) * 2;

View File

@ -39,7 +39,7 @@
#include "SDL_name.h" #include "SDL_name.h"
#include "SDL_loadso.h" #include "SDL_loadso.h"
#else #else
#define SDL_NAME(X) X #define SDL_NAME(X) X
#endif #endif
#ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC #ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC

View File

@ -477,8 +477,8 @@ DSOUND_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
SDL_bool tried_format = SDL_FALSE; SDL_bool tried_format = SDL_FALSE;
SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
LPGUID guid = (LPGUID) handle; LPGUID guid = (LPGUID) handle;
DWORD bufsize; DWORD bufsize;
/* Initialize all variables that we clean on shutdown */ /* Initialize all variables that we clean on shutdown */
this->hidden = (struct SDL_PrivateAudioData *) this->hidden = (struct SDL_PrivateAudioData *)
SDL_malloc((sizeof *this->hidden)); SDL_malloc((sizeof *this->hidden));
@ -526,7 +526,7 @@ DSOUND_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
(int) (DSBSIZE_MAX / numchunks)); (int) (DSBSIZE_MAX / numchunks));
} else { } else {
int rc; int rc;
WAVEFORMATEX wfmt; WAVEFORMATEX wfmt;
SDL_zero(wfmt); SDL_zero(wfmt);
if (SDL_AUDIO_ISFLOAT(this->spec.format)) { if (SDL_AUDIO_ISFLOAT(this->spec.format)) {
wfmt.wFormatTag = WAVE_FORMAT_IEEE_FLOAT; wfmt.wFormatTag = WAVE_FORMAT_IEEE_FLOAT;

View File

@ -109,7 +109,7 @@ static pa_operation * (*PULSEAUDIO_pa_stream_drain) (pa_stream *,
pa_stream_success_cb_t, void *); pa_stream_success_cb_t, void *);
static int (*PULSEAUDIO_pa_stream_peek) (pa_stream *, const void **, size_t *); static int (*PULSEAUDIO_pa_stream_peek) (pa_stream *, const void **, size_t *);
static int (*PULSEAUDIO_pa_stream_drop) (pa_stream *); static int (*PULSEAUDIO_pa_stream_drop) (pa_stream *);
static pa_operation * (*PULSEAUDIO_pa_stream_flush) (pa_stream *, static pa_operation * (*PULSEAUDIO_pa_stream_flush) (pa_stream *,
pa_stream_success_cb_t, void *); pa_stream_success_cb_t, void *);
static int (*PULSEAUDIO_pa_stream_disconnect) (pa_stream *); static int (*PULSEAUDIO_pa_stream_disconnect) (pa_stream *);
static void (*PULSEAUDIO_pa_stream_unref) (pa_stream *); static void (*PULSEAUDIO_pa_stream_unref) (pa_stream *);

View File

@ -78,7 +78,7 @@ static void DetectWave##typ##Devs(void) { \
capstyp##2W caps; \ capstyp##2W caps; \
UINT i; \ UINT i; \
for (i = 0; i < devcount; i++) { \ for (i = 0; i < devcount; i++) { \
if (wave##typ##GetDevCaps(i,(LP##capstyp##W)&caps,sizeof(caps))==MMSYSERR_NOERROR) { \ if (wave##typ##GetDevCaps(i,(LP##capstyp##W)&caps,sizeof(caps))==MMSYSERR_NOERROR) { \
char *name = WIN_LookupAudioDeviceName(caps.szPname,&caps.NameGuid); \ char *name = WIN_LookupAudioDeviceName(caps.szPname,&caps.NameGuid); \
if (name != NULL) { \ if (name != NULL) { \
SDL_AddAudioDevice((int) iscapture, name, (void *) ((size_t) i+1)); \ SDL_AddAudioDevice((int) iscapture, name, (void *) ((size_t) i+1)); \
@ -375,8 +375,7 @@ WINMM_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
#endif #endif
/* Create the audio buffer semaphore */ /* Create the audio buffer semaphore */
this->hidden->audio_sem = this->hidden->audio_sem = CreateSemaphore(NULL, iscapture ? 0 : NUM_BUFFERS - 1, NUM_BUFFERS, NULL);
CreateSemaphore(NULL, iscapture ? 0 : NUM_BUFFERS - 1, NUM_BUFFERS, NULL);
if (this->hidden->audio_sem == NULL) { if (this->hidden->audio_sem == NULL) {
return SDL_SetError("Couldn't create semaphore"); return SDL_SetError("Couldn't create semaphore");
} }

View File

@ -77,7 +77,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)(
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)( JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)(
JNIEnv* env, jclass jcls, JNIEnv* env, jclass jcls,
jint surfaceWidth, jint surfaceHeight, jint surfaceWidth, jint surfaceHeight,
jint deviceWidth, jint deviceHeight, jint format, jfloat rate); jint deviceWidth, jint deviceHeight, jint format, jfloat rate);
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)( JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(
JNIEnv* env, jclass jcls); JNIEnv* env, jclass jcls);
@ -537,7 +537,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)(
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)( JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)(
JNIEnv* env, jclass jcls, JNIEnv* env, jclass jcls,
jint surfaceWidth, jint surfaceHeight, jint surfaceWidth, jint surfaceHeight,
jint deviceWidth, jint deviceHeight, jint format, jfloat rate) jint deviceWidth, jint deviceHeight, jint format, jfloat rate)
{ {
Android_SetScreenResolution(surfaceWidth, surfaceHeight, deviceWidth, deviceHeight, format, rate); Android_SetScreenResolution(surfaceWidth, surfaceHeight, deviceWidth, deviceHeight, format, rate);
} }

View File

@ -39,9 +39,8 @@ typedef struct SDL_DBusContext {
void (*bus_add_match)(DBusConnection *, const char *, DBusError *); void (*bus_add_match)(DBusConnection *, const char *, DBusError *);
DBusConnection * (*connection_open_private)(const char *, DBusError *); DBusConnection * (*connection_open_private)(const char *, DBusError *);
void (*connection_set_exit_on_disconnect)(DBusConnection *, dbus_bool_t); void (*connection_set_exit_on_disconnect)(DBusConnection *, dbus_bool_t);
dbus_bool_t (*connection_get_is_connected)(DBusConnection *); dbus_bool_t (*connection_get_is_connected)(DBusConnection *);
dbus_bool_t (*connection_add_filter)(DBusConnection *, DBusHandleMessageFunction, dbus_bool_t (*connection_add_filter)(DBusConnection *, DBusHandleMessageFunction, void *, DBusFreeFunction);
void *, DBusFreeFunction);
dbus_bool_t (*connection_try_register_object_path)(DBusConnection *, const char *, dbus_bool_t (*connection_try_register_object_path)(DBusConnection *, const char *,
const DBusObjectPathVTable *, void *, DBusError *); const DBusObjectPathVTable *, void *, DBusError *);
dbus_bool_t (*connection_send)(DBusConnection *, DBusMessage *, dbus_uint32_t *); dbus_bool_t (*connection_send)(DBusConnection *, DBusMessage *, dbus_uint32_t *);
@ -51,7 +50,7 @@ typedef struct SDL_DBusContext {
void (*connection_flush)(DBusConnection *); void (*connection_flush)(DBusConnection *);
dbus_bool_t (*connection_read_write)(DBusConnection *, int); dbus_bool_t (*connection_read_write)(DBusConnection *, int);
DBusDispatchStatus (*connection_dispatch)(DBusConnection *); DBusDispatchStatus (*connection_dispatch)(DBusConnection *);
dbus_bool_t (*message_is_signal)(DBusMessage *, const char *, const char *); dbus_bool_t (*message_is_signal)(DBusMessage *, const char *, const char *);
DBusMessage *(*message_new_method_call)(const char *, const char *, const char *, const char *); DBusMessage *(*message_new_method_call)(const char *, const char *, const char *, const char *);
dbus_bool_t (*message_append_args)(DBusMessage *, int, ...); dbus_bool_t (*message_append_args)(DBusMessage *, int, ...);
dbus_bool_t (*message_append_args_valist)(DBusMessage *, int, va_list); dbus_bool_t (*message_append_args_valist)(DBusMessage *, int, va_list);
@ -61,7 +60,7 @@ typedef struct SDL_DBusContext {
dbus_bool_t (*message_iter_next)(DBusMessageIter *); dbus_bool_t (*message_iter_next)(DBusMessageIter *);
void (*message_iter_get_basic)(DBusMessageIter *, void *); void (*message_iter_get_basic)(DBusMessageIter *, void *);
int (*message_iter_get_arg_type)(DBusMessageIter *); int (*message_iter_get_arg_type)(DBusMessageIter *);
void (*message_iter_recurse)(DBusMessageIter *, DBusMessageIter *); void (*message_iter_recurse)(DBusMessageIter *, DBusMessageIter *);
void (*message_unref)(DBusMessage *); void (*message_unref)(DBusMessage *);
void (*error_init)(DBusError *); void (*error_init)(DBusError *);
dbus_bool_t (*error_is_set)(const DBusError *); dbus_bool_t (*error_is_set)(const DBusError *);

View File

@ -77,9 +77,9 @@ typedef struct SDL_UDEV_PrivateData
const char *(*udev_device_get_action)(struct udev_device *); const char *(*udev_device_get_action)(struct udev_device *);
const char *(*udev_device_get_devnode)(struct udev_device *); const char *(*udev_device_get_devnode)(struct udev_device *);
const char *(*udev_device_get_subsystem)(struct udev_device *); const char *(*udev_device_get_subsystem)(struct udev_device *);
struct udev_device *(*udev_device_get_parent_with_subsystem_devtype)(struct udev_device *udev_device, const char *subsystem, const char *devtype); struct udev_device *(*udev_device_get_parent_with_subsystem_devtype)(struct udev_device *udev_device, const char *subsystem, const char *devtype);
const char *(*udev_device_get_property_value)(struct udev_device *, const char *); const char *(*udev_device_get_property_value)(struct udev_device *, const char *);
const char *(*udev_device_get_sysattr_value)(struct udev_device *udev_device, const char *sysattr); const char *(*udev_device_get_sysattr_value)(struct udev_device *udev_device, const char *sysattr);
struct udev_device *(*udev_device_new_from_syspath)(struct udev *, const char *); struct udev_device *(*udev_device_new_from_syspath)(struct udev *, const char *);
void (*udev_device_unref)(struct udev_device *); void (*udev_device_unref)(struct udev_device *);
int (*udev_enumerate_add_match_property)(struct udev_enumerate *, const char *, const char *); int (*udev_enumerate_add_match_property)(struct udev_enumerate *, const char *, const char *);

View File

@ -44,7 +44,7 @@ SDL_bool WINRT_XAMLWasEnabled = SDL_FALSE;
#if WINAPI_FAMILY == WINAPI_FAMILY_APP #if WINAPI_FAMILY == WINAPI_FAMILY_APP
extern "C" extern "C"
ISwapChainBackgroundPanelNative * WINRT_GlobalSwapChainBackgroundPanelNative = NULL; ISwapChainBackgroundPanelNative * WINRT_GlobalSwapChainBackgroundPanelNative = NULL;
static Windows::Foundation::EventRegistrationToken WINRT_XAMLAppEventToken; static Windows::Foundation::EventRegistrationToken WINRT_XAMLAppEventToken;
#endif #endif

View File

@ -1027,7 +1027,7 @@ static ControllerMapping_t *SDL_PrivateGetControllerMappingForNameAndGUID(const
} }
#ifdef __ANDROID__ #ifdef __ANDROID__
if (!mapping && name && !SDL_IsJoystickHIDAPI(guid)) { if (!mapping && name && !SDL_IsJoystickHIDAPI(guid)) {
mapping = SDL_CreateMappingForAndroidController(name, guid); mapping = SDL_CreateMappingForAndroidController(name, guid);
} }
#endif #endif
if (!mapping) { if (!mapping) {

View File

@ -1141,13 +1141,13 @@ SDL_IsJoystickSteamController(Uint16 vendor, Uint16 product)
SDL_bool SDL_bool
SDL_IsJoystickXbox360(Uint16 vendor, Uint16 product) SDL_IsJoystickXbox360(Uint16 vendor, Uint16 product)
{ {
/* Filter out some bogus values here */ /* Filter out some bogus values here */
if (vendor == 0x0000 && product == 0x0000) { if (vendor == 0x0000 && product == 0x0000) {
return SDL_FALSE; return SDL_FALSE;
} }
if (vendor == 0x0001 && product == 0x0001) { if (vendor == 0x0001 && product == 0x0001) {
return SDL_FALSE; return SDL_FALSE;
} }
return (GuessControllerType(vendor, product) == k_eControllerType_XBox360Controller); return (GuessControllerType(vendor, product) == k_eControllerType_XBox360Controller);
} }

View File

@ -43,9 +43,6 @@ typedef enum
k_eControllerType_SteamController = 2, k_eControllerType_SteamController = 2,
k_eControllerType_SteamControllerV2 = 3, k_eControllerType_SteamControllerV2 = 3,
// IR Remote controls on Steambox
k_eControllerType_FrontPanelBoard = 20,
// Other Controllers // Other Controllers
k_eControllerType_UnknownNonSteamController = 30, k_eControllerType_UnknownNonSteamController = 30,
k_eControllerType_XBox360Controller = 31, k_eControllerType_XBox360Controller = 31,
@ -73,49 +70,6 @@ static inline bool BIsSteamController( EControllerType eType )
return ( eType == k_eControllerType_SteamController || eType == k_eControllerType_SteamControllerV2 ); return ( eType == k_eControllerType_SteamController || eType == k_eControllerType_SteamControllerV2 );
} }
#if 0 /* these are currently unused, so #if 0'd out to prevent compiler warnings for now */
static inline bool BIsSteamHardwareDevice( EControllerType eType )
{
return ( eType == k_eControllerType_SteamController || eType == k_eControllerType_SteamControllerV2 || eType == k_eControllerType_FrontPanelBoard );
}
static inline bool BIsXInputController( EControllerType eType )
{
return ( eType == k_eControllerType_XBox360Controller || eType == k_eControllerType_XBoxOneController || eType == k_eControllerType_UnknownNonSteamController );
}
static inline bool BIsSwitchController( EControllerType eType )
{
return ( eType == k_eControllerType_SwitchJoyConLeft || eType == k_eControllerType_SwitchJoyConRight ||
eType == k_eControllerType_SwitchJoyConPair || eType == k_eControllerType_SwitchProController ||
eType == k_eControllerType_SwitchInputOnlyController );
}
/* XXX: this should be updated when we ship nintentdo switch controller support */
static inline bool BIsRawHIDDevice( EControllerType eType )
{
return BIsSteamHardwareDevice( eType) || eType == k_eControllerType_PS4Controller || BIsSwitchController( eType );
}
// 'Full' here means that the controller has a full complement of buttons, joysticks, etc, as compared to
// the single Joy-Con's that only have around half of the controls that a normal controller has
static inline bool BIsFullSwitchController( EControllerType eType )
{
return ( eType == k_eControllerType_SwitchJoyConPair || eType == k_eControllerType_SwitchProController );
}
static inline bool BIsCompatibleType( EControllerType eTypeA, EControllerType eTypeB )
{
if ( BIsSteamController( eTypeA ) && BIsSteamController( eTypeB ) )
return true;
if ( BIsXInputController( eTypeA ) && BIsXInputController( eTypeB ) )
return true;
if ( eTypeA == eTypeB )
return true;
return false;
}
#endif
#define MAKE_CONTROLLER_ID( nVID, nPID ) (unsigned int)( nVID << 16 | nPID ) #define MAKE_CONTROLLER_ID( nVID, nPID ) (unsigned int)( nVID << 16 | nPID )
typedef struct typedef struct
{ {
@ -168,7 +122,6 @@ static const ControllerDescription_t arrControllers[] = {
{ MAKE_CONTROLLER_ID( 0x146b, 0x0603 ), k_eControllerType_PS3Controller }, // From SDL { MAKE_CONTROLLER_ID( 0x146b, 0x0603 ), k_eControllerType_PS3Controller }, // From SDL
{ MAKE_CONTROLLER_ID( 0x044f, 0xb315 ), k_eControllerType_PS3Controller }, // Firestorm Dual Analog 3 { MAKE_CONTROLLER_ID( 0x044f, 0xb315 ), k_eControllerType_PS3Controller }, // Firestorm Dual Analog 3
{ MAKE_CONTROLLER_ID( 0x0925, 0x8888 ), k_eControllerType_PS3Controller }, // Actually ps2 -maybe break out later Lakeview Research WiseGroup Ltd, MP-8866 Dual Joypad { MAKE_CONTROLLER_ID( 0x0925, 0x8888 ), k_eControllerType_PS3Controller }, // Actually ps2 -maybe break out later Lakeview Research WiseGroup Ltd, MP-8866 Dual Joypad
{ MAKE_CONTROLLER_ID( 0x146b, 0x0602 ), k_eControllerType_PS3Controller }, // From SDL
{ MAKE_CONTROLLER_ID( 0x0f0d, 0x004d ), k_eControllerType_PS3Controller }, // Horipad 3 { MAKE_CONTROLLER_ID( 0x0f0d, 0x004d ), k_eControllerType_PS3Controller }, // Horipad 3
{ MAKE_CONTROLLER_ID( 0x0f0d, 0x0009 ), k_eControllerType_PS3Controller }, // HORI BDA GP1 { MAKE_CONTROLLER_ID( 0x0f0d, 0x0009 ), k_eControllerType_PS3Controller }, // HORI BDA GP1
{ MAKE_CONTROLLER_ID( 0x0e8f, 0x0008 ), k_eControllerType_PS3Controller }, // Green Asia { MAKE_CONTROLLER_ID( 0x0e8f, 0x0008 ), k_eControllerType_PS3Controller }, // Green Asia
@ -214,8 +167,8 @@ static const ControllerDescription_t arrControllers[] = {
{ MAKE_CONTROLLER_ID( 0x1532, 0x1000 ), k_eControllerType_PS4Controller }, // Razer Raiju PS4 Controller { MAKE_CONTROLLER_ID( 0x1532, 0x1000 ), k_eControllerType_PS4Controller }, // Razer Raiju PS4 Controller
{ MAKE_CONTROLLER_ID( 0x1532, 0X0401 ), k_eControllerType_PS4Controller }, // Razer Panthera PS4 Controller { MAKE_CONTROLLER_ID( 0x1532, 0X0401 ), k_eControllerType_PS4Controller }, // Razer Panthera PS4 Controller
{ MAKE_CONTROLLER_ID( 0x054c, 0x05c5 ), k_eControllerType_PS4Controller }, // STRIKEPAD PS4 Grip Add-on { MAKE_CONTROLLER_ID( 0x054c, 0x05c5 ), k_eControllerType_PS4Controller }, // STRIKEPAD PS4 Grip Add-on
{ MAKE_CONTROLLER_ID( 0x146b, 0x0d01 ), k_eControllerType_PS4Controller }, // Nacon Revolution Pro Controller { MAKE_CONTROLLER_ID( 0x146b, 0x0d01 ), k_eControllerType_PS4Controller }, // Nacon Revolution Pro Controller - has gyro
{ MAKE_CONTROLLER_ID( 0x146b, 0x0d02 ), k_eControllerType_PS4Controller }, // Nacon Revolution Pro Controller v2 { MAKE_CONTROLLER_ID( 0x146b, 0x0d02 ), k_eControllerType_PS4Controller }, // Nacon Revolution Pro Controller v2 - has gyro
{ MAKE_CONTROLLER_ID( 0x0f0d, 0x00a0 ), k_eControllerType_PS4Controller }, // HORI TAC4 mousething { MAKE_CONTROLLER_ID( 0x0f0d, 0x00a0 ), k_eControllerType_PS4Controller }, // HORI TAC4 mousething
{ MAKE_CONTROLLER_ID( 0x0f0d, 0x009c ), k_eControllerType_PS4Controller }, // HORI TAC PRO mousething { MAKE_CONTROLLER_ID( 0x0f0d, 0x009c ), k_eControllerType_PS4Controller }, // HORI TAC PRO mousething
{ MAKE_CONTROLLER_ID( 0x0c12, 0x0ef6 ), k_eControllerType_PS4Controller }, // Hitbox Arcade Stick { MAKE_CONTROLLER_ID( 0x0c12, 0x0ef6 ), k_eControllerType_PS4Controller }, // Hitbox Arcade Stick
@ -224,7 +177,15 @@ static const ControllerDescription_t arrControllers[] = {
{ MAKE_CONTROLLER_ID( 0x0f0d, 0x00ee ), k_eControllerType_PS4Controller }, // Hori mini wired https://www.playstation.com/en-us/explore/accessories/gaming-controllers/mini-wired-gamepad/ { MAKE_CONTROLLER_ID( 0x0f0d, 0x00ee ), k_eControllerType_PS4Controller }, // Hori mini wired https://www.playstation.com/en-us/explore/accessories/gaming-controllers/mini-wired-gamepad/
{ MAKE_CONTROLLER_ID( 0x0738, 0x8481 ), k_eControllerType_PS4Controller }, // Mad Catz FightStick TE 2+ PS4 { MAKE_CONTROLLER_ID( 0x0738, 0x8481 ), k_eControllerType_PS4Controller }, // Mad Catz FightStick TE 2+ PS4
{ MAKE_CONTROLLER_ID( 0x0738, 0x8480 ), k_eControllerType_PS4Controller }, // Mad Catz FightStick TE 2 PS4 { MAKE_CONTROLLER_ID( 0x0738, 0x8480 ), k_eControllerType_PS4Controller }, // Mad Catz FightStick TE 2 PS4
{ MAKE_CONTROLLER_ID( 0x7545, 0x0104 ), k_eControllerType_PS4Controller }, // Armor 3 or Level Up Cobra { MAKE_CONTROLLER_ID( 0x7545, 0x0104 ), k_eControllerType_PS4Controller }, // Armor 3 or Level Up Cobra - At least one variant has gyro
{ MAKE_CONTROLLER_ID( 0x0c12, 0x0e15 ), k_eControllerType_PS4Controller }, // Game:Pad 4
{ MAKE_CONTROLLER_ID( 0x11c0, 0x4001 ), k_eControllerType_PS4Controller }, // "PS4 Fun Controller" added from user log
{ MAKE_CONTROLLER_ID( 0x1532, 0x1007 ), k_eControllerType_PS4Controller }, // Razer Raiju 2 Tournament edition USB- untested and added for razer
{ MAKE_CONTROLLER_ID( 0x1532, 0x100A ), k_eControllerType_PS4Controller }, // Razer Raiju 2 Tournament edition BT - untested and added for razer
{ MAKE_CONTROLLER_ID( 0x1532, 0x1004 ), k_eControllerType_PS4Controller }, // Razer Raiju 2 Ultimate USB - untested and added for razer
{ MAKE_CONTROLLER_ID( 0x1532, 0x1009 ), k_eControllerType_PS4Controller }, // Razer Raiju 2 Ultimate BT - untested and added for razer
{ MAKE_CONTROLLER_ID( 0x1532, 0x1008 ), k_eControllerType_PS4Controller }, // Razer Panthera Evo Fightstick - untested and added for razer
{ MAKE_CONTROLLER_ID( 0x056e, 0x2004 ), k_eControllerType_XBox360Controller }, // Elecom JC-U3613M { MAKE_CONTROLLER_ID( 0x056e, 0x2004 ), k_eControllerType_XBox360Controller }, // Elecom JC-U3613M
{ MAKE_CONTROLLER_ID( 0x06a3, 0xf51a ), k_eControllerType_XBox360Controller }, // Saitek P3600 { MAKE_CONTROLLER_ID( 0x06a3, 0xf51a ), k_eControllerType_XBox360Controller }, // Saitek P3600
@ -400,32 +361,42 @@ static const ControllerDescription_t arrControllers[] = {
{ MAKE_CONTROLLER_ID( 0x0079, 0x187c ), k_eControllerType_XBox360Controller }, // Unknown Controller { MAKE_CONTROLLER_ID( 0x0079, 0x187c ), k_eControllerType_XBox360Controller }, // Unknown Controller
{ MAKE_CONTROLLER_ID( 0x0079, 0x189c ), k_eControllerType_XBox360Controller }, // Unknown Controller { MAKE_CONTROLLER_ID( 0x0079, 0x189c ), k_eControllerType_XBox360Controller }, // Unknown Controller
{ MAKE_CONTROLLER_ID( 0x0079, 0x1874 ), k_eControllerType_XBox360Controller }, // Unknown Controller { MAKE_CONTROLLER_ID( 0x0079, 0x1874 ), k_eControllerType_XBox360Controller }, // Unknown Controller
{ MAKE_CONTROLLER_ID( 0x1038, 0xb360 ), k_eControllerType_XBox360Controller }, // SteelSeries Nimbus/Stratus XL
//{ MAKE_CONTROLLER_ID( 0x1949, 0x0402 ), /*android*/ }, // Unknown Controller //{ MAKE_CONTROLLER_ID( 0x1949, 0x0402 ), /*android*/ }, // Unknown Controller
{ MAKE_CONTROLLER_ID( 0x05ac, 0x0001 ), k_eControllerType_AppleController }, // MFI Extended Gamepad (generic entry for iOS/tvOS) { MAKE_CONTROLLER_ID( 0x05ac, 0x0001 ), k_eControllerType_AppleController }, // MFI Extended Gamepad (generic entry for iOS/tvOS)
{ MAKE_CONTROLLER_ID( 0x05ac, 0x0002 ), k_eControllerType_AppleController }, // MFI Standard Gamepad (generic entry for iOS/tvOS) { MAKE_CONTROLLER_ID( 0x05ac, 0x0002 ), k_eControllerType_AppleController }, // MFI Standard Gamepad (generic entry for iOS/tvOS)
{ MAKE_CONTROLLER_ID( 0x1038, 0xb360 ), k_eControllerType_AppleController }, // SteelSeries Nimbus
// We currently don't support using a pair of Switch Joy-Con's as a single // We currently don't support using a pair of Switch Joy-Con's as a single
// controller and we don't want to support using them individually for the // controller and we don't want to support using them individually for the
// time being, so these should be disabled until one of the above is true // time being, so these should be disabled until one of the above is true
// { MAKE_CONTROLLER_ID( 0x057e, 0x2006 ), k_eControllerType_SwitchJoyConLeft }, // Nintendo Switch Joy-Con (Left) // { MAKE_CONTROLLER_ID( 0x057e, 0x2006 ), k_eControllerType_SwitchJoyConLeft }, // Nintendo Switch Joy-Con (Left)
// { MAKE_CONTROLLER_ID( 0x057e, 0x2007 ), k_eControllerType_SwitchJoyConRight }, // Nintendo Switch Joy-Con (Right) // { MAKE_CONTROLLER_ID( 0x057e, 0x2007 ), k_eControllerType_SwitchJoyConRight }, // Nintendo Switch Joy-Con (Right)
// This same controller ID is spoofed by many 3rd-party Switch controllers.
// The ones we currently know of are:
// * Any 8bitdo controller with Switch support
// * ORTZ Gaming Wireless Pro Controller
// * ZhiXu Gamepad Wireless
// * Sunwaytek Wireless Motion Controller for Nintendo Switch
{ MAKE_CONTROLLER_ID( 0x057e, 0x2009 ), k_eControllerType_SwitchProController }, // Nintendo Switch Pro Controller { MAKE_CONTROLLER_ID( 0x057e, 0x2009 ), k_eControllerType_SwitchProController }, // Nintendo Switch Pro Controller
{ MAKE_CONTROLLER_ID( 0x0f0d, 0x00c1 ), k_eControllerType_SwitchInputOnlyController }, // HORIPAD for Nintendo Switch { MAKE_CONTROLLER_ID( 0x0f0d, 0x00c1 ), k_eControllerType_SwitchInputOnlyController }, // HORIPAD for Nintendo Switch
{ MAKE_CONTROLLER_ID( 0x20d6, 0xa711 ), k_eControllerType_SwitchInputOnlyController }, // PowerA Wired Controller Plus { MAKE_CONTROLLER_ID( 0x20d6, 0xa711 ), k_eControllerType_SwitchInputOnlyController }, // PowerA Wired Controller Plus
{ MAKE_CONTROLLER_ID( 0x0f0d, 0x0092 ), k_eControllerType_SwitchInputOnlyController }, // HORI Pokken Tournament DX Pro Pad
// Valve products - don't add to public list // Valve products - don't add to public list
{ MAKE_CONTROLLER_ID( 0x0000, 0x11fa ), k_eControllerType_MobileTouch }, // Streaming mobile touch virtual controls { MAKE_CONTROLLER_ID( 0x0000, 0x11fb ), k_eControllerType_MobileTouch }, // Streaming mobile touch virtual controls
{ MAKE_CONTROLLER_ID( 0x28de, 0x1101 ), k_eControllerType_SteamController }, // Valve Legacy Steam Controller (CHELL) { MAKE_CONTROLLER_ID( 0x28de, 0x1101 ), k_eControllerType_SteamController }, // Valve Legacy Steam Controller (CHELL)
{ MAKE_CONTROLLER_ID( 0x28de, 0x1102 ), k_eControllerType_SteamController }, // Valve wired Steam Controller (D0G) { MAKE_CONTROLLER_ID( 0x28de, 0x1102 ), k_eControllerType_SteamController }, // Valve wired Steam Controller (D0G)
{ MAKE_CONTROLLER_ID( 0x28de, 0x1105 ), k_eControllerType_SteamControllerV2 }, // Valve Bluetooth Steam Controller (D0G) { MAKE_CONTROLLER_ID( 0x28de, 0x1105 ), k_eControllerType_SteamControllerV2 }, // Valve Bluetooth Steam Controller (D0G)
{ MAKE_CONTROLLER_ID( 0x28de, 0x1106 ), k_eControllerType_SteamControllerV2 }, // Valve Bluetooth Steam Controller (D0G) { MAKE_CONTROLLER_ID( 0x28de, 0x1106 ), k_eControllerType_SteamControllerV2 }, // Valve Bluetooth Steam Controller (D0G)
{ MAKE_CONTROLLER_ID( 0x28de, 0x1142 ), k_eControllerType_SteamController }, // Valve wireless Steam Controller { MAKE_CONTROLLER_ID( 0x28de, 0x1142 ), k_eControllerType_SteamController }, // Valve wireless Steam Controller
{ MAKE_CONTROLLER_ID( 0x28de, 0x1201 ), k_eControllerType_SteamController }, // Valve wired Steam Controller (HEADCRAB) { MAKE_CONTROLLER_ID( 0x28de, 0x1201 ), k_eControllerType_SteamController }, // Valve wired Steam Controller (HEADCRAB)
{ MAKE_CONTROLLER_ID( 0x28de, 0x1202 ), k_eControllerType_SteamControllerV2 }, // Valve Bluetooth Steam Controller (HEADCRAB)
}; };

View File

@ -36,7 +36,7 @@ extern "C"
/* The maximum number of joysticks we'll detect */ /* The maximum number of joysticks we'll detect */
#define MAX_JOYSTICKS 16 #define MAX_JOYSTICKS 16
/* A list of available joysticks */ /* A list of available joysticks */
static char *SDL_joyport[MAX_JOYSTICKS]; static char *SDL_joyport[MAX_JOYSTICKS];

View File

@ -255,7 +255,7 @@ SDL_JoystickThread(void *_data)
/* WM_DEVICECHANGE not working, no XINPUT, no point in keeping thread alive */ /* WM_DEVICECHANGE not working, no XINPUT, no point in keeping thread alive */
break; break;
#endif /* SDL_JOYSTICK_XINPUT */ #endif /* SDL_JOYSTICK_XINPUT */
} }
if (s_bWindowsDeviceChanged || bXInputChanged) { if (s_bWindowsDeviceChanged || bXInputChanged) {
s_bDeviceRemoved = SDL_TRUE; s_bDeviceRemoved = SDL_TRUE;

View File

@ -198,7 +198,7 @@ public:
_current_context->UnlockGL(); _current_context->UnlockGL();
_current_context = newContext; _current_context = newContext;
if (_current_context) if (_current_context)
_current_context->LockGL(); _current_context->LockGL();
} }
#endif #endif

View File

@ -31,7 +31,7 @@
#include <storage/File.h> #include <storage/File.h>
#include <unistd.h> #include <unistd.h>
#include "SDL_BApp.h" /* SDL_BApp class definition */ #include "SDL_BApp.h" /* SDL_BApp class definition */
#include "SDL_BeApp.h" #include "SDL_BeApp.h"
#include "SDL_timer.h" #include "SDL_timer.h"
#include "SDL_error.h" #include "SDL_error.h"
@ -53,24 +53,24 @@ StartBeApp(void *unused)
{ {
BApplication *App; BApplication *App;
// default application signature // default application signature
const char *signature = "application/x-SDL-executable"; const char *signature = "application/x-SDL-executable";
// dig resources for correct signature // dig resources for correct signature
image_info info; image_info info;
int32 cookie = 0; int32 cookie = 0;
if (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) { if (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
BFile f(info.name, O_RDONLY); BFile f(info.name, O_RDONLY);
if (f.InitCheck() == B_OK) { if (f.InitCheck() == B_OK) {
BAppFileInfo app_info(&f); BAppFileInfo app_info(&f);
if (app_info.InitCheck() == B_OK) { if (app_info.InitCheck() == B_OK) {
char sig[B_MIME_TYPE_LENGTH]; char sig[B_MIME_TYPE_LENGTH];
if (app_info.GetSignature(sig) == B_OK) if (app_info.GetSignature(sig) == B_OK)
signature = strndup(sig, B_MIME_TYPE_LENGTH); signature = strndup(sig, B_MIME_TYPE_LENGTH);
} }
} }
} }
App = new SDL_BApp(signature); App = new SDL_BApp(signature);
App->Run(); App->Run();
delete App; delete App;
@ -144,12 +144,12 @@ SDL_QuitBeApp(void)
/* SDL_BApp functions */ /* SDL_BApp functions */
void SDL_BApp::ClearID(SDL_BWin *bwin) { void SDL_BApp::ClearID(SDL_BWin *bwin) {
_SetSDLWindow(NULL, bwin->GetID()); _SetSDLWindow(NULL, bwin->GetID());
int32 i = _GetNumWindowSlots() - 1; int32 i = _GetNumWindowSlots() - 1;
while(i >= 0 && GetSDLWindow(i) == NULL) { while(i >= 0 && GetSDLWindow(i) == NULL) {
_PopBackWindow(); _PopBackWindow();
--i; --i;
} }
} }
#endif /* __HAIKU__ */ #endif /* __HAIKU__ */

View File

@ -89,13 +89,13 @@ SDL_iconv(SDL_iconv_t cd,
#else #else
/* Lots of useful information on Unicode at: /* Lots of useful information on Unicode at:
http://www.cl.cam.ac.uk/~mgk25/unicode.html http://www.cl.cam.ac.uk/~mgk25/unicode.html
*/ */
#define UNICODE_BOM 0xFEFF #define UNICODE_BOM 0xFEFF
#define UNKNOWN_ASCII '?' #define UNKNOWN_ASCII '?'
#define UNKNOWN_UNICODE 0xFFFD #define UNKNOWN_UNICODE 0xFFFD
enum enum
{ {
@ -115,13 +115,13 @@ enum
ENCODING_UCS4LE, ENCODING_UCS4LE,
}; };
#if SDL_BYTEORDER == SDL_BIG_ENDIAN #if SDL_BYTEORDER == SDL_BIG_ENDIAN
#define ENCODING_UTF16NATIVE ENCODING_UTF16BE #define ENCODING_UTF16NATIVE ENCODING_UTF16BE
#define ENCODING_UTF32NATIVE ENCODING_UTF32BE #define ENCODING_UTF32NATIVE ENCODING_UTF32BE
#define ENCODING_UCS2NATIVE ENCODING_UCS2BE #define ENCODING_UCS2NATIVE ENCODING_UCS2BE
#define ENCODING_UCS4NATIVE ENCODING_UCS4BE #define ENCODING_UCS4NATIVE ENCODING_UCS4BE
#else #else
#define ENCODING_UTF16NATIVE ENCODING_UTF16LE #define ENCODING_UTF16NATIVE ENCODING_UTF16LE
#define ENCODING_UTF32NATIVE ENCODING_UTF32LE #define ENCODING_UTF32NATIVE ENCODING_UTF32LE
#define ENCODING_UCS2NATIVE ENCODING_UCS2LE #define ENCODING_UCS2NATIVE ENCODING_UCS2LE
#define ENCODING_UCS4NATIVE ENCODING_UCS4LE #define ENCODING_UCS4NATIVE ENCODING_UCS4LE
#endif #endif

View File

@ -49,13 +49,13 @@ Blit1to1(SDL_BlitInfo * info)
while (height--) { while (height--) {
#ifdef USE_DUFFS_LOOP #ifdef USE_DUFFS_LOOP
/* *INDENT-OFF* */ /* *INDENT-OFF* */
DUFFS_LOOP( DUFFS_LOOP(
{ {
*dst = map[*src]; *dst = map[*src];
} }
dst++; dst++;
src++; src++;
, width); , width);
/* *INDENT-ON* */ /* *INDENT-ON* */
#else #else
for (c = width; c; --c) { for (c = width; c; --c) {
@ -72,11 +72,11 @@ Blit1to1(SDL_BlitInfo * info)
/* This is now endian dependent */ /* This is now endian dependent */
#ifndef USE_DUFFS_LOOP #ifndef USE_DUFFS_LOOP
# if ( SDL_BYTEORDER == SDL_LIL_ENDIAN ) # if ( SDL_BYTEORDER == SDL_LIL_ENDIAN )
# define HI 1 # define HI 1
# define LO 0 # define LO 0
# else /* ( SDL_BYTEORDER == SDL_BIG_ENDIAN ) */ # else /* ( SDL_BYTEORDER == SDL_BIG_ENDIAN ) */
# define HI 0 # define HI 0
# define LO 1 # define LO 1
# endif # endif
#endif #endif
static void static void
@ -101,14 +101,14 @@ Blit1to2(SDL_BlitInfo * info)
#ifdef USE_DUFFS_LOOP #ifdef USE_DUFFS_LOOP
while (height--) { while (height--) {
/* *INDENT-OFF* */ /* *INDENT-OFF* */
DUFFS_LOOP( DUFFS_LOOP(
{ {
*(Uint16 *)dst = map[*src++]; *(Uint16 *)dst = map[*src++];
dst += 2; dst += 2;
}, },
width); width);
/* *INDENT-ON* */ /* *INDENT-ON* */
src += srcskip; src += srcskip;
dst += dstskip; dst += dstskip;
} }
@ -208,18 +208,18 @@ Blit1to3(SDL_BlitInfo * info)
while (height--) { while (height--) {
#ifdef USE_DUFFS_LOOP #ifdef USE_DUFFS_LOOP
/* *INDENT-OFF* */ /* *INDENT-OFF* */
DUFFS_LOOP( DUFFS_LOOP(
{ {
o = *src * 4; o = *src * 4;
dst[0] = map[o++]; dst[0] = map[o++];
dst[1] = map[o++]; dst[1] = map[o++];
dst[2] = map[o++]; dst[2] = map[o++];
} }
src++; src++;
dst += 3; dst += 3;
, width); , width);
/* *INDENT-ON* */ /* *INDENT-ON* */
#else #else
for (c = width; c; --c) { for (c = width; c; --c) {
o = *src * 4; o = *src * 4;
@ -257,11 +257,11 @@ Blit1to4(SDL_BlitInfo * info)
while (height--) { while (height--) {
#ifdef USE_DUFFS_LOOP #ifdef USE_DUFFS_LOOP
/* *INDENT-OFF* */ /* *INDENT-OFF* */
DUFFS_LOOP( DUFFS_LOOP(
*dst++ = map[*src++]; *dst++ = map[*src++];
, width); , width);
/* *INDENT-ON* */ /* *INDENT-ON* */
#else #else
for (c = width / 4; c; --c) { for (c = width / 4; c; --c) {
*dst++ = map[*src++]; *dst++ = map[*src++];
@ -297,33 +297,33 @@ Blit1to1Key(SDL_BlitInfo * info)
if (palmap) { if (palmap) {
while (height--) { while (height--) {
/* *INDENT-OFF* */ /* *INDENT-OFF* */
DUFFS_LOOP( DUFFS_LOOP(
{ {
if ( *src != ckey ) { if ( *src != ckey ) {
*dst = palmap[*src]; *dst = palmap[*src];
} }
dst++; dst++;
src++; src++;
}, },
width); width);
/* *INDENT-ON* */ /* *INDENT-ON* */
src += srcskip; src += srcskip;
dst += dstskip; dst += dstskip;
} }
} else { } else {
while (height--) { while (height--) {
/* *INDENT-OFF* */ /* *INDENT-OFF* */
DUFFS_LOOP( DUFFS_LOOP(
{ {
if ( *src != ckey ) { if ( *src != ckey ) {
*dst = *src; *dst = *src;
} }
dst++; dst++;
src++; src++;
}, },
width); width);
/* *INDENT-ON* */ /* *INDENT-ON* */
src += srcskip; src += srcskip;
dst += dstskip; dst += dstskip;
} }
@ -346,17 +346,17 @@ Blit1to2Key(SDL_BlitInfo * info)
dstskip /= 2; dstskip /= 2;
while (height--) { while (height--) {
/* *INDENT-OFF* */ /* *INDENT-OFF* */
DUFFS_LOOP( DUFFS_LOOP(
{ {
if ( *src != ckey ) { if ( *src != ckey ) {
*dstp=palmap[*src]; *dstp=palmap[*src];
} }
src++; src++;
dstp++; dstp++;
}, },
width); width);
/* *INDENT-ON* */ /* *INDENT-ON* */
src += srcskip; src += srcskip;
dstp += dstskip; dstp += dstskip;
} }
@ -376,20 +376,20 @@ Blit1to3Key(SDL_BlitInfo * info)
int o; int o;
while (height--) { while (height--) {
/* *INDENT-OFF* */ /* *INDENT-OFF* */
DUFFS_LOOP( DUFFS_LOOP(
{ {
if ( *src != ckey ) { if ( *src != ckey ) {
o = *src * 4; o = *src * 4;
dst[0] = palmap[o++]; dst[0] = palmap[o++];
dst[1] = palmap[o++]; dst[1] = palmap[o++];
dst[2] = palmap[o++]; dst[2] = palmap[o++];
} }
src++; src++;
dst += 3; dst += 3;
}, },
width); width);
/* *INDENT-ON* */ /* *INDENT-ON* */
src += srcskip; src += srcskip;
dst += dstskip; dst += dstskip;
} }
@ -411,17 +411,17 @@ Blit1to4Key(SDL_BlitInfo * info)
dstskip /= 4; dstskip /= 4;
while (height--) { while (height--) {
/* *INDENT-OFF* */ /* *INDENT-OFF* */
DUFFS_LOOP( DUFFS_LOOP(
{ {
if ( *src != ckey ) { if ( *src != ckey ) {
*dstp = palmap[*src]; *dstp = palmap[*src];
} }
src++; src++;
dstp++; dstp++;
}, },
width); width);
/* *INDENT-ON* */ /* *INDENT-ON* */
src += srcskip; src += srcskip;
dstp += dstskip; dstp += dstskip;
} }
@ -489,22 +489,22 @@ Blit1toNAlphaKey(SDL_BlitInfo * info)
dstbpp = dstfmt->BytesPerPixel; dstbpp = dstfmt->BytesPerPixel;
while (height--) { while (height--) {
/* *INDENT-OFF* */ /* *INDENT-OFF* */
DUFFS_LOOP( DUFFS_LOOP(
{ {
if ( *src != ckey ) { if ( *src != ckey ) {
sR = srcpal[*src].r; sR = srcpal[*src].r;
sG = srcpal[*src].g; sG = srcpal[*src].g;
sB = srcpal[*src].b; sB = srcpal[*src].b;
DISEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA); DISEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA);
ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA); ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA);
ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA); ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
} }
src++; src++;
dst += dstbpp; dst += dstbpp;
}, },
width); width);
/* *INDENT-ON* */ /* *INDENT-ON* */
src += srcskip; src += srcskip;
dst += dstskip; dst += dstskip;
} }

File diff suppressed because it is too large Load Diff

View File

@ -836,7 +836,7 @@ SDL_EGL_CreateSurface(_THIS, NativeWindowType nw)
/* max 2 values plus terminator. */ /* max 2 values plus terminator. */
EGLint attribs[3]; EGLint attribs[3];
int attr = 0; int attr = 0;
EGLSurface * surface; EGLSurface * surface;
if (SDL_EGL_ChooseConfig(_this) != 0) { if (SDL_EGL_ChooseConfig(_this) != 0) {
@ -868,7 +868,7 @@ SDL_EGL_CreateSurface(_THIS, NativeWindowType nw)
return EGL_NO_SURFACE; return EGL_NO_SURFACE;
} }
} }
attribs[attr++] = EGL_NONE; attribs[attr++] = EGL_NONE;
surface = _this->egl_data->eglCreateWindowSurface( surface = _this->egl_data->eglCreateWindowSurface(

View File

@ -326,7 +326,7 @@ SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask,
if (Rmask == 0) { if (Rmask == 0) {
return SDL_PIXELFORMAT_RGB555; return SDL_PIXELFORMAT_RGB555;
} }
/* fallthrough */ /* fallthrough */
case 16: case 16:
if (Rmask == 0) { if (Rmask == 0) {
return SDL_PIXELFORMAT_RGB565; return SDL_PIXELFORMAT_RGB565;

View File

@ -36,21 +36,21 @@ extern "C" {
#endif #endif
typedef struct { typedef struct {
struct SDL_ShapeTree *upleft,*upright,*downleft,*downright; struct SDL_ShapeTree *upleft,*upright,*downleft,*downright;
} SDL_QuadTreeChildren; } SDL_QuadTreeChildren;
typedef union { typedef union {
SDL_QuadTreeChildren children; SDL_QuadTreeChildren children;
SDL_Rect shape; SDL_Rect shape;
} SDL_ShapeUnion; } SDL_ShapeUnion;
typedef enum { QuadShape,TransparentShape,OpaqueShape } SDL_ShapeKind; typedef enum { QuadShape,TransparentShape,OpaqueShape } SDL_ShapeKind;
typedef struct { typedef struct {
SDL_ShapeKind kind; SDL_ShapeKind kind;
SDL_ShapeUnion data; SDL_ShapeUnion data;
} SDL_ShapeTree; } SDL_ShapeTree;
typedef void(*SDL_TraversalFunction)(SDL_ShapeTree*,void*); typedef void(*SDL_TraversalFunction)(SDL_ShapeTree*,void*);
extern void SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitmap,Uint8 ppb); extern void SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitmap,Uint8 ppb);

View File

@ -1540,11 +1540,12 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
return NULL; return NULL;
} }
// Clear minimized if not on windows, only windows handles it at create rather than FinishWindowCreation, /* Clear minimized if not on windows, only windows handles it at create rather than FinishWindowCreation,
// but it's important or window focus will get broken on windows! * but it's important or window focus will get broken on windows!
*/
#if !defined(__WIN32__) #if !defined(__WIN32__)
if (window->flags & SDL_WINDOW_MINIMIZED) { if (window->flags & SDL_WINDOW_MINIMIZED) {
window->flags &= ~SDL_WINDOW_MINIMIZED; window->flags &= ~SDL_WINDOW_MINIMIZED;
} }
#endif #endif

View File

@ -123,10 +123,10 @@ VkExtensionProperties *SDL_Vulkan_CreateInstanceExtensionsList(
{ {
retval = SDL_calloc(1, sizeof(VkExtensionProperties)); // so we can return non-null retval = SDL_calloc(1, sizeof(VkExtensionProperties)); // so we can return non-null
} }
else else
{ {
retval = SDL_calloc(count, sizeof(VkExtensionProperties)); retval = SDL_calloc(count, sizeof(VkExtensionProperties));
} }
if(!retval) if(!retval)
{ {
SDL_OutOfMemory(); SDL_OutOfMemory();

View File

@ -89,10 +89,10 @@ static SDL_bool IsPacked4Format(Uint32 format)
} }
static int GetYUVPlanes(int width, int height, Uint32 format, const void *yuv, int yuv_pitch, static int GetYUVPlanes(int width, int height, Uint32 format, const void *yuv, int yuv_pitch,
const Uint8 **y, const Uint8 **u, const Uint8 **v, Uint32 *y_stride, Uint32 *uv_stride) const Uint8 **y, const Uint8 **u, const Uint8 **v, Uint32 *y_stride, Uint32 *uv_stride)
{ {
const Uint8 *planes[3] = { NULL, NULL, NULL }; const Uint8 *planes[3] = { NULL, NULL, NULL };
int pitches[3] = { 0, 0, 0 }; int pitches[3] = { 0, 0, 0 };
switch (format) { switch (format) {
case SDL_PIXELFORMAT_YV12: case SDL_PIXELFORMAT_YV12:
@ -180,10 +180,10 @@ static int GetYUVPlanes(int width, int height, Uint32 format, const void *yuv, i
static SDL_bool yuv_rgb_sse( static SDL_bool yuv_rgb_sse(
Uint32 src_format, Uint32 dst_format, Uint32 src_format, Uint32 dst_format,
Uint32 width, Uint32 height, Uint32 width, Uint32 height,
const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride, const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride,
Uint8 *rgb, Uint32 rgb_stride, Uint8 *rgb, Uint32 rgb_stride,
YCbCrType yuv_type) YCbCrType yuv_type)
{ {
#ifdef __SSE2__ #ifdef __SSE2__
if (!SDL_HasSSE2()) { if (!SDL_HasSSE2()) {
@ -289,10 +289,10 @@ static SDL_bool yuv_rgb_sse(
static SDL_bool yuv_rgb_std( static SDL_bool yuv_rgb_std(
Uint32 src_format, Uint32 dst_format, Uint32 src_format, Uint32 dst_format,
Uint32 width, Uint32 height, Uint32 width, Uint32 height,
const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride, const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride,
Uint8 *rgb, Uint32 rgb_stride, Uint8 *rgb, Uint32 rgb_stride,
YCbCrType yuv_type) YCbCrType yuv_type)
{ {
if (src_format == SDL_PIXELFORMAT_YV12 || if (src_format == SDL_PIXELFORMAT_YV12 ||
src_format == SDL_PIXELFORMAT_IYUV) { src_format == SDL_PIXELFORMAT_IYUV) {
@ -395,7 +395,7 @@ SDL_ConvertPixels_YUV_to_RGB(int width, int height,
Uint32 src_format, const void *src, int src_pitch, Uint32 src_format, const void *src, int src_pitch,
Uint32 dst_format, void *dst, int dst_pitch) Uint32 dst_format, void *dst, int dst_pitch)
{ {
const Uint8 *y = NULL; const Uint8 *y = NULL;
const Uint8 *u = NULL; const Uint8 *u = NULL;
const Uint8 *v = NULL; const Uint8 *v = NULL;
Uint32 y_stride = 0; Uint32 y_stride = 0;
@ -553,7 +553,7 @@ SDL_ConvertPixels_ARGB8888_to_YUV(int width, int height, const void *src, int sr
Uint32 y_stride, uv_stride, y_skip, uv_skip; Uint32 y_stride, uv_stride, y_skip, uv_skip;
GetYUVPlanes(width, height, dst_format, dst, dst_pitch, GetYUVPlanes(width, height, dst_format, dst, dst_pitch,
(const Uint8 **)&plane_y, (const Uint8 **)&plane_u, (const Uint8 **)&plane_v, (const Uint8 **)&plane_y, (const Uint8 **)&plane_u, (const Uint8 **)&plane_v,
&y_stride, &uv_stride); &y_stride, &uv_stride);
plane_interleaved_uv = (plane_y + height * y_stride); plane_interleaved_uv = (plane_y + height * y_stride);
y_skip = (y_stride - width); y_skip = (y_stride - width);

View File

@ -214,12 +214,12 @@ Android_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * h
void void
Android_SetScreenResolution(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, Uint32 format, float rate) Android_SetScreenResolution(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, Uint32 format, float rate)
{ {
SDL_VideoDevice* device; SDL_VideoDevice* device;
SDL_VideoDisplay *display; SDL_VideoDisplay *display;
Android_SurfaceWidth = surfaceWidth; Android_SurfaceWidth = surfaceWidth;
Android_SurfaceHeight = surfaceHeight; Android_SurfaceHeight = surfaceHeight;
Android_DeviceWidth = deviceWidth; Android_DeviceWidth = deviceWidth;
Android_DeviceHeight = deviceHeight; Android_DeviceHeight = deviceHeight;
Android_ScreenFormat = format; Android_ScreenFormat = format;
Android_ScreenRate = rate; Android_ScreenRate = rate;

View File

@ -390,8 +390,8 @@ Cocoa_RegisterApp(void)
if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, SDL_FALSE)) { if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, SDL_FALSE)) {
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
} }
if ([NSApp mainMenu] == nil) { if ([NSApp mainMenu] == nil) {
CreateApplicationMenus(); CreateApplicationMenus();
} }

View File

@ -39,7 +39,7 @@
/* Return a Metal-compatible layer. */ /* Return a Metal-compatible layer. */
+ (Class)layerClass + (Class)layerClass
{ {
return NSClassFromString(@"CAMetalLayer"); return NSClassFromString(@"CAMetalLayer");
} }
/* Indicate the view wants to draw using a backing layer instead of drawRect. */ /* Indicate the view wants to draw using a backing layer instead of drawRect. */
@ -59,7 +59,7 @@
- (instancetype)initWithFrame:(NSRect)frame - (instancetype)initWithFrame:(NSRect)frame
scale:(CGFloat)scale scale:(CGFloat)scale
{ {
if ((self = [super initWithFrame:frame])) { if ((self = [super initWithFrame:frame])) {
_tag = METALVIEW_TAG; _tag = METALVIEW_TAG;
self.wantsLayer = YES; self.wantsLayer = YES;
@ -71,7 +71,7 @@
self.layer.contentsScale = scale; self.layer.contentsScale = scale;
} }
return self; return self;
} }
/* Set the size of the metal drawables when the view is resized. */ /* Set the size of the metal drawables when the view is resized. */

View File

@ -211,7 +211,7 @@ Cocoa_InitMouseEventTap(SDL_MouseData* driverdata)
tapdata->thread = SDL_CreateThreadInternal(&Cocoa_MouseTapThread, "Event Tap Loop", 512 * 1024, tapdata); tapdata->thread = SDL_CreateThreadInternal(&Cocoa_MouseTapThread, "Event Tap Loop", 512 * 1024, tapdata);
if (tapdata->thread) { if (tapdata->thread) {
/* Success - early out. Ownership transferred to thread. */ /* Success - early out. Ownership transferred to thread. */
return; return;
} }
CFRelease(tapdata->tap); CFRelease(tapdata->tap);
} }

View File

@ -241,7 +241,7 @@ ScheduleContextUpdates(SDL_WindowData *data)
static int static int
GetHintCtrlClickEmulateRightClick() GetHintCtrlClickEmulateRightClick()
{ {
return SDL_GetHintBoolean(SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK, SDL_FALSE); return SDL_GetHintBoolean(SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK, SDL_FALSE);
} }
static NSUInteger static NSUInteger
@ -908,7 +908,7 @@ SetWindowStyle(SDL_Window * window, NSUInteger style)
switch ([theEvent buttonNumber]) { switch ([theEvent buttonNumber]) {
case 0: case 0:
if (([theEvent modifierFlags] & NSEventModifierFlagControl) && if (([theEvent modifierFlags] & NSEventModifierFlagControl) &&
GetHintCtrlClickEmulateRightClick()) { GetHintCtrlClickEmulateRightClick()) {
wasCtrlLeft = YES; wasCtrlLeft = YES;
button = SDL_BUTTON_RIGHT; button = SDL_BUTTON_RIGHT;
} else { } else {

View File

@ -324,7 +324,7 @@ static const struct {
{ DSPF_YUY2, SDL_PIXELFORMAT_YUY2 }, /* 16 bit YUV (4 byte/ 2 pixel, macropixel contains CbYCrY [31:0]) */ { DSPF_YUY2, SDL_PIXELFORMAT_YUY2 }, /* 16 bit YUV (4 byte/ 2 pixel, macropixel contains CbYCrY [31:0]) */
{ DSPF_UYVY, SDL_PIXELFORMAT_UYVY }, /* 16 bit YUV (4 byte/ 2 pixel, macropixel contains YCbYCr [31:0]) */ { DSPF_UYVY, SDL_PIXELFORMAT_UYVY }, /* 16 bit YUV (4 byte/ 2 pixel, macropixel contains YCbYCr [31:0]) */
{ DSPF_RGB555, SDL_PIXELFORMAT_RGB555 }, /* 16 bit RGB (2 byte, nothing @15, red 5@10, green 5@5, blue 5@0) */ { DSPF_RGB555, SDL_PIXELFORMAT_RGB555 }, /* 16 bit RGB (2 byte, nothing @15, red 5@10, green 5@5, blue 5@0) */
{ DSPF_ABGR, SDL_PIXELFORMAT_ABGR8888 }, /* 32 bit ABGR (4 byte, alpha 8@24, blue 8@16, green 8@8, red 8@0) */ { DSPF_ABGR, SDL_PIXELFORMAT_ABGR8888 }, /* 32 bit ABGR (4 byte, alpha 8@24, blue 8@16, green 8@8, red 8@0) */
#if (ENABLE_LUT8) #if (ENABLE_LUT8)
{ DSPF_LUT8, SDL_PIXELFORMAT_INDEX8 }, /* 8 bit LUT (8 bit color and alpha lookup from palette) */ { DSPF_LUT8, SDL_PIXELFORMAT_INDEX8 }, /* 8 bit LUT (8 bit color and alpha lookup from palette) */
#endif #endif

View File

@ -538,7 +538,7 @@ private:
msg.AddInt32("key-state", keyState); msg.AddInt32("key-state", keyState);
msg.AddInt32("key-scancode", keyCode); msg.AddInt32("key-scancode", keyCode);
if (keyUtf8 != NULL) { if (keyUtf8 != NULL) {
msg.AddData("key-utf8", B_INT8_TYPE, (const void*)keyUtf8, len); msg.AddData("key-utf8", B_INT8_TYPE, (const void*)keyUtf8, len);
} }
be_app->PostMessage(&msg); be_app->PostMessage(&msg);
} }

View File

@ -36,54 +36,54 @@ extern "C" {
#endif #endif
int HAIKU_SetClipboardText(_THIS, const char *text) { int HAIKU_SetClipboardText(_THIS, const char *text) {
BMessage *clip = NULL; BMessage *clip = NULL;
if(be_clipboard->Lock()) { if(be_clipboard->Lock()) {
be_clipboard->Clear(); be_clipboard->Clear();
if((clip = be_clipboard->Data())) { if((clip = be_clipboard->Data())) {
/* Presumably the string of characters is ascii-format */ /* Presumably the string of characters is ascii-format */
ssize_t asciiLength = 0; ssize_t asciiLength = 0;
for(; text[asciiLength] != 0; ++asciiLength) {} for(; text[asciiLength] != 0; ++asciiLength) {}
clip->AddData("text/plain", B_MIME_TYPE, text, asciiLength); clip->AddData("text/plain", B_MIME_TYPE, text, asciiLength);
be_clipboard->Commit(); be_clipboard->Commit();
} }
be_clipboard->Unlock(); be_clipboard->Unlock();
} }
return 0; return 0;
} }
char *HAIKU_GetClipboardText(_THIS) { char *HAIKU_GetClipboardText(_THIS) {
BMessage *clip = NULL; BMessage *clip = NULL;
const char *text = NULL; const char *text = NULL;
ssize_t length; ssize_t length;
char *result; char *result;
if(be_clipboard->Lock()) { if(be_clipboard->Lock()) {
if((clip = be_clipboard->Data())) { if((clip = be_clipboard->Data())) {
/* Presumably the string of characters is ascii-format */ /* Presumably the string of characters is ascii-format */
clip->FindData("text/plain", B_MIME_TYPE, (const void**)&text, clip->FindData("text/plain", B_MIME_TYPE, (const void**)&text,
&length); &length);
} }
be_clipboard->Unlock(); be_clipboard->Unlock();
} }
if (!text) { if (!text) {
result = SDL_strdup(""); result = SDL_strdup("");
} else { } else {
/* Copy the data and pass on to SDL */ /* Copy the data and pass on to SDL */
result = (char *)SDL_malloc((length + 1) * sizeof(char)); result = (char *)SDL_malloc((length + 1) * sizeof(char));
SDL_strlcpy(result, text, length + 1); SDL_strlcpy(result, text, length + 1);
} }
return result; return result;
} }
SDL_bool HAIKU_HasClipboardText(_THIS) { SDL_bool HAIKU_HasClipboardText(_THIS) {
SDL_bool result = SDL_FALSE; SDL_bool result = SDL_FALSE;
char *text = HAIKU_GetClipboardText(_this); char *text = HAIKU_GetClipboardText(_this);
if (text) { if (text) {
result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE; result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE;
SDL_free(text); SDL_free(text);
} }
return result; return result;
} }
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -29,7 +29,7 @@ extern "C" {
#endif #endif
void HAIKU_PumpEvents(_THIS) { void HAIKU_PumpEvents(_THIS) {
/* Since the event thread is its own thread, this isn't really necessary */ /* Since the event thread is its own thread, this isn't really necessary */
} }
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -40,158 +40,158 @@ static int32 HAIKU_UpdateOnce(SDL_Window *window);
#endif #endif
static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) { static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
return ((SDL_BWin*)(window->driverdata)); return ((SDL_BWin*)(window->driverdata));
} }
static SDL_INLINE SDL_BApp *_GetBeApp() { static SDL_INLINE SDL_BApp *_GetBeApp() {
return ((SDL_BApp*)be_app); return ((SDL_BApp*)be_app);
} }
int HAIKU_CreateWindowFramebuffer(_THIS, SDL_Window * window, int HAIKU_CreateWindowFramebuffer(_THIS, SDL_Window * window,
Uint32 * format, Uint32 * format,
void ** pixels, int *pitch) { void ** pixels, int *pitch) {
SDL_BWin *bwin = _ToBeWin(window); SDL_BWin *bwin = _ToBeWin(window);
BScreen bscreen; BScreen bscreen;
if(!bscreen.IsValid()) { if(!bscreen.IsValid()) {
return -1; return -1;
} }
while(!bwin->Connected()) { snooze(100); } while(!bwin->Connected()) { snooze(100); }
/* Make sure we have exclusive access to frame buffer data */ /* Make sure we have exclusive access to frame buffer data */
bwin->LockBuffer(); bwin->LockBuffer();
/* format */ /* format */
display_mode bmode; display_mode bmode;
bscreen.GetMode(&bmode); bscreen.GetMode(&bmode);
int32 bpp = HAIKU_ColorSpaceToBitsPerPixel(bmode.space); int32 bpp = HAIKU_ColorSpaceToBitsPerPixel(bmode.space);
*format = HAIKU_BPPToSDLPxFormat(bpp); *format = HAIKU_BPPToSDLPxFormat(bpp);
/* Create the new bitmap object */ /* Create the new bitmap object */
BBitmap *bitmap = bwin->GetBitmap(); BBitmap *bitmap = bwin->GetBitmap();
if(bitmap) { if(bitmap) {
delete bitmap; delete bitmap;
} }
bitmap = new BBitmap(bwin->Bounds(), (color_space)bmode.space, bitmap = new BBitmap(bwin->Bounds(), (color_space)bmode.space,
false, /* Views not accepted */ false, /* Views not accepted */
true); /* Contiguous memory required */ true); /* Contiguous memory required */
if(bitmap->InitCheck() != B_OK) { if(bitmap->InitCheck() != B_OK) {
delete bitmap; delete bitmap;
return SDL_SetError("Could not initialize back buffer!"); return SDL_SetError("Could not initialize back buffer!");
} }
bwin->SetBitmap(bitmap); bwin->SetBitmap(bitmap);
/* Set the pixel pointer */ /* Set the pixel pointer */
*pixels = bitmap->Bits(); *pixels = bitmap->Bits();
/* pitch = width of window, in bytes */ /* pitch = width of window, in bytes */
*pitch = bitmap->BytesPerRow(); *pitch = bitmap->BytesPerRow();
bwin->SetBufferExists(true); bwin->SetBufferExists(true);
bwin->SetTrashBuffer(false); bwin->SetTrashBuffer(false);
bwin->UnlockBuffer(); bwin->UnlockBuffer();
return 0; return 0;
} }
int HAIKU_UpdateWindowFramebuffer(_THIS, SDL_Window * window, int HAIKU_UpdateWindowFramebuffer(_THIS, SDL_Window * window,
const SDL_Rect * rects, int numrects) { const SDL_Rect * rects, int numrects) {
if(!window) if(!window)
return 0; return 0;
SDL_BWin *bwin = _ToBeWin(window); SDL_BWin *bwin = _ToBeWin(window);
#ifdef DRAWTHREAD #ifdef DRAWTHREAD
bwin->LockBuffer(); bwin->LockBuffer();
bwin->SetBufferDirty(true); bwin->SetBufferDirty(true);
bwin->UnlockBuffer(); bwin->UnlockBuffer();
#else #else
bwin->SetBufferDirty(true); bwin->SetBufferDirty(true);
HAIKU_UpdateOnce(window); HAIKU_UpdateOnce(window);
#endif #endif
return 0; return 0;
} }
int32 HAIKU_DrawThread(void *data) { int32 HAIKU_DrawThread(void *data) {
SDL_BWin *bwin = (SDL_BWin*)data; SDL_BWin *bwin = (SDL_BWin*)data;
BScreen bscreen; BScreen bscreen;
if(!bscreen.IsValid()) { if(!bscreen.IsValid()) {
return -1; return -1;
} }
while(bwin->ConnectionEnabled()) { while(bwin->ConnectionEnabled()) {
if( bwin->Connected() && bwin->BufferExists() && bwin->BufferIsDirty() ) { if( bwin->Connected() && bwin->BufferExists() && bwin->BufferIsDirty() ) {
bwin->LockBuffer(); bwin->LockBuffer();
BBitmap *bitmap = NULL; BBitmap *bitmap = NULL;
bitmap = bwin->GetBitmap(); bitmap = bwin->GetBitmap();
int32 windowPitch = bitmap->BytesPerRow(); int32 windowPitch = bitmap->BytesPerRow();
int32 bufferPitch = bwin->GetRowBytes(); int32 bufferPitch = bwin->GetRowBytes();
uint8 *windowpx; uint8 *windowpx;
uint8 *bufferpx; uint8 *bufferpx;
int32 BPP = bwin->GetBytesPerPx(); int32 BPP = bwin->GetBytesPerPx();
int32 windowSub = bwin->GetFbX() * BPP + int32 windowSub = bwin->GetFbX() * BPP +
bwin->GetFbY() * windowPitch; bwin->GetFbY() * windowPitch;
clipping_rect *clips = bwin->GetClips(); clipping_rect *clips = bwin->GetClips();
int32 numClips = bwin->GetNumClips(); int32 numClips = bwin->GetNumClips();
int i, y; int i, y;
/* Blit each clipping rectangle */ /* Blit each clipping rectangle */
bscreen.WaitForRetrace(); bscreen.WaitForRetrace();
for(i = 0; i < numClips; ++i) { for(i = 0; i < numClips; ++i) {
/* Get addresses of the start of each clipping rectangle */ /* Get addresses of the start of each clipping rectangle */
int32 width = clips[i].right - clips[i].left + 1; int32 width = clips[i].right - clips[i].left + 1;
int32 height = clips[i].bottom - clips[i].top + 1; int32 height = clips[i].bottom - clips[i].top + 1;
bufferpx = bwin->GetBufferPx() + bufferpx = bwin->GetBufferPx() +
clips[i].top * bufferPitch + clips[i].left * BPP; clips[i].top * bufferPitch + clips[i].left * BPP;
windowpx = (uint8*)bitmap->Bits() + windowpx = (uint8*)bitmap->Bits() +
clips[i].top * windowPitch + clips[i].left * BPP - clips[i].top * windowPitch + clips[i].left * BPP -
windowSub; windowSub;
/* Copy each row of pixels from the window buffer into the frame /* Copy each row of pixels from the window buffer into the frame
buffer */ buffer */
for(y = 0; y < height; ++y) for(y = 0; y < height; ++y)
{ {
if(bwin->CanTrashWindowBuffer()) { if(bwin->CanTrashWindowBuffer()) {
goto escape; /* Break out before the buffer is killed */ goto escape; /* Break out before the buffer is killed */
} }
memcpy(bufferpx, windowpx, width * BPP); memcpy(bufferpx, windowpx, width * BPP);
bufferpx += bufferPitch; bufferpx += bufferPitch;
windowpx += windowPitch; windowpx += windowPitch;
} }
} }
bwin->SetBufferDirty(false); bwin->SetBufferDirty(false);
escape: escape:
bwin->UnlockBuffer(); bwin->UnlockBuffer();
} else { } else {
snooze(16000); snooze(16000);
} }
} }
return B_OK; return B_OK;
} }
void HAIKU_DestroyWindowFramebuffer(_THIS, SDL_Window * window) { void HAIKU_DestroyWindowFramebuffer(_THIS, SDL_Window * window) {
SDL_BWin *bwin = _ToBeWin(window); SDL_BWin *bwin = _ToBeWin(window);
bwin->LockBuffer(); bwin->LockBuffer();
/* Free and clear the window buffer */ /* Free and clear the window buffer */
BBitmap *bitmap = bwin->GetBitmap(); BBitmap *bitmap = bwin->GetBitmap();
delete bitmap; delete bitmap;
bwin->SetBitmap(NULL); bwin->SetBitmap(NULL);
bwin->SetBufferExists(false); bwin->SetBufferExists(false);
bwin->UnlockBuffer(); bwin->UnlockBuffer();
} }
@ -203,50 +203,50 @@ void HAIKU_DestroyWindowFramebuffer(_THIS, SDL_Window * window) {
*/ */
#ifndef DRAWTHREAD #ifndef DRAWTHREAD
static int32 HAIKU_UpdateOnce(SDL_Window *window) { static int32 HAIKU_UpdateOnce(SDL_Window *window) {
SDL_BWin *bwin = _ToBeWin(window); SDL_BWin *bwin = _ToBeWin(window);
BScreen bscreen; BScreen bscreen;
if(!bscreen.IsValid()) { if(!bscreen.IsValid()) {
return -1; return -1;
} }
if(bwin->ConnectionEnabled() && bwin->Connected()) { if(bwin->ConnectionEnabled() && bwin->Connected()) {
bwin->LockBuffer(); bwin->LockBuffer();
int32 windowPitch = window->surface->pitch; int32 windowPitch = window->surface->pitch;
int32 bufferPitch = bwin->GetRowBytes(); int32 bufferPitch = bwin->GetRowBytes();
uint8 *windowpx; uint8 *windowpx;
uint8 *bufferpx; uint8 *bufferpx;
int32 BPP = bwin->GetBytesPerPx(); int32 BPP = bwin->GetBytesPerPx();
uint8 *windowBaseAddress = (uint8*)window->surface->pixels; uint8 *windowBaseAddress = (uint8*)window->surface->pixels;
int32 windowSub = bwin->GetFbX() * BPP + int32 windowSub = bwin->GetFbX() * BPP +
bwin->GetFbY() * windowPitch; bwin->GetFbY() * windowPitch;
clipping_rect *clips = bwin->GetClips(); clipping_rect *clips = bwin->GetClips();
int32 numClips = bwin->GetNumClips(); int32 numClips = bwin->GetNumClips();
int i, y; int i, y;
/* Blit each clipping rectangle */ /* Blit each clipping rectangle */
bscreen.WaitForRetrace(); bscreen.WaitForRetrace();
for(i = 0; i < numClips; ++i) { for(i = 0; i < numClips; ++i) {
/* Get addresses of the start of each clipping rectangle */ /* Get addresses of the start of each clipping rectangle */
int32 width = clips[i].right - clips[i].left + 1; int32 width = clips[i].right - clips[i].left + 1;
int32 height = clips[i].bottom - clips[i].top + 1; int32 height = clips[i].bottom - clips[i].top + 1;
bufferpx = bwin->GetBufferPx() + bufferpx = bwin->GetBufferPx() +
clips[i].top * bufferPitch + clips[i].left * BPP; clips[i].top * bufferPitch + clips[i].left * BPP;
windowpx = windowBaseAddress + windowpx = windowBaseAddress +
clips[i].top * windowPitch + clips[i].left * BPP - windowSub; clips[i].top * windowPitch + clips[i].left * BPP - windowSub;
/* Copy each row of pixels from the window buffer into the frame /* Copy each row of pixels from the window buffer into the frame
buffer */ buffer */
for(y = 0; y < height; ++y) for(y = 0; y < height; ++y)
{ {
memcpy(bufferpx, windowpx, width * BPP); memcpy(bufferpx, windowpx, width * BPP);
bufferpx += bufferPitch; bufferpx += bufferPitch;
windowpx += windowPitch; windowpx += windowPitch;
} }
} }
bwin->UnlockBuffer(); bwin->UnlockBuffer();
} }
return 0; return 0;
} }
#endif #endif

View File

@ -42,143 +42,143 @@ static SDL_Scancode keymap[KEYMAP_SIZE];
static int8 keystate[KEYMAP_SIZE]; static int8 keystate[KEYMAP_SIZE];
void HAIKU_InitOSKeymap(void) { void HAIKU_InitOSKeymap(void) {
for( uint i = 0; i < SDL_TABLESIZE(keymap); ++i ) { for( uint i = 0; i < SDL_TABLESIZE(keymap); ++i ) {
keymap[i] = SDL_SCANCODE_UNKNOWN; keymap[i] = SDL_SCANCODE_UNKNOWN;
} }
for( uint i = 0; i < KEYMAP_SIZE; ++i ) { for( uint i = 0; i < KEYMAP_SIZE; ++i ) {
keystate[i] = SDL_RELEASED; keystate[i] = SDL_RELEASED;
} }
keymap[0x01] = SDL_GetScancodeFromKey(SDLK_ESCAPE); keymap[0x01] = SDL_GetScancodeFromKey(SDLK_ESCAPE);
keymap[B_F1_KEY] = SDL_GetScancodeFromKey(SDLK_F1); keymap[B_F1_KEY] = SDL_GetScancodeFromKey(SDLK_F1);
keymap[B_F2_KEY] = SDL_GetScancodeFromKey(SDLK_F2); keymap[B_F2_KEY] = SDL_GetScancodeFromKey(SDLK_F2);
keymap[B_F3_KEY] = SDL_GetScancodeFromKey(SDLK_F3); keymap[B_F3_KEY] = SDL_GetScancodeFromKey(SDLK_F3);
keymap[B_F4_KEY] = SDL_GetScancodeFromKey(SDLK_F4); keymap[B_F4_KEY] = SDL_GetScancodeFromKey(SDLK_F4);
keymap[B_F5_KEY] = SDL_GetScancodeFromKey(SDLK_F5); keymap[B_F5_KEY] = SDL_GetScancodeFromKey(SDLK_F5);
keymap[B_F6_KEY] = SDL_GetScancodeFromKey(SDLK_F6); keymap[B_F6_KEY] = SDL_GetScancodeFromKey(SDLK_F6);
keymap[B_F7_KEY] = SDL_GetScancodeFromKey(SDLK_F7); keymap[B_F7_KEY] = SDL_GetScancodeFromKey(SDLK_F7);
keymap[B_F8_KEY] = SDL_GetScancodeFromKey(SDLK_F8); keymap[B_F8_KEY] = SDL_GetScancodeFromKey(SDLK_F8);
keymap[B_F9_KEY] = SDL_GetScancodeFromKey(SDLK_F9); keymap[B_F9_KEY] = SDL_GetScancodeFromKey(SDLK_F9);
keymap[B_F10_KEY] = SDL_GetScancodeFromKey(SDLK_F10); keymap[B_F10_KEY] = SDL_GetScancodeFromKey(SDLK_F10);
keymap[B_F11_KEY] = SDL_GetScancodeFromKey(SDLK_F11); keymap[B_F11_KEY] = SDL_GetScancodeFromKey(SDLK_F11);
keymap[B_F12_KEY] = SDL_GetScancodeFromKey(SDLK_F12); keymap[B_F12_KEY] = SDL_GetScancodeFromKey(SDLK_F12);
keymap[B_PRINT_KEY] = SDL_GetScancodeFromKey(SDLK_PRINTSCREEN); keymap[B_PRINT_KEY] = SDL_GetScancodeFromKey(SDLK_PRINTSCREEN);
keymap[B_SCROLL_KEY] = SDL_GetScancodeFromKey(SDLK_SCROLLLOCK); keymap[B_SCROLL_KEY] = SDL_GetScancodeFromKey(SDLK_SCROLLLOCK);
keymap[B_PAUSE_KEY] = SDL_GetScancodeFromKey(SDLK_PAUSE); keymap[B_PAUSE_KEY] = SDL_GetScancodeFromKey(SDLK_PAUSE);
keymap[0x11] = SDL_GetScancodeFromKey(SDLK_BACKQUOTE); keymap[0x11] = SDL_GetScancodeFromKey(SDLK_BACKQUOTE);
keymap[0x12] = SDL_GetScancodeFromKey(SDLK_1); keymap[0x12] = SDL_GetScancodeFromKey(SDLK_1);
keymap[0x13] = SDL_GetScancodeFromKey(SDLK_2); keymap[0x13] = SDL_GetScancodeFromKey(SDLK_2);
keymap[0x14] = SDL_GetScancodeFromKey(SDLK_3); keymap[0x14] = SDL_GetScancodeFromKey(SDLK_3);
keymap[0x15] = SDL_GetScancodeFromKey(SDLK_4); keymap[0x15] = SDL_GetScancodeFromKey(SDLK_4);
keymap[0x16] = SDL_GetScancodeFromKey(SDLK_5); keymap[0x16] = SDL_GetScancodeFromKey(SDLK_5);
keymap[0x17] = SDL_GetScancodeFromKey(SDLK_6); keymap[0x17] = SDL_GetScancodeFromKey(SDLK_6);
keymap[0x18] = SDL_GetScancodeFromKey(SDLK_7); keymap[0x18] = SDL_GetScancodeFromKey(SDLK_7);
keymap[0x19] = SDL_GetScancodeFromKey(SDLK_8); keymap[0x19] = SDL_GetScancodeFromKey(SDLK_8);
keymap[0x1a] = SDL_GetScancodeFromKey(SDLK_9); keymap[0x1a] = SDL_GetScancodeFromKey(SDLK_9);
keymap[0x1b] = SDL_GetScancodeFromKey(SDLK_0); keymap[0x1b] = SDL_GetScancodeFromKey(SDLK_0);
keymap[0x1c] = SDL_GetScancodeFromKey(SDLK_MINUS); keymap[0x1c] = SDL_GetScancodeFromKey(SDLK_MINUS);
keymap[0x1d] = SDL_GetScancodeFromKey(SDLK_EQUALS); keymap[0x1d] = SDL_GetScancodeFromKey(SDLK_EQUALS);
keymap[0x1e] = SDL_GetScancodeFromKey(SDLK_BACKSPACE); keymap[0x1e] = SDL_GetScancodeFromKey(SDLK_BACKSPACE);
keymap[0x1f] = SDL_GetScancodeFromKey(SDLK_INSERT); keymap[0x1f] = SDL_GetScancodeFromKey(SDLK_INSERT);
keymap[0x20] = SDL_GetScancodeFromKey(SDLK_HOME); keymap[0x20] = SDL_GetScancodeFromKey(SDLK_HOME);
keymap[0x21] = SDL_GetScancodeFromKey(SDLK_PAGEUP); keymap[0x21] = SDL_GetScancodeFromKey(SDLK_PAGEUP);
keymap[0x22] = SDL_GetScancodeFromKey(SDLK_NUMLOCKCLEAR); keymap[0x22] = SDL_GetScancodeFromKey(SDLK_NUMLOCKCLEAR);
keymap[0x23] = SDL_GetScancodeFromKey(SDLK_KP_DIVIDE); keymap[0x23] = SDL_GetScancodeFromKey(SDLK_KP_DIVIDE);
keymap[0x24] = SDL_GetScancodeFromKey(SDLK_KP_MULTIPLY); keymap[0x24] = SDL_GetScancodeFromKey(SDLK_KP_MULTIPLY);
keymap[0x25] = SDL_GetScancodeFromKey(SDLK_KP_MINUS); keymap[0x25] = SDL_GetScancodeFromKey(SDLK_KP_MINUS);
keymap[0x26] = SDL_GetScancodeFromKey(SDLK_TAB); keymap[0x26] = SDL_GetScancodeFromKey(SDLK_TAB);
keymap[0x27] = SDL_GetScancodeFromKey(SDLK_q); keymap[0x27] = SDL_GetScancodeFromKey(SDLK_q);
keymap[0x28] = SDL_GetScancodeFromKey(SDLK_w); keymap[0x28] = SDL_GetScancodeFromKey(SDLK_w);
keymap[0x29] = SDL_GetScancodeFromKey(SDLK_e); keymap[0x29] = SDL_GetScancodeFromKey(SDLK_e);
keymap[0x2a] = SDL_GetScancodeFromKey(SDLK_r); keymap[0x2a] = SDL_GetScancodeFromKey(SDLK_r);
keymap[0x2b] = SDL_GetScancodeFromKey(SDLK_t); keymap[0x2b] = SDL_GetScancodeFromKey(SDLK_t);
keymap[0x2c] = SDL_GetScancodeFromKey(SDLK_y); keymap[0x2c] = SDL_GetScancodeFromKey(SDLK_y);
keymap[0x2d] = SDL_GetScancodeFromKey(SDLK_u); keymap[0x2d] = SDL_GetScancodeFromKey(SDLK_u);
keymap[0x2e] = SDL_GetScancodeFromKey(SDLK_i); keymap[0x2e] = SDL_GetScancodeFromKey(SDLK_i);
keymap[0x2f] = SDL_GetScancodeFromKey(SDLK_o); keymap[0x2f] = SDL_GetScancodeFromKey(SDLK_o);
keymap[0x30] = SDL_GetScancodeFromKey(SDLK_p); keymap[0x30] = SDL_GetScancodeFromKey(SDLK_p);
keymap[0x31] = SDL_GetScancodeFromKey(SDLK_LEFTBRACKET); keymap[0x31] = SDL_GetScancodeFromKey(SDLK_LEFTBRACKET);
keymap[0x32] = SDL_GetScancodeFromKey(SDLK_RIGHTBRACKET); keymap[0x32] = SDL_GetScancodeFromKey(SDLK_RIGHTBRACKET);
keymap[0x33] = SDL_GetScancodeFromKey(SDLK_BACKSLASH); keymap[0x33] = SDL_GetScancodeFromKey(SDLK_BACKSLASH);
keymap[0x34] = SDL_GetScancodeFromKey(SDLK_DELETE); keymap[0x34] = SDL_GetScancodeFromKey(SDLK_DELETE);
keymap[0x35] = SDL_GetScancodeFromKey(SDLK_END); keymap[0x35] = SDL_GetScancodeFromKey(SDLK_END);
keymap[0x36] = SDL_GetScancodeFromKey(SDLK_PAGEDOWN); keymap[0x36] = SDL_GetScancodeFromKey(SDLK_PAGEDOWN);
keymap[0x37] = SDL_GetScancodeFromKey(SDLK_KP_7); keymap[0x37] = SDL_GetScancodeFromKey(SDLK_KP_7);
keymap[0x38] = SDL_GetScancodeFromKey(SDLK_KP_8); keymap[0x38] = SDL_GetScancodeFromKey(SDLK_KP_8);
keymap[0x39] = SDL_GetScancodeFromKey(SDLK_KP_9); keymap[0x39] = SDL_GetScancodeFromKey(SDLK_KP_9);
keymap[0x3a] = SDL_GetScancodeFromKey(SDLK_KP_PLUS); keymap[0x3a] = SDL_GetScancodeFromKey(SDLK_KP_PLUS);
keymap[0x3b] = SDL_GetScancodeFromKey(SDLK_CAPSLOCK); keymap[0x3b] = SDL_GetScancodeFromKey(SDLK_CAPSLOCK);
keymap[0x3c] = SDL_GetScancodeFromKey(SDLK_a); keymap[0x3c] = SDL_GetScancodeFromKey(SDLK_a);
keymap[0x3d] = SDL_GetScancodeFromKey(SDLK_s); keymap[0x3d] = SDL_GetScancodeFromKey(SDLK_s);
keymap[0x3e] = SDL_GetScancodeFromKey(SDLK_d); keymap[0x3e] = SDL_GetScancodeFromKey(SDLK_d);
keymap[0x3f] = SDL_GetScancodeFromKey(SDLK_f); keymap[0x3f] = SDL_GetScancodeFromKey(SDLK_f);
keymap[0x40] = SDL_GetScancodeFromKey(SDLK_g); keymap[0x40] = SDL_GetScancodeFromKey(SDLK_g);
keymap[0x41] = SDL_GetScancodeFromKey(SDLK_h); keymap[0x41] = SDL_GetScancodeFromKey(SDLK_h);
keymap[0x42] = SDL_GetScancodeFromKey(SDLK_j); keymap[0x42] = SDL_GetScancodeFromKey(SDLK_j);
keymap[0x43] = SDL_GetScancodeFromKey(SDLK_k); keymap[0x43] = SDL_GetScancodeFromKey(SDLK_k);
keymap[0x44] = SDL_GetScancodeFromKey(SDLK_l); keymap[0x44] = SDL_GetScancodeFromKey(SDLK_l);
keymap[0x45] = SDL_GetScancodeFromKey(SDLK_SEMICOLON); keymap[0x45] = SDL_GetScancodeFromKey(SDLK_SEMICOLON);
keymap[0x46] = SDL_GetScancodeFromKey(SDLK_QUOTE); keymap[0x46] = SDL_GetScancodeFromKey(SDLK_QUOTE);
keymap[0x47] = SDL_GetScancodeFromKey(SDLK_RETURN); keymap[0x47] = SDL_GetScancodeFromKey(SDLK_RETURN);
keymap[0x48] = SDL_GetScancodeFromKey(SDLK_KP_4); keymap[0x48] = SDL_GetScancodeFromKey(SDLK_KP_4);
keymap[0x49] = SDL_GetScancodeFromKey(SDLK_KP_5); keymap[0x49] = SDL_GetScancodeFromKey(SDLK_KP_5);
keymap[0x4a] = SDL_GetScancodeFromKey(SDLK_KP_6); keymap[0x4a] = SDL_GetScancodeFromKey(SDLK_KP_6);
keymap[0x4b] = SDL_GetScancodeFromKey(SDLK_LSHIFT); keymap[0x4b] = SDL_GetScancodeFromKey(SDLK_LSHIFT);
keymap[0x4c] = SDL_GetScancodeFromKey(SDLK_z); keymap[0x4c] = SDL_GetScancodeFromKey(SDLK_z);
keymap[0x4d] = SDL_GetScancodeFromKey(SDLK_x); keymap[0x4d] = SDL_GetScancodeFromKey(SDLK_x);
keymap[0x4e] = SDL_GetScancodeFromKey(SDLK_c); keymap[0x4e] = SDL_GetScancodeFromKey(SDLK_c);
keymap[0x4f] = SDL_GetScancodeFromKey(SDLK_v); keymap[0x4f] = SDL_GetScancodeFromKey(SDLK_v);
keymap[0x50] = SDL_GetScancodeFromKey(SDLK_b); keymap[0x50] = SDL_GetScancodeFromKey(SDLK_b);
keymap[0x51] = SDL_GetScancodeFromKey(SDLK_n); keymap[0x51] = SDL_GetScancodeFromKey(SDLK_n);
keymap[0x52] = SDL_GetScancodeFromKey(SDLK_m); keymap[0x52] = SDL_GetScancodeFromKey(SDLK_m);
keymap[0x53] = SDL_GetScancodeFromKey(SDLK_COMMA); keymap[0x53] = SDL_GetScancodeFromKey(SDLK_COMMA);
keymap[0x54] = SDL_GetScancodeFromKey(SDLK_PERIOD); keymap[0x54] = SDL_GetScancodeFromKey(SDLK_PERIOD);
keymap[0x55] = SDL_GetScancodeFromKey(SDLK_SLASH); keymap[0x55] = SDL_GetScancodeFromKey(SDLK_SLASH);
keymap[0x56] = SDL_GetScancodeFromKey(SDLK_RSHIFT); keymap[0x56] = SDL_GetScancodeFromKey(SDLK_RSHIFT);
keymap[0x57] = SDL_GetScancodeFromKey(SDLK_UP); keymap[0x57] = SDL_GetScancodeFromKey(SDLK_UP);
keymap[0x58] = SDL_GetScancodeFromKey(SDLK_KP_1); keymap[0x58] = SDL_GetScancodeFromKey(SDLK_KP_1);
keymap[0x59] = SDL_GetScancodeFromKey(SDLK_KP_2); keymap[0x59] = SDL_GetScancodeFromKey(SDLK_KP_2);
keymap[0x5a] = SDL_GetScancodeFromKey(SDLK_KP_3); keymap[0x5a] = SDL_GetScancodeFromKey(SDLK_KP_3);
keymap[0x5b] = SDL_GetScancodeFromKey(SDLK_KP_ENTER); keymap[0x5b] = SDL_GetScancodeFromKey(SDLK_KP_ENTER);
keymap[0x5c] = SDL_GetScancodeFromKey(SDLK_LCTRL); keymap[0x5c] = SDL_GetScancodeFromKey(SDLK_LCTRL);
keymap[0x5d] = SDL_GetScancodeFromKey(SDLK_LALT); keymap[0x5d] = SDL_GetScancodeFromKey(SDLK_LALT);
keymap[0x5e] = SDL_GetScancodeFromKey(SDLK_SPACE); keymap[0x5e] = SDL_GetScancodeFromKey(SDLK_SPACE);
keymap[0x5f] = SDL_GetScancodeFromKey(SDLK_RALT); keymap[0x5f] = SDL_GetScancodeFromKey(SDLK_RALT);
keymap[0x60] = SDL_GetScancodeFromKey(SDLK_RCTRL); keymap[0x60] = SDL_GetScancodeFromKey(SDLK_RCTRL);
keymap[0x61] = SDL_GetScancodeFromKey(SDLK_LEFT); keymap[0x61] = SDL_GetScancodeFromKey(SDLK_LEFT);
keymap[0x62] = SDL_GetScancodeFromKey(SDLK_DOWN); keymap[0x62] = SDL_GetScancodeFromKey(SDLK_DOWN);
keymap[0x63] = SDL_GetScancodeFromKey(SDLK_RIGHT); keymap[0x63] = SDL_GetScancodeFromKey(SDLK_RIGHT);
keymap[0x64] = SDL_GetScancodeFromKey(SDLK_KP_0); keymap[0x64] = SDL_GetScancodeFromKey(SDLK_KP_0);
keymap[0x65] = SDL_GetScancodeFromKey(SDLK_KP_PERIOD); keymap[0x65] = SDL_GetScancodeFromKey(SDLK_KP_PERIOD);
keymap[0x66] = SDL_GetScancodeFromKey(SDLK_LGUI); keymap[0x66] = SDL_GetScancodeFromKey(SDLK_LGUI);
keymap[0x67] = SDL_GetScancodeFromKey(SDLK_RGUI); keymap[0x67] = SDL_GetScancodeFromKey(SDLK_RGUI);
keymap[0x68] = SDL_GetScancodeFromKey(SDLK_MENU); keymap[0x68] = SDL_GetScancodeFromKey(SDLK_MENU);
keymap[0x69] = SDL_GetScancodeFromKey(SDLK_2); /* SDLK_EURO */ keymap[0x69] = SDL_GetScancodeFromKey(SDLK_2); /* SDLK_EURO */
keymap[0x6a] = SDL_GetScancodeFromKey(SDLK_KP_EQUALS); keymap[0x6a] = SDL_GetScancodeFromKey(SDLK_KP_EQUALS);
keymap[0x6b] = SDL_GetScancodeFromKey(SDLK_POWER); keymap[0x6b] = SDL_GetScancodeFromKey(SDLK_POWER);
} }
SDL_Scancode HAIKU_GetScancodeFromBeKey(int32 bkey) { SDL_Scancode HAIKU_GetScancodeFromBeKey(int32 bkey) {
if(bkey > 0 && bkey < (int32)SDL_TABLESIZE(keymap)) { if(bkey > 0 && bkey < (int32)SDL_TABLESIZE(keymap)) {
return keymap[bkey]; return keymap[bkey];
} else { } else {
return SDL_SCANCODE_UNKNOWN; return SDL_SCANCODE_UNKNOWN;
} }
} }
int8 HAIKU_GetKeyState(int32 bkey) { int8 HAIKU_GetKeyState(int32 bkey) {
if(bkey > 0 && bkey < KEYMAP_SIZE) { if(bkey > 0 && bkey < KEYMAP_SIZE) {
return keystate[bkey]; return keystate[bkey];
} else { } else {
return SDL_RELEASED; return SDL_RELEASED;
} }
} }
void HAIKU_SetKeyState(int32 bkey, int8 state) { void HAIKU_SetKeyState(int32 bkey, int8 state) {
if(bkey > 0 && bkey < KEYMAP_SIZE) { if(bkey > 0 && bkey < KEYMAP_SIZE) {
keystate[bkey] = state; keystate[bkey] = state;
} }
} }
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -44,30 +44,30 @@ extern "C" {
/* This wrapper is here so that the driverdata can be freed without freeing /* This wrapper is here so that the driverdata can be freed without freeing
the display_mode structure */ the display_mode structure */
struct SDL_DisplayModeData { struct SDL_DisplayModeData {
display_mode *bmode; display_mode *bmode;
}; };
#endif #endif
static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) { static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
return ((SDL_BWin*)(window->driverdata)); return ((SDL_BWin*)(window->driverdata));
} }
static SDL_INLINE SDL_BApp *_GetBeApp() { static SDL_INLINE SDL_BApp *_GetBeApp() {
return ((SDL_BApp*)be_app); return ((SDL_BApp*)be_app);
} }
static SDL_INLINE display_mode * _ExtractBMode(SDL_DisplayMode *mode) { static SDL_INLINE display_mode * _ExtractBMode(SDL_DisplayMode *mode) {
#if WRAP_BMODE #if WRAP_BMODE
return ((SDL_DisplayModeData*)mode->driverdata)->bmode; return ((SDL_DisplayModeData*)mode->driverdata)->bmode;
#else #else
return (display_mode*)(mode->driverdata); return (display_mode*)(mode->driverdata);
#endif #endif
} }
/* Copied from haiku/trunk/src/preferences/screen/ScreenMode.cpp */ /* Copied from haiku/trunk/src/preferences/screen/ScreenMode.cpp */
static float get_refresh_rate(display_mode &mode) { static float get_refresh_rate(display_mode &mode) {
return float(mode.timing.pixel_clock * 1000) return float(mode.timing.pixel_clock * 1000)
/ float(mode.timing.h_total * mode.timing.v_total); / float(mode.timing.h_total * mode.timing.v_total);
} }
@ -76,57 +76,57 @@ static float get_refresh_rate(display_mode &mode) {
* This is a useful debugging tool. Uncomment and insert into code as needed. * This is a useful debugging tool. Uncomment and insert into code as needed.
*/ */
void _SpoutModeData(display_mode *bmode) { void _SpoutModeData(display_mode *bmode) {
printf("BMode:\n"); printf("BMode:\n");
printf("\tw,h = (%i,%i)\n", bmode->virtual_width, bmode->virtual_height); printf("\tw,h = (%i,%i)\n", bmode->virtual_width, bmode->virtual_height);
printf("\th,v = (%i,%i)\n", bmode->h_display_start, printf("\th,v = (%i,%i)\n", bmode->h_display_start,
bmode->v_display_start); bmode->v_display_start);
if(bmode->flags) { if(bmode->flags) {
printf("\tFlags:\n"); printf("\tFlags:\n");
if(bmode->flags & B_SCROLL) { if(bmode->flags & B_SCROLL) {
printf("\t\tB_SCROLL\n"); printf("\t\tB_SCROLL\n");
} }
if(bmode->flags & B_8_BIT_DAC) { if(bmode->flags & B_8_BIT_DAC) {
printf("\t\tB_8_BIT_DAC\n"); printf("\t\tB_8_BIT_DAC\n");
} }
if(bmode->flags & B_HARDWARE_CURSOR) { if(bmode->flags & B_HARDWARE_CURSOR) {
printf("\t\tB_HARDWARE_CURSOR\n"); printf("\t\tB_HARDWARE_CURSOR\n");
} }
if(bmode->flags & B_PARALLEL_ACCESS) { if(bmode->flags & B_PARALLEL_ACCESS) {
printf("\t\tB_PARALLEL_ACCESS\n"); printf("\t\tB_PARALLEL_ACCESS\n");
} }
if(bmode->flags & B_DPMS) { if(bmode->flags & B_DPMS) {
printf("\t\tB_DPMS\n"); printf("\t\tB_DPMS\n");
} }
if(bmode->flags & B_IO_FB_NA) { if(bmode->flags & B_IO_FB_NA) {
printf("\t\tB_IO_FB_NA\n"); printf("\t\tB_IO_FB_NA\n");
} }
} }
printf("\tTiming:\n"); printf("\tTiming:\n");
printf("\t\tpx clock: %i\n", bmode->timing.pixel_clock); printf("\t\tpx clock: %i\n", bmode->timing.pixel_clock);
printf("\t\th - display: %i sync start: %i sync end: %i total: %i\n", printf("\t\th - display: %i sync start: %i sync end: %i total: %i\n",
bmode->timing.h_display, bmode->timing.h_sync_start, bmode->timing.h_display, bmode->timing.h_sync_start,
bmode->timing.h_sync_end, bmode->timing.h_total); bmode->timing.h_sync_end, bmode->timing.h_total);
printf("\t\tv - display: %i sync start: %i sync end: %i total: %i\n", printf("\t\tv - display: %i sync start: %i sync end: %i total: %i\n",
bmode->timing.v_display, bmode->timing.v_sync_start, bmode->timing.v_display, bmode->timing.v_sync_start,
bmode->timing.v_sync_end, bmode->timing.v_total); bmode->timing.v_sync_end, bmode->timing.v_total);
if(bmode->timing.flags) { if(bmode->timing.flags) {
printf("\t\tFlags:\n"); printf("\t\tFlags:\n");
if(bmode->timing.flags & B_BLANK_PEDESTAL) { if(bmode->timing.flags & B_BLANK_PEDESTAL) {
printf("\t\t\tB_BLANK_PEDESTAL\n"); printf("\t\t\tB_BLANK_PEDESTAL\n");
} }
if(bmode->timing.flags & B_TIMING_INTERLACED) { if(bmode->timing.flags & B_TIMING_INTERLACED) {
printf("\t\t\tB_TIMING_INTERLACED\n"); printf("\t\t\tB_TIMING_INTERLACED\n");
} }
if(bmode->timing.flags & B_POSITIVE_HSYNC) { if(bmode->timing.flags & B_POSITIVE_HSYNC) {
printf("\t\t\tB_POSITIVE_HSYNC\n"); printf("\t\t\tB_POSITIVE_HSYNC\n");
} }
if(bmode->timing.flags & B_POSITIVE_VSYNC) { if(bmode->timing.flags & B_POSITIVE_VSYNC) {
printf("\t\t\tB_POSITIVE_VSYNC\n"); printf("\t\t\tB_POSITIVE_VSYNC\n");
} }
if(bmode->timing.flags & B_SYNC_ON_GREEN) { if(bmode->timing.flags & B_SYNC_ON_GREEN) {
printf("\t\t\tB_SYNC_ON_GREEN\n"); printf("\t\t\tB_SYNC_ON_GREEN\n");
} }
} }
} }
#endif #endif
@ -134,101 +134,101 @@ void _SpoutModeData(display_mode *bmode) {
int32 HAIKU_ColorSpaceToBitsPerPixel(uint32 colorspace) int32 HAIKU_ColorSpaceToBitsPerPixel(uint32 colorspace)
{ {
int bitsperpixel; int bitsperpixel;
bitsperpixel = 0; bitsperpixel = 0;
switch (colorspace) { switch (colorspace) {
case B_CMAP8: case B_CMAP8:
bitsperpixel = 8; bitsperpixel = 8;
break; break;
case B_RGB15: case B_RGB15:
case B_RGBA15: case B_RGBA15:
case B_RGB15_BIG: case B_RGB15_BIG:
case B_RGBA15_BIG: case B_RGBA15_BIG:
bitsperpixel = 15; bitsperpixel = 15;
break; break;
case B_RGB16: case B_RGB16:
case B_RGB16_BIG: case B_RGB16_BIG:
bitsperpixel = 16; bitsperpixel = 16;
break; break;
case B_RGB32: case B_RGB32:
case B_RGBA32: case B_RGBA32:
case B_RGB32_BIG: case B_RGB32_BIG:
case B_RGBA32_BIG: case B_RGBA32_BIG:
bitsperpixel = 32; bitsperpixel = 32;
break; break;
default: default:
break; break;
} }
return(bitsperpixel); return(bitsperpixel);
} }
int32 HAIKU_BPPToSDLPxFormat(int32 bpp) { int32 HAIKU_BPPToSDLPxFormat(int32 bpp) {
/* Translation taken from SDL_windowsmodes.c */ /* Translation taken from SDL_windowsmodes.c */
switch (bpp) { switch (bpp) {
case 32: case 32:
return SDL_PIXELFORMAT_RGB888; return SDL_PIXELFORMAT_RGB888;
break; break;
case 24: /* May not be supported by Haiku */ case 24: /* May not be supported by Haiku */
return SDL_PIXELFORMAT_RGB24; return SDL_PIXELFORMAT_RGB24;
break; break;
case 16: case 16:
return SDL_PIXELFORMAT_RGB565; return SDL_PIXELFORMAT_RGB565;
break; break;
case 15: case 15:
return SDL_PIXELFORMAT_RGB555; return SDL_PIXELFORMAT_RGB555;
break; break;
case 8: case 8:
return SDL_PIXELFORMAT_INDEX8; return SDL_PIXELFORMAT_INDEX8;
break; break;
case 4: /* May not be supported by Haiku */ case 4: /* May not be supported by Haiku */
return SDL_PIXELFORMAT_INDEX4LSB; return SDL_PIXELFORMAT_INDEX4LSB;
break; break;
} }
/* May never get here, but safer and needed to shut up compiler */ /* May never get here, but safer and needed to shut up compiler */
SDL_SetError("Invalid bpp value"); SDL_SetError("Invalid bpp value");
return 0; return 0;
} }
static void _BDisplayModeToSdlDisplayMode(display_mode *bmode, static void _BDisplayModeToSdlDisplayMode(display_mode *bmode,
SDL_DisplayMode *mode) { SDL_DisplayMode *mode) {
mode->w = bmode->virtual_width; mode->w = bmode->virtual_width;
mode->h = bmode->virtual_height; mode->h = bmode->virtual_height;
mode->refresh_rate = (int)get_refresh_rate(*bmode); mode->refresh_rate = (int)get_refresh_rate(*bmode);
#if WRAP_BMODE #if WRAP_BMODE
SDL_DisplayModeData *data = (SDL_DisplayModeData*)SDL_calloc(1, SDL_DisplayModeData *data = (SDL_DisplayModeData*)SDL_calloc(1,
sizeof(SDL_DisplayModeData)); sizeof(SDL_DisplayModeData));
data->bmode = bmode; data->bmode = bmode;
mode->driverdata = data; mode->driverdata = data;
#else #else
mode->driverdata = bmode; mode->driverdata = bmode;
#endif #endif
/* Set the format */ /* Set the format */
int32 bpp = HAIKU_ColorSpaceToBitsPerPixel(bmode->space); int32 bpp = HAIKU_ColorSpaceToBitsPerPixel(bmode->space);
mode->format = HAIKU_BPPToSDLPxFormat(bpp); mode->format = HAIKU_BPPToSDLPxFormat(bpp);
} }
/* Later, there may be more than one monitor available */ /* Later, there may be more than one monitor available */
static void _AddDisplay(BScreen *screen) { static void _AddDisplay(BScreen *screen) {
SDL_VideoDisplay display; SDL_VideoDisplay display;
SDL_DisplayMode *mode = (SDL_DisplayMode*)SDL_calloc(1, SDL_DisplayMode *mode = (SDL_DisplayMode*)SDL_calloc(1,
sizeof(SDL_DisplayMode)); sizeof(SDL_DisplayMode));
display_mode *bmode = (display_mode*)SDL_calloc(1, sizeof(display_mode)); display_mode *bmode = (display_mode*)SDL_calloc(1, sizeof(display_mode));
screen->GetMode(bmode); screen->GetMode(bmode);
_BDisplayModeToSdlDisplayMode(bmode, mode); _BDisplayModeToSdlDisplayMode(bmode, mode);
SDL_zero(display); SDL_zero(display);
display.desktop_mode = *mode; display.desktop_mode = *mode;
display.current_mode = *mode; display.current_mode = *mode;
SDL_AddVideoDisplay(&display); SDL_AddVideoDisplay(&display);
} }
/* /*
@ -236,92 +236,92 @@ static void _AddDisplay(BScreen *screen) {
*/ */
int HAIKU_InitModes(_THIS) { int HAIKU_InitModes(_THIS) {
BScreen screen; BScreen screen;
/* TODO: When Haiku supports multiple display screens, call /* TODO: When Haiku supports multiple display screens, call
_AddDisplayScreen() for each of them. */ _AddDisplayScreen() for each of them. */
_AddDisplay(&screen); _AddDisplay(&screen);
return 0; return 0;
} }
int HAIKU_QuitModes(_THIS) { int HAIKU_QuitModes(_THIS) {
/* FIXME: Nothing really needs to be done here at the moment? */ /* FIXME: Nothing really needs to be done here at the moment? */
return 0; return 0;
} }
int HAIKU_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect) { int HAIKU_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect) {
BScreen bscreen; BScreen bscreen;
BRect rc = bscreen.Frame(); BRect rc = bscreen.Frame();
rect->x = (int)rc.left; rect->x = (int)rc.left;
rect->y = (int)rc.top; rect->y = (int)rc.top;
rect->w = (int)rc.Width() + 1; rect->w = (int)rc.Width() + 1;
rect->h = (int)rc.Height() + 1; rect->h = (int)rc.Height() + 1;
return 0; return 0;
} }
void HAIKU_GetDisplayModes(_THIS, SDL_VideoDisplay *display) { void HAIKU_GetDisplayModes(_THIS, SDL_VideoDisplay *display) {
/* Get the current screen */ /* Get the current screen */
BScreen bscreen; BScreen bscreen;
/* Iterate through all of the modes */ /* Iterate through all of the modes */
SDL_DisplayMode mode; SDL_DisplayMode mode;
display_mode this_bmode; display_mode this_bmode;
display_mode *bmodes; display_mode *bmodes;
uint32 count, i; uint32 count, i;
/* Get graphics-hardware supported modes */ /* Get graphics-hardware supported modes */
bscreen.GetModeList(&bmodes, &count); bscreen.GetModeList(&bmodes, &count);
bscreen.GetMode(&this_bmode); bscreen.GetMode(&this_bmode);
for(i = 0; i < count; ++i) { for(i = 0; i < count; ++i) {
// FIXME: Apparently there are errors with colorspace changes // FIXME: Apparently there are errors with colorspace changes
if (bmodes[i].space == this_bmode.space) { if (bmodes[i].space == this_bmode.space) {
_BDisplayModeToSdlDisplayMode(&bmodes[i], &mode); _BDisplayModeToSdlDisplayMode(&bmodes[i], &mode);
SDL_AddDisplayMode(display, &mode); SDL_AddDisplayMode(display, &mode);
} }
} }
free(bmodes); free(bmodes);
} }
int HAIKU_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode){ int HAIKU_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode){
/* Get the current screen */ /* Get the current screen */
BScreen bscreen; BScreen bscreen;
if(!bscreen.IsValid()) { if(!bscreen.IsValid()) {
printf(__FILE__": %d - ERROR: BAD SCREEN\n", __LINE__); printf(__FILE__": %d - ERROR: BAD SCREEN\n", __LINE__);
} }
/* Set the mode using the driver data */ /* Set the mode using the driver data */
display_mode *bmode = _ExtractBMode(mode); display_mode *bmode = _ExtractBMode(mode);
/* FIXME: Is the first option always going to be the right one? */ /* FIXME: Is the first option always going to be the right one? */
uint32 c = 0, i; uint32 c = 0, i;
display_mode *bmode_list; display_mode *bmode_list;
bscreen.GetModeList(&bmode_list, &c); bscreen.GetModeList(&bmode_list, &c);
for(i = 0; i < c; ++i) { for(i = 0; i < c; ++i) {
if( bmode_list[i].space == bmode->space && if( bmode_list[i].space == bmode->space &&
bmode_list[i].virtual_width == bmode->virtual_width && bmode_list[i].virtual_width == bmode->virtual_width &&
bmode_list[i].virtual_height == bmode->virtual_height ) { bmode_list[i].virtual_height == bmode->virtual_height ) {
bmode = &bmode_list[i]; bmode = &bmode_list[i];
break; break;
} }
} }
if(bscreen.SetMode(bmode) != B_OK) { if(bscreen.SetMode(bmode) != B_OK) {
return SDL_SetError("Bad video mode"); return SDL_SetError("Bad video mode");
} }
free(bmode_list); free(bmode_list);
#if SDL_VIDEO_OPENGL #if SDL_VIDEO_OPENGL
/* FIXME: Is there some way to reboot the OpenGL context? This doesn't /* FIXME: Is there some way to reboot the OpenGL context? This doesn't
help */ help */
// HAIKU_GL_RebootContexts(_this); // HAIKU_GL_RebootContexts(_this);
#endif #endif
return 0; return 0;
} }
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -56,7 +56,7 @@ HAIKU_CreateDevice(int devindex)
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
device->driverdata = NULL; /* FIXME: Is this the cause of some of the device->driverdata = NULL; /* FIXME: Is this the cause of some of the
SDL_Quit() errors? */ SDL_Quit() errors? */
/* TODO: Figure out if any initialization needs to go here */ /* TODO: Figure out if any initialization needs to go here */
@ -122,37 +122,36 @@ HAIKU_CreateDevice(int devindex)
} }
VideoBootStrap HAIKU_bootstrap = { VideoBootStrap HAIKU_bootstrap = {
"haiku", "Haiku graphics", "haiku", "Haiku graphics",
HAIKU_Available, HAIKU_CreateDevice HAIKU_Available, HAIKU_CreateDevice
}; };
void HAIKU_DeleteDevice(SDL_VideoDevice * device) void HAIKU_DeleteDevice(SDL_VideoDevice * device)
{ {
SDL_free(device->driverdata); SDL_free(device->driverdata);
SDL_free(device); SDL_free(device);
} }
int HAIKU_VideoInit(_THIS) int HAIKU_VideoInit(_THIS)
{ {
/* Initialize the Be Application for appserver interaction */ /* Initialize the Be Application for appserver interaction */
if (SDL_InitBeApp() < 0) { if (SDL_InitBeApp() < 0) {
return -1; return -1;
} }
/* Initialize video modes */ /* Initialize video modes */
HAIKU_InitModes(_this); HAIKU_InitModes(_this);
/* Init the keymap */
HAIKU_InitOSKeymap();
/* Init the keymap */
HAIKU_InitOSKeymap();
#if SDL_VIDEO_OPENGL #if SDL_VIDEO_OPENGL
/* testgl application doesn't load library, just tries to load symbols */ /* testgl application doesn't load library, just tries to load symbols */
/* is it correct? if so we have to load library here */ /* is it correct? if so we have to load library here */
HAIKU_GL_LoadLibrary(_this, NULL); HAIKU_GL_LoadLibrary(_this, NULL);
#endif #endif
/* We're done! */ /* We're done! */
return (0); return (0);
} }

View File

@ -32,36 +32,36 @@ extern "C" {
#endif #endif
static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) { static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) {
return ((SDL_BWin*)(window->driverdata)); return ((SDL_BWin*)(window->driverdata));
} }
static SDL_INLINE SDL_BApp *_GetBeApp() { static SDL_INLINE SDL_BApp *_GetBeApp() {
return ((SDL_BApp*)be_app); return ((SDL_BApp*)be_app);
} }
static int _InitWindow(_THIS, SDL_Window *window) { static int _InitWindow(_THIS, SDL_Window *window) {
uint32 flags = 0; uint32 flags = 0;
window_look look = B_TITLED_WINDOW_LOOK; window_look look = B_TITLED_WINDOW_LOOK;
BRect bounds( BRect bounds(
window->x, window->x,
window->y, window->y,
window->x + window->w - 1, //BeWindows have an off-by-one px w/h thing window->x + window->w - 1, //BeWindows have an off-by-one px w/h thing
window->y + window->h - 1 window->y + window->h - 1
); );
if(window->flags & SDL_WINDOW_FULLSCREEN) { if(window->flags & SDL_WINDOW_FULLSCREEN) {
/* TODO: Add support for this flag */ /* TODO: Add support for this flag */
printf(__FILE__": %d!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",__LINE__); printf(__FILE__": %d!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",__LINE__);
} }
if(window->flags & SDL_WINDOW_OPENGL) { if(window->flags & SDL_WINDOW_OPENGL) {
/* TODO: Add support for this flag */ /* TODO: Add support for this flag */
} }
if(!(window->flags & SDL_WINDOW_RESIZABLE)) { if(!(window->flags & SDL_WINDOW_RESIZABLE)) {
flags |= B_NOT_RESIZABLE | B_NOT_ZOOMABLE; flags |= B_NOT_RESIZABLE | B_NOT_ZOOMABLE;
} }
if(window->flags & SDL_WINDOW_BORDERLESS) { if(window->flags & SDL_WINDOW_BORDERLESS) {
look = B_NO_BORDER_WINDOW_LOOK; look = B_NO_BORDER_WINDOW_LOOK;
} }
SDL_BWin *bwin = new(std::nothrow) SDL_BWin(bounds, look, flags); SDL_BWin *bwin = new(std::nothrow) SDL_BWin(bounds, look, flags);
@ -79,35 +79,35 @@ int HAIKU_CreateWindow(_THIS, SDL_Window *window) {
if (_InitWindow(_this, window) < 0) { if (_InitWindow(_this, window) < 0) {
return -1; return -1;
} }
/* Start window loop */ /* Start window loop */
_ToBeWin(window)->Show(); _ToBeWin(window)->Show();
return 0; return 0;
} }
int HAIKU_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) { int HAIKU_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) {
SDL_BWin *otherBWin = (SDL_BWin*)data; SDL_BWin *otherBWin = (SDL_BWin*)data;
if(!otherBWin->LockLooper()) if(!otherBWin->LockLooper())
return -1; return -1;
/* Create the new window and initialize its members */ /* Create the new window and initialize its members */
window->x = (int)otherBWin->Frame().left; window->x = (int)otherBWin->Frame().left;
window->y = (int)otherBWin->Frame().top; window->y = (int)otherBWin->Frame().top;
window->w = (int)otherBWin->Frame().Width(); window->w = (int)otherBWin->Frame().Width();
window->h = (int)otherBWin->Frame().Height(); window->h = (int)otherBWin->Frame().Height();
/* Set SDL flags */ /* Set SDL flags */
if(!(otherBWin->Flags() & B_NOT_RESIZABLE)) { if(!(otherBWin->Flags() & B_NOT_RESIZABLE)) {
window->flags |= SDL_WINDOW_RESIZABLE; window->flags |= SDL_WINDOW_RESIZABLE;
} }
/* If we are out of memory, return the error code */ /* If we are out of memory, return the error code */
if (_InitWindow(_this, window) < 0) { if (_InitWindow(_this, window) < 0) {
return -1; return -1;
} }
/* TODO: Add any other SDL-supported window attributes here */ /* TODO: Add any other SDL-supported window attributes here */
_ToBeWin(window)->SetTitle(otherBWin->Title()); _ToBeWin(window)->SetTitle(otherBWin->Title());
/* Start window loop and unlock the other window */ /* Start window loop and unlock the other window */
@ -118,106 +118,106 @@ int HAIKU_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) {
} }
void HAIKU_SetWindowTitle(_THIS, SDL_Window * window) { void HAIKU_SetWindowTitle(_THIS, SDL_Window * window) {
BMessage msg(BWIN_SET_TITLE); BMessage msg(BWIN_SET_TITLE);
msg.AddString("window-title", window->title); msg.AddString("window-title", window->title);
_ToBeWin(window)->PostMessage(&msg); _ToBeWin(window)->PostMessage(&msg);
} }
void HAIKU_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) { void HAIKU_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) {
/* FIXME: Icons not supported by Haiku */ /* FIXME: Icons not supported by Haiku */
} }
void HAIKU_SetWindowPosition(_THIS, SDL_Window * window) { void HAIKU_SetWindowPosition(_THIS, SDL_Window * window) {
BMessage msg(BWIN_MOVE_WINDOW); BMessage msg(BWIN_MOVE_WINDOW);
msg.AddInt32("window-x", window->x); msg.AddInt32("window-x", window->x);
msg.AddInt32("window-y", window->y); msg.AddInt32("window-y", window->y);
_ToBeWin(window)->PostMessage(&msg); _ToBeWin(window)->PostMessage(&msg);
} }
void HAIKU_SetWindowSize(_THIS, SDL_Window * window) { void HAIKU_SetWindowSize(_THIS, SDL_Window * window) {
BMessage msg(BWIN_RESIZE_WINDOW); BMessage msg(BWIN_RESIZE_WINDOW);
msg.AddInt32("window-w", window->w - 1); msg.AddInt32("window-w", window->w - 1);
msg.AddInt32("window-h", window->h - 1); msg.AddInt32("window-h", window->h - 1);
_ToBeWin(window)->PostMessage(&msg); _ToBeWin(window)->PostMessage(&msg);
} }
void HAIKU_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) { void HAIKU_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) {
BMessage msg(BWIN_SET_BORDERED); BMessage msg(BWIN_SET_BORDERED);
msg.AddBool("window-border", bordered != SDL_FALSE); msg.AddBool("window-border", bordered != SDL_FALSE);
_ToBeWin(window)->PostMessage(&msg); _ToBeWin(window)->PostMessage(&msg);
} }
void HAIKU_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) { void HAIKU_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) {
BMessage msg(BWIN_SET_RESIZABLE); BMessage msg(BWIN_SET_RESIZABLE);
msg.AddBool("window-resizable", resizable != SDL_FALSE); msg.AddBool("window-resizable", resizable != SDL_FALSE);
_ToBeWin(window)->PostMessage(&msg); _ToBeWin(window)->PostMessage(&msg);
} }
void HAIKU_ShowWindow(_THIS, SDL_Window * window) { void HAIKU_ShowWindow(_THIS, SDL_Window * window) {
BMessage msg(BWIN_SHOW_WINDOW); BMessage msg(BWIN_SHOW_WINDOW);
_ToBeWin(window)->PostMessage(&msg); _ToBeWin(window)->PostMessage(&msg);
} }
void HAIKU_HideWindow(_THIS, SDL_Window * window) { void HAIKU_HideWindow(_THIS, SDL_Window * window) {
BMessage msg(BWIN_HIDE_WINDOW); BMessage msg(BWIN_HIDE_WINDOW);
_ToBeWin(window)->PostMessage(&msg); _ToBeWin(window)->PostMessage(&msg);
} }
void HAIKU_RaiseWindow(_THIS, SDL_Window * window) { void HAIKU_RaiseWindow(_THIS, SDL_Window * window) {
BMessage msg(BWIN_SHOW_WINDOW); /* Activate this window and move to front */ BMessage msg(BWIN_SHOW_WINDOW); /* Activate this window and move to front */
_ToBeWin(window)->PostMessage(&msg); _ToBeWin(window)->PostMessage(&msg);
} }
void HAIKU_MaximizeWindow(_THIS, SDL_Window * window) { void HAIKU_MaximizeWindow(_THIS, SDL_Window * window) {
BMessage msg(BWIN_MAXIMIZE_WINDOW); BMessage msg(BWIN_MAXIMIZE_WINDOW);
_ToBeWin(window)->PostMessage(&msg); _ToBeWin(window)->PostMessage(&msg);
} }
void HAIKU_MinimizeWindow(_THIS, SDL_Window * window) { void HAIKU_MinimizeWindow(_THIS, SDL_Window * window) {
BMessage msg(BWIN_MINIMIZE_WINDOW); BMessage msg(BWIN_MINIMIZE_WINDOW);
_ToBeWin(window)->PostMessage(&msg); _ToBeWin(window)->PostMessage(&msg);
} }
void HAIKU_RestoreWindow(_THIS, SDL_Window * window) { void HAIKU_RestoreWindow(_THIS, SDL_Window * window) {
BMessage msg(BWIN_RESTORE_WINDOW); BMessage msg(BWIN_RESTORE_WINDOW);
_ToBeWin(window)->PostMessage(&msg); _ToBeWin(window)->PostMessage(&msg);
} }
void HAIKU_SetWindowFullscreen(_THIS, SDL_Window * window, void HAIKU_SetWindowFullscreen(_THIS, SDL_Window * window,
SDL_VideoDisplay * display, SDL_bool fullscreen) { SDL_VideoDisplay * display, SDL_bool fullscreen) {
/* Haiku tracks all video display information */ /* Haiku tracks all video display information */
BMessage msg(BWIN_FULLSCREEN); BMessage msg(BWIN_FULLSCREEN);
msg.AddBool("fullscreen", fullscreen); msg.AddBool("fullscreen", fullscreen);
_ToBeWin(window)->PostMessage(&msg); _ToBeWin(window)->PostMessage(&msg);
} }
int HAIKU_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) { int HAIKU_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) {
/* FIXME: Not Haiku supported */ /* FIXME: Not Haiku supported */
return -1; return -1;
} }
int HAIKU_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp) { int HAIKU_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp) {
/* FIXME: Not Haiku supported */ /* FIXME: Not Haiku supported */
return -1; return -1;
} }
void HAIKU_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) { void HAIKU_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) {
/* TODO: Implement this! */ /* TODO: Implement this! */
} }
void HAIKU_DestroyWindow(_THIS, SDL_Window * window) { void HAIKU_DestroyWindow(_THIS, SDL_Window * window) {
_ToBeWin(window)->LockLooper(); /* This MUST be locked */ _ToBeWin(window)->LockLooper(); /* This MUST be locked */
_GetBeApp()->ClearID(_ToBeWin(window)); _GetBeApp()->ClearID(_ToBeWin(window));
_ToBeWin(window)->Quit(); _ToBeWin(window)->Quit();
window->driverdata = NULL; window->driverdata = NULL;
} }
SDL_bool HAIKU_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_bool HAIKU_GetWindowWMInfo(_THIS, SDL_Window * window,
struct SDL_SysWMinfo *info) { struct SDL_SysWMinfo *info) {
/* FIXME: What is the point of this? What information should be included? */ /* FIXME: What is the point of this? What information should be included? */
return SDL_FALSE; return SDL_FALSE;
} }

View File

@ -487,12 +487,12 @@ KMSDRM_MoveCursor(SDL_Cursor * cursor)
That's why we move the cursor graphic ONLY. */ That's why we move the cursor graphic ONLY. */
if (mouse != NULL && mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) { if (mouse != NULL && mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) {
curdata = (KMSDRM_CursorData *) mouse->cur_cursor->driverdata; curdata = (KMSDRM_CursorData *) mouse->cur_cursor->driverdata;
drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(curdata->bo)); drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(curdata->bo));
ret = KMSDRM_drmModeMoveCursor(drm_fd, curdata->crtc_id, mouse->x, mouse->y); ret = KMSDRM_drmModeMoveCursor(drm_fd, curdata->crtc_id, mouse->x, mouse->y);
if (ret) { if (ret) {
SDL_SetError("drmModeMoveCursor() failed."); SDL_SetError("drmModeMoveCursor() failed.");
} }
} }
} }

View File

@ -50,23 +50,23 @@ KMSDRM_GLES_SetupCrtc(_THIS, SDL_Window * window) {
KMSDRM_FBInfo *fb_info; KMSDRM_FBInfo *fb_info;
if (!(_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, wdata->egl_surface))) { if (!(_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, wdata->egl_surface))) {
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "eglSwapBuffers failed on CRTC setup"); SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "eglSwapBuffers failed on CRTC setup");
return SDL_FALSE; return SDL_FALSE;
} }
wdata->next_bo = KMSDRM_gbm_surface_lock_front_buffer(wdata->gs); wdata->next_bo = KMSDRM_gbm_surface_lock_front_buffer(wdata->gs);
if (wdata->next_bo == NULL) { if (wdata->next_bo == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not lock GBM surface front buffer on CRTC setup"); SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not lock GBM surface front buffer on CRTC setup");
return SDL_FALSE; return SDL_FALSE;
} }
fb_info = KMSDRM_FBFromBO(_this, wdata->next_bo); fb_info = KMSDRM_FBFromBO(_this, wdata->next_bo);
if (fb_info == NULL) { if (fb_info == NULL) {
return SDL_FALSE; return SDL_FALSE;
} }
if(KMSDRM_drmModeSetCrtc(vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id, if(KMSDRM_drmModeSetCrtc(vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id,
0, 0, &vdata->saved_conn_id, 1, &displaydata->cur_mode) != 0) { 0, 0, &vdata->saved_conn_id, 1, &displaydata->cur_mode) != 0) {
SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Could not set up CRTC to a GBM buffer"); SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Could not set up CRTC to a GBM buffer");
return SDL_FALSE; return SDL_FALSE;
@ -153,14 +153,14 @@ KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window) {
} else { } else {
/* Queue page flip at vsync */ /* Queue page flip at vsync */
/* Have we already setup the CRTC to one of the GBM buffers? Do so if we have not, /* Have we already setup the CRTC to one of the GBM buffers? Do so if we have not,
or FlipPage won't work in some cases. */ or FlipPage won't work in some cases. */
if (!wdata->crtc_ready) { if (!wdata->crtc_ready) {
if(!KMSDRM_GLES_SetupCrtc(_this, window)) { if(!KMSDRM_GLES_SetupCrtc(_this, window)) {
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not set up CRTC for doing vsync-ed pageflips"); SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not set up CRTC for doing vsync-ed pageflips");
return 0; return 0;
} }
} }
/* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "drmModePageFlip(%d, %u, %u, DRM_MODE_PAGE_FLIP_EVENT, &wdata->waiting_for_flip)", /* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "drmModePageFlip(%d, %u, %u, DRM_MODE_PAGE_FLIP_EVENT, &wdata->waiting_for_flip)",
vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id); */ vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id); */

View File

@ -343,17 +343,17 @@ RPI_DestroyWindow(_THIS, SDL_Window * window)
SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata; SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
if(data) { if(data) {
if (data->double_buffer) { if (data->double_buffer) {
/* Wait for vsync, and then stop vsync callbacks and destroy related stuff, if needed */ /* Wait for vsync, and then stop vsync callbacks and destroy related stuff, if needed */
SDL_LockMutex(data->vsync_cond_mutex); SDL_LockMutex(data->vsync_cond_mutex);
SDL_CondWait(data->vsync_cond, data->vsync_cond_mutex); SDL_CondWait(data->vsync_cond, data->vsync_cond_mutex);
SDL_UnlockMutex(data->vsync_cond_mutex); SDL_UnlockMutex(data->vsync_cond_mutex);
vc_dispmanx_vsync_callback(displaydata->dispman_display, NULL, NULL); vc_dispmanx_vsync_callback(displaydata->dispman_display, NULL, NULL);
SDL_DestroyCond(data->vsync_cond); SDL_DestroyCond(data->vsync_cond);
SDL_DestroyMutex(data->vsync_cond_mutex); SDL_DestroyMutex(data->vsync_cond_mutex);
} }
#if SDL_VIDEO_OPENGL_EGL #if SDL_VIDEO_OPENGL_EGL
if (data->egl_surface != EGL_NO_SURFACE) { if (data->egl_surface != EGL_NO_SURFACE) {

View File

@ -445,7 +445,7 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh)
#if !TARGET_OS_TV #if !TARGET_OS_TV
- (void)application:(UIApplication *)application didChangeStatusBarOrientation:(UIInterfaceOrientation)oldStatusBarOrientation - (void)application:(UIApplication *)application didChangeStatusBarOrientation:(UIInterfaceOrientation)oldStatusBarOrientation
{ {
SDL_OnApplicationDidChangeStatusBarOrientation(); SDL_OnApplicationDidChangeStatusBarOrientation();
} }
#endif #endif

View File

@ -191,7 +191,7 @@ UIKit_InitModes(_THIS)
} }
} }
#if !TARGET_OS_TV #if !TARGET_OS_TV
SDL_OnApplicationDidChangeStatusBarOrientation(); SDL_OnApplicationDidChangeStatusBarOrientation();
#endif #endif
} }

View File

@ -252,34 +252,34 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
- (void)pressesBegan:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event - (void)pressesBegan:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
{ {
if (!SDL_AppleTVRemoteOpenedAsJoystick) { if (!SDL_AppleTVRemoteOpenedAsJoystick) {
for (UIPress *press in presses) { for (UIPress *press in presses) {
SDL_Scancode scancode = [self scancodeFromPressType:press.type]; SDL_Scancode scancode = [self scancodeFromPressType:press.type];
SDL_SendKeyboardKey(SDL_PRESSED, scancode); SDL_SendKeyboardKey(SDL_PRESSED, scancode);
} }
} }
[super pressesBegan:presses withEvent:event]; [super pressesBegan:presses withEvent:event];
} }
- (void)pressesEnded:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event - (void)pressesEnded:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
{ {
if (!SDL_AppleTVRemoteOpenedAsJoystick) { if (!SDL_AppleTVRemoteOpenedAsJoystick) {
for (UIPress *press in presses) { for (UIPress *press in presses) {
SDL_Scancode scancode = [self scancodeFromPressType:press.type]; SDL_Scancode scancode = [self scancodeFromPressType:press.type];
SDL_SendKeyboardKey(SDL_RELEASED, scancode); SDL_SendKeyboardKey(SDL_RELEASED, scancode);
} }
} }
[super pressesEnded:presses withEvent:event]; [super pressesEnded:presses withEvent:event];
} }
- (void)pressesCancelled:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event - (void)pressesCancelled:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
{ {
if (!SDL_AppleTVRemoteOpenedAsJoystick) { if (!SDL_AppleTVRemoteOpenedAsJoystick) {
for (UIPress *press in presses) { for (UIPress *press in presses) {
SDL_Scancode scancode = [self scancodeFromPressType:press.type]; SDL_Scancode scancode = [self scancodeFromPressType:press.type];
SDL_SendKeyboardKey(SDL_RELEASED, scancode); SDL_SendKeyboardKey(SDL_RELEASED, scancode);
} }
} }
[super pressesCancelled:presses withEvent:event]; [super pressesCancelled:presses withEvent:event];
} }

View File

@ -747,7 +747,7 @@ static const struct wl_data_offer_listener data_offer_listener = {
static void static void
data_device_handle_data_offer(void *data, struct wl_data_device *wl_data_device, data_device_handle_data_offer(void *data, struct wl_data_device *wl_data_device,
struct wl_data_offer *id) struct wl_data_offer *id)
{ {
SDL_WaylandDataOffer *data_offer = NULL; SDL_WaylandDataOffer *data_offer = NULL;
@ -765,7 +765,7 @@ data_device_handle_data_offer(void *data, struct wl_data_device *wl_data_device,
static void static void
data_device_handle_enter(void *data, struct wl_data_device *wl_data_device, data_device_handle_enter(void *data, struct wl_data_device *wl_data_device,
uint32_t serial, struct wl_surface *surface, uint32_t serial, struct wl_surface *surface,
wl_fixed_t x, wl_fixed_t y, struct wl_data_offer *id) wl_fixed_t x, wl_fixed_t y, struct wl_data_offer *id)
{ {
SDL_WaylandDataDevice *data_device = data; SDL_WaylandDataDevice *data_device = data;
@ -808,7 +808,7 @@ data_device_handle_leave(void *data, struct wl_data_device *wl_data_device)
static void static void
data_device_handle_motion(void *data, struct wl_data_device *wl_data_device, data_device_handle_motion(void *data, struct wl_data_device *wl_data_device,
uint32_t time, wl_fixed_t x, wl_fixed_t y) uint32_t time, wl_fixed_t x, wl_fixed_t y)
{ {
} }
@ -847,7 +847,7 @@ data_device_handle_drop(void *data, struct wl_data_device *wl_data_device)
static void static void
data_device_handle_selection(void *data, struct wl_data_device *wl_data_device, data_device_handle_selection(void *data, struct wl_data_device *wl_data_device,
struct wl_data_offer *id) struct wl_data_offer *id)
{ {
SDL_WaylandDataDevice *data_device = data; SDL_WaylandDataDevice *data_device = data;
SDL_WaylandDataOffer *offer = NULL; SDL_WaylandDataOffer *offer = NULL;

View File

@ -89,9 +89,9 @@ touch_handle_touch(void *data,
*/ */
SDL_TouchID deviceId = 1; SDL_TouchID deviceId = 1;
if (SDL_AddTouch(deviceId, "qt_touch_extension") < 0) { if (SDL_AddTouch(deviceId, "qt_touch_extension") < 0) {
SDL_Log("error: can't add touch %s, %d", __FILE__, __LINE__); SDL_Log("error: can't add touch %s, %d", __FILE__, __LINE__);
} }
switch (touchState) { switch (touchState) {
case QtWaylandTouchPointPressed: case QtWaylandTouchPointPressed:

View File

@ -68,10 +68,10 @@ static char *
get_classname() get_classname()
{ {
/* !!! FIXME: this is probably wrong, albeit harmless in many common cases. From protocol spec: /* !!! FIXME: this is probably wrong, albeit harmless in many common cases. From protocol spec:
"The surface class identifies the general class of applications "The surface class identifies the general class of applications
to which the surface belongs. A common convention is to use the to which the surface belongs. A common convention is to use the
file name (or the full path if it is a non-standard location) of file name (or the full path if it is a non-standard location) of
the application's .desktop file as the class." */ the application's .desktop file as the class." */
char *spot; char *spot;
#if defined(__LINUX__) || defined(__FREEBSD__) #if defined(__LINUX__) || defined(__FREEBSD__)

View File

@ -134,10 +134,10 @@ static const struct zxdg_surface_v6_listener shell_surface_listener_zxdg = {
static void static void
handle_configure_zxdg_toplevel(void *data, handle_configure_zxdg_toplevel(void *data,
struct zxdg_toplevel_v6 *zxdg_toplevel_v6, struct zxdg_toplevel_v6 *zxdg_toplevel_v6,
int32_t width, int32_t width,
int32_t height, int32_t height,
struct wl_array *states) struct wl_array *states)
{ {
SDL_WindowData *wind = (SDL_WindowData *)data; SDL_WindowData *wind = (SDL_WindowData *)data;
SDL_Window *window = wind->sdlwindow; SDL_Window *window = wind->sdlwindow;
@ -213,10 +213,10 @@ static const struct xdg_surface_listener shell_surface_listener_xdg = {
static void static void
handle_configure_xdg_toplevel(void *data, handle_configure_xdg_toplevel(void *data,
struct xdg_toplevel *xdg_toplevel, struct xdg_toplevel *xdg_toplevel,
int32_t width, int32_t width,
int32_t height, int32_t height,
struct wl_array *states) struct wl_array *states)
{ {
SDL_WindowData *wind = (SDL_WindowData *)data; SDL_WindowData *wind = (SDL_WindowData *)data;
SDL_Window *window = wind->sdlwindow; SDL_Window *window = wind->sdlwindow;

View File

@ -33,31 +33,31 @@ struct SDL_GLDriverData
SDL_bool HAS_WGL_ARB_create_context_robustness; SDL_bool HAS_WGL_ARB_create_context_robustness;
SDL_bool HAS_WGL_ARB_create_context_no_error; SDL_bool HAS_WGL_ARB_create_context_no_error;
/* Max version of OpenGL ES context that can be created if the /* Max version of OpenGL ES context that can be created if the
implementation supports WGL_EXT_create_context_es2_profile. implementation supports WGL_EXT_create_context_es2_profile.
major = minor = 0 when unsupported. major = minor = 0 when unsupported.
*/ */
struct { struct {
int major; int major;
int minor; int minor;
} es_profile_max_supported_version; } es_profile_max_supported_version;
void *(WINAPI * wglGetProcAddress) (const char *proc); void *(WINAPI * wglGetProcAddress) (const char *proc);
HGLRC(WINAPI * wglCreateContext) (HDC hdc); HGLRC(WINAPI * wglCreateContext) (HDC hdc);
BOOL(WINAPI * wglDeleteContext) (HGLRC hglrc); BOOL(WINAPI * wglDeleteContext) (HGLRC hglrc);
BOOL(WINAPI * wglMakeCurrent) (HDC hdc, HGLRC hglrc); BOOL(WINAPI * wglMakeCurrent) (HDC hdc, HGLRC hglrc);
BOOL(WINAPI * wglShareLists) (HGLRC hglrc1, HGLRC hglrc2); BOOL(WINAPI * wglShareLists) (HGLRC hglrc1, HGLRC hglrc2);
BOOL(WINAPI * wglChoosePixelFormatARB) (HDC hdc, BOOL(WINAPI * wglChoosePixelFormatARB) (HDC hdc,
const int *piAttribIList, const int *piAttribIList,
const FLOAT * pfAttribFList, const FLOAT * pfAttribFList,
UINT nMaxFormats, UINT nMaxFormats,
int *piFormats, int *piFormats,
UINT * nNumFormats); UINT * nNumFormats);
BOOL(WINAPI * wglGetPixelFormatAttribivARB) (HDC hdc, int iPixelFormat, BOOL(WINAPI * wglGetPixelFormatAttribivARB) (HDC hdc, int iPixelFormat,
int iLayerPlane, int iLayerPlane,
UINT nAttributes, UINT nAttributes,
const int *piAttributes, const int *piAttributes,
int *piValues); int *piValues);
BOOL (WINAPI * wglSwapIntervalEXT) (int interval); BOOL (WINAPI * wglSwapIntervalEXT) (int interval);
int (WINAPI * wglGetSwapIntervalEXT) (void); int (WINAPI * wglGetSwapIntervalEXT) (void);
}; };

View File

@ -40,7 +40,7 @@ int WIN_Vulkan_LoadLibrary(_THIS, const char *path)
{ {
VkExtensionProperties *extensions = NULL; VkExtensionProperties *extensions = NULL;
Uint32 extensionCount = 0; Uint32 extensionCount = 0;
Uint32 i; Uint32 i;
SDL_bool hasSurfaceExtension = SDL_FALSE; SDL_bool hasSurfaceExtension = SDL_FALSE;
SDL_bool hasWin32SurfaceExtension = SDL_FALSE; SDL_bool hasWin32SurfaceExtension = SDL_FALSE;
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;

View File

@ -38,14 +38,14 @@ struct SDL_GLDriverData
SDL_bool HAS_GLX_ARB_create_context_robustness; SDL_bool HAS_GLX_ARB_create_context_robustness;
SDL_bool HAS_GLX_ARB_create_context_no_error; SDL_bool HAS_GLX_ARB_create_context_no_error;
/* Max version of OpenGL ES context that can be created if the /* Max version of OpenGL ES context that can be created if the
implementation supports GLX_EXT_create_context_es2_profile. implementation supports GLX_EXT_create_context_es2_profile.
major = minor = 0 when unsupported. major = minor = 0 when unsupported.
*/ */
struct { struct {
int major; int major;
int minor; int minor;
} es_profile_max_supported_version; } es_profile_max_supported_version;
Bool (*glXQueryExtension) (Display*,int*,int*); Bool (*glXQueryExtension) (Display*,int*,int*);
void *(*glXGetProcAddress) (const GLubyte*); void *(*glXGetProcAddress) (const GLubyte*);

View File

@ -45,7 +45,7 @@ SDL_X11_SYM(Pixmap,XCreateBitmapFromData,(Display *dpy,Drawable d,_Xconst char *
SDL_X11_SYM(Colormap,XCreateColormap,(Display* a,Window b,Visual* c,int d),(a,b,c,d),return) SDL_X11_SYM(Colormap,XCreateColormap,(Display* a,Window b,Visual* c,int d),(a,b,c,d),return)
SDL_X11_SYM(Cursor,XCreatePixmapCursor,(Display* a,Pixmap b,Pixmap c,XColor* d,XColor* e,unsigned int f,unsigned int g),(a,b,c,d,e,f,g),return) SDL_X11_SYM(Cursor,XCreatePixmapCursor,(Display* a,Pixmap b,Pixmap c,XColor* d,XColor* e,unsigned int f,unsigned int g),(a,b,c,d,e,f,g),return)
SDL_X11_SYM(Cursor,XCreateFontCursor,(Display* a,unsigned int b),(a,b),return) SDL_X11_SYM(Cursor,XCreateFontCursor,(Display* a,unsigned int b),(a,b),return)
SDL_X11_SYM(XFontSet,XCreateFontSet,(Display* a, _Xconst char* b, char*** c, int* d, char** e),(a,b,c,d,e),return) SDL_X11_SYM(XFontSet,XCreateFontSet,(Display* a, _Xconst char* b, char*** c, int* d, char** e),(a,b,c,d,e),return)
SDL_X11_SYM(GC,XCreateGC,(Display* a,Drawable b,unsigned long c,XGCValues* d),(a,b,c,d),return) SDL_X11_SYM(GC,XCreateGC,(Display* a,Drawable b,unsigned long c,XGCValues* d),(a,b,c,d),return)
SDL_X11_SYM(XImage*,XCreateImage,(Display* a,Visual* b,unsigned int c,int d,int e,char* f,unsigned int g,unsigned int h,int i,int j),(a,b,c,d,e,f,g,h,i,j),return) SDL_X11_SYM(XImage*,XCreateImage,(Display* a,Visual* b,unsigned int c,int d,int e,char* f,unsigned int g,unsigned int h,int i,int j),(a,b,c,d,e,f,g,h,i,j),return)
SDL_X11_SYM(Window,XCreateWindow,(Display* a,Window b,int c,int d,unsigned int e,unsigned int f,unsigned int g,int h,unsigned int i,Visual* j,unsigned long k,XSetWindowAttributes* l),(a,b,c,d,e,f,g,h,i,j,k,l),return) SDL_X11_SYM(Window,XCreateWindow,(Display* a,Window b,int c,int d,unsigned int e,unsigned int f,unsigned int g,int h,unsigned int i,Visual* j,unsigned long k,XSetWindowAttributes* l),(a,b,c,d,e,f,g,h,i,j,k,l),return)
@ -201,7 +201,7 @@ SDL_X11_SYM(void,XUnsetICFocus,(XIC a),(a),)
SDL_X11_SYM(XIM,XOpenIM,(Display* a,struct _XrmHashBucketRec* b,char* c,char* d),(a,b,c,d),return) SDL_X11_SYM(XIM,XOpenIM,(Display* a,struct _XrmHashBucketRec* b,char* c,char* d),(a,b,c,d),return)
SDL_X11_SYM(Status,XCloseIM,(XIM a),(a),return) SDL_X11_SYM(Status,XCloseIM,(XIM a),(a),return)
SDL_X11_SYM(void,Xutf8DrawString,(Display *a, Drawable b, XFontSet c, GC d, int e, int f, _Xconst char *g, int h),(a,b,c,d,e,f,g,h),) SDL_X11_SYM(void,Xutf8DrawString,(Display *a, Drawable b, XFontSet c, GC d, int e, int f, _Xconst char *g, int h),(a,b,c,d,e,f,g,h),)
SDL_X11_SYM(int,Xutf8TextExtents,(XFontSet a, _Xconst char* b, int c, XRectangle* d, XRectangle* e),(a,b,c,d,e),return) SDL_X11_SYM(int,Xutf8TextExtents,(XFontSet a, _Xconst char* b, int c, XRectangle* d, XRectangle* e),(a,b,c,d,e),return)
SDL_X11_SYM(char*,XSetLocaleModifiers,(const char *a),(a),return) SDL_X11_SYM(char*,XSetLocaleModifiers,(const char *a),(a),return)
SDL_X11_SYM(char*,Xutf8ResetIC,(XIC a),(a),return) SDL_X11_SYM(char*,Xutf8ResetIC,(XIC a),(a),return)
#endif #endif