mirror of
https://github.com/Ryujinx/SDL.git
synced 2024-12-23 12:55:37 +00:00
Fixed whitespace
This commit is contained in:
parent
58021b3834
commit
5febdfcece
14
src/SDL.c
14
src/SDL.c
|
@ -124,11 +124,11 @@ SDL_InitSubSystem(Uint32 flags)
|
|||
}
|
||||
|
||||
#if SDL_VIDEO_DRIVER_WINDOWS
|
||||
if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) {
|
||||
if (SDL_HelperWindowCreate() < 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
if ((flags & (SDL_INIT_HAPTIC|SDL_INIT_JOYSTICK))) {
|
||||
if (SDL_HelperWindowCreate() < 0) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !SDL_TIMERS_DISABLED
|
||||
|
@ -263,8 +263,8 @@ SDL_QuitSubSystem(Uint32 flags)
|
|||
#if !SDL_SENSOR_DISABLED
|
||||
if ((flags & SDL_INIT_SENSOR)) {
|
||||
if (SDL_PrivateShouldQuitSubsystem(SDL_INIT_SENSOR)) {
|
||||
SDL_SensorQuit();
|
||||
}
|
||||
SDL_SensorQuit();
|
||||
}
|
||||
SDL_PrivateSubsystemRefCountDecr(SDL_INIT_SENSOR);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -445,7 +445,7 @@ static void
|
|||
ALSA_CloseDevice(_THIS)
|
||||
{
|
||||
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.
|
||||
*/
|
||||
Uint32 delay = ((this->spec.samples * 1000) / this->spec.freq) * 2;
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#include "SDL_name.h"
|
||||
#include "SDL_loadso.h"
|
||||
#else
|
||||
#define SDL_NAME(X) X
|
||||
#define SDL_NAME(X) X
|
||||
#endif
|
||||
|
||||
#ifdef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
|
||||
|
|
|
@ -477,8 +477,8 @@ DSOUND_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
|||
SDL_bool tried_format = SDL_FALSE;
|
||||
SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format);
|
||||
LPGUID guid = (LPGUID) handle;
|
||||
DWORD bufsize;
|
||||
|
||||
DWORD bufsize;
|
||||
|
||||
/* Initialize all variables that we clean on shutdown */
|
||||
this->hidden = (struct SDL_PrivateAudioData *)
|
||||
SDL_malloc((sizeof *this->hidden));
|
||||
|
@ -526,7 +526,7 @@ DSOUND_OpenDevice(_THIS, void *handle, const char *devname, int iscapture)
|
|||
(int) (DSBSIZE_MAX / numchunks));
|
||||
} else {
|
||||
int rc;
|
||||
WAVEFORMATEX wfmt;
|
||||
WAVEFORMATEX wfmt;
|
||||
SDL_zero(wfmt);
|
||||
if (SDL_AUDIO_ISFLOAT(this->spec.format)) {
|
||||
wfmt.wFormatTag = WAVE_FORMAT_IEEE_FLOAT;
|
||||
|
|
|
@ -109,7 +109,7 @@ static pa_operation * (*PULSEAUDIO_pa_stream_drain) (pa_stream *,
|
|||
pa_stream_success_cb_t, void *);
|
||||
static int (*PULSEAUDIO_pa_stream_peek) (pa_stream *, const void **, size_t *);
|
||||
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 *);
|
||||
static int (*PULSEAUDIO_pa_stream_disconnect) (pa_stream *);
|
||||
static void (*PULSEAUDIO_pa_stream_unref) (pa_stream *);
|
||||
|
|
|
@ -78,7 +78,7 @@ static void DetectWave##typ##Devs(void) { \
|
|||
capstyp##2W caps; \
|
||||
UINT 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); \
|
||||
if (name != NULL) { \
|
||||
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
|
||||
|
||||
/* Create the audio buffer semaphore */
|
||||
this->hidden->audio_sem =
|
||||
CreateSemaphore(NULL, iscapture ? 0 : NUM_BUFFERS - 1, NUM_BUFFERS, NULL);
|
||||
this->hidden->audio_sem = CreateSemaphore(NULL, iscapture ? 0 : NUM_BUFFERS - 1, NUM_BUFFERS, NULL);
|
||||
if (this->hidden->audio_sem == NULL) {
|
||||
return SDL_SetError("Couldn't create semaphore");
|
||||
}
|
||||
|
|
|
@ -77,7 +77,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)(
|
|||
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)(
|
||||
JNIEnv* env, jclass jcls,
|
||||
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)(
|
||||
JNIEnv* env, jclass jcls);
|
||||
|
@ -537,7 +537,7 @@ JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)(
|
|||
JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)(
|
||||
JNIEnv* env, jclass jcls,
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -39,9 +39,8 @@ typedef struct SDL_DBusContext {
|
|||
void (*bus_add_match)(DBusConnection *, const char *, DBusError *);
|
||||
DBusConnection * (*connection_open_private)(const char *, DBusError *);
|
||||
void (*connection_set_exit_on_disconnect)(DBusConnection *, dbus_bool_t);
|
||||
dbus_bool_t (*connection_get_is_connected)(DBusConnection *);
|
||||
dbus_bool_t (*connection_add_filter)(DBusConnection *, DBusHandleMessageFunction,
|
||||
void *, DBusFreeFunction);
|
||||
dbus_bool_t (*connection_get_is_connected)(DBusConnection *);
|
||||
dbus_bool_t (*connection_add_filter)(DBusConnection *, DBusHandleMessageFunction, void *, DBusFreeFunction);
|
||||
dbus_bool_t (*connection_try_register_object_path)(DBusConnection *, const char *,
|
||||
const DBusObjectPathVTable *, void *, DBusError *);
|
||||
dbus_bool_t (*connection_send)(DBusConnection *, DBusMessage *, dbus_uint32_t *);
|
||||
|
@ -51,7 +50,7 @@ typedef struct SDL_DBusContext {
|
|||
void (*connection_flush)(DBusConnection *);
|
||||
dbus_bool_t (*connection_read_write)(DBusConnection *, int);
|
||||
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 *);
|
||||
dbus_bool_t (*message_append_args)(DBusMessage *, int, ...);
|
||||
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 *);
|
||||
void (*message_iter_get_basic)(DBusMessageIter *, void *);
|
||||
int (*message_iter_get_arg_type)(DBusMessageIter *);
|
||||
void (*message_iter_recurse)(DBusMessageIter *, DBusMessageIter *);
|
||||
void (*message_iter_recurse)(DBusMessageIter *, DBusMessageIter *);
|
||||
void (*message_unref)(DBusMessage *);
|
||||
void (*error_init)(DBusError *);
|
||||
dbus_bool_t (*error_is_set)(const DBusError *);
|
||||
|
|
|
@ -77,9 +77,9 @@ typedef struct SDL_UDEV_PrivateData
|
|||
const char *(*udev_device_get_action)(struct udev_device *);
|
||||
const char *(*udev_device_get_devnode)(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_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 *);
|
||||
void (*udev_device_unref)(struct udev_device *);
|
||||
int (*udev_enumerate_add_match_property)(struct udev_enumerate *, const char *, const char *);
|
||||
|
|
|
@ -44,7 +44,7 @@ SDL_bool WINRT_XAMLWasEnabled = SDL_FALSE;
|
|||
#if WINAPI_FAMILY == WINAPI_FAMILY_APP
|
||||
extern "C"
|
||||
ISwapChainBackgroundPanelNative * WINRT_GlobalSwapChainBackgroundPanelNative = NULL;
|
||||
static Windows::Foundation::EventRegistrationToken WINRT_XAMLAppEventToken;
|
||||
static Windows::Foundation::EventRegistrationToken WINRT_XAMLAppEventToken;
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
@ -1027,7 +1027,7 @@ static ControllerMapping_t *SDL_PrivateGetControllerMappingForNameAndGUID(const
|
|||
}
|
||||
#ifdef __ANDROID__
|
||||
if (!mapping && name && !SDL_IsJoystickHIDAPI(guid)) {
|
||||
mapping = SDL_CreateMappingForAndroidController(name, guid);
|
||||
mapping = SDL_CreateMappingForAndroidController(name, guid);
|
||||
}
|
||||
#endif
|
||||
if (!mapping) {
|
||||
|
|
|
@ -1141,13 +1141,13 @@ SDL_IsJoystickSteamController(Uint16 vendor, Uint16 product)
|
|||
SDL_bool
|
||||
SDL_IsJoystickXbox360(Uint16 vendor, Uint16 product)
|
||||
{
|
||||
/* Filter out some bogus values here */
|
||||
if (vendor == 0x0000 && product == 0x0000) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
if (vendor == 0x0001 && product == 0x0001) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
/* Filter out some bogus values here */
|
||||
if (vendor == 0x0000 && product == 0x0000) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
if (vendor == 0x0001 && product == 0x0001) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
return (GuessControllerType(vendor, product) == k_eControllerType_XBox360Controller);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,9 +43,6 @@ typedef enum
|
|||
k_eControllerType_SteamController = 2,
|
||||
k_eControllerType_SteamControllerV2 = 3,
|
||||
|
||||
// IR Remote controls on Steambox
|
||||
k_eControllerType_FrontPanelBoard = 20,
|
||||
|
||||
// Other Controllers
|
||||
k_eControllerType_UnknownNonSteamController = 30,
|
||||
k_eControllerType_XBox360Controller = 31,
|
||||
|
@ -73,49 +70,6 @@ static inline bool BIsSteamController( EControllerType eType )
|
|||
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 )
|
||||
typedef struct
|
||||
{
|
||||
|
@ -168,7 +122,6 @@ static const ControllerDescription_t arrControllers[] = {
|
|||
{ 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( 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, 0x0009 ), k_eControllerType_PS3Controller }, // HORI BDA GP1
|
||||
{ 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, 0X0401 ), k_eControllerType_PS4Controller }, // Razer Panthera PS4 Controller
|
||||
{ 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, 0x0d02 ), k_eControllerType_PS4Controller }, // Nacon Revolution Pro Controller v2
|
||||
{ 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 - has gyro
|
||||
{ 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( 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( 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( 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( 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, 0x189c ), 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( 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( 0x1038, 0xb360 ), k_eControllerType_AppleController }, // SteelSeries Nimbus
|
||||
|
||||
// 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
|
||||
// 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, 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( 0x0f0d, 0x00c1 ), k_eControllerType_SwitchInputOnlyController }, // HORIPAD for Nintendo Switch
|
||||
{ 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
|
||||
{ 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, 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, 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, 0x1201 ), k_eControllerType_SteamController }, // Valve wired Steam Controller (HEADCRAB)
|
||||
{ MAKE_CONTROLLER_ID( 0x28de, 0x1202 ), k_eControllerType_SteamControllerV2 }, // Valve Bluetooth Steam Controller (HEADCRAB)
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ extern "C"
|
|||
|
||||
|
||||
/* The maximum number of joysticks we'll detect */
|
||||
#define MAX_JOYSTICKS 16
|
||||
#define MAX_JOYSTICKS 16
|
||||
|
||||
/* A list of available joysticks */
|
||||
static char *SDL_joyport[MAX_JOYSTICKS];
|
||||
|
|
|
@ -255,7 +255,7 @@ SDL_JoystickThread(void *_data)
|
|||
/* WM_DEVICECHANGE not working, no XINPUT, no point in keeping thread alive */
|
||||
break;
|
||||
#endif /* SDL_JOYSTICK_XINPUT */
|
||||
}
|
||||
}
|
||||
|
||||
if (s_bWindowsDeviceChanged || bXInputChanged) {
|
||||
s_bDeviceRemoved = SDL_TRUE;
|
||||
|
|
|
@ -198,7 +198,7 @@ public:
|
|||
_current_context->UnlockGL();
|
||||
_current_context = newContext;
|
||||
if (_current_context)
|
||||
_current_context->LockGL();
|
||||
_current_context->LockGL();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#include <storage/File.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_timer.h"
|
||||
#include "SDL_error.h"
|
||||
|
@ -53,24 +53,24 @@ StartBeApp(void *unused)
|
|||
{
|
||||
BApplication *App;
|
||||
|
||||
// default application signature
|
||||
const char *signature = "application/x-SDL-executable";
|
||||
// dig resources for correct signature
|
||||
image_info info;
|
||||
int32 cookie = 0;
|
||||
if (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
|
||||
BFile f(info.name, O_RDONLY);
|
||||
if (f.InitCheck() == B_OK) {
|
||||
BAppFileInfo app_info(&f);
|
||||
if (app_info.InitCheck() == B_OK) {
|
||||
char sig[B_MIME_TYPE_LENGTH];
|
||||
if (app_info.GetSignature(sig) == B_OK)
|
||||
signature = strndup(sig, B_MIME_TYPE_LENGTH);
|
||||
}
|
||||
}
|
||||
}
|
||||
// default application signature
|
||||
const char *signature = "application/x-SDL-executable";
|
||||
// dig resources for correct signature
|
||||
image_info info;
|
||||
int32 cookie = 0;
|
||||
if (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) {
|
||||
BFile f(info.name, O_RDONLY);
|
||||
if (f.InitCheck() == B_OK) {
|
||||
BAppFileInfo app_info(&f);
|
||||
if (app_info.InitCheck() == B_OK) {
|
||||
char sig[B_MIME_TYPE_LENGTH];
|
||||
if (app_info.GetSignature(sig) == B_OK)
|
||||
signature = strndup(sig, B_MIME_TYPE_LENGTH);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
App = new SDL_BApp(signature);
|
||||
App = new SDL_BApp(signature);
|
||||
|
||||
App->Run();
|
||||
delete App;
|
||||
|
@ -144,12 +144,12 @@ SDL_QuitBeApp(void)
|
|||
|
||||
/* SDL_BApp functions */
|
||||
void SDL_BApp::ClearID(SDL_BWin *bwin) {
|
||||
_SetSDLWindow(NULL, bwin->GetID());
|
||||
int32 i = _GetNumWindowSlots() - 1;
|
||||
while(i >= 0 && GetSDLWindow(i) == NULL) {
|
||||
_PopBackWindow();
|
||||
--i;
|
||||
}
|
||||
_SetSDLWindow(NULL, bwin->GetID());
|
||||
int32 i = _GetNumWindowSlots() - 1;
|
||||
while(i >= 0 && GetSDLWindow(i) == NULL) {
|
||||
_PopBackWindow();
|
||||
--i;
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* __HAIKU__ */
|
||||
|
|
|
@ -89,13 +89,13 @@ SDL_iconv(SDL_iconv_t cd,
|
|||
#else
|
||||
|
||||
/* 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_UNICODE 0xFFFD
|
||||
#define UNKNOWN_ASCII '?'
|
||||
#define UNKNOWN_UNICODE 0xFFFD
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -115,13 +115,13 @@ enum
|
|||
ENCODING_UCS4LE,
|
||||
};
|
||||
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
|
||||
#define ENCODING_UTF16NATIVE ENCODING_UTF16BE
|
||||
#define ENCODING_UTF32NATIVE ENCODING_UTF32BE
|
||||
#define ENCODING_UTF16NATIVE ENCODING_UTF16BE
|
||||
#define ENCODING_UTF32NATIVE ENCODING_UTF32BE
|
||||
#define ENCODING_UCS2NATIVE ENCODING_UCS2BE
|
||||
#define ENCODING_UCS4NATIVE ENCODING_UCS4BE
|
||||
#else
|
||||
#define ENCODING_UTF16NATIVE ENCODING_UTF16LE
|
||||
#define ENCODING_UTF32NATIVE ENCODING_UTF32LE
|
||||
#define ENCODING_UTF16NATIVE ENCODING_UTF16LE
|
||||
#define ENCODING_UTF32NATIVE ENCODING_UTF32LE
|
||||
#define ENCODING_UCS2NATIVE ENCODING_UCS2LE
|
||||
#define ENCODING_UCS4NATIVE ENCODING_UCS4LE
|
||||
#endif
|
||||
|
|
|
@ -49,13 +49,13 @@ Blit1to1(SDL_BlitInfo * info)
|
|||
while (height--) {
|
||||
#ifdef USE_DUFFS_LOOP
|
||||
/* *INDENT-OFF* */
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
*dst = map[*src];
|
||||
}
|
||||
dst++;
|
||||
src++;
|
||||
, width);
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
*dst = map[*src];
|
||||
}
|
||||
dst++;
|
||||
src++;
|
||||
, width);
|
||||
/* *INDENT-ON* */
|
||||
#else
|
||||
for (c = width; c; --c) {
|
||||
|
@ -72,11 +72,11 @@ Blit1to1(SDL_BlitInfo * info)
|
|||
/* This is now endian dependent */
|
||||
#ifndef USE_DUFFS_LOOP
|
||||
# if ( SDL_BYTEORDER == SDL_LIL_ENDIAN )
|
||||
# define HI 1
|
||||
# define LO 0
|
||||
# define HI 1
|
||||
# define LO 0
|
||||
# else /* ( SDL_BYTEORDER == SDL_BIG_ENDIAN ) */
|
||||
# define HI 0
|
||||
# define LO 1
|
||||
# define HI 0
|
||||
# define LO 1
|
||||
# endif
|
||||
#endif
|
||||
static void
|
||||
|
@ -101,14 +101,14 @@ Blit1to2(SDL_BlitInfo * info)
|
|||
|
||||
#ifdef USE_DUFFS_LOOP
|
||||
while (height--) {
|
||||
/* *INDENT-OFF* */
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
*(Uint16 *)dst = map[*src++];
|
||||
dst += 2;
|
||||
},
|
||||
width);
|
||||
/* *INDENT-ON* */
|
||||
/* *INDENT-OFF* */
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
*(Uint16 *)dst = map[*src++];
|
||||
dst += 2;
|
||||
},
|
||||
width);
|
||||
/* *INDENT-ON* */
|
||||
src += srcskip;
|
||||
dst += dstskip;
|
||||
}
|
||||
|
@ -208,18 +208,18 @@ Blit1to3(SDL_BlitInfo * info)
|
|||
|
||||
while (height--) {
|
||||
#ifdef USE_DUFFS_LOOP
|
||||
/* *INDENT-OFF* */
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
o = *src * 4;
|
||||
dst[0] = map[o++];
|
||||
dst[1] = map[o++];
|
||||
dst[2] = map[o++];
|
||||
}
|
||||
src++;
|
||||
dst += 3;
|
||||
, width);
|
||||
/* *INDENT-ON* */
|
||||
/* *INDENT-OFF* */
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
o = *src * 4;
|
||||
dst[0] = map[o++];
|
||||
dst[1] = map[o++];
|
||||
dst[2] = map[o++];
|
||||
}
|
||||
src++;
|
||||
dst += 3;
|
||||
, width);
|
||||
/* *INDENT-ON* */
|
||||
#else
|
||||
for (c = width; c; --c) {
|
||||
o = *src * 4;
|
||||
|
@ -257,11 +257,11 @@ Blit1to4(SDL_BlitInfo * info)
|
|||
|
||||
while (height--) {
|
||||
#ifdef USE_DUFFS_LOOP
|
||||
/* *INDENT-OFF* */
|
||||
DUFFS_LOOP(
|
||||
*dst++ = map[*src++];
|
||||
, width);
|
||||
/* *INDENT-ON* */
|
||||
/* *INDENT-OFF* */
|
||||
DUFFS_LOOP(
|
||||
*dst++ = map[*src++];
|
||||
, width);
|
||||
/* *INDENT-ON* */
|
||||
#else
|
||||
for (c = width / 4; c; --c) {
|
||||
*dst++ = map[*src++];
|
||||
|
@ -297,33 +297,33 @@ Blit1to1Key(SDL_BlitInfo * info)
|
|||
|
||||
if (palmap) {
|
||||
while (height--) {
|
||||
/* *INDENT-OFF* */
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
if ( *src != ckey ) {
|
||||
*dst = palmap[*src];
|
||||
}
|
||||
dst++;
|
||||
src++;
|
||||
},
|
||||
width);
|
||||
/* *INDENT-ON* */
|
||||
/* *INDENT-OFF* */
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
if ( *src != ckey ) {
|
||||
*dst = palmap[*src];
|
||||
}
|
||||
dst++;
|
||||
src++;
|
||||
},
|
||||
width);
|
||||
/* *INDENT-ON* */
|
||||
src += srcskip;
|
||||
dst += dstskip;
|
||||
}
|
||||
} else {
|
||||
while (height--) {
|
||||
/* *INDENT-OFF* */
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
if ( *src != ckey ) {
|
||||
*dst = *src;
|
||||
}
|
||||
dst++;
|
||||
src++;
|
||||
},
|
||||
width);
|
||||
/* *INDENT-ON* */
|
||||
/* *INDENT-OFF* */
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
if ( *src != ckey ) {
|
||||
*dst = *src;
|
||||
}
|
||||
dst++;
|
||||
src++;
|
||||
},
|
||||
width);
|
||||
/* *INDENT-ON* */
|
||||
src += srcskip;
|
||||
dst += dstskip;
|
||||
}
|
||||
|
@ -346,17 +346,17 @@ Blit1to2Key(SDL_BlitInfo * info)
|
|||
dstskip /= 2;
|
||||
|
||||
while (height--) {
|
||||
/* *INDENT-OFF* */
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
if ( *src != ckey ) {
|
||||
*dstp=palmap[*src];
|
||||
}
|
||||
src++;
|
||||
dstp++;
|
||||
},
|
||||
width);
|
||||
/* *INDENT-ON* */
|
||||
/* *INDENT-OFF* */
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
if ( *src != ckey ) {
|
||||
*dstp=palmap[*src];
|
||||
}
|
||||
src++;
|
||||
dstp++;
|
||||
},
|
||||
width);
|
||||
/* *INDENT-ON* */
|
||||
src += srcskip;
|
||||
dstp += dstskip;
|
||||
}
|
||||
|
@ -376,20 +376,20 @@ Blit1to3Key(SDL_BlitInfo * info)
|
|||
int o;
|
||||
|
||||
while (height--) {
|
||||
/* *INDENT-OFF* */
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
if ( *src != ckey ) {
|
||||
o = *src * 4;
|
||||
dst[0] = palmap[o++];
|
||||
dst[1] = palmap[o++];
|
||||
dst[2] = palmap[o++];
|
||||
}
|
||||
src++;
|
||||
dst += 3;
|
||||
},
|
||||
width);
|
||||
/* *INDENT-ON* */
|
||||
/* *INDENT-OFF* */
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
if ( *src != ckey ) {
|
||||
o = *src * 4;
|
||||
dst[0] = palmap[o++];
|
||||
dst[1] = palmap[o++];
|
||||
dst[2] = palmap[o++];
|
||||
}
|
||||
src++;
|
||||
dst += 3;
|
||||
},
|
||||
width);
|
||||
/* *INDENT-ON* */
|
||||
src += srcskip;
|
||||
dst += dstskip;
|
||||
}
|
||||
|
@ -411,17 +411,17 @@ Blit1to4Key(SDL_BlitInfo * info)
|
|||
dstskip /= 4;
|
||||
|
||||
while (height--) {
|
||||
/* *INDENT-OFF* */
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
if ( *src != ckey ) {
|
||||
*dstp = palmap[*src];
|
||||
}
|
||||
src++;
|
||||
dstp++;
|
||||
},
|
||||
width);
|
||||
/* *INDENT-ON* */
|
||||
/* *INDENT-OFF* */
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
if ( *src != ckey ) {
|
||||
*dstp = palmap[*src];
|
||||
}
|
||||
src++;
|
||||
dstp++;
|
||||
},
|
||||
width);
|
||||
/* *INDENT-ON* */
|
||||
src += srcskip;
|
||||
dstp += dstskip;
|
||||
}
|
||||
|
@ -489,22 +489,22 @@ Blit1toNAlphaKey(SDL_BlitInfo * info)
|
|||
dstbpp = dstfmt->BytesPerPixel;
|
||||
|
||||
while (height--) {
|
||||
/* *INDENT-OFF* */
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
if ( *src != ckey ) {
|
||||
sR = srcpal[*src].r;
|
||||
sG = srcpal[*src].g;
|
||||
sB = srcpal[*src].b;
|
||||
DISEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA);
|
||||
ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA);
|
||||
ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
|
||||
}
|
||||
src++;
|
||||
dst += dstbpp;
|
||||
},
|
||||
width);
|
||||
/* *INDENT-ON* */
|
||||
/* *INDENT-OFF* */
|
||||
DUFFS_LOOP(
|
||||
{
|
||||
if ( *src != ckey ) {
|
||||
sR = srcpal[*src].r;
|
||||
sG = srcpal[*src].g;
|
||||
sB = srcpal[*src].b;
|
||||
DISEMBLE_RGBA(dst, dstbpp, dstfmt, pixel, dR, dG, dB, dA);
|
||||
ALPHA_BLEND_RGBA(sR, sG, sB, A, dR, dG, dB, dA);
|
||||
ASSEMBLE_RGBA(dst, dstbpp, dstfmt, dR, dG, dB, dA);
|
||||
}
|
||||
src++;
|
||||
dst += dstbpp;
|
||||
},
|
||||
width);
|
||||
/* *INDENT-ON* */
|
||||
src += srcskip;
|
||||
dst += dstskip;
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -836,7 +836,7 @@ SDL_EGL_CreateSurface(_THIS, NativeWindowType nw)
|
|||
/* max 2 values plus terminator. */
|
||||
EGLint attribs[3];
|
||||
int attr = 0;
|
||||
|
||||
|
||||
EGLSurface * surface;
|
||||
|
||||
if (SDL_EGL_ChooseConfig(_this) != 0) {
|
||||
|
@ -868,7 +868,7 @@ SDL_EGL_CreateSurface(_THIS, NativeWindowType nw)
|
|||
return EGL_NO_SURFACE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
attribs[attr++] = EGL_NONE;
|
||||
|
||||
surface = _this->egl_data->eglCreateWindowSurface(
|
||||
|
|
|
@ -326,7 +326,7 @@ SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask,
|
|||
if (Rmask == 0) {
|
||||
return SDL_PIXELFORMAT_RGB555;
|
||||
}
|
||||
/* fallthrough */
|
||||
/* fallthrough */
|
||||
case 16:
|
||||
if (Rmask == 0) {
|
||||
return SDL_PIXELFORMAT_RGB565;
|
||||
|
|
|
@ -36,21 +36,21 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
typedef struct {
|
||||
struct SDL_ShapeTree *upleft,*upright,*downleft,*downright;
|
||||
struct SDL_ShapeTree *upleft,*upright,*downleft,*downright;
|
||||
} SDL_QuadTreeChildren;
|
||||
|
||||
typedef union {
|
||||
SDL_QuadTreeChildren children;
|
||||
SDL_Rect shape;
|
||||
SDL_QuadTreeChildren children;
|
||||
SDL_Rect shape;
|
||||
} SDL_ShapeUnion;
|
||||
|
||||
typedef enum { QuadShape,TransparentShape,OpaqueShape } SDL_ShapeKind;
|
||||
|
||||
typedef struct {
|
||||
SDL_ShapeKind kind;
|
||||
SDL_ShapeUnion data;
|
||||
SDL_ShapeKind kind;
|
||||
SDL_ShapeUnion data;
|
||||
} SDL_ShapeTree;
|
||||
|
||||
|
||||
typedef void(*SDL_TraversalFunction)(SDL_ShapeTree*,void*);
|
||||
|
||||
extern void SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitmap,Uint8 ppb);
|
||||
|
|
|
@ -1540,11 +1540,12 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
// 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!
|
||||
/* 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!
|
||||
*/
|
||||
#if !defined(__WIN32__)
|
||||
if (window->flags & SDL_WINDOW_MINIMIZED) {
|
||||
window->flags &= ~SDL_WINDOW_MINIMIZED;
|
||||
if (window->flags & SDL_WINDOW_MINIMIZED) {
|
||||
window->flags &= ~SDL_WINDOW_MINIMIZED;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -123,10 +123,10 @@ VkExtensionProperties *SDL_Vulkan_CreateInstanceExtensionsList(
|
|||
{
|
||||
retval = SDL_calloc(1, sizeof(VkExtensionProperties)); // so we can return non-null
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = SDL_calloc(count, sizeof(VkExtensionProperties));
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = SDL_calloc(count, sizeof(VkExtensionProperties));
|
||||
}
|
||||
if(!retval)
|
||||
{
|
||||
SDL_OutOfMemory();
|
||||
|
|
|
@ -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,
|
||||
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 };
|
||||
int pitches[3] = { 0, 0, 0 };
|
||||
const Uint8 *planes[3] = { NULL, NULL, NULL };
|
||||
int pitches[3] = { 0, 0, 0 };
|
||||
|
||||
switch (format) {
|
||||
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(
|
||||
Uint32 src_format, Uint32 dst_format,
|
||||
Uint32 width, Uint32 height,
|
||||
const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride,
|
||||
Uint8 *rgb, Uint32 rgb_stride,
|
||||
YCbCrType yuv_type)
|
||||
Uint32 width, Uint32 height,
|
||||
const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride,
|
||||
Uint8 *rgb, Uint32 rgb_stride,
|
||||
YCbCrType yuv_type)
|
||||
{
|
||||
#ifdef __SSE2__
|
||||
if (!SDL_HasSSE2()) {
|
||||
|
@ -289,10 +289,10 @@ static SDL_bool yuv_rgb_sse(
|
|||
|
||||
static SDL_bool yuv_rgb_std(
|
||||
Uint32 src_format, Uint32 dst_format,
|
||||
Uint32 width, Uint32 height,
|
||||
const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride,
|
||||
Uint8 *rgb, Uint32 rgb_stride,
|
||||
YCbCrType yuv_type)
|
||||
Uint32 width, Uint32 height,
|
||||
const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride,
|
||||
Uint8 *rgb, Uint32 rgb_stride,
|
||||
YCbCrType yuv_type)
|
||||
{
|
||||
if (src_format == SDL_PIXELFORMAT_YV12 ||
|
||||
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 dst_format, void *dst, int dst_pitch)
|
||||
{
|
||||
const Uint8 *y = NULL;
|
||||
const Uint8 *y = NULL;
|
||||
const Uint8 *u = NULL;
|
||||
const Uint8 *v = NULL;
|
||||
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;
|
||||
|
||||
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);
|
||||
plane_interleaved_uv = (plane_y + height * y_stride);
|
||||
y_skip = (y_stride - width);
|
||||
|
|
|
@ -214,12 +214,12 @@ Android_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * h
|
|||
void
|
||||
Android_SetScreenResolution(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, Uint32 format, float rate)
|
||||
{
|
||||
SDL_VideoDevice* device;
|
||||
SDL_VideoDisplay *display;
|
||||
SDL_VideoDevice* device;
|
||||
SDL_VideoDisplay *display;
|
||||
Android_SurfaceWidth = surfaceWidth;
|
||||
Android_SurfaceHeight = surfaceHeight;
|
||||
Android_DeviceWidth = deviceWidth;
|
||||
Android_DeviceHeight = deviceHeight;
|
||||
Android_DeviceWidth = deviceWidth;
|
||||
Android_DeviceHeight = deviceHeight;
|
||||
Android_ScreenFormat = format;
|
||||
Android_ScreenRate = rate;
|
||||
|
||||
|
|
|
@ -390,8 +390,8 @@ Cocoa_RegisterApp(void)
|
|||
|
||||
if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, SDL_FALSE)) {
|
||||
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ([NSApp mainMenu] == nil) {
|
||||
CreateApplicationMenus();
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
/* Return a Metal-compatible layer. */
|
||||
+ (Class)layerClass
|
||||
{
|
||||
return NSClassFromString(@"CAMetalLayer");
|
||||
return NSClassFromString(@"CAMetalLayer");
|
||||
}
|
||||
|
||||
/* Indicate the view wants to draw using a backing layer instead of drawRect. */
|
||||
|
@ -59,7 +59,7 @@
|
|||
- (instancetype)initWithFrame:(NSRect)frame
|
||||
scale:(CGFloat)scale
|
||||
{
|
||||
if ((self = [super initWithFrame:frame])) {
|
||||
if ((self = [super initWithFrame:frame])) {
|
||||
_tag = METALVIEW_TAG;
|
||||
self.wantsLayer = YES;
|
||||
|
||||
|
@ -71,7 +71,7 @@
|
|||
self.layer.contentsScale = scale;
|
||||
}
|
||||
|
||||
return self;
|
||||
return self;
|
||||
}
|
||||
|
||||
/* Set the size of the metal drawables when the view is resized. */
|
||||
|
|
|
@ -211,7 +211,7 @@ Cocoa_InitMouseEventTap(SDL_MouseData* driverdata)
|
|||
tapdata->thread = SDL_CreateThreadInternal(&Cocoa_MouseTapThread, "Event Tap Loop", 512 * 1024, tapdata);
|
||||
if (tapdata->thread) {
|
||||
/* Success - early out. Ownership transferred to thread. */
|
||||
return;
|
||||
return;
|
||||
}
|
||||
CFRelease(tapdata->tap);
|
||||
}
|
||||
|
|
|
@ -241,7 +241,7 @@ ScheduleContextUpdates(SDL_WindowData *data)
|
|||
static int
|
||||
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
|
||||
|
@ -908,7 +908,7 @@ SetWindowStyle(SDL_Window * window, NSUInteger style)
|
|||
switch ([theEvent buttonNumber]) {
|
||||
case 0:
|
||||
if (([theEvent modifierFlags] & NSEventModifierFlagControl) &&
|
||||
GetHintCtrlClickEmulateRightClick()) {
|
||||
GetHintCtrlClickEmulateRightClick()) {
|
||||
wasCtrlLeft = YES;
|
||||
button = SDL_BUTTON_RIGHT;
|
||||
} else {
|
||||
|
|
|
@ -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_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_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)
|
||||
{ DSPF_LUT8, SDL_PIXELFORMAT_INDEX8 }, /* 8 bit LUT (8 bit color and alpha lookup from palette) */
|
||||
#endif
|
||||
|
|
|
@ -538,7 +538,7 @@ private:
|
|||
msg.AddInt32("key-state", keyState);
|
||||
msg.AddInt32("key-scancode", keyCode);
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -36,54 +36,54 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
int HAIKU_SetClipboardText(_THIS, const char *text) {
|
||||
BMessage *clip = NULL;
|
||||
if(be_clipboard->Lock()) {
|
||||
be_clipboard->Clear();
|
||||
if((clip = be_clipboard->Data())) {
|
||||
/* Presumably the string of characters is ascii-format */
|
||||
ssize_t asciiLength = 0;
|
||||
for(; text[asciiLength] != 0; ++asciiLength) {}
|
||||
clip->AddData("text/plain", B_MIME_TYPE, text, asciiLength);
|
||||
be_clipboard->Commit();
|
||||
}
|
||||
be_clipboard->Unlock();
|
||||
}
|
||||
return 0;
|
||||
BMessage *clip = NULL;
|
||||
if(be_clipboard->Lock()) {
|
||||
be_clipboard->Clear();
|
||||
if((clip = be_clipboard->Data())) {
|
||||
/* Presumably the string of characters is ascii-format */
|
||||
ssize_t asciiLength = 0;
|
||||
for(; text[asciiLength] != 0; ++asciiLength) {}
|
||||
clip->AddData("text/plain", B_MIME_TYPE, text, asciiLength);
|
||||
be_clipboard->Commit();
|
||||
}
|
||||
be_clipboard->Unlock();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *HAIKU_GetClipboardText(_THIS) {
|
||||
BMessage *clip = NULL;
|
||||
const char *text = NULL;
|
||||
ssize_t length;
|
||||
char *result;
|
||||
if(be_clipboard->Lock()) {
|
||||
if((clip = be_clipboard->Data())) {
|
||||
/* Presumably the string of characters is ascii-format */
|
||||
clip->FindData("text/plain", B_MIME_TYPE, (const void**)&text,
|
||||
&length);
|
||||
}
|
||||
be_clipboard->Unlock();
|
||||
}
|
||||
|
||||
if (!text) {
|
||||
result = SDL_strdup("");
|
||||
} else {
|
||||
/* Copy the data and pass on to SDL */
|
||||
result = (char *)SDL_malloc((length + 1) * sizeof(char));
|
||||
SDL_strlcpy(result, text, length + 1);
|
||||
}
|
||||
|
||||
return result;
|
||||
BMessage *clip = NULL;
|
||||
const char *text = NULL;
|
||||
ssize_t length;
|
||||
char *result;
|
||||
if(be_clipboard->Lock()) {
|
||||
if((clip = be_clipboard->Data())) {
|
||||
/* Presumably the string of characters is ascii-format */
|
||||
clip->FindData("text/plain", B_MIME_TYPE, (const void**)&text,
|
||||
&length);
|
||||
}
|
||||
be_clipboard->Unlock();
|
||||
}
|
||||
|
||||
if (!text) {
|
||||
result = SDL_strdup("");
|
||||
} else {
|
||||
/* Copy the data and pass on to SDL */
|
||||
result = (char *)SDL_malloc((length + 1) * sizeof(char));
|
||||
SDL_strlcpy(result, text, length + 1);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
SDL_bool HAIKU_HasClipboardText(_THIS) {
|
||||
SDL_bool result = SDL_FALSE;
|
||||
char *text = HAIKU_GetClipboardText(_this);
|
||||
if (text) {
|
||||
result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE;
|
||||
SDL_free(text);
|
||||
}
|
||||
return result;
|
||||
SDL_bool result = SDL_FALSE;
|
||||
char *text = HAIKU_GetClipboardText(_this);
|
||||
if (text) {
|
||||
result = text[0] != '\0' ? SDL_TRUE : SDL_FALSE;
|
||||
SDL_free(text);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -29,7 +29,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
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
|
||||
|
|
|
@ -40,158 +40,158 @@ static int32 HAIKU_UpdateOnce(SDL_Window *window);
|
|||
#endif
|
||||
|
||||
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() {
|
||||
return ((SDL_BApp*)be_app);
|
||||
return ((SDL_BApp*)be_app);
|
||||
}
|
||||
|
||||
int HAIKU_CreateWindowFramebuffer(_THIS, SDL_Window * window,
|
||||
Uint32 * format,
|
||||
void ** pixels, int *pitch) {
|
||||
SDL_BWin *bwin = _ToBeWin(window);
|
||||
BScreen bscreen;
|
||||
if(!bscreen.IsValid()) {
|
||||
return -1;
|
||||
}
|
||||
SDL_BWin *bwin = _ToBeWin(window);
|
||||
BScreen bscreen;
|
||||
if(!bscreen.IsValid()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
while(!bwin->Connected()) { snooze(100); }
|
||||
|
||||
/* Make sure we have exclusive access to frame buffer data */
|
||||
bwin->LockBuffer();
|
||||
while(!bwin->Connected()) { snooze(100); }
|
||||
|
||||
/* Make sure we have exclusive access to frame buffer data */
|
||||
bwin->LockBuffer();
|
||||
|
||||
/* format */
|
||||
display_mode bmode;
|
||||
bscreen.GetMode(&bmode);
|
||||
int32 bpp = HAIKU_ColorSpaceToBitsPerPixel(bmode.space);
|
||||
*format = HAIKU_BPPToSDLPxFormat(bpp);
|
||||
/* format */
|
||||
display_mode bmode;
|
||||
bscreen.GetMode(&bmode);
|
||||
int32 bpp = HAIKU_ColorSpaceToBitsPerPixel(bmode.space);
|
||||
*format = HAIKU_BPPToSDLPxFormat(bpp);
|
||||
|
||||
/* Create the new bitmap object */
|
||||
BBitmap *bitmap = bwin->GetBitmap();
|
||||
/* Create the new bitmap object */
|
||||
BBitmap *bitmap = bwin->GetBitmap();
|
||||
|
||||
if(bitmap) {
|
||||
delete bitmap;
|
||||
}
|
||||
bitmap = new BBitmap(bwin->Bounds(), (color_space)bmode.space,
|
||||
false, /* Views not accepted */
|
||||
true); /* Contiguous memory required */
|
||||
|
||||
if(bitmap->InitCheck() != B_OK) {
|
||||
delete bitmap;
|
||||
return SDL_SetError("Could not initialize back buffer!");
|
||||
}
|
||||
if(bitmap) {
|
||||
delete bitmap;
|
||||
}
|
||||
bitmap = new BBitmap(bwin->Bounds(), (color_space)bmode.space,
|
||||
false, /* Views not accepted */
|
||||
true); /* Contiguous memory required */
|
||||
|
||||
if(bitmap->InitCheck() != B_OK) {
|
||||
delete bitmap;
|
||||
return SDL_SetError("Could not initialize back buffer!");
|
||||
}
|
||||
|
||||
|
||||
bwin->SetBitmap(bitmap);
|
||||
|
||||
/* Set the pixel pointer */
|
||||
*pixels = bitmap->Bits();
|
||||
bwin->SetBitmap(bitmap);
|
||||
|
||||
/* Set the pixel pointer */
|
||||
*pixels = bitmap->Bits();
|
||||
|
||||
/* pitch = width of window, in bytes */
|
||||
*pitch = bitmap->BytesPerRow();
|
||||
/* pitch = width of window, in bytes */
|
||||
*pitch = bitmap->BytesPerRow();
|
||||
|
||||
bwin->SetBufferExists(true);
|
||||
bwin->SetTrashBuffer(false);
|
||||
bwin->UnlockBuffer();
|
||||
return 0;
|
||||
bwin->SetBufferExists(true);
|
||||
bwin->SetTrashBuffer(false);
|
||||
bwin->UnlockBuffer();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int HAIKU_UpdateWindowFramebuffer(_THIS, SDL_Window * window,
|
||||
const SDL_Rect * rects, int numrects) {
|
||||
if(!window)
|
||||
return 0;
|
||||
if(!window)
|
||||
return 0;
|
||||
|
||||
SDL_BWin *bwin = _ToBeWin(window);
|
||||
SDL_BWin *bwin = _ToBeWin(window);
|
||||
|
||||
#ifdef DRAWTHREAD
|
||||
bwin->LockBuffer();
|
||||
bwin->SetBufferDirty(true);
|
||||
bwin->UnlockBuffer();
|
||||
#ifdef DRAWTHREAD
|
||||
bwin->LockBuffer();
|
||||
bwin->SetBufferDirty(true);
|
||||
bwin->UnlockBuffer();
|
||||
#else
|
||||
bwin->SetBufferDirty(true);
|
||||
HAIKU_UpdateOnce(window);
|
||||
bwin->SetBufferDirty(true);
|
||||
HAIKU_UpdateOnce(window);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32 HAIKU_DrawThread(void *data) {
|
||||
SDL_BWin *bwin = (SDL_BWin*)data;
|
||||
|
||||
BScreen bscreen;
|
||||
if(!bscreen.IsValid()) {
|
||||
return -1;
|
||||
}
|
||||
SDL_BWin *bwin = (SDL_BWin*)data;
|
||||
|
||||
BScreen bscreen;
|
||||
if(!bscreen.IsValid()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
while(bwin->ConnectionEnabled()) {
|
||||
if( bwin->Connected() && bwin->BufferExists() && bwin->BufferIsDirty() ) {
|
||||
bwin->LockBuffer();
|
||||
BBitmap *bitmap = NULL;
|
||||
bitmap = bwin->GetBitmap();
|
||||
int32 windowPitch = bitmap->BytesPerRow();
|
||||
int32 bufferPitch = bwin->GetRowBytes();
|
||||
uint8 *windowpx;
|
||||
uint8 *bufferpx;
|
||||
while(bwin->ConnectionEnabled()) {
|
||||
if( bwin->Connected() && bwin->BufferExists() && bwin->BufferIsDirty() ) {
|
||||
bwin->LockBuffer();
|
||||
BBitmap *bitmap = NULL;
|
||||
bitmap = bwin->GetBitmap();
|
||||
int32 windowPitch = bitmap->BytesPerRow();
|
||||
int32 bufferPitch = bwin->GetRowBytes();
|
||||
uint8 *windowpx;
|
||||
uint8 *bufferpx;
|
||||
|
||||
int32 BPP = bwin->GetBytesPerPx();
|
||||
int32 windowSub = bwin->GetFbX() * BPP +
|
||||
bwin->GetFbY() * windowPitch;
|
||||
clipping_rect *clips = bwin->GetClips();
|
||||
int32 numClips = bwin->GetNumClips();
|
||||
int i, y;
|
||||
int32 BPP = bwin->GetBytesPerPx();
|
||||
int32 windowSub = bwin->GetFbX() * BPP +
|
||||
bwin->GetFbY() * windowPitch;
|
||||
clipping_rect *clips = bwin->GetClips();
|
||||
int32 numClips = bwin->GetNumClips();
|
||||
int i, y;
|
||||
|
||||
/* Blit each clipping rectangle */
|
||||
bscreen.WaitForRetrace();
|
||||
for(i = 0; i < numClips; ++i) {
|
||||
/* Get addresses of the start of each clipping rectangle */
|
||||
int32 width = clips[i].right - clips[i].left + 1;
|
||||
int32 height = clips[i].bottom - clips[i].top + 1;
|
||||
bufferpx = bwin->GetBufferPx() +
|
||||
clips[i].top * bufferPitch + clips[i].left * BPP;
|
||||
windowpx = (uint8*)bitmap->Bits() +
|
||||
clips[i].top * windowPitch + clips[i].left * BPP -
|
||||
windowSub;
|
||||
/* Blit each clipping rectangle */
|
||||
bscreen.WaitForRetrace();
|
||||
for(i = 0; i < numClips; ++i) {
|
||||
/* Get addresses of the start of each clipping rectangle */
|
||||
int32 width = clips[i].right - clips[i].left + 1;
|
||||
int32 height = clips[i].bottom - clips[i].top + 1;
|
||||
bufferpx = bwin->GetBufferPx() +
|
||||
clips[i].top * bufferPitch + clips[i].left * BPP;
|
||||
windowpx = (uint8*)bitmap->Bits() +
|
||||
clips[i].top * windowPitch + clips[i].left * BPP -
|
||||
windowSub;
|
||||
|
||||
/* Copy each row of pixels from the window buffer into the frame
|
||||
buffer */
|
||||
for(y = 0; y < height; ++y)
|
||||
{
|
||||
/* Copy each row of pixels from the window buffer into the frame
|
||||
buffer */
|
||||
for(y = 0; y < height; ++y)
|
||||
{
|
||||
|
||||
if(bwin->CanTrashWindowBuffer()) {
|
||||
goto escape; /* Break out before the buffer is killed */
|
||||
}
|
||||
if(bwin->CanTrashWindowBuffer()) {
|
||||
goto escape; /* Break out before the buffer is killed */
|
||||
}
|
||||
|
||||
memcpy(bufferpx, windowpx, width * BPP);
|
||||
bufferpx += bufferPitch;
|
||||
windowpx += windowPitch;
|
||||
}
|
||||
}
|
||||
memcpy(bufferpx, windowpx, width * BPP);
|
||||
bufferpx += bufferPitch;
|
||||
windowpx += windowPitch;
|
||||
}
|
||||
}
|
||||
|
||||
bwin->SetBufferDirty(false);
|
||||
bwin->SetBufferDirty(false);
|
||||
escape:
|
||||
bwin->UnlockBuffer();
|
||||
} else {
|
||||
snooze(16000);
|
||||
}
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
bwin->UnlockBuffer();
|
||||
} else {
|
||||
snooze(16000);
|
||||
}
|
||||
}
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
void HAIKU_DestroyWindowFramebuffer(_THIS, SDL_Window * window) {
|
||||
SDL_BWin *bwin = _ToBeWin(window);
|
||||
|
||||
bwin->LockBuffer();
|
||||
|
||||
/* Free and clear the window buffer */
|
||||
BBitmap *bitmap = bwin->GetBitmap();
|
||||
delete bitmap;
|
||||
bwin->SetBitmap(NULL);
|
||||
bwin->SetBufferExists(false);
|
||||
bwin->UnlockBuffer();
|
||||
SDL_BWin *bwin = _ToBeWin(window);
|
||||
|
||||
bwin->LockBuffer();
|
||||
|
||||
/* Free and clear the window buffer */
|
||||
BBitmap *bitmap = bwin->GetBitmap();
|
||||
delete bitmap;
|
||||
bwin->SetBitmap(NULL);
|
||||
bwin->SetBufferExists(false);
|
||||
bwin->UnlockBuffer();
|
||||
}
|
||||
|
||||
|
||||
|
@ -203,50 +203,50 @@ void HAIKU_DestroyWindowFramebuffer(_THIS, SDL_Window * window) {
|
|||
*/
|
||||
#ifndef DRAWTHREAD
|
||||
static int32 HAIKU_UpdateOnce(SDL_Window *window) {
|
||||
SDL_BWin *bwin = _ToBeWin(window);
|
||||
BScreen bscreen;
|
||||
if(!bscreen.IsValid()) {
|
||||
return -1;
|
||||
}
|
||||
SDL_BWin *bwin = _ToBeWin(window);
|
||||
BScreen bscreen;
|
||||
if(!bscreen.IsValid()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(bwin->ConnectionEnabled() && bwin->Connected()) {
|
||||
bwin->LockBuffer();
|
||||
int32 windowPitch = window->surface->pitch;
|
||||
int32 bufferPitch = bwin->GetRowBytes();
|
||||
uint8 *windowpx;
|
||||
uint8 *bufferpx;
|
||||
if(bwin->ConnectionEnabled() && bwin->Connected()) {
|
||||
bwin->LockBuffer();
|
||||
int32 windowPitch = window->surface->pitch;
|
||||
int32 bufferPitch = bwin->GetRowBytes();
|
||||
uint8 *windowpx;
|
||||
uint8 *bufferpx;
|
||||
|
||||
int32 BPP = bwin->GetBytesPerPx();
|
||||
uint8 *windowBaseAddress = (uint8*)window->surface->pixels;
|
||||
int32 windowSub = bwin->GetFbX() * BPP +
|
||||
bwin->GetFbY() * windowPitch;
|
||||
clipping_rect *clips = bwin->GetClips();
|
||||
int32 numClips = bwin->GetNumClips();
|
||||
int i, y;
|
||||
int32 BPP = bwin->GetBytesPerPx();
|
||||
uint8 *windowBaseAddress = (uint8*)window->surface->pixels;
|
||||
int32 windowSub = bwin->GetFbX() * BPP +
|
||||
bwin->GetFbY() * windowPitch;
|
||||
clipping_rect *clips = bwin->GetClips();
|
||||
int32 numClips = bwin->GetNumClips();
|
||||
int i, y;
|
||||
|
||||
/* Blit each clipping rectangle */
|
||||
bscreen.WaitForRetrace();
|
||||
for(i = 0; i < numClips; ++i) {
|
||||
/* Get addresses of the start of each clipping rectangle */
|
||||
int32 width = clips[i].right - clips[i].left + 1;
|
||||
int32 height = clips[i].bottom - clips[i].top + 1;
|
||||
bufferpx = bwin->GetBufferPx() +
|
||||
clips[i].top * bufferPitch + clips[i].left * BPP;
|
||||
windowpx = windowBaseAddress +
|
||||
clips[i].top * windowPitch + clips[i].left * BPP - windowSub;
|
||||
/* Blit each clipping rectangle */
|
||||
bscreen.WaitForRetrace();
|
||||
for(i = 0; i < numClips; ++i) {
|
||||
/* Get addresses of the start of each clipping rectangle */
|
||||
int32 width = clips[i].right - clips[i].left + 1;
|
||||
int32 height = clips[i].bottom - clips[i].top + 1;
|
||||
bufferpx = bwin->GetBufferPx() +
|
||||
clips[i].top * bufferPitch + clips[i].left * BPP;
|
||||
windowpx = windowBaseAddress +
|
||||
clips[i].top * windowPitch + clips[i].left * BPP - windowSub;
|
||||
|
||||
/* Copy each row of pixels from the window buffer into the frame
|
||||
buffer */
|
||||
for(y = 0; y < height; ++y)
|
||||
{
|
||||
memcpy(bufferpx, windowpx, width * BPP);
|
||||
bufferpx += bufferPitch;
|
||||
windowpx += windowPitch;
|
||||
}
|
||||
}
|
||||
bwin->UnlockBuffer();
|
||||
}
|
||||
return 0;
|
||||
/* Copy each row of pixels from the window buffer into the frame
|
||||
buffer */
|
||||
for(y = 0; y < height; ++y)
|
||||
{
|
||||
memcpy(bufferpx, windowpx, width * BPP);
|
||||
bufferpx += bufferPitch;
|
||||
windowpx += windowPitch;
|
||||
}
|
||||
}
|
||||
bwin->UnlockBuffer();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -42,143 +42,143 @@ static SDL_Scancode keymap[KEYMAP_SIZE];
|
|||
static int8 keystate[KEYMAP_SIZE];
|
||||
|
||||
void HAIKU_InitOSKeymap(void) {
|
||||
for( uint i = 0; i < SDL_TABLESIZE(keymap); ++i ) {
|
||||
keymap[i] = SDL_SCANCODE_UNKNOWN;
|
||||
}
|
||||
for( uint i = 0; i < SDL_TABLESIZE(keymap); ++i ) {
|
||||
keymap[i] = SDL_SCANCODE_UNKNOWN;
|
||||
}
|
||||
|
||||
for( uint i = 0; i < KEYMAP_SIZE; ++i ) {
|
||||
keystate[i] = SDL_RELEASED;
|
||||
}
|
||||
for( uint i = 0; i < KEYMAP_SIZE; ++i ) {
|
||||
keystate[i] = SDL_RELEASED;
|
||||
}
|
||||
|
||||
keymap[0x01] = SDL_GetScancodeFromKey(SDLK_ESCAPE);
|
||||
keymap[B_F1_KEY] = SDL_GetScancodeFromKey(SDLK_F1);
|
||||
keymap[B_F2_KEY] = SDL_GetScancodeFromKey(SDLK_F2);
|
||||
keymap[B_F3_KEY] = SDL_GetScancodeFromKey(SDLK_F3);
|
||||
keymap[B_F4_KEY] = SDL_GetScancodeFromKey(SDLK_F4);
|
||||
keymap[B_F5_KEY] = SDL_GetScancodeFromKey(SDLK_F5);
|
||||
keymap[B_F6_KEY] = SDL_GetScancodeFromKey(SDLK_F6);
|
||||
keymap[B_F7_KEY] = SDL_GetScancodeFromKey(SDLK_F7);
|
||||
keymap[B_F8_KEY] = SDL_GetScancodeFromKey(SDLK_F8);
|
||||
keymap[B_F9_KEY] = SDL_GetScancodeFromKey(SDLK_F9);
|
||||
keymap[B_F10_KEY] = SDL_GetScancodeFromKey(SDLK_F10);
|
||||
keymap[B_F11_KEY] = SDL_GetScancodeFromKey(SDLK_F11);
|
||||
keymap[B_F12_KEY] = SDL_GetScancodeFromKey(SDLK_F12);
|
||||
keymap[B_PRINT_KEY] = SDL_GetScancodeFromKey(SDLK_PRINTSCREEN);
|
||||
keymap[B_SCROLL_KEY] = SDL_GetScancodeFromKey(SDLK_SCROLLLOCK);
|
||||
keymap[B_PAUSE_KEY] = SDL_GetScancodeFromKey(SDLK_PAUSE);
|
||||
keymap[0x11] = SDL_GetScancodeFromKey(SDLK_BACKQUOTE);
|
||||
keymap[0x12] = SDL_GetScancodeFromKey(SDLK_1);
|
||||
keymap[0x13] = SDL_GetScancodeFromKey(SDLK_2);
|
||||
keymap[0x14] = SDL_GetScancodeFromKey(SDLK_3);
|
||||
keymap[0x15] = SDL_GetScancodeFromKey(SDLK_4);
|
||||
keymap[0x16] = SDL_GetScancodeFromKey(SDLK_5);
|
||||
keymap[0x17] = SDL_GetScancodeFromKey(SDLK_6);
|
||||
keymap[0x18] = SDL_GetScancodeFromKey(SDLK_7);
|
||||
keymap[0x19] = SDL_GetScancodeFromKey(SDLK_8);
|
||||
keymap[0x1a] = SDL_GetScancodeFromKey(SDLK_9);
|
||||
keymap[0x1b] = SDL_GetScancodeFromKey(SDLK_0);
|
||||
keymap[0x1c] = SDL_GetScancodeFromKey(SDLK_MINUS);
|
||||
keymap[0x1d] = SDL_GetScancodeFromKey(SDLK_EQUALS);
|
||||
keymap[0x1e] = SDL_GetScancodeFromKey(SDLK_BACKSPACE);
|
||||
keymap[0x1f] = SDL_GetScancodeFromKey(SDLK_INSERT);
|
||||
keymap[0x20] = SDL_GetScancodeFromKey(SDLK_HOME);
|
||||
keymap[0x21] = SDL_GetScancodeFromKey(SDLK_PAGEUP);
|
||||
keymap[0x22] = SDL_GetScancodeFromKey(SDLK_NUMLOCKCLEAR);
|
||||
keymap[0x23] = SDL_GetScancodeFromKey(SDLK_KP_DIVIDE);
|
||||
keymap[0x24] = SDL_GetScancodeFromKey(SDLK_KP_MULTIPLY);
|
||||
keymap[0x25] = SDL_GetScancodeFromKey(SDLK_KP_MINUS);
|
||||
keymap[0x26] = SDL_GetScancodeFromKey(SDLK_TAB);
|
||||
keymap[0x27] = SDL_GetScancodeFromKey(SDLK_q);
|
||||
keymap[0x28] = SDL_GetScancodeFromKey(SDLK_w);
|
||||
keymap[0x29] = SDL_GetScancodeFromKey(SDLK_e);
|
||||
keymap[0x2a] = SDL_GetScancodeFromKey(SDLK_r);
|
||||
keymap[0x2b] = SDL_GetScancodeFromKey(SDLK_t);
|
||||
keymap[0x2c] = SDL_GetScancodeFromKey(SDLK_y);
|
||||
keymap[0x2d] = SDL_GetScancodeFromKey(SDLK_u);
|
||||
keymap[0x2e] = SDL_GetScancodeFromKey(SDLK_i);
|
||||
keymap[0x2f] = SDL_GetScancodeFromKey(SDLK_o);
|
||||
keymap[0x30] = SDL_GetScancodeFromKey(SDLK_p);
|
||||
keymap[0x31] = SDL_GetScancodeFromKey(SDLK_LEFTBRACKET);
|
||||
keymap[0x32] = SDL_GetScancodeFromKey(SDLK_RIGHTBRACKET);
|
||||
keymap[0x33] = SDL_GetScancodeFromKey(SDLK_BACKSLASH);
|
||||
keymap[0x34] = SDL_GetScancodeFromKey(SDLK_DELETE);
|
||||
keymap[0x35] = SDL_GetScancodeFromKey(SDLK_END);
|
||||
keymap[0x36] = SDL_GetScancodeFromKey(SDLK_PAGEDOWN);
|
||||
keymap[0x37] = SDL_GetScancodeFromKey(SDLK_KP_7);
|
||||
keymap[0x38] = SDL_GetScancodeFromKey(SDLK_KP_8);
|
||||
keymap[0x39] = SDL_GetScancodeFromKey(SDLK_KP_9);
|
||||
keymap[0x3a] = SDL_GetScancodeFromKey(SDLK_KP_PLUS);
|
||||
keymap[0x3b] = SDL_GetScancodeFromKey(SDLK_CAPSLOCK);
|
||||
keymap[0x3c] = SDL_GetScancodeFromKey(SDLK_a);
|
||||
keymap[0x3d] = SDL_GetScancodeFromKey(SDLK_s);
|
||||
keymap[0x3e] = SDL_GetScancodeFromKey(SDLK_d);
|
||||
keymap[0x3f] = SDL_GetScancodeFromKey(SDLK_f);
|
||||
keymap[0x40] = SDL_GetScancodeFromKey(SDLK_g);
|
||||
keymap[0x41] = SDL_GetScancodeFromKey(SDLK_h);
|
||||
keymap[0x42] = SDL_GetScancodeFromKey(SDLK_j);
|
||||
keymap[0x43] = SDL_GetScancodeFromKey(SDLK_k);
|
||||
keymap[0x44] = SDL_GetScancodeFromKey(SDLK_l);
|
||||
keymap[0x45] = SDL_GetScancodeFromKey(SDLK_SEMICOLON);
|
||||
keymap[0x46] = SDL_GetScancodeFromKey(SDLK_QUOTE);
|
||||
keymap[0x47] = SDL_GetScancodeFromKey(SDLK_RETURN);
|
||||
keymap[0x48] = SDL_GetScancodeFromKey(SDLK_KP_4);
|
||||
keymap[0x49] = SDL_GetScancodeFromKey(SDLK_KP_5);
|
||||
keymap[0x4a] = SDL_GetScancodeFromKey(SDLK_KP_6);
|
||||
keymap[0x4b] = SDL_GetScancodeFromKey(SDLK_LSHIFT);
|
||||
keymap[0x4c] = SDL_GetScancodeFromKey(SDLK_z);
|
||||
keymap[0x4d] = SDL_GetScancodeFromKey(SDLK_x);
|
||||
keymap[0x4e] = SDL_GetScancodeFromKey(SDLK_c);
|
||||
keymap[0x4f] = SDL_GetScancodeFromKey(SDLK_v);
|
||||
keymap[0x50] = SDL_GetScancodeFromKey(SDLK_b);
|
||||
keymap[0x51] = SDL_GetScancodeFromKey(SDLK_n);
|
||||
keymap[0x52] = SDL_GetScancodeFromKey(SDLK_m);
|
||||
keymap[0x53] = SDL_GetScancodeFromKey(SDLK_COMMA);
|
||||
keymap[0x54] = SDL_GetScancodeFromKey(SDLK_PERIOD);
|
||||
keymap[0x55] = SDL_GetScancodeFromKey(SDLK_SLASH);
|
||||
keymap[0x56] = SDL_GetScancodeFromKey(SDLK_RSHIFT);
|
||||
keymap[0x57] = SDL_GetScancodeFromKey(SDLK_UP);
|
||||
keymap[0x58] = SDL_GetScancodeFromKey(SDLK_KP_1);
|
||||
keymap[0x59] = SDL_GetScancodeFromKey(SDLK_KP_2);
|
||||
keymap[0x5a] = SDL_GetScancodeFromKey(SDLK_KP_3);
|
||||
keymap[0x5b] = SDL_GetScancodeFromKey(SDLK_KP_ENTER);
|
||||
keymap[0x5c] = SDL_GetScancodeFromKey(SDLK_LCTRL);
|
||||
keymap[0x5d] = SDL_GetScancodeFromKey(SDLK_LALT);
|
||||
keymap[0x5e] = SDL_GetScancodeFromKey(SDLK_SPACE);
|
||||
keymap[0x5f] = SDL_GetScancodeFromKey(SDLK_RALT);
|
||||
keymap[0x60] = SDL_GetScancodeFromKey(SDLK_RCTRL);
|
||||
keymap[0x61] = SDL_GetScancodeFromKey(SDLK_LEFT);
|
||||
keymap[0x62] = SDL_GetScancodeFromKey(SDLK_DOWN);
|
||||
keymap[0x63] = SDL_GetScancodeFromKey(SDLK_RIGHT);
|
||||
keymap[0x64] = SDL_GetScancodeFromKey(SDLK_KP_0);
|
||||
keymap[0x65] = SDL_GetScancodeFromKey(SDLK_KP_PERIOD);
|
||||
keymap[0x66] = SDL_GetScancodeFromKey(SDLK_LGUI);
|
||||
keymap[0x67] = SDL_GetScancodeFromKey(SDLK_RGUI);
|
||||
keymap[0x68] = SDL_GetScancodeFromKey(SDLK_MENU);
|
||||
keymap[0x69] = SDL_GetScancodeFromKey(SDLK_2); /* SDLK_EURO */
|
||||
keymap[0x6a] = SDL_GetScancodeFromKey(SDLK_KP_EQUALS);
|
||||
keymap[0x6b] = SDL_GetScancodeFromKey(SDLK_POWER);
|
||||
keymap[0x01] = SDL_GetScancodeFromKey(SDLK_ESCAPE);
|
||||
keymap[B_F1_KEY] = SDL_GetScancodeFromKey(SDLK_F1);
|
||||
keymap[B_F2_KEY] = SDL_GetScancodeFromKey(SDLK_F2);
|
||||
keymap[B_F3_KEY] = SDL_GetScancodeFromKey(SDLK_F3);
|
||||
keymap[B_F4_KEY] = SDL_GetScancodeFromKey(SDLK_F4);
|
||||
keymap[B_F5_KEY] = SDL_GetScancodeFromKey(SDLK_F5);
|
||||
keymap[B_F6_KEY] = SDL_GetScancodeFromKey(SDLK_F6);
|
||||
keymap[B_F7_KEY] = SDL_GetScancodeFromKey(SDLK_F7);
|
||||
keymap[B_F8_KEY] = SDL_GetScancodeFromKey(SDLK_F8);
|
||||
keymap[B_F9_KEY] = SDL_GetScancodeFromKey(SDLK_F9);
|
||||
keymap[B_F10_KEY] = SDL_GetScancodeFromKey(SDLK_F10);
|
||||
keymap[B_F11_KEY] = SDL_GetScancodeFromKey(SDLK_F11);
|
||||
keymap[B_F12_KEY] = SDL_GetScancodeFromKey(SDLK_F12);
|
||||
keymap[B_PRINT_KEY] = SDL_GetScancodeFromKey(SDLK_PRINTSCREEN);
|
||||
keymap[B_SCROLL_KEY] = SDL_GetScancodeFromKey(SDLK_SCROLLLOCK);
|
||||
keymap[B_PAUSE_KEY] = SDL_GetScancodeFromKey(SDLK_PAUSE);
|
||||
keymap[0x11] = SDL_GetScancodeFromKey(SDLK_BACKQUOTE);
|
||||
keymap[0x12] = SDL_GetScancodeFromKey(SDLK_1);
|
||||
keymap[0x13] = SDL_GetScancodeFromKey(SDLK_2);
|
||||
keymap[0x14] = SDL_GetScancodeFromKey(SDLK_3);
|
||||
keymap[0x15] = SDL_GetScancodeFromKey(SDLK_4);
|
||||
keymap[0x16] = SDL_GetScancodeFromKey(SDLK_5);
|
||||
keymap[0x17] = SDL_GetScancodeFromKey(SDLK_6);
|
||||
keymap[0x18] = SDL_GetScancodeFromKey(SDLK_7);
|
||||
keymap[0x19] = SDL_GetScancodeFromKey(SDLK_8);
|
||||
keymap[0x1a] = SDL_GetScancodeFromKey(SDLK_9);
|
||||
keymap[0x1b] = SDL_GetScancodeFromKey(SDLK_0);
|
||||
keymap[0x1c] = SDL_GetScancodeFromKey(SDLK_MINUS);
|
||||
keymap[0x1d] = SDL_GetScancodeFromKey(SDLK_EQUALS);
|
||||
keymap[0x1e] = SDL_GetScancodeFromKey(SDLK_BACKSPACE);
|
||||
keymap[0x1f] = SDL_GetScancodeFromKey(SDLK_INSERT);
|
||||
keymap[0x20] = SDL_GetScancodeFromKey(SDLK_HOME);
|
||||
keymap[0x21] = SDL_GetScancodeFromKey(SDLK_PAGEUP);
|
||||
keymap[0x22] = SDL_GetScancodeFromKey(SDLK_NUMLOCKCLEAR);
|
||||
keymap[0x23] = SDL_GetScancodeFromKey(SDLK_KP_DIVIDE);
|
||||
keymap[0x24] = SDL_GetScancodeFromKey(SDLK_KP_MULTIPLY);
|
||||
keymap[0x25] = SDL_GetScancodeFromKey(SDLK_KP_MINUS);
|
||||
keymap[0x26] = SDL_GetScancodeFromKey(SDLK_TAB);
|
||||
keymap[0x27] = SDL_GetScancodeFromKey(SDLK_q);
|
||||
keymap[0x28] = SDL_GetScancodeFromKey(SDLK_w);
|
||||
keymap[0x29] = SDL_GetScancodeFromKey(SDLK_e);
|
||||
keymap[0x2a] = SDL_GetScancodeFromKey(SDLK_r);
|
||||
keymap[0x2b] = SDL_GetScancodeFromKey(SDLK_t);
|
||||
keymap[0x2c] = SDL_GetScancodeFromKey(SDLK_y);
|
||||
keymap[0x2d] = SDL_GetScancodeFromKey(SDLK_u);
|
||||
keymap[0x2e] = SDL_GetScancodeFromKey(SDLK_i);
|
||||
keymap[0x2f] = SDL_GetScancodeFromKey(SDLK_o);
|
||||
keymap[0x30] = SDL_GetScancodeFromKey(SDLK_p);
|
||||
keymap[0x31] = SDL_GetScancodeFromKey(SDLK_LEFTBRACKET);
|
||||
keymap[0x32] = SDL_GetScancodeFromKey(SDLK_RIGHTBRACKET);
|
||||
keymap[0x33] = SDL_GetScancodeFromKey(SDLK_BACKSLASH);
|
||||
keymap[0x34] = SDL_GetScancodeFromKey(SDLK_DELETE);
|
||||
keymap[0x35] = SDL_GetScancodeFromKey(SDLK_END);
|
||||
keymap[0x36] = SDL_GetScancodeFromKey(SDLK_PAGEDOWN);
|
||||
keymap[0x37] = SDL_GetScancodeFromKey(SDLK_KP_7);
|
||||
keymap[0x38] = SDL_GetScancodeFromKey(SDLK_KP_8);
|
||||
keymap[0x39] = SDL_GetScancodeFromKey(SDLK_KP_9);
|
||||
keymap[0x3a] = SDL_GetScancodeFromKey(SDLK_KP_PLUS);
|
||||
keymap[0x3b] = SDL_GetScancodeFromKey(SDLK_CAPSLOCK);
|
||||
keymap[0x3c] = SDL_GetScancodeFromKey(SDLK_a);
|
||||
keymap[0x3d] = SDL_GetScancodeFromKey(SDLK_s);
|
||||
keymap[0x3e] = SDL_GetScancodeFromKey(SDLK_d);
|
||||
keymap[0x3f] = SDL_GetScancodeFromKey(SDLK_f);
|
||||
keymap[0x40] = SDL_GetScancodeFromKey(SDLK_g);
|
||||
keymap[0x41] = SDL_GetScancodeFromKey(SDLK_h);
|
||||
keymap[0x42] = SDL_GetScancodeFromKey(SDLK_j);
|
||||
keymap[0x43] = SDL_GetScancodeFromKey(SDLK_k);
|
||||
keymap[0x44] = SDL_GetScancodeFromKey(SDLK_l);
|
||||
keymap[0x45] = SDL_GetScancodeFromKey(SDLK_SEMICOLON);
|
||||
keymap[0x46] = SDL_GetScancodeFromKey(SDLK_QUOTE);
|
||||
keymap[0x47] = SDL_GetScancodeFromKey(SDLK_RETURN);
|
||||
keymap[0x48] = SDL_GetScancodeFromKey(SDLK_KP_4);
|
||||
keymap[0x49] = SDL_GetScancodeFromKey(SDLK_KP_5);
|
||||
keymap[0x4a] = SDL_GetScancodeFromKey(SDLK_KP_6);
|
||||
keymap[0x4b] = SDL_GetScancodeFromKey(SDLK_LSHIFT);
|
||||
keymap[0x4c] = SDL_GetScancodeFromKey(SDLK_z);
|
||||
keymap[0x4d] = SDL_GetScancodeFromKey(SDLK_x);
|
||||
keymap[0x4e] = SDL_GetScancodeFromKey(SDLK_c);
|
||||
keymap[0x4f] = SDL_GetScancodeFromKey(SDLK_v);
|
||||
keymap[0x50] = SDL_GetScancodeFromKey(SDLK_b);
|
||||
keymap[0x51] = SDL_GetScancodeFromKey(SDLK_n);
|
||||
keymap[0x52] = SDL_GetScancodeFromKey(SDLK_m);
|
||||
keymap[0x53] = SDL_GetScancodeFromKey(SDLK_COMMA);
|
||||
keymap[0x54] = SDL_GetScancodeFromKey(SDLK_PERIOD);
|
||||
keymap[0x55] = SDL_GetScancodeFromKey(SDLK_SLASH);
|
||||
keymap[0x56] = SDL_GetScancodeFromKey(SDLK_RSHIFT);
|
||||
keymap[0x57] = SDL_GetScancodeFromKey(SDLK_UP);
|
||||
keymap[0x58] = SDL_GetScancodeFromKey(SDLK_KP_1);
|
||||
keymap[0x59] = SDL_GetScancodeFromKey(SDLK_KP_2);
|
||||
keymap[0x5a] = SDL_GetScancodeFromKey(SDLK_KP_3);
|
||||
keymap[0x5b] = SDL_GetScancodeFromKey(SDLK_KP_ENTER);
|
||||
keymap[0x5c] = SDL_GetScancodeFromKey(SDLK_LCTRL);
|
||||
keymap[0x5d] = SDL_GetScancodeFromKey(SDLK_LALT);
|
||||
keymap[0x5e] = SDL_GetScancodeFromKey(SDLK_SPACE);
|
||||
keymap[0x5f] = SDL_GetScancodeFromKey(SDLK_RALT);
|
||||
keymap[0x60] = SDL_GetScancodeFromKey(SDLK_RCTRL);
|
||||
keymap[0x61] = SDL_GetScancodeFromKey(SDLK_LEFT);
|
||||
keymap[0x62] = SDL_GetScancodeFromKey(SDLK_DOWN);
|
||||
keymap[0x63] = SDL_GetScancodeFromKey(SDLK_RIGHT);
|
||||
keymap[0x64] = SDL_GetScancodeFromKey(SDLK_KP_0);
|
||||
keymap[0x65] = SDL_GetScancodeFromKey(SDLK_KP_PERIOD);
|
||||
keymap[0x66] = SDL_GetScancodeFromKey(SDLK_LGUI);
|
||||
keymap[0x67] = SDL_GetScancodeFromKey(SDLK_RGUI);
|
||||
keymap[0x68] = SDL_GetScancodeFromKey(SDLK_MENU);
|
||||
keymap[0x69] = SDL_GetScancodeFromKey(SDLK_2); /* SDLK_EURO */
|
||||
keymap[0x6a] = SDL_GetScancodeFromKey(SDLK_KP_EQUALS);
|
||||
keymap[0x6b] = SDL_GetScancodeFromKey(SDLK_POWER);
|
||||
}
|
||||
|
||||
SDL_Scancode HAIKU_GetScancodeFromBeKey(int32 bkey) {
|
||||
if(bkey > 0 && bkey < (int32)SDL_TABLESIZE(keymap)) {
|
||||
return keymap[bkey];
|
||||
} else {
|
||||
return SDL_SCANCODE_UNKNOWN;
|
||||
}
|
||||
if(bkey > 0 && bkey < (int32)SDL_TABLESIZE(keymap)) {
|
||||
return keymap[bkey];
|
||||
} else {
|
||||
return SDL_SCANCODE_UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
int8 HAIKU_GetKeyState(int32 bkey) {
|
||||
if(bkey > 0 && bkey < KEYMAP_SIZE) {
|
||||
return keystate[bkey];
|
||||
} else {
|
||||
return SDL_RELEASED;
|
||||
}
|
||||
if(bkey > 0 && bkey < KEYMAP_SIZE) {
|
||||
return keystate[bkey];
|
||||
} else {
|
||||
return SDL_RELEASED;
|
||||
}
|
||||
}
|
||||
|
||||
void HAIKU_SetKeyState(int32 bkey, int8 state) {
|
||||
if(bkey > 0 && bkey < KEYMAP_SIZE) {
|
||||
keystate[bkey] = state;
|
||||
}
|
||||
if(bkey > 0 && bkey < KEYMAP_SIZE) {
|
||||
keystate[bkey] = state;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -44,30 +44,30 @@ extern "C" {
|
|||
/* This wrapper is here so that the driverdata can be freed without freeing
|
||||
the display_mode structure */
|
||||
struct SDL_DisplayModeData {
|
||||
display_mode *bmode;
|
||||
display_mode *bmode;
|
||||
};
|
||||
#endif
|
||||
|
||||
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() {
|
||||
return ((SDL_BApp*)be_app);
|
||||
return ((SDL_BApp*)be_app);
|
||||
}
|
||||
|
||||
static SDL_INLINE display_mode * _ExtractBMode(SDL_DisplayMode *mode) {
|
||||
#if WRAP_BMODE
|
||||
return ((SDL_DisplayModeData*)mode->driverdata)->bmode;
|
||||
return ((SDL_DisplayModeData*)mode->driverdata)->bmode;
|
||||
#else
|
||||
return (display_mode*)(mode->driverdata);
|
||||
return (display_mode*)(mode->driverdata);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Copied from haiku/trunk/src/preferences/screen/ScreenMode.cpp */
|
||||
static float get_refresh_rate(display_mode &mode) {
|
||||
return float(mode.timing.pixel_clock * 1000)
|
||||
/ float(mode.timing.h_total * mode.timing.v_total);
|
||||
return float(mode.timing.pixel_clock * 1000)
|
||||
/ 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.
|
||||
*/
|
||||
void _SpoutModeData(display_mode *bmode) {
|
||||
printf("BMode:\n");
|
||||
printf("\tw,h = (%i,%i)\n", bmode->virtual_width, bmode->virtual_height);
|
||||
printf("\th,v = (%i,%i)\n", bmode->h_display_start,
|
||||
bmode->v_display_start);
|
||||
if(bmode->flags) {
|
||||
printf("\tFlags:\n");
|
||||
if(bmode->flags & B_SCROLL) {
|
||||
printf("\t\tB_SCROLL\n");
|
||||
}
|
||||
if(bmode->flags & B_8_BIT_DAC) {
|
||||
printf("\t\tB_8_BIT_DAC\n");
|
||||
}
|
||||
if(bmode->flags & B_HARDWARE_CURSOR) {
|
||||
printf("\t\tB_HARDWARE_CURSOR\n");
|
||||
}
|
||||
if(bmode->flags & B_PARALLEL_ACCESS) {
|
||||
printf("\t\tB_PARALLEL_ACCESS\n");
|
||||
}
|
||||
if(bmode->flags & B_DPMS) {
|
||||
printf("\t\tB_DPMS\n");
|
||||
}
|
||||
if(bmode->flags & B_IO_FB_NA) {
|
||||
printf("\t\tB_IO_FB_NA\n");
|
||||
}
|
||||
}
|
||||
printf("\tTiming:\n");
|
||||
printf("\t\tpx clock: %i\n", bmode->timing.pixel_clock);
|
||||
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_sync_end, bmode->timing.h_total);
|
||||
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_sync_end, bmode->timing.v_total);
|
||||
if(bmode->timing.flags) {
|
||||
printf("\t\tFlags:\n");
|
||||
if(bmode->timing.flags & B_BLANK_PEDESTAL) {
|
||||
printf("\t\t\tB_BLANK_PEDESTAL\n");
|
||||
}
|
||||
if(bmode->timing.flags & B_TIMING_INTERLACED) {
|
||||
printf("\t\t\tB_TIMING_INTERLACED\n");
|
||||
}
|
||||
if(bmode->timing.flags & B_POSITIVE_HSYNC) {
|
||||
printf("\t\t\tB_POSITIVE_HSYNC\n");
|
||||
}
|
||||
if(bmode->timing.flags & B_POSITIVE_VSYNC) {
|
||||
printf("\t\t\tB_POSITIVE_VSYNC\n");
|
||||
}
|
||||
if(bmode->timing.flags & B_SYNC_ON_GREEN) {
|
||||
printf("\t\t\tB_SYNC_ON_GREEN\n");
|
||||
}
|
||||
}
|
||||
printf("BMode:\n");
|
||||
printf("\tw,h = (%i,%i)\n", bmode->virtual_width, bmode->virtual_height);
|
||||
printf("\th,v = (%i,%i)\n", bmode->h_display_start,
|
||||
bmode->v_display_start);
|
||||
if(bmode->flags) {
|
||||
printf("\tFlags:\n");
|
||||
if(bmode->flags & B_SCROLL) {
|
||||
printf("\t\tB_SCROLL\n");
|
||||
}
|
||||
if(bmode->flags & B_8_BIT_DAC) {
|
||||
printf("\t\tB_8_BIT_DAC\n");
|
||||
}
|
||||
if(bmode->flags & B_HARDWARE_CURSOR) {
|
||||
printf("\t\tB_HARDWARE_CURSOR\n");
|
||||
}
|
||||
if(bmode->flags & B_PARALLEL_ACCESS) {
|
||||
printf("\t\tB_PARALLEL_ACCESS\n");
|
||||
}
|
||||
if(bmode->flags & B_DPMS) {
|
||||
printf("\t\tB_DPMS\n");
|
||||
}
|
||||
if(bmode->flags & B_IO_FB_NA) {
|
||||
printf("\t\tB_IO_FB_NA\n");
|
||||
}
|
||||
}
|
||||
printf("\tTiming:\n");
|
||||
printf("\t\tpx clock: %i\n", bmode->timing.pixel_clock);
|
||||
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_sync_end, bmode->timing.h_total);
|
||||
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_sync_end, bmode->timing.v_total);
|
||||
if(bmode->timing.flags) {
|
||||
printf("\t\tFlags:\n");
|
||||
if(bmode->timing.flags & B_BLANK_PEDESTAL) {
|
||||
printf("\t\t\tB_BLANK_PEDESTAL\n");
|
||||
}
|
||||
if(bmode->timing.flags & B_TIMING_INTERLACED) {
|
||||
printf("\t\t\tB_TIMING_INTERLACED\n");
|
||||
}
|
||||
if(bmode->timing.flags & B_POSITIVE_HSYNC) {
|
||||
printf("\t\t\tB_POSITIVE_HSYNC\n");
|
||||
}
|
||||
if(bmode->timing.flags & B_POSITIVE_VSYNC) {
|
||||
printf("\t\t\tB_POSITIVE_VSYNC\n");
|
||||
}
|
||||
if(bmode->timing.flags & B_SYNC_ON_GREEN) {
|
||||
printf("\t\t\tB_SYNC_ON_GREEN\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -134,101 +134,101 @@ void _SpoutModeData(display_mode *bmode) {
|
|||
|
||||
int32 HAIKU_ColorSpaceToBitsPerPixel(uint32 colorspace)
|
||||
{
|
||||
int bitsperpixel;
|
||||
int bitsperpixel;
|
||||
|
||||
bitsperpixel = 0;
|
||||
switch (colorspace) {
|
||||
case B_CMAP8:
|
||||
bitsperpixel = 8;
|
||||
break;
|
||||
case B_RGB15:
|
||||
case B_RGBA15:
|
||||
case B_RGB15_BIG:
|
||||
case B_RGBA15_BIG:
|
||||
bitsperpixel = 15;
|
||||
break;
|
||||
case B_RGB16:
|
||||
case B_RGB16_BIG:
|
||||
bitsperpixel = 16;
|
||||
break;
|
||||
case B_RGB32:
|
||||
case B_RGBA32:
|
||||
case B_RGB32_BIG:
|
||||
case B_RGBA32_BIG:
|
||||
bitsperpixel = 32;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return(bitsperpixel);
|
||||
bitsperpixel = 0;
|
||||
switch (colorspace) {
|
||||
case B_CMAP8:
|
||||
bitsperpixel = 8;
|
||||
break;
|
||||
case B_RGB15:
|
||||
case B_RGBA15:
|
||||
case B_RGB15_BIG:
|
||||
case B_RGBA15_BIG:
|
||||
bitsperpixel = 15;
|
||||
break;
|
||||
case B_RGB16:
|
||||
case B_RGB16_BIG:
|
||||
bitsperpixel = 16;
|
||||
break;
|
||||
case B_RGB32:
|
||||
case B_RGBA32:
|
||||
case B_RGB32_BIG:
|
||||
case B_RGBA32_BIG:
|
||||
bitsperpixel = 32;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return(bitsperpixel);
|
||||
}
|
||||
|
||||
int32 HAIKU_BPPToSDLPxFormat(int32 bpp) {
|
||||
/* Translation taken from SDL_windowsmodes.c */
|
||||
switch (bpp) {
|
||||
case 32:
|
||||
return SDL_PIXELFORMAT_RGB888;
|
||||
break;
|
||||
case 24: /* May not be supported by Haiku */
|
||||
return SDL_PIXELFORMAT_RGB24;
|
||||
break;
|
||||
case 16:
|
||||
return SDL_PIXELFORMAT_RGB565;
|
||||
break;
|
||||
case 15:
|
||||
return SDL_PIXELFORMAT_RGB555;
|
||||
break;
|
||||
case 8:
|
||||
return SDL_PIXELFORMAT_INDEX8;
|
||||
break;
|
||||
case 4: /* May not be supported by Haiku */
|
||||
return SDL_PIXELFORMAT_INDEX4LSB;
|
||||
break;
|
||||
}
|
||||
/* Translation taken from SDL_windowsmodes.c */
|
||||
switch (bpp) {
|
||||
case 32:
|
||||
return SDL_PIXELFORMAT_RGB888;
|
||||
break;
|
||||
case 24: /* May not be supported by Haiku */
|
||||
return SDL_PIXELFORMAT_RGB24;
|
||||
break;
|
||||
case 16:
|
||||
return SDL_PIXELFORMAT_RGB565;
|
||||
break;
|
||||
case 15:
|
||||
return SDL_PIXELFORMAT_RGB555;
|
||||
break;
|
||||
case 8:
|
||||
return SDL_PIXELFORMAT_INDEX8;
|
||||
break;
|
||||
case 4: /* May not be supported by Haiku */
|
||||
return SDL_PIXELFORMAT_INDEX4LSB;
|
||||
break;
|
||||
}
|
||||
|
||||
/* May never get here, but safer and needed to shut up compiler */
|
||||
SDL_SetError("Invalid bpp value");
|
||||
return 0;
|
||||
/* May never get here, but safer and needed to shut up compiler */
|
||||
SDL_SetError("Invalid bpp value");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void _BDisplayModeToSdlDisplayMode(display_mode *bmode,
|
||||
SDL_DisplayMode *mode) {
|
||||
mode->w = bmode->virtual_width;
|
||||
mode->h = bmode->virtual_height;
|
||||
mode->refresh_rate = (int)get_refresh_rate(*bmode);
|
||||
SDL_DisplayMode *mode) {
|
||||
mode->w = bmode->virtual_width;
|
||||
mode->h = bmode->virtual_height;
|
||||
mode->refresh_rate = (int)get_refresh_rate(*bmode);
|
||||
|
||||
#if WRAP_BMODE
|
||||
SDL_DisplayModeData *data = (SDL_DisplayModeData*)SDL_calloc(1,
|
||||
sizeof(SDL_DisplayModeData));
|
||||
data->bmode = bmode;
|
||||
|
||||
mode->driverdata = data;
|
||||
SDL_DisplayModeData *data = (SDL_DisplayModeData*)SDL_calloc(1,
|
||||
sizeof(SDL_DisplayModeData));
|
||||
data->bmode = bmode;
|
||||
|
||||
mode->driverdata = data;
|
||||
|
||||
#else
|
||||
|
||||
mode->driverdata = bmode;
|
||||
mode->driverdata = bmode;
|
||||
#endif
|
||||
|
||||
/* Set the format */
|
||||
int32 bpp = HAIKU_ColorSpaceToBitsPerPixel(bmode->space);
|
||||
mode->format = HAIKU_BPPToSDLPxFormat(bpp);
|
||||
/* Set the format */
|
||||
int32 bpp = HAIKU_ColorSpaceToBitsPerPixel(bmode->space);
|
||||
mode->format = HAIKU_BPPToSDLPxFormat(bpp);
|
||||
}
|
||||
|
||||
/* Later, there may be more than one monitor available */
|
||||
static void _AddDisplay(BScreen *screen) {
|
||||
SDL_VideoDisplay display;
|
||||
SDL_DisplayMode *mode = (SDL_DisplayMode*)SDL_calloc(1,
|
||||
sizeof(SDL_DisplayMode));
|
||||
display_mode *bmode = (display_mode*)SDL_calloc(1, sizeof(display_mode));
|
||||
screen->GetMode(bmode);
|
||||
SDL_VideoDisplay display;
|
||||
SDL_DisplayMode *mode = (SDL_DisplayMode*)SDL_calloc(1,
|
||||
sizeof(SDL_DisplayMode));
|
||||
display_mode *bmode = (display_mode*)SDL_calloc(1, sizeof(display_mode));
|
||||
screen->GetMode(bmode);
|
||||
|
||||
_BDisplayModeToSdlDisplayMode(bmode, mode);
|
||||
|
||||
SDL_zero(display);
|
||||
display.desktop_mode = *mode;
|
||||
display.current_mode = *mode;
|
||||
|
||||
SDL_AddVideoDisplay(&display);
|
||||
_BDisplayModeToSdlDisplayMode(bmode, mode);
|
||||
|
||||
SDL_zero(display);
|
||||
display.desktop_mode = *mode;
|
||||
display.current_mode = *mode;
|
||||
|
||||
SDL_AddVideoDisplay(&display);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -236,92 +236,92 @@ static void _AddDisplay(BScreen *screen) {
|
|||
*/
|
||||
|
||||
int HAIKU_InitModes(_THIS) {
|
||||
BScreen screen;
|
||||
BScreen screen;
|
||||
|
||||
/* TODO: When Haiku supports multiple display screens, call
|
||||
_AddDisplayScreen() for each of them. */
|
||||
_AddDisplay(&screen);
|
||||
return 0;
|
||||
/* TODO: When Haiku supports multiple display screens, call
|
||||
_AddDisplayScreen() for each of them. */
|
||||
_AddDisplay(&screen);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int HAIKU_QuitModes(_THIS) {
|
||||
/* FIXME: Nothing really needs to be done here at the moment? */
|
||||
return 0;
|
||||
/* FIXME: Nothing really needs to be done here at the moment? */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int HAIKU_GetDisplayBounds(_THIS, SDL_VideoDisplay *display, SDL_Rect *rect) {
|
||||
BScreen bscreen;
|
||||
BRect rc = bscreen.Frame();
|
||||
rect->x = (int)rc.left;
|
||||
rect->y = (int)rc.top;
|
||||
rect->w = (int)rc.Width() + 1;
|
||||
rect->h = (int)rc.Height() + 1;
|
||||
return 0;
|
||||
BScreen bscreen;
|
||||
BRect rc = bscreen.Frame();
|
||||
rect->x = (int)rc.left;
|
||||
rect->y = (int)rc.top;
|
||||
rect->w = (int)rc.Width() + 1;
|
||||
rect->h = (int)rc.Height() + 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void HAIKU_GetDisplayModes(_THIS, SDL_VideoDisplay *display) {
|
||||
/* Get the current screen */
|
||||
BScreen bscreen;
|
||||
/* Get the current screen */
|
||||
BScreen bscreen;
|
||||
|
||||
/* Iterate through all of the modes */
|
||||
SDL_DisplayMode mode;
|
||||
display_mode this_bmode;
|
||||
display_mode *bmodes;
|
||||
uint32 count, i;
|
||||
|
||||
/* Get graphics-hardware supported modes */
|
||||
bscreen.GetModeList(&bmodes, &count);
|
||||
bscreen.GetMode(&this_bmode);
|
||||
|
||||
for(i = 0; i < count; ++i) {
|
||||
// FIXME: Apparently there are errors with colorspace changes
|
||||
if (bmodes[i].space == this_bmode.space) {
|
||||
_BDisplayModeToSdlDisplayMode(&bmodes[i], &mode);
|
||||
SDL_AddDisplayMode(display, &mode);
|
||||
}
|
||||
}
|
||||
free(bmodes);
|
||||
/* Iterate through all of the modes */
|
||||
SDL_DisplayMode mode;
|
||||
display_mode this_bmode;
|
||||
display_mode *bmodes;
|
||||
uint32 count, i;
|
||||
|
||||
/* Get graphics-hardware supported modes */
|
||||
bscreen.GetModeList(&bmodes, &count);
|
||||
bscreen.GetMode(&this_bmode);
|
||||
|
||||
for(i = 0; i < count; ++i) {
|
||||
// FIXME: Apparently there are errors with colorspace changes
|
||||
if (bmodes[i].space == this_bmode.space) {
|
||||
_BDisplayModeToSdlDisplayMode(&bmodes[i], &mode);
|
||||
SDL_AddDisplayMode(display, &mode);
|
||||
}
|
||||
}
|
||||
free(bmodes);
|
||||
}
|
||||
|
||||
|
||||
int HAIKU_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode){
|
||||
/* Get the current screen */
|
||||
BScreen bscreen;
|
||||
if(!bscreen.IsValid()) {
|
||||
printf(__FILE__": %d - ERROR: BAD SCREEN\n", __LINE__);
|
||||
}
|
||||
/* Get the current screen */
|
||||
BScreen bscreen;
|
||||
if(!bscreen.IsValid()) {
|
||||
printf(__FILE__": %d - ERROR: BAD SCREEN\n", __LINE__);
|
||||
}
|
||||
|
||||
/* Set the mode using the driver data */
|
||||
display_mode *bmode = _ExtractBMode(mode);
|
||||
/* Set the mode using the driver data */
|
||||
display_mode *bmode = _ExtractBMode(mode);
|
||||
|
||||
|
||||
/* FIXME: Is the first option always going to be the right one? */
|
||||
uint32 c = 0, i;
|
||||
display_mode *bmode_list;
|
||||
bscreen.GetModeList(&bmode_list, &c);
|
||||
for(i = 0; i < c; ++i) {
|
||||
if( bmode_list[i].space == bmode->space &&
|
||||
bmode_list[i].virtual_width == bmode->virtual_width &&
|
||||
bmode_list[i].virtual_height == bmode->virtual_height ) {
|
||||
bmode = &bmode_list[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* FIXME: Is the first option always going to be the right one? */
|
||||
uint32 c = 0, i;
|
||||
display_mode *bmode_list;
|
||||
bscreen.GetModeList(&bmode_list, &c);
|
||||
for(i = 0; i < c; ++i) {
|
||||
if( bmode_list[i].space == bmode->space &&
|
||||
bmode_list[i].virtual_width == bmode->virtual_width &&
|
||||
bmode_list[i].virtual_height == bmode->virtual_height ) {
|
||||
bmode = &bmode_list[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(bscreen.SetMode(bmode) != B_OK) {
|
||||
return SDL_SetError("Bad video mode");
|
||||
}
|
||||
|
||||
free(bmode_list);
|
||||
|
||||
if(bscreen.SetMode(bmode) != B_OK) {
|
||||
return SDL_SetError("Bad video mode");
|
||||
}
|
||||
|
||||
free(bmode_list);
|
||||
|
||||
#if SDL_VIDEO_OPENGL
|
||||
/* FIXME: Is there some way to reboot the OpenGL context? This doesn't
|
||||
help */
|
||||
// HAIKU_GL_RebootContexts(_this);
|
||||
/* FIXME: Is there some way to reboot the OpenGL context? This doesn't
|
||||
help */
|
||||
// HAIKU_GL_RebootContexts(_this);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -56,7 +56,7 @@ HAIKU_CreateDevice(int devindex)
|
|||
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
|
||||
|
||||
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 */
|
||||
|
||||
|
@ -122,37 +122,36 @@ HAIKU_CreateDevice(int devindex)
|
|||
}
|
||||
|
||||
VideoBootStrap HAIKU_bootstrap = {
|
||||
"haiku", "Haiku graphics",
|
||||
HAIKU_Available, HAIKU_CreateDevice
|
||||
"haiku", "Haiku graphics",
|
||||
HAIKU_Available, HAIKU_CreateDevice
|
||||
};
|
||||
|
||||
void HAIKU_DeleteDevice(SDL_VideoDevice * device)
|
||||
{
|
||||
SDL_free(device->driverdata);
|
||||
SDL_free(device);
|
||||
SDL_free(device->driverdata);
|
||||
SDL_free(device);
|
||||
}
|
||||
|
||||
int HAIKU_VideoInit(_THIS)
|
||||
{
|
||||
/* Initialize the Be Application for appserver interaction */
|
||||
if (SDL_InitBeApp() < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Initialize video modes */
|
||||
HAIKU_InitModes(_this);
|
||||
/* Initialize the Be Application for appserver interaction */
|
||||
if (SDL_InitBeApp() < 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Initialize video modes */
|
||||
HAIKU_InitModes(_this);
|
||||
|
||||
/* Init the keymap */
|
||||
HAIKU_InitOSKeymap();
|
||||
|
||||
/* Init the keymap */
|
||||
HAIKU_InitOSKeymap();
|
||||
|
||||
|
||||
#if SDL_VIDEO_OPENGL
|
||||
/* testgl application doesn't load library, just tries to load symbols */
|
||||
/* is it correct? if so we have to load library here */
|
||||
HAIKU_GL_LoadLibrary(_this, NULL);
|
||||
#endif
|
||||
|
||||
/* We're done! */
|
||||
/* We're done! */
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,36 +32,36 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
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() {
|
||||
return ((SDL_BApp*)be_app);
|
||||
return ((SDL_BApp*)be_app);
|
||||
}
|
||||
|
||||
static int _InitWindow(_THIS, SDL_Window *window) {
|
||||
uint32 flags = 0;
|
||||
window_look look = B_TITLED_WINDOW_LOOK;
|
||||
uint32 flags = 0;
|
||||
window_look look = B_TITLED_WINDOW_LOOK;
|
||||
|
||||
BRect bounds(
|
||||
BRect bounds(
|
||||
window->x,
|
||||
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
|
||||
);
|
||||
|
||||
if(window->flags & SDL_WINDOW_FULLSCREEN) {
|
||||
/* TODO: Add support for this flag */
|
||||
printf(__FILE__": %d!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",__LINE__);
|
||||
/* TODO: Add support for this flag */
|
||||
printf(__FILE__": %d!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n",__LINE__);
|
||||
}
|
||||
if(window->flags & SDL_WINDOW_OPENGL) {
|
||||
/* TODO: Add support for this flag */
|
||||
/* TODO: Add support for this flag */
|
||||
}
|
||||
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) {
|
||||
look = B_NO_BORDER_WINDOW_LOOK;
|
||||
look = B_NO_BORDER_WINDOW_LOOK;
|
||||
}
|
||||
|
||||
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) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Start window loop */
|
||||
|
||||
/* Start window loop */
|
||||
_ToBeWin(window)->Show();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int HAIKU_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) {
|
||||
|
||||
SDL_BWin *otherBWin = (SDL_BWin*)data;
|
||||
if(!otherBWin->LockLooper())
|
||||
return -1;
|
||||
|
||||
/* Create the new window and initialize its members */
|
||||
window->x = (int)otherBWin->Frame().left;
|
||||
window->y = (int)otherBWin->Frame().top;
|
||||
window->w = (int)otherBWin->Frame().Width();
|
||||
window->h = (int)otherBWin->Frame().Height();
|
||||
|
||||
/* Set SDL flags */
|
||||
if(!(otherBWin->Flags() & B_NOT_RESIZABLE)) {
|
||||
window->flags |= SDL_WINDOW_RESIZABLE;
|
||||
}
|
||||
|
||||
/* If we are out of memory, return the error code */
|
||||
SDL_BWin *otherBWin = (SDL_BWin*)data;
|
||||
if(!otherBWin->LockLooper())
|
||||
return -1;
|
||||
|
||||
/* Create the new window and initialize its members */
|
||||
window->x = (int)otherBWin->Frame().left;
|
||||
window->y = (int)otherBWin->Frame().top;
|
||||
window->w = (int)otherBWin->Frame().Width();
|
||||
window->h = (int)otherBWin->Frame().Height();
|
||||
|
||||
/* Set SDL flags */
|
||||
if(!(otherBWin->Flags() & B_NOT_RESIZABLE)) {
|
||||
window->flags |= SDL_WINDOW_RESIZABLE;
|
||||
}
|
||||
|
||||
/* If we are out of memory, return the error code */
|
||||
if (_InitWindow(_this, window) < 0) {
|
||||
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());
|
||||
|
||||
/* 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) {
|
||||
BMessage msg(BWIN_SET_TITLE);
|
||||
msg.AddString("window-title", window->title);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
BMessage msg(BWIN_SET_TITLE);
|
||||
msg.AddString("window-title", window->title);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
}
|
||||
|
||||
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) {
|
||||
BMessage msg(BWIN_MOVE_WINDOW);
|
||||
msg.AddInt32("window-x", window->x);
|
||||
msg.AddInt32("window-y", window->y);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
BMessage msg(BWIN_MOVE_WINDOW);
|
||||
msg.AddInt32("window-x", window->x);
|
||||
msg.AddInt32("window-y", window->y);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
}
|
||||
|
||||
void HAIKU_SetWindowSize(_THIS, SDL_Window * window) {
|
||||
BMessage msg(BWIN_RESIZE_WINDOW);
|
||||
msg.AddInt32("window-w", window->w - 1);
|
||||
msg.AddInt32("window-h", window->h - 1);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
BMessage msg(BWIN_RESIZE_WINDOW);
|
||||
msg.AddInt32("window-w", window->w - 1);
|
||||
msg.AddInt32("window-h", window->h - 1);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
}
|
||||
|
||||
void HAIKU_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) {
|
||||
BMessage msg(BWIN_SET_BORDERED);
|
||||
msg.AddBool("window-border", bordered != SDL_FALSE);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
BMessage msg(BWIN_SET_BORDERED);
|
||||
msg.AddBool("window-border", bordered != SDL_FALSE);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
}
|
||||
|
||||
void HAIKU_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) {
|
||||
BMessage msg(BWIN_SET_RESIZABLE);
|
||||
msg.AddBool("window-resizable", resizable != SDL_FALSE);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
BMessage msg(BWIN_SET_RESIZABLE);
|
||||
msg.AddBool("window-resizable", resizable != SDL_FALSE);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
}
|
||||
|
||||
void HAIKU_ShowWindow(_THIS, SDL_Window * window) {
|
||||
BMessage msg(BWIN_SHOW_WINDOW);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
BMessage msg(BWIN_SHOW_WINDOW);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
}
|
||||
|
||||
void HAIKU_HideWindow(_THIS, SDL_Window * window) {
|
||||
BMessage msg(BWIN_HIDE_WINDOW);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
BMessage msg(BWIN_HIDE_WINDOW);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
}
|
||||
|
||||
void HAIKU_RaiseWindow(_THIS, SDL_Window * window) {
|
||||
BMessage msg(BWIN_SHOW_WINDOW); /* Activate this window and move to front */
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
BMessage msg(BWIN_SHOW_WINDOW); /* Activate this window and move to front */
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
}
|
||||
|
||||
void HAIKU_MaximizeWindow(_THIS, SDL_Window * window) {
|
||||
BMessage msg(BWIN_MAXIMIZE_WINDOW);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
BMessage msg(BWIN_MAXIMIZE_WINDOW);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
}
|
||||
|
||||
void HAIKU_MinimizeWindow(_THIS, SDL_Window * window) {
|
||||
BMessage msg(BWIN_MINIMIZE_WINDOW);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
BMessage msg(BWIN_MINIMIZE_WINDOW);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
}
|
||||
|
||||
void HAIKU_RestoreWindow(_THIS, SDL_Window * window) {
|
||||
BMessage msg(BWIN_RESTORE_WINDOW);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
BMessage msg(BWIN_RESTORE_WINDOW);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
}
|
||||
|
||||
void HAIKU_SetWindowFullscreen(_THIS, SDL_Window * window,
|
||||
SDL_VideoDisplay * display, SDL_bool fullscreen) {
|
||||
/* Haiku tracks all video display information */
|
||||
BMessage msg(BWIN_FULLSCREEN);
|
||||
msg.AddBool("fullscreen", fullscreen);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
|
||||
SDL_VideoDisplay * display, SDL_bool fullscreen) {
|
||||
/* Haiku tracks all video display information */
|
||||
BMessage msg(BWIN_FULLSCREEN);
|
||||
msg.AddBool("fullscreen", fullscreen);
|
||||
_ToBeWin(window)->PostMessage(&msg);
|
||||
|
||||
}
|
||||
|
||||
int HAIKU_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp) {
|
||||
/* FIXME: Not Haiku supported */
|
||||
return -1;
|
||||
/* FIXME: Not Haiku supported */
|
||||
return -1;
|
||||
}
|
||||
|
||||
int HAIKU_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp) {
|
||||
/* FIXME: Not Haiku supported */
|
||||
return -1;
|
||||
/* FIXME: Not Haiku supported */
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
void HAIKU_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) {
|
||||
/* TODO: Implement this! */
|
||||
/* TODO: Implement this! */
|
||||
}
|
||||
|
||||
void HAIKU_DestroyWindow(_THIS, SDL_Window * window) {
|
||||
_ToBeWin(window)->LockLooper(); /* This MUST be locked */
|
||||
_GetBeApp()->ClearID(_ToBeWin(window));
|
||||
_ToBeWin(window)->Quit();
|
||||
window->driverdata = NULL;
|
||||
_ToBeWin(window)->LockLooper(); /* This MUST be locked */
|
||||
_GetBeApp()->ClearID(_ToBeWin(window));
|
||||
_ToBeWin(window)->Quit();
|
||||
window->driverdata = NULL;
|
||||
}
|
||||
|
||||
SDL_bool HAIKU_GetWindowWMInfo(_THIS, SDL_Window * window,
|
||||
struct SDL_SysWMinfo *info) {
|
||||
/* FIXME: What is the point of this? What information should be included? */
|
||||
return SDL_FALSE;
|
||||
/* FIXME: What is the point of this? What information should be included? */
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -487,12 +487,12 @@ KMSDRM_MoveCursor(SDL_Cursor * cursor)
|
|||
That's why we move the cursor graphic ONLY. */
|
||||
if (mouse != NULL && mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) {
|
||||
curdata = (KMSDRM_CursorData *) mouse->cur_cursor->driverdata;
|
||||
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);
|
||||
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);
|
||||
|
||||
if (ret) {
|
||||
SDL_SetError("drmModeMoveCursor() failed.");
|
||||
}
|
||||
if (ret) {
|
||||
SDL_SetError("drmModeMoveCursor() failed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -50,23 +50,23 @@ KMSDRM_GLES_SetupCrtc(_THIS, SDL_Window * window) {
|
|||
KMSDRM_FBInfo *fb_info;
|
||||
|
||||
if (!(_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, wdata->egl_surface))) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "eglSwapBuffers failed on CRTC setup");
|
||||
return SDL_FALSE;
|
||||
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "eglSwapBuffers failed on CRTC setup");
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
wdata->next_bo = KMSDRM_gbm_surface_lock_front_buffer(wdata->gs);
|
||||
if (wdata->next_bo == NULL) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not lock GBM surface front buffer on CRTC setup");
|
||||
return SDL_FALSE;
|
||||
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not lock GBM surface front buffer on CRTC setup");
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
fb_info = KMSDRM_FBFromBO(_this, wdata->next_bo);
|
||||
if (fb_info == NULL) {
|
||||
return SDL_FALSE;
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
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");
|
||||
return SDL_FALSE;
|
||||
|
||||
|
@ -153,14 +153,14 @@ KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window) {
|
|||
} else {
|
||||
/* 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. */
|
||||
if (!wdata->crtc_ready) {
|
||||
if (!wdata->crtc_ready) {
|
||||
if(!KMSDRM_GLES_SetupCrtc(_this, window)) {
|
||||
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not set up CRTC for doing vsync-ed pageflips");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 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); */
|
||||
|
|
|
@ -343,17 +343,17 @@ RPI_DestroyWindow(_THIS, SDL_Window * window)
|
|||
SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata;
|
||||
|
||||
if(data) {
|
||||
if (data->double_buffer) {
|
||||
/* Wait for vsync, and then stop vsync callbacks and destroy related stuff, if needed */
|
||||
SDL_LockMutex(data->vsync_cond_mutex);
|
||||
SDL_CondWait(data->vsync_cond, data->vsync_cond_mutex);
|
||||
SDL_UnlockMutex(data->vsync_cond_mutex);
|
||||
if (data->double_buffer) {
|
||||
/* Wait for vsync, and then stop vsync callbacks and destroy related stuff, if needed */
|
||||
SDL_LockMutex(data->vsync_cond_mutex);
|
||||
SDL_CondWait(data->vsync_cond, 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_DestroyMutex(data->vsync_cond_mutex);
|
||||
}
|
||||
SDL_DestroyCond(data->vsync_cond);
|
||||
SDL_DestroyMutex(data->vsync_cond_mutex);
|
||||
}
|
||||
|
||||
#if SDL_VIDEO_OPENGL_EGL
|
||||
if (data->egl_surface != EGL_NO_SURFACE) {
|
||||
|
|
|
@ -445,7 +445,7 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh)
|
|||
#if !TARGET_OS_TV
|
||||
- (void)application:(UIApplication *)application didChangeStatusBarOrientation:(UIInterfaceOrientation)oldStatusBarOrientation
|
||||
{
|
||||
SDL_OnApplicationDidChangeStatusBarOrientation();
|
||||
SDL_OnApplicationDidChangeStatusBarOrientation();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -191,7 +191,7 @@ UIKit_InitModes(_THIS)
|
|||
}
|
||||
}
|
||||
#if !TARGET_OS_TV
|
||||
SDL_OnApplicationDidChangeStatusBarOrientation();
|
||||
SDL_OnApplicationDidChangeStatusBarOrientation();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -252,34 +252,34 @@ extern int SDL_AppleTVRemoteOpenedAsJoystick;
|
|||
|
||||
- (void)pressesBegan:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
|
||||
{
|
||||
if (!SDL_AppleTVRemoteOpenedAsJoystick) {
|
||||
for (UIPress *press in presses) {
|
||||
SDL_Scancode scancode = [self scancodeFromPressType:press.type];
|
||||
SDL_SendKeyboardKey(SDL_PRESSED, scancode);
|
||||
}
|
||||
}
|
||||
if (!SDL_AppleTVRemoteOpenedAsJoystick) {
|
||||
for (UIPress *press in presses) {
|
||||
SDL_Scancode scancode = [self scancodeFromPressType:press.type];
|
||||
SDL_SendKeyboardKey(SDL_PRESSED, scancode);
|
||||
}
|
||||
}
|
||||
[super pressesBegan:presses withEvent:event];
|
||||
}
|
||||
|
||||
- (void)pressesEnded:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
|
||||
{
|
||||
if (!SDL_AppleTVRemoteOpenedAsJoystick) {
|
||||
for (UIPress *press in presses) {
|
||||
SDL_Scancode scancode = [self scancodeFromPressType:press.type];
|
||||
SDL_SendKeyboardKey(SDL_RELEASED, scancode);
|
||||
}
|
||||
}
|
||||
if (!SDL_AppleTVRemoteOpenedAsJoystick) {
|
||||
for (UIPress *press in presses) {
|
||||
SDL_Scancode scancode = [self scancodeFromPressType:press.type];
|
||||
SDL_SendKeyboardKey(SDL_RELEASED, scancode);
|
||||
}
|
||||
}
|
||||
[super pressesEnded:presses withEvent:event];
|
||||
}
|
||||
|
||||
- (void)pressesCancelled:(NSSet<UIPress *> *)presses withEvent:(UIPressesEvent *)event
|
||||
{
|
||||
if (!SDL_AppleTVRemoteOpenedAsJoystick) {
|
||||
for (UIPress *press in presses) {
|
||||
SDL_Scancode scancode = [self scancodeFromPressType:press.type];
|
||||
SDL_SendKeyboardKey(SDL_RELEASED, scancode);
|
||||
}
|
||||
}
|
||||
if (!SDL_AppleTVRemoteOpenedAsJoystick) {
|
||||
for (UIPress *press in presses) {
|
||||
SDL_Scancode scancode = [self scancodeFromPressType:press.type];
|
||||
SDL_SendKeyboardKey(SDL_RELEASED, scancode);
|
||||
}
|
||||
}
|
||||
[super pressesCancelled:presses withEvent:event];
|
||||
}
|
||||
|
||||
|
|
|
@ -747,7 +747,7 @@ static const struct wl_data_offer_listener data_offer_listener = {
|
|||
|
||||
static void
|
||||
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;
|
||||
|
||||
|
@ -765,7 +765,7 @@ data_device_handle_data_offer(void *data, struct wl_data_device *wl_data_device,
|
|||
|
||||
static void
|
||||
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)
|
||||
{
|
||||
SDL_WaylandDataDevice *data_device = data;
|
||||
|
@ -808,7 +808,7 @@ data_device_handle_leave(void *data, struct wl_data_device *wl_data_device)
|
|||
|
||||
static void
|
||||
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
|
||||
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_WaylandDataOffer *offer = NULL;
|
||||
|
|
|
@ -89,9 +89,9 @@ touch_handle_touch(void *data,
|
|||
*/
|
||||
|
||||
SDL_TouchID deviceId = 1;
|
||||
if (SDL_AddTouch(deviceId, "qt_touch_extension") < 0) {
|
||||
SDL_Log("error: can't add touch %s, %d", __FILE__, __LINE__);
|
||||
}
|
||||
if (SDL_AddTouch(deviceId, "qt_touch_extension") < 0) {
|
||||
SDL_Log("error: can't add touch %s, %d", __FILE__, __LINE__);
|
||||
}
|
||||
|
||||
switch (touchState) {
|
||||
case QtWaylandTouchPointPressed:
|
||||
|
|
|
@ -68,10 +68,10 @@ static char *
|
|||
get_classname()
|
||||
{
|
||||
/* !!! FIXME: this is probably wrong, albeit harmless in many common cases. From protocol spec:
|
||||
"The surface class identifies the general class of applications
|
||||
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
|
||||
the application's .desktop file as the class." */
|
||||
"The surface class identifies the general class of applications
|
||||
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
|
||||
the application's .desktop file as the class." */
|
||||
|
||||
char *spot;
|
||||
#if defined(__LINUX__) || defined(__FREEBSD__)
|
||||
|
|
|
@ -134,10 +134,10 @@ static const struct zxdg_surface_v6_listener shell_surface_listener_zxdg = {
|
|||
|
||||
static void
|
||||
handle_configure_zxdg_toplevel(void *data,
|
||||
struct zxdg_toplevel_v6 *zxdg_toplevel_v6,
|
||||
int32_t width,
|
||||
int32_t height,
|
||||
struct wl_array *states)
|
||||
struct zxdg_toplevel_v6 *zxdg_toplevel_v6,
|
||||
int32_t width,
|
||||
int32_t height,
|
||||
struct wl_array *states)
|
||||
{
|
||||
SDL_WindowData *wind = (SDL_WindowData *)data;
|
||||
SDL_Window *window = wind->sdlwindow;
|
||||
|
@ -213,10 +213,10 @@ static const struct xdg_surface_listener shell_surface_listener_xdg = {
|
|||
|
||||
static void
|
||||
handle_configure_xdg_toplevel(void *data,
|
||||
struct xdg_toplevel *xdg_toplevel,
|
||||
int32_t width,
|
||||
int32_t height,
|
||||
struct wl_array *states)
|
||||
struct xdg_toplevel *xdg_toplevel,
|
||||
int32_t width,
|
||||
int32_t height,
|
||||
struct wl_array *states)
|
||||
{
|
||||
SDL_WindowData *wind = (SDL_WindowData *)data;
|
||||
SDL_Window *window = wind->sdlwindow;
|
||||
|
|
|
@ -33,31 +33,31 @@ struct SDL_GLDriverData
|
|||
SDL_bool HAS_WGL_ARB_create_context_robustness;
|
||||
SDL_bool HAS_WGL_ARB_create_context_no_error;
|
||||
|
||||
/* Max version of OpenGL ES context that can be created if the
|
||||
implementation supports WGL_EXT_create_context_es2_profile.
|
||||
major = minor = 0 when unsupported.
|
||||
*/
|
||||
struct {
|
||||
int major;
|
||||
int minor;
|
||||
} es_profile_max_supported_version;
|
||||
/* Max version of OpenGL ES context that can be created if the
|
||||
implementation supports WGL_EXT_create_context_es2_profile.
|
||||
major = minor = 0 when unsupported.
|
||||
*/
|
||||
struct {
|
||||
int major;
|
||||
int minor;
|
||||
} es_profile_max_supported_version;
|
||||
|
||||
void *(WINAPI * wglGetProcAddress) (const char *proc);
|
||||
HGLRC(WINAPI * wglCreateContext) (HDC hdc);
|
||||
BOOL(WINAPI * wglDeleteContext) (HGLRC hglrc);
|
||||
BOOL(WINAPI * wglMakeCurrent) (HDC hdc, HGLRC hglrc);
|
||||
BOOL(WINAPI * wglShareLists) (HGLRC hglrc1, HGLRC hglrc2);
|
||||
BOOL(WINAPI * wglChoosePixelFormatARB) (HDC hdc,
|
||||
const int *piAttribIList,
|
||||
const FLOAT * pfAttribFList,
|
||||
UINT nMaxFormats,
|
||||
int *piFormats,
|
||||
UINT * nNumFormats);
|
||||
BOOL(WINAPI * wglGetPixelFormatAttribivARB) (HDC hdc, int iPixelFormat,
|
||||
int iLayerPlane,
|
||||
UINT nAttributes,
|
||||
const int *piAttributes,
|
||||
int *piValues);
|
||||
void *(WINAPI * wglGetProcAddress) (const char *proc);
|
||||
HGLRC(WINAPI * wglCreateContext) (HDC hdc);
|
||||
BOOL(WINAPI * wglDeleteContext) (HGLRC hglrc);
|
||||
BOOL(WINAPI * wglMakeCurrent) (HDC hdc, HGLRC hglrc);
|
||||
BOOL(WINAPI * wglShareLists) (HGLRC hglrc1, HGLRC hglrc2);
|
||||
BOOL(WINAPI * wglChoosePixelFormatARB) (HDC hdc,
|
||||
const int *piAttribIList,
|
||||
const FLOAT * pfAttribFList,
|
||||
UINT nMaxFormats,
|
||||
int *piFormats,
|
||||
UINT * nNumFormats);
|
||||
BOOL(WINAPI * wglGetPixelFormatAttribivARB) (HDC hdc, int iPixelFormat,
|
||||
int iLayerPlane,
|
||||
UINT nAttributes,
|
||||
const int *piAttributes,
|
||||
int *piValues);
|
||||
BOOL (WINAPI * wglSwapIntervalEXT) (int interval);
|
||||
int (WINAPI * wglGetSwapIntervalEXT) (void);
|
||||
};
|
||||
|
|
|
@ -40,7 +40,7 @@ int WIN_Vulkan_LoadLibrary(_THIS, const char *path)
|
|||
{
|
||||
VkExtensionProperties *extensions = NULL;
|
||||
Uint32 extensionCount = 0;
|
||||
Uint32 i;
|
||||
Uint32 i;
|
||||
SDL_bool hasSurfaceExtension = SDL_FALSE;
|
||||
SDL_bool hasWin32SurfaceExtension = SDL_FALSE;
|
||||
PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL;
|
||||
|
|
|
@ -38,14 +38,14 @@ struct SDL_GLDriverData
|
|||
SDL_bool HAS_GLX_ARB_create_context_robustness;
|
||||
SDL_bool HAS_GLX_ARB_create_context_no_error;
|
||||
|
||||
/* Max version of OpenGL ES context that can be created if the
|
||||
implementation supports GLX_EXT_create_context_es2_profile.
|
||||
major = minor = 0 when unsupported.
|
||||
*/
|
||||
struct {
|
||||
int major;
|
||||
int minor;
|
||||
} es_profile_max_supported_version;
|
||||
/* Max version of OpenGL ES context that can be created if the
|
||||
implementation supports GLX_EXT_create_context_es2_profile.
|
||||
major = minor = 0 when unsupported.
|
||||
*/
|
||||
struct {
|
||||
int major;
|
||||
int minor;
|
||||
} es_profile_max_supported_version;
|
||||
|
||||
Bool (*glXQueryExtension) (Display*,int*,int*);
|
||||
void *(*glXGetProcAddress) (const GLubyte*);
|
||||
|
|
|
@ -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(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(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(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)
|
||||
|
@ -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(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(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*,Xutf8ResetIC,(XIC a),(a),return)
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue