Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libSDL
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PocketInsanity
libSDL
Commits
1d7cfea7
Commit
1d7cfea7
authored
Oct 18, 2011
by
Ryan C. Gordon
Browse files
Options
Browse Files
Download
Plain Diff
Merged with Kees Bakker's repo at
https://bitbucket.org/keestux/sdl
...
parents
eecf78dc
b5692bd2
Changes
34
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
34 changed files
with
310 additions
and
351 deletions
+310
-351
default.properties
android-project/default.properties
+1
-1
SDLActivity.java
android-project/src/org/libsdl/app/SDLActivity.java
+40
-13
configure.in
configure.in
+38
-0
SDL_config_iphoneos.h
include/SDL_config_iphoneos.h
+3
-0
SDL_rwops.h
include/SDL_rwops.h
+0
-1
SDL_spinlock.c
src/atomic/SDL_spinlock.c
+3
-2
SDL_audiotypecvt.c
src/audio/SDL_audiotypecvt.c
+0
-200
sdlgenaudiocvt.pl
src/audio/sdlgenaudiocvt.pl
+1
-2
SDL_android.cpp
src/core/android/SDL_android.cpp
+77
-18
SDL_cpuinfo.c
src/cpuinfo/SDL_cpuinfo.c
+3
-0
SDL_gesture.c
src/events/SDL_gesture.c
+2
-1
SDL_mouse.c
src/events/SDL_mouse.c
+0
-1
SDL_syspower.c
src/power/linux/SDL_syspower.c
+0
-8
SDL_render_gl.c
src/render/opengl/SDL_render_gl.c
+0
-2
SDL_blendline.c
src/render/software/SDL_blendline.c
+0
-4
SDL_draw.h
src/render/software/SDL_draw.h
+4
-4
SDL_systhread.c
src/thread/beos/SDL_systhread.c
+2
-1
SDL_syssem.c
src/thread/pthread/SDL_syssem.c
+1
-0
SDL_systhread.c
src/thread/pthread/SDL_systhread.c
+8
-3
SDL_systhread.c
src/thread/windows/SDL_systhread.c
+20
-18
SDL_androidgl.c
src/video/android/SDL_androidgl.c
+21
-4
SDL_androidtouch.c
src/video/android/SDL_androidtouch.c
+40
-11
SDL_androidtouch.h
src/video/android/SDL_androidtouch.h
+1
-1
SDL_uikitvideo.m
src/video/uikit/SDL_uikitvideo.m
+8
-6
SDL_uikitwindow.m
src/video/uikit/SDL_uikitwindow.m
+6
-1
SDL_windowswindow.c
src/video/windows/SDL_windowswindow.c
+2
-1
SDL_x11events.c
src/video/x11/SDL_x11events.c
+6
-3
SDL_x11framebuffer.c
src/video/x11/SDL_x11framebuffer.c
+3
-0
SDL_x11mouse.c
src/video/x11/SDL_x11mouse.c
+1
-1
SDL_x11opengl.c
src/video/x11/SDL_x11opengl.c
+5
-3
SDL_x11shape.c
src/video/x11/SDL_x11shape.c
+1
-0
SDL_x11sym.h
src/video/x11/SDL_x11sym.h
+11
-11
SDL_x11touch.c
src/video/x11/SDL_x11touch.c
+1
-2
SDL_x11window.c
src/video/x11/SDL_x11window.c
+1
-28
No files found.
android-project/default.properties
View file @
1d7cfea7
...
@@ -8,4 +8,4 @@
...
@@ -8,4 +8,4 @@
# project structure.
# project structure.
# Project target.
# Project target.
target
=
android-
4
target
=
android-
5
android-project/src/org/libsdl/app/SDLActivity.java
View file @
1d7cfea7
package
org
.
libsdl
.
app
;
package
org
.
libsdl
.
app
;
import
javax.microedition.khronos.egl.EGL10
;
import
javax.microedition.khronos.egl.EGLConfig
;
import
javax.microedition.khronos.egl.EGLConfig
;
import
javax.microedition.khronos.egl.EGLContext
;
import
javax.microedition.khronos.opengles.GL10
;
import
javax.microedition.khronos.opengles.GL10
;
import
javax.microedition.khronos.egl.*
;
import
javax.microedition.khronos.egl.*
;
...
@@ -93,7 +95,8 @@ public class SDLActivity extends Activity {
...
@@ -93,7 +95,8 @@ public class SDLActivity extends Activity {
public
static
native
void
onNativeResize
(
int
x
,
int
y
,
int
format
);
public
static
native
void
onNativeResize
(
int
x
,
int
y
,
int
format
);
public
static
native
void
onNativeKeyDown
(
int
keycode
);
public
static
native
void
onNativeKeyDown
(
int
keycode
);
public
static
native
void
onNativeKeyUp
(
int
keycode
);
public
static
native
void
onNativeKeyUp
(
int
keycode
);
public
static
native
void
onNativeTouch
(
int
action
,
float
x
,
public
static
native
void
onNativeTouch
(
int
touchDevId
,
int
pointerFingerId
,
int
action
,
float
x
,
float
y
,
float
p
);
float
y
,
float
p
);
public
static
native
void
onNativeAccel
(
float
x
,
float
y
,
float
z
);
public
static
native
void
onNativeAccel
(
float
x
,
float
y
,
float
z
);
public
static
native
void
nativeRunAudioThread
();
public
static
native
void
nativeRunAudioThread
();
...
@@ -387,7 +390,13 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
...
@@ -387,7 +390,13 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
}
}
EGLConfig
config
=
configs
[
0
];
EGLConfig
config
=
configs
[
0
];
EGLContext
ctx
=
egl
.
eglCreateContext
(
dpy
,
config
,
EGL10
.
EGL_NO_CONTEXT
,
null
);
int
EGL_CONTEXT_CLIENT_VERSION
=
0x3098
;
int
contextAttrs
[]
=
new
int
[]
{
EGL_CONTEXT_CLIENT_VERSION
,
majorVersion
,
EGL10
.
EGL_NONE
};
EGLContext
ctx
=
egl
.
eglCreateContext
(
dpy
,
config
,
EGL10
.
EGL_NO_CONTEXT
,
contextAttrs
);
if
(
ctx
==
EGL10
.
EGL_NO_CONTEXT
)
{
if
(
ctx
==
EGL10
.
EGL_NO_CONTEXT
)
{
Log
.
e
(
"SDL"
,
"Couldn't create context"
);
Log
.
e
(
"SDL"
,
"Couldn't create context"
);
return
false
;
return
false
;
...
@@ -423,7 +432,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
...
@@ -423,7 +432,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
try
{
try
{
EGL10
egl
=
(
EGL10
)
EGLContext
.
getEGL
();
EGL10
egl
=
(
EGL10
)
EGLContext
.
getEGL
();
egl
.
eglWaitNative
(
EGL10
.
EGL_
NATIVE_RENDERABL
E
,
null
);
egl
.
eglWaitNative
(
EGL10
.
EGL_
CORE_NATIVE_ENGIN
E
,
null
);
// drawing here
// drawing here
...
@@ -459,14 +468,32 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
...
@@ -459,14 +468,32 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
// Touch events
// Touch events
public
boolean
onTouch
(
View
v
,
MotionEvent
event
)
{
public
boolean
onTouch
(
View
v
,
MotionEvent
event
)
{
{
int
action
=
event
.
getAction
();
final
int
touchDevId
=
event
.
getDeviceId
();
float
x
=
event
.
getX
();
final
int
pointerCount
=
event
.
getPointerCount
();
float
y
=
event
.
getY
();
// touchId, pointerId, action, x, y, pressure
float
p
=
event
.
getPressure
();
int
actionPointerIndex
=
event
.
getActionIndex
();
int
pointerFingerId
=
event
.
getPointerId
(
actionPointerIndex
);
// TODO: Anything else we need to pass?
int
action
=
event
.
getActionMasked
();
SDLActivity
.
onNativeTouch
(
action
,
x
,
y
,
p
);
float
x
=
event
.
getX
(
actionPointerIndex
);
float
y
=
event
.
getY
(
actionPointerIndex
);
float
p
=
event
.
getPressure
(
actionPointerIndex
);
if
(
action
==
MotionEvent
.
ACTION_MOVE
&&
pointerCount
>
1
)
{
// TODO send motion to every pointer if its position has
// changed since prev event.
for
(
int
i
=
0
;
i
<
pointerCount
;
i
++)
{
pointerFingerId
=
event
.
getPointerId
(
i
);
x
=
event
.
getX
(
i
);
y
=
event
.
getY
(
i
);
p
=
event
.
getPressure
(
i
);
SDLActivity
.
onNativeTouch
(
touchDevId
,
pointerFingerId
,
action
,
x
,
y
,
p
);
}
}
else
{
SDLActivity
.
onNativeTouch
(
touchDevId
,
pointerFingerId
,
action
,
x
,
y
,
p
);
}
}
return
true
;
return
true
;
}
}
...
...
configure.in
View file @
1d7cfea7
...
@@ -939,6 +939,41 @@ CheckVisibilityHidden()
...
@@ -939,6 +939,41 @@ CheckVisibilityHidden()
fi
fi
}
}
dnl See if GCC's -Wall is supported.
CheckWarnAll()
{
AC_MSG_CHECKING(for GCC -Wall option)
have_gcc_Wall=no
save_CFLAGS="$CFLAGS"
CFLAGS="$save_CFLAGS -Wall"
AC_TRY_COMPILE([
int x = 0;
],[
],[
have_gcc_Wall=yes
])
AC_MSG_RESULT($have_gcc_Wall)
CFLAGS="$save_CFLAGS"
if test x$have_gcc_Wall = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -Wall"
dnl Haiku headers use multicharacter constants all over the place. Ignore these warnings when using -Wall.
AC_MSG_CHECKING(for necessary GCC -Wno-multichar option)
need_gcc_Wno_multichar=no
case "$host" in
*-*-beos* | *-*-haiku*)
need_gcc_Wno_multichar=yes
;;
esac
AC_MSG_RESULT($need_gcc_Wno_multichar)
if test x$need_gcc_Wno_multichar = xyes; then
EXTRA_CFLAGS="$EXTRA_CFLAGS -Wno-multichar"
fi
fi
}
dnl Find the X11 include and library directories
dnl Find the X11 include and library directories
CheckX11()
CheckX11()
...
@@ -2356,6 +2391,9 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
...
@@ -2356,6 +2391,9 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
;;
;;
esac
esac
dnl Do this on all platforms, after everything else.
CheckWarnAll
# Verify that we have all the platform specific files we need
# Verify that we have all the platform specific files we need
if test x$have_joystick != xyes; then
if test x$have_joystick != xyes; then
...
...
include/SDL_config_iphoneos.h
View file @
1d7cfea7
...
@@ -140,6 +140,9 @@
...
@@ -140,6 +140,9 @@
/* enable iPhone keyboard support */
/* enable iPhone keyboard support */
#define SDL_IPHONE_KEYBOARD 1
#define SDL_IPHONE_KEYBOARD 1
/* enable joystick subsystem */
#define SDL_JOYSTICK_DISABLED 0
/* Set max recognized G-force from accelerometer
/* Set max recognized G-force from accelerometer
See src/joystick/uikit/SDLUIAccelerationDelegate.m for notes on why this is needed
See src/joystick/uikit/SDLUIAccelerationDelegate.m for notes on why this is needed
*/
*/
...
...
include/SDL_rwops.h
View file @
1d7cfea7
...
@@ -89,7 +89,6 @@ typedef struct SDL_RWops
...
@@ -89,7 +89,6 @@ typedef struct SDL_RWops
void
*
fileNameRef
;
void
*
fileNameRef
;
void
*
inputStream
;
void
*
inputStream
;
void
*
inputStreamRef
;
void
*
inputStreamRef
;
void
*
skipMethod
;
void
*
readableByteChannel
;
void
*
readableByteChannel
;
void
*
readableByteChannelRef
;
void
*
readableByteChannelRef
;
void
*
readMethod
;
void
*
readMethod
;
...
...
src/atomic/SDL_spinlock.c
View file @
1d7cfea7
...
@@ -60,7 +60,8 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
...
@@ -60,7 +60,8 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
#elif defined(__GNUC__) && defined(__arm__) && \
#elif defined(__GNUC__) && defined(__arm__) && \
(defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) || \
(defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) || \
defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5TE__))
defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5TE__) || \
defined(__ARM_ARCH_5TEJ__))
int
result
;
int
result
;
__asm__
__volatile__
(
__asm__
__volatile__
(
"swp %0, %1, [%2]
\n
"
"swp %0, %1, [%2]
\n
"
...
@@ -81,7 +82,7 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
...
@@ -81,7 +82,7 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
:
"=r"
(
result
)
:
"r"
(
lock
),
"0"
(
1
)
:
"cc"
,
"memory"
);
:
"=r"
(
result
)
:
"r"
(
lock
),
"0"
(
1
)
:
"cc"
,
"memory"
);
return
(
result
==
0
);
return
(
result
==
0
);
#elif defined(__MACOSX__)
#elif defined(__MACOSX__)
|| defined(__IPHONEOS__)
/* Maybe used for PowerPC, but the Intel asm or gcc atomics are favored. */
/* Maybe used for PowerPC, but the Intel asm or gcc atomics are favored. */
return
OSAtomicCompareAndSwap32Barrier
(
0
,
1
,
lock
);
return
OSAtomicCompareAndSwap32Barrier
(
0
,
1
,
lock
);
...
...
src/audio/SDL_audiotypecvt.c
View file @
1d7cfea7
This diff is collapsed.
Click to expand it.
src/audio/sdlgenaudiocvt.pl
View file @
1d7cfea7
...
@@ -38,7 +38,7 @@ sub outputHeader {
...
@@ -38,7 +38,7 @@ sub outputHeader {
/* DO NOT EDIT! This file is generated by sdlgenaudiocvt.pl */
/* DO NOT EDIT! This file is generated by sdlgenaudiocvt.pl */
/*
/*
Simple DirectMedia Layer
Simple DirectMedia Layer
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2011 Sam Lantinga <slouken
\
@libsdl.org>
This software is provided 'as-is', without any express or implied
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
warranty. In no event will the authors be held liable for any damages
...
@@ -536,7 +536,6 @@ ${sym}(SDL_AudioCVT * cvt, SDL_AudioFormat format)
...
@@ -536,7 +536,6 @@ ${sym}(SDL_AudioCVT * cvt, SDL_AudioFormat format)
fprintf(stderr, "$resample (x${multiple}) AUDIO_${from}, ${channels} channels.\\n");
fprintf(stderr, "$resample (x${multiple}) AUDIO_${from}, ${channels} channels.\\n");
#endif
#endif
const int srcsize = cvt->len_cvt;
const int dstsize = cvt->len_cvt $lencvtop $multiple;
const int dstsize = cvt->len_cvt $lencvtop $multiple;
EOF
EOF
...
...
src/core/android/SDL_android.cpp
View file @
1d7cfea7
...
@@ -29,6 +29,14 @@ extern "C" {
...
@@ -29,6 +29,14 @@ extern "C" {
#include "../../video/android/SDL_androidtouch.h"
#include "../../video/android/SDL_androidtouch.h"
#include "../../video/android/SDL_androidvideo.h"
#include "../../video/android/SDL_androidvideo.h"
#include <android/log.h>
#define LOG_TAG "SDL_android"
//#define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__)
//#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)
#define LOGI(...) do {} while (false)
#define LOGE(...) do {} while (false)
/* Impelemented in audio/android/SDL_androidaudio.c */
/* Impelemented in audio/android/SDL_androidaudio.c */
extern
void
Android_RunAudioThread
();
extern
void
Android_RunAudioThread
();
}
// C
}
// C
...
@@ -45,6 +53,7 @@ extern void Android_RunAudioThread();
...
@@ -45,6 +53,7 @@ extern void Android_RunAudioThread();
*******************************************************************************/
*******************************************************************************/
static
JNIEnv
*
mEnv
=
NULL
;
static
JNIEnv
*
mEnv
=
NULL
;
static
JNIEnv
*
mAudioEnv
=
NULL
;
static
JNIEnv
*
mAudioEnv
=
NULL
;
static
JavaVM
*
mJavaVM
;
// Main activity
// Main activity
static
jclass
mActivityClass
;
static
jclass
mActivityClass
;
...
@@ -68,6 +77,14 @@ static float fLastAccelerometer[3];
...
@@ -68,6 +77,14 @@ static float fLastAccelerometer[3];
// Library init
// Library init
extern
"C"
jint
JNI_OnLoad
(
JavaVM
*
vm
,
void
*
reserved
)
extern
"C"
jint
JNI_OnLoad
(
JavaVM
*
vm
,
void
*
reserved
)
{
{
JNIEnv
*
env
;
mJavaVM
=
vm
;
LOGI
(
"JNI_OnLoad called"
);
if
(
mJavaVM
->
GetEnv
((
void
**
)
&
env
,
JNI_VERSION_1_4
)
!=
JNI_OK
)
{
LOGE
(
"Failed to get the environment using GetEnv()"
);
return
-
1
;
}
return
JNI_VERSION_1_4
;
return
JNI_VERSION_1_4
;
}
}
...
@@ -96,6 +113,7 @@ extern "C" void SDL_Android_Init(JNIEnv* env, jclass cls)
...
@@ -96,6 +113,7 @@ extern "C" void SDL_Android_Init(JNIEnv* env, jclass cls)
!
midAudioWriteShortBuffer
||
!
midAudioWriteByteBuffer
||
!
midAudioQuit
)
{
!
midAudioWriteShortBuffer
||
!
midAudioWriteByteBuffer
||
!
midAudioQuit
)
{
__android_log_print
(
ANDROID_LOG_WARN
,
"SDL"
,
"SDL: Couldn't locate Java callbacks, check that they're named and typed correctly"
);
__android_log_print
(
ANDROID_LOG_WARN
,
"SDL"
,
"SDL: Couldn't locate Java callbacks, check that they're named and typed correctly"
);
}
}
__android_log_print
(
ANDROID_LOG_INFO
,
"SDL"
,
"SDL_Android_Init() finished!"
);
}
}
// Resize
// Resize
...
@@ -123,9 +141,10 @@ extern "C" void Java_org_libsdl_app_SDLActivity_onNativeKeyUp(
...
@@ -123,9 +141,10 @@ extern "C" void Java_org_libsdl_app_SDLActivity_onNativeKeyUp(
// Touch
// Touch
extern
"C"
void
Java_org_libsdl_app_SDLActivity_onNativeTouch
(
extern
"C"
void
Java_org_libsdl_app_SDLActivity_onNativeTouch
(
JNIEnv
*
env
,
jclass
jcls
,
JNIEnv
*
env
,
jclass
jcls
,
jint
touch_device_id_in
,
jint
pointer_finger_id_in
,
jint
action
,
jfloat
x
,
jfloat
y
,
jfloat
p
)
jint
action
,
jfloat
x
,
jfloat
y
,
jfloat
p
)
{
{
Android_OnTouch
(
action
,
x
,
y
,
p
);
Android_OnTouch
(
touch_device_id_in
,
pointer_finger_id_in
,
action
,
x
,
y
,
p
);
}
}
// Accelerometer
// Accelerometer
...
@@ -203,30 +222,49 @@ extern "C" int Android_JNI_OpenAudioDevice(int sampleRate, int is16Bit, int chan
...
@@ -203,30 +222,49 @@ extern "C" int Android_JNI_OpenAudioDevice(int sampleRate, int is16Bit, int chan
{
{
int
audioBufferFrames
;
int
audioBufferFrames
;
int
status
;
JNIEnv
*
env
;
static
bool
isAttached
=
false
;
status
=
mJavaVM
->
GetEnv
((
void
**
)
&
env
,
JNI_VERSION_1_4
);
if
(
status
<
0
)
{
LOGE
(
"callback_handler: failed to get JNI environment, assuming native thread"
);
status
=
mJavaVM
->
AttachCurrentThread
(
&
env
,
NULL
);
if
(
status
<
0
)
{
LOGE
(
"callback_handler: failed to attach current thread"
);
return
0
;
}
isAttached
=
true
;
}
__android_log_print
(
ANDROID_LOG_VERBOSE
,
"SDL"
,
"SDL audio: opening device"
);
__android_log_print
(
ANDROID_LOG_VERBOSE
,
"SDL"
,
"SDL audio: opening device"
);
audioBuffer16Bit
=
is16Bit
;
audioBuffer16Bit
=
is16Bit
;
audioBufferStereo
=
channelCount
>
1
;
audioBufferStereo
=
channelCount
>
1
;
audioBuffer
=
mE
nv
->
CallStaticObjectMethod
(
mActivityClass
,
midAudioInit
,
sampleRate
,
audioBuffer16Bit
,
audioBufferStereo
,
desiredBufferFrames
);
audioBuffer
=
e
nv
->
CallStaticObjectMethod
(
mActivityClass
,
midAudioInit
,
sampleRate
,
audioBuffer16Bit
,
audioBufferStereo
,
desiredBufferFrames
);
if
(
audioBuffer
==
NULL
)
{
if
(
audioBuffer
==
NULL
)
{
__android_log_print
(
ANDROID_LOG_WARN
,
"SDL"
,
"SDL audio: didn't get back a good audio buffer!"
);
__android_log_print
(
ANDROID_LOG_WARN
,
"SDL"
,
"SDL audio: didn't get back a good audio buffer!"
);
return
0
;
return
0
;
}
}
audioBuffer
=
mE
nv
->
NewGlobalRef
(
audioBuffer
);
audioBuffer
=
e
nv
->
NewGlobalRef
(
audioBuffer
);
jboolean
isCopy
=
JNI_FALSE
;
jboolean
isCopy
=
JNI_FALSE
;
if
(
audioBuffer16Bit
)
{
if
(
audioBuffer16Bit
)
{
audioBufferPinned
=
mE
nv
->
GetShortArrayElements
((
jshortArray
)
audioBuffer
,
&
isCopy
);
audioBufferPinned
=
e
nv
->
GetShortArrayElements
((
jshortArray
)
audioBuffer
,
&
isCopy
);
audioBufferFrames
=
mE
nv
->
GetArrayLength
((
jshortArray
)
audioBuffer
);
audioBufferFrames
=
e
nv
->
GetArrayLength
((
jshortArray
)
audioBuffer
);
}
else
{
}
else
{
audioBufferPinned
=
mE
nv
->
GetByteArrayElements
((
jbyteArray
)
audioBuffer
,
&
isCopy
);
audioBufferPinned
=
e
nv
->
GetByteArrayElements
((
jbyteArray
)
audioBuffer
,
&
isCopy
);
audioBufferFrames
=
mE
nv
->
GetArrayLength
((
jbyteArray
)
audioBuffer
);
audioBufferFrames
=
e
nv
->
GetArrayLength
((
jbyteArray
)
audioBuffer
);
}
}
if
(
audioBufferStereo
)
{
if
(
audioBufferStereo
)
{
audioBufferFrames
/=
2
;
audioBufferFrames
/=
2
;
}
}
if
(
isAttached
)
{
mJavaVM
->
DetachCurrentThread
();
}
return
audioBufferFrames
;
return
audioBufferFrames
;
}
}
...
@@ -250,13 +288,31 @@ extern "C" void Android_JNI_WriteAudioBuffer()
...
@@ -250,13 +288,31 @@ extern "C" void Android_JNI_WriteAudioBuffer()
extern
"C"
void
Android_JNI_CloseAudioDevice
()
extern
"C"
void
Android_JNI_CloseAudioDevice
()
{
{
mEnv
->
CallStaticVoidMethod
(
mActivityClass
,
midAudioQuit
);
int
status
;
JNIEnv
*
env
;
static
bool
isAttached
=
false
;
status
=
mJavaVM
->
GetEnv
((
void
**
)
&
env
,
JNI_VERSION_1_4
);
if
(
status
<
0
)
{
LOGE
(
"callback_handler: failed to get JNI environment, assuming native thread"
);
status
=
mJavaVM
->
AttachCurrentThread
(
&
env
,
NULL
);
if
(
status
<
0
)
{
LOGE
(
"callback_handler: failed to attach current thread"
);
return
;
}
isAttached
=
true
;
}
env
->
CallStaticVoidMethod
(
mActivityClass
,
midAudioQuit
);
if
(
audioBuffer
)
{
if
(
audioBuffer
)
{
mE
nv
->
DeleteGlobalRef
(
audioBuffer
);
e
nv
->
DeleteGlobalRef
(
audioBuffer
);
audioBuffer
=
NULL
;
audioBuffer
=
NULL
;
audioBufferPinned
=
NULL
;
audioBufferPinned
=
NULL
;
}
}
if
(
isAttached
)
{
mJavaVM
->
DetachCurrentThread
();
}
}
}
// Test for an exception and call SDL_SetError with its detail if one occurs
// Test for an exception and call SDL_SetError with its detail if one occurs
...
@@ -345,11 +401,6 @@ static int Android_JNI_FileOpen(SDL_RWops* ctx)
...
@@ -345,11 +401,6 @@ static int Android_JNI_FileOpen(SDL_RWops* ctx)
ctx
->
hidden
.
androidio
.
inputStream
=
inputStream
;
ctx
->
hidden
.
androidio
.
inputStream
=
inputStream
;
ctx
->
hidden
.
androidio
.
inputStreamRef
=
mEnv
->
NewGlobalRef
(
inputStream
);
ctx
->
hidden
.
androidio
.
inputStreamRef
=
mEnv
->
NewGlobalRef
(
inputStream
);
// Store .skip id for seeking purposes
mid
=
mEnv
->
GetMethodID
(
mEnv
->
GetObjectClass
(
inputStream
),
"skip"
,
"(J)J"
);
ctx
->
hidden
.
androidio
.
skipMethod
=
mid
;
// Despite all the visible documentation on [Asset]InputStream claiming
// Despite all the visible documentation on [Asset]InputStream claiming
// that the .available() method is not guaranteed to return the entire file
// that the .available() method is not guaranteed to return the entire file
// size, comments in <sdk>/samples/<ver>/ApiDemos/src/com/example/ ...
// size, comments in <sdk>/samples/<ver>/ApiDemos/src/com/example/ ...
...
@@ -517,16 +568,24 @@ extern "C" long Android_JNI_FileSeek(SDL_RWops* ctx, long offset, int whence)
...
@@ -517,16 +568,24 @@ extern "C" long Android_JNI_FileSeek(SDL_RWops* ctx, long offset, int whence)
long
movement
=
newPosition
-
ctx
->
hidden
.
androidio
.
position
;
long
movement
=
newPosition
-
ctx
->
hidden
.
androidio
.
position
;
jobject
inputStream
=
(
jobject
)
ctx
->
hidden
.
androidio
.
inputStream
;
jobject
inputStream
=
(
jobject
)
ctx
->
hidden
.
androidio
.
inputStream
;
jmethodID
skipMethod
=
(
jmethodID
)
ctx
->
hidden
.
androidio
.
skipMethod
;
if
(
movement
>
0
)
{
if
(
movement
>
0
)
{
unsigned
char
buffer
[
1024
];
// The easy case where we're seeking forwards
// The easy case where we're seeking forwards
while
(
movement
>
0
)
{
while
(
movement
>
0
)
{
// inputStream.skip(...);
long
amount
=
(
long
)
sizeof
(
buffer
);
movement
-=
mEnv
->
CallLongMethod
(
inputStream
,
skipMethod
,
movement
);
if
(
amount
>
movement
)
{
if
(
Android_JNI_ExceptionOccurred
())
{
amount
=
movement
;
}
size_t
result
=
Android_JNI_FileRead
(
ctx
,
buffer
,
1
,
amount
);
if
(
result
<=
0
)
{
// Failed to read/skip the required amount, so fail
return
-
1
;
return
-
1
;
}
}
movement
-=
result
;
}
}
}
else
if
(
movement
<
0
)
{
}
else
if
(
movement
<
0
)
{
// We can't seek backwards so we have to reopen the file and seek
// We can't seek backwards so we have to reopen the file and seek
...
...
src/cpuinfo/SDL_cpuinfo.c
View file @
1d7cfea7
...
@@ -384,6 +384,8 @@ SDL_GetCPUType(void)
...
@@ -384,6 +384,8 @@ SDL_GetCPUType(void)
return
SDL_CPUType
;
return
SDL_CPUType
;
}
}
#ifdef TEST_MAIN
/* !!! FIXME: only used for test at the moment. */
static
const
char
*
static
const
char
*
SDL_GetCPUName
(
void
)
SDL_GetCPUName
(
void
)
{
{
...
@@ -455,6 +457,7 @@ SDL_GetCPUName(void)
...
@@ -455,6 +457,7 @@ SDL_GetCPUName(void)
}
}
return
SDL_CPUName
;
return
SDL_CPUName
;
}
}
#endif
int
int
SDL_GetCPUCacheLineSize
(
void
)
SDL_GetCPUCacheLineSize
(
void
)
...
...
src/events/SDL_gesture.c
View file @
1d7cfea7
...
@@ -390,10 +390,11 @@ int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points) {
...
@@ -390,10 +390,11 @@ int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points) {
float
dollarRecognize
(
const
SDL_DollarPath
*
path
,
int
*
bestTempl
,
SDL_GestureTouch
*
touch
)
{
float
dollarRecognize
(
const
SDL_DollarPath
*
path
,
int
*
bestTempl
,
SDL_GestureTouch
*
touch
)
{
SDL_FloatPoint
points
[
DOLLARNPOINTS
];
SDL_FloatPoint
points
[
DOLLARNPOINTS
];
int
numPoints
=
dollarNormalize
(
path
,
points
);
int
i
;
int
i
;
float
bestDiff
=
10000
;
float
bestDiff
=
10000
;
dollarNormalize
(
path
,
points
);
//PrintPath(points);
//PrintPath(points);
*
bestTempl
=
-
1
;
*
bestTempl
=
-
1
;
for
(
i
=
0
;
i
<
touch
->
numDollarTemplates
;
i
++
)
{
for
(
i
=
0
;
i
<
touch
->
numDollarTemplates
;
i
++
)
{
...
...
src/events/SDL_mouse.c
View file @
1d7cfea7
...
@@ -349,7 +349,6 @@ SDL_Cursor *
...
@@ -349,7 +349,6 @@ SDL_Cursor *
SDL_CreateCursor
(
const
Uint8
*
data
,
const
Uint8
*
mask
,
SDL_CreateCursor
(
const
Uint8
*
data
,
const
Uint8
*
mask
,
int
w
,
int
h
,
int
hot_x
,
int
hot_y
)
int
w
,
int
h
,
int
hot_x
,
int
hot_y
)
{
{
SDL_Mouse
*
mouse
=
SDL_GetMouse
();
SDL_Surface
*
surface
;
SDL_Surface
*
surface
;
SDL_Cursor
*
cursor
;
SDL_Cursor
*
cursor
;
int
x
,
y
;
int
x
,
y
;
...
...
src/power/linux/SDL_syspower.c
View file @
1d7cfea7
...
@@ -128,7 +128,6 @@ check_proc_acpi_battery(const char * node, SDL_bool * have_battery,
...
@@ -128,7 +128,6 @@ check_proc_acpi_battery(const char * node, SDL_bool * have_battery,
char
*
val
=
NULL
;
char
*
val
=
NULL
;
SDL_bool
charge
=
SDL_FALSE
;
SDL_bool
charge
=
SDL_FALSE
;
SDL_bool
choose
=
SDL_FALSE
;
SDL_bool
choose
=
SDL_FALSE
;
SDL_bool
is_ac
=
SDL_FALSE
;
int
maximum
=
-
1
;
int
maximum
=
-
1
;
int
remaining
=
-
1
;
int
remaining
=
-
1
;
int
secs
=
-
1
;
int
secs
=
-
1
;
...
@@ -214,13 +213,6 @@ check_proc_acpi_ac_adapter(const char * node, SDL_bool * have_ac)
...
@@ -214,13 +213,6 @@ check_proc_acpi_ac_adapter(const char * node, SDL_bool * have_ac)
char
*
ptr
=
NULL
;
char
*
ptr
=
NULL
;
char
*
key
=
NULL
;
char
*
key
=
NULL
;
char
*
val
=
NULL
;
char
*
val
=
NULL
;
SDL_bool
charge
=
SDL_FALSE
;
SDL_bool
choose
=
SDL_FALSE
;
SDL_bool
is_ac
=
SDL_FALSE
;
int
maximum
=
-
1
;
int
remaining
=
-
1
;
int
secs
=
-
1
;
int
pct
=
-
1
;
if
(
!
load_acpi_file
(
base
,
node
,
"state"
,
state
,
sizeof
(
state
)))
{
if
(
!
load_acpi_file
(
base
,
node
,
"state"
,
state
,
sizeof
(
state
)))
{
return
;
return
;
...
...
src/render/opengl/SDL_render_gl.c
View file @
1d7cfea7
...
@@ -348,8 +348,6 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
...
@@ -348,8 +348,6 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags)
static
void
static
void
GL_WindowEvent
(
SDL_Renderer
*
renderer
,
const
SDL_WindowEvent
*
event
)
GL_WindowEvent
(
SDL_Renderer
*
renderer
,
const
SDL_WindowEvent
*
event
)
{
{
GL_RenderData
*
data
=
(
GL_RenderData
*
)
renderer
->
driverdata
;
if
(
event
->
event
==
SDL_WINDOWEVENT_SIZE_CHANGED
)
{
if
(
event
->
event
==
SDL_WINDOWEVENT_SIZE_CHANGED
)
{
/* Rebind the context to the window area and update matrices */
/* Rebind the context to the window area and update matrices */
SDL_CurrentContext
=
NULL
;
SDL_CurrentContext
=
NULL
;
...
...
src/render/software/SDL_blendline.c
View file @
1d7cfea7
...
@@ -124,7 +124,6 @@ SDL_BlendLine_RGB555(SDL_Surface * dst, int x1, int y1, int x2, int y2,
...
@@ -124,7 +124,6 @@ SDL_BlendLine_RGB555(SDL_Surface * dst, int x1, int y1, int x2, int y2,
SDL_BlendMode
blendMode
,
Uint8
_r
,
Uint8
_g
,
Uint8
_b
,
Uint8
_a
,
SDL_BlendMode
blendMode
,
Uint8
_r
,
Uint8
_g
,
Uint8
_b
,
Uint8
_a
,
SDL_bool
draw_end
)
SDL_bool
draw_end
)
{
{
const
SDL_PixelFormat
*
fmt
=
dst
->
format
;
unsigned
r
,
g
,
b
,
a
,
inva
;
unsigned
r
,
g
,
b
,
a
,
inva
;
if
(
blendMode
==
SDL_BLENDMODE_BLEND
||
blendMode
==
SDL_BLENDMODE_ADD
)
{
if
(
blendMode
==
SDL_BLENDMODE_BLEND
||
blendMode
==
SDL_BLENDMODE_ADD
)
{
...
@@ -216,7 +215,6 @@ SDL_BlendLine_RGB565(SDL_Surface * dst, int x1, int y1, int x2, int y2,
...
@@ -216,7 +215,6 @@ SDL_BlendLine_RGB565(SDL_Surface * dst, int x1, int y1, int x2, int y2,
SDL_BlendMode
blendMode
,
Uint8
_r
,
Uint8
_g
,
Uint8
_b
,
Uint8
_a
,
SDL_BlendMode
blendMode
,
Uint8
_r
,
Uint8
_g
,
Uint8
_b
,
Uint8
_a
,
SDL_bool
draw_end
)
SDL_bool
draw_end
)
{
{
const
SDL_PixelFormat
*
fmt
=
dst
->
format
;
unsigned
r
,
g
,
b
,
a
,
inva
;
unsigned
r
,
g
,
b
,
a
,
inva
;
if
(
blendMode
==
SDL_BLENDMODE_BLEND
||
blendMode
==
SDL_BLENDMODE_ADD
)
{
if
(
blendMode
==
SDL_BLENDMODE_BLEND
||
blendMode
==
SDL_BLENDMODE_ADD
)
{
...
@@ -492,7 +490,6 @@ SDL_BlendLine_RGB888(SDL_Surface * dst, int x1, int y1, int x2, int y2,
...
@@ -492,7 +490,6 @@ SDL_BlendLine_RGB888(SDL_Surface * dst, int x1, int y1, int x2, int y2,
SDL_BlendMode
blendMode
,
Uint8
_r
,
Uint8
_g
,
Uint8
_b
,
Uint8
_a
,
SDL_BlendMode
blendMode
,
Uint8
_r
,
Uint8
_g
,
Uint8
_b
,
Uint8
_a
,
SDL_bool
draw_end
)
SDL_bool
draw_end
)
{
{
const
SDL_PixelFormat
*
fmt
=
dst
->
format
;
unsigned
r
,
g
,
b
,
a
,
inva
;
unsigned
r
,
g
,
b
,
a
,
inva
;
if
(
blendMode
==
SDL_BLENDMODE_BLEND
||
blendMode
==
SDL_BLENDMODE_ADD
)
{
if
(
blendMode
==
SDL_BLENDMODE_BLEND
||
blendMode
==
SDL_BLENDMODE_ADD
)
{
...
@@ -584,7 +581,6 @@ SDL_BlendLine_ARGB8888(SDL_Surface * dst, int x1, int y1, int x2, int y2,
...
@@ -584,7 +581,6 @@ SDL_BlendLine_ARGB8888(SDL_Surface * dst, int x1, int y1, int x2, int y2,
SDL_BlendMode
blendMode
,
Uint8
_r
,
Uint8
_g
,
Uint8
_b
,
Uint8
_a
,
SDL_BlendMode
blendMode
,
Uint8
_r
,
Uint8
_g
,
Uint8
_b
,
Uint8
_a
,
SDL_bool
draw_end
)
SDL_bool
draw_end
)
{
{
const
SDL_PixelFormat
*
fmt
=
dst
->
format
;
unsigned
r
,
g
,
b
,
a
,
inva
;
unsigned
r
,
g
,
b
,
a
,
inva
;
if
(
blendMode
==
SDL_BLENDMODE_BLEND
||
blendMode
==
SDL_BLENDMODE_ADD
)
{
if
(
blendMode
==
SDL_BLENDMODE_BLEND
||
blendMode
==
SDL_BLENDMODE_ADD
)
{
...
...
src/render/software/SDL_draw.h
View file @
1d7cfea7
...
@@ -45,13 +45,13 @@
...
@@ -45,13 +45,13 @@
#define DRAW_SETPIXEL(setpixel) \
#define DRAW_SETPIXEL(setpixel) \
do { \
do { \
unsigned sr = r, sg = g, sb = b, sa = a; \
unsigned sr = r, sg = g, sb = b, sa = a;
(void) sa;
\
setpixel; \
setpixel; \
} while (0)
} while (0)
#define DRAW_SETPIXEL_BLEND(getpixel, setpixel) \
#define DRAW_SETPIXEL_BLEND(getpixel, setpixel) \
do { \
do { \
unsigned sr, sg, sb, sa; sa; \
unsigned sr, sg, sb, sa;
(void)
sa; \
getpixel; \
getpixel; \
sr = DRAW_MUL(inva, sr) + r; \
sr = DRAW_MUL(inva, sr) + r; \
sg = DRAW_MUL(inva, sg) + g; \
sg = DRAW_MUL(inva, sg) + g; \
...
@@ -61,7 +61,7 @@ do { \
...
@@ -61,7 +61,7 @@ do { \
#define DRAW_SETPIXEL_ADD(getpixel, setpixel) \
#define DRAW_SETPIXEL_ADD(getpixel, setpixel) \
do { \
do { \
unsigned sr, sg, sb, sa; sa; \
unsigned sr, sg, sb, sa;
(void)
sa; \
getpixel; \
getpixel; \
sr += r; if (sr > 0xff) sr = 0xff; \
sr += r; if (sr > 0xff) sr = 0xff; \
sg += g; if (sg > 0xff) sg = 0xff; \
sg += g; if (sg > 0xff) sg = 0xff; \
...
@@ -71,7 +71,7 @@ do { \
...
@@ -71,7 +71,7 @@ do { \
#define DRAW_SETPIXEL_MOD(getpixel, setpixel) \
#define DRAW_SETPIXEL_MOD(getpixel, setpixel) \
do { \
do { \
unsigned sr, sg, sb, sa; sa; \
unsigned sr, sg, sb, sa;
(void)
sa; \
getpixel; \
getpixel; \
sr = DRAW_MUL(sr, r); \
sr = DRAW_MUL(sr, r); \
sg = DRAW_MUL(sg, g); \
sg = DRAW_MUL(sg, g); \
...
...
src/thread/beos/SDL_systhread.c
View file @
1d7cfea7
...
@@ -66,8 +66,9 @@ int
...
@@ -66,8 +66,9 @@ int
SDL_SYS_CreateThread
(
SDL_Thread
*
thread
,
void
*
args
)
SDL_SYS_CreateThread
(
SDL_Thread
*
thread
,
void
*
args
)
{
{
/* The docs say the thread name can't be longer than B_OS_NAME_LENGTH. */
/* The docs say the thread name can't be longer than B_OS_NAME_LENGTH. */
const
char
*
threadname
=
thread
->
name
?
thread
->
name
:
"SDL Thread"
;
char
name
[
B_OS_NAME_LENGTH
];
char
name
[
B_OS_NAME_LENGTH
];
SDL_snprintf
(
name
,
sizeof
(
name
),
"%s"
,
thread
->
name
);
SDL_snprintf
(
name
,
sizeof
(
name
),
"%s"
,
threadname
);
name
[
sizeof
(
name
)
-
1
]
=
'\0'
;
name
[
sizeof
(
name
)
-
1
]
=
'\0'
;
/* Create the thread and go! */
/* Create the thread and go! */
...
...
src/thread/pthread/SDL_syssem.c
View file @
1d7cfea7
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
#include <errno.h>
#include <errno.h>
#include <pthread.h>
#include <pthread.h>
#include <semaphore.h>
#include <semaphore.h>
#include <sys/time.h>
#include "SDL_thread.h"
#include "SDL_thread.h"
#include "SDL_timer.h"
#include "SDL_timer.h"
...
...
src/thread/pthread/SDL_systhread.c
View file @
1d7cfea7
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
misrepresented as being the original software.
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
3. This notice may not be removed or altered from any source distribution.
*/
*/
#include "SDL_config.h"
#include "SDL_config.h"
#include <pthread.h>
#include <pthread.h>
...
@@ -31,6 +32,8 @@
...
@@ -31,6 +32,8 @@
#include <sys/time.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/resource.h>
#include <sys/syscall.h>
#include <sys/syscall.h>
#include <unistd.h>
extern
int
pthread_setname_np
(
pthread_t
__target_thread
,
__const
char
*
__name
)
__THROW
__nonnull
((
2
));
#endif
#endif
#include "SDL_platform.h"
#include "SDL_platform.h"
...
@@ -79,6 +82,7 @@ SDL_SYS_SetupThread(const char *name)
...
@@ -79,6 +82,7 @@ SDL_SYS_SetupThread(const char *name)
int
i
;
int
i
;
sigset_t
mask
;
sigset_t
mask
;
if
(
name
!=
NULL
)
{
#if ( (__MACOSX__ && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)) || \
#if ( (__MACOSX__ && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)) || \
(__IPHONEOS__ && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 30200)) )
(__IPHONEOS__ && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 30200)) )
if
(
pthread_setname_np
!=
NULL
)
{
pthread_setname_np
(
name
);
}
if
(
pthread_setname_np
!=
NULL
)
{
pthread_setname_np
(
name
);
}
...
@@ -87,6 +91,7 @@ SDL_SYS_SetupThread(const char *name)
...
@@ -87,6 +91,7 @@ SDL_SYS_SetupThread(const char *name)
#elif HAVE_PTHREAD_SET_NAME_NP
#elif HAVE_PTHREAD_SET_NAME_NP
pthread_set_name_np
(
pthread_self
(),
name
);
pthread_set_name_np
(
pthread_self
(),
name
);
#endif
#endif
}
/* Mask asynchronous signals for this thread */
/* Mask asynchronous signals for this thread */
sigemptyset
(
&
mask
);
sigemptyset
(
&
mask
);
...
...
src/thread/windows/SDL_systhread.c
View file @
1d7cfea7
...
@@ -161,8 +161,9 @@ typedef struct tagTHREADNAME_INFO
...
@@ -161,8 +161,9 @@ typedef struct tagTHREADNAME_INFO
void
void
SDL_SYS_SetupThread
(
const
char
*
name
)
SDL_SYS_SetupThread
(
const
char
*
name
)
{
{
#if 0 /* !!! FIXME: __except needs C runtime, which we don't link against. */
if
(
name
!=
NULL
)
{
#ifdef _MSC_VER /* !!! FIXME: can we do SEH on other compilers yet? */
#if 0 /* !!! FIXME: __except needs C runtime, which we don't link against. */
#ifdef _MSC_VER /* !!! FIXME: can we do SEH on other compilers yet? */
/* This magic tells the debugger to name a thread if it's listening. */
/* This magic tells the debugger to name a thread if it's listening. */
THREADNAME_INFO inf;
THREADNAME_INFO inf;
inf.dwType = 0x1000;
inf.dwType = 0x1000;
...
@@ -178,8 +179,9 @@ SDL_SYS_SetupThread(const char *name)
...
@@ -178,8 +179,9 @@ SDL_SYS_SetupThread(const char *name)
{
{
/* The program itself should ignore this bogus exception. */
/* The program itself should ignore this bogus exception. */
}
}
#endif
#endif
#endif
#endif
}
}
}
SDL_threadID
SDL_threadID
...
...
src/video/android/SDL_androidgl.c
View file @
1d7cfea7
...
@@ -29,26 +29,43 @@
...
@@ -29,26 +29,43 @@
#include <android/log.h>
#include <android/log.h>
#include <dlfcn.h>
static
void
*
Android_GLHandle
=
NULL
;
/* GL functions */
/* GL functions */
int
int
Android_GL_LoadLibrary
(
_THIS
,
const
char
*
path
)
Android_GL_LoadLibrary
(
_THIS
,
const
char
*
path
)
{
{
__android_log_print
(
ANDROID_LOG_INFO
,
"SDL"
,
"[STUB] GL_LoadLibrary
\n
"
);
if
(
!
Android_GLHandle
)
{
Android_GLHandle
=
dlopen
(
"libGLESv1_CM.so"
,
RTLD_GLOBAL
);
if
(
!
Android_GLHandle
)
{
SDL_SetError
(
"Could not initialize GL ES library
\n
"
);
return
-
1
;
}
}
return
0
;
return
0
;
}
}
void
*
void
*
Android_GL_GetProcAddress
(
_THIS
,
const
char
*
proc
)
Android_GL_GetProcAddress
(
_THIS
,
const
char
*
proc
)
{
{
__android_log_print
(
ANDROID_LOG_INFO
,
"SDL"
,
"[STUB] GL_GetProcAddress
\n
"
);
/*
return
0
;
!!! FIXME: this _should_ use eglGetProcAddress(), but it appears to be
!!! FIXME: busted on Android at the moment...
!!! FIXME: http://code.google.com/p/android/issues/detail?id=7681
!!! FIXME: ...so revisit this later. --ryan.
*/
return
dlsym
(
Android_GLHandle
,
proc
);
}
}
void
void
Android_GL_UnloadLibrary
(
_THIS
)
Android_GL_UnloadLibrary
(
_THIS
)
{
{
__android_log_print
(
ANDROID_LOG_INFO
,
"SDL"
,
"[STUB] GL_UnloadLibrary
\n
"
);
if
(
Android_GLHandle
)
{
dlclose
(
Android_GLHandle
);
Android_GLHandle
=
NULL
;
}
}
}
SDL_GLContext
SDL_GLContext
...
...
src/video/android/SDL_androidtouch.c
View file @
1d7cfea7
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include "SDL_events.h"
#include "SDL_events.h"
#include "../../events/SDL_mouse_c.h"
#include "../../events/SDL_mouse_c.h"
#include "../../events/SDL_touch_c.h"
#include "SDL_androidtouch.h"
#include "SDL_androidtouch.h"
...
@@ -33,26 +34,54 @@
...
@@ -33,26 +34,54 @@
#define ACTION_MOVE 2
#define ACTION_MOVE 2
#define ACTION_CANCEL 3
#define ACTION_CANCEL 3
#define ACTION_OUTSIDE 4
#define ACTION_OUTSIDE 4
// The following two are deprecated but it seems they are still emitted (instead the corresponding ACTION_UP/DOWN) as of Android 3.2
#define ACTION_POINTER_1_DOWN 5
#define ACTION_POINTER_1_UP 6
void
Android_OnTouch
(
int
action
,
float
x
,
float
y
,
float
p
)
void
Android_OnTouch
(
int
touch_device_id_in
,
int
pointer_finger_id_in
,
int
action
,
float
x
,
float
y
,
float
p
)
{
{
SDL_TouchID
touchDeviceId
=
0
;
SDL_FingerID
fingerId
=
0
;
if
(
!
Android_Window
)
{
if
(
!
Android_Window
)
{
return
;
return
;
}
}
if
((
action
!=
ACTION_CANCEL
)
&&
(
action
!=
ACTION_OUTSIDE
))
{
touchDeviceId
=
(
SDL_TouchID
)
touch_device_id_in
;
SDL_SetMouseFocus
(
Android_Window
);
if
(
!
SDL_GetTouch
(
touchDeviceId
))
{
SDL_SendMouseMotion
(
Android_Window
,
0
,
(
int
)
x
,
(
int
)
y
);
SDL_Touch
touch
;
switch
(
action
)
{
memset
(
&
touch
,
0
,
sizeof
(
touch
)
);
touch
.
id
=
touchDeviceId
;
touch
.
x_min
=
0
.
0
f
;
touch
.
x_max
=
(
float
)
Android_ScreenWidth
;
touch
.
native_xres
=
touch
.
x_max
-
touch
.
x_min
;
touch
.
y_min
=
0
.
0
f
;
touch
.
y_max
=
(
float
)
Android_ScreenHeight
;
touch
.
native_yres
=
touch
.
y_max
-
touch
.
y_min
;
touch
.
pressure_min
=
0
.
0
f
;
touch
.
pressure_max
=
1
.
0
f
;
touch
.
native_pressureres
=
touch
.
pressure_max
-
touch
.
pressure_min
;
if
(
SDL_AddTouch
(
&
touch
,
""
)
<
0
)
{
SDL_Log
(
"error: can't add touch %s, %d"
,
__FILE__
,
__LINE__
);
}
}
fingerId
=
(
SDL_FingerID
)
pointer_finger_id_in
;
switch
(
action
)
{
case
ACTION_DOWN
:
case
ACTION_DOWN
:
SDL_SendMouseButton
(
Android_Window
,
SDL_PRESSED
,
SDL_BUTTON_LEFT
);
case
ACTION_POINTER_1_DOWN
:
SDL_SendFingerDown
(
touchDeviceId
,
fingerId
,
SDL_TRUE
,
x
,
y
,
p
);
break
;
case
ACTION_MOVE
:
SDL_SendTouchMotion
(
touchDeviceId
,
fingerId
,
SDL_FALSE
,
x
,
y
,
p
);
break
;
break
;
case
ACTION_UP
:
case
ACTION_UP
:
SDL_SendMouseButton
(
Android_Window
,
SDL_RELEASED
,
SDL_BUTTON_LEFT
);
case
ACTION_POINTER_1_UP
:
SDL_SendFingerDown
(
touchDeviceId
,
fingerId
,
SDL_FALSE
,
x
,
y
,
p
);
break
;
default:
break
;
break
;
}
}
else
{
SDL_SetMouseFocus
(
NULL
);
}
}
}
}
...
...
src/video/android/SDL_androidtouch.h
View file @
1d7cfea7
...
@@ -22,6 +22,6 @@
...
@@ -22,6 +22,6 @@
#include "SDL_androidvideo.h"
#include "SDL_androidvideo.h"
extern
void
Android_OnTouch
(
int
action
,
float
x
,
float
y
,
float
p
);
extern
void
Android_OnTouch
(
int
touch_device_id_in
,
int
pointer_finger_id_in
,
int
action
,
float
x
,
float
y
,
float
p
);
/* vi: set ts=4 sw=4 expandtab: */
/* vi: set ts=4 sw=4 expandtab: */
src/video/uikit/SDL_uikitvideo.m
View file @
1d7cfea7
...
@@ -176,7 +176,8 @@ UIKit_AddDisplay(UIScreen *uiscreen, UIScreenMode *uimode, int w, int h)
...
@@ -176,7 +176,8 @@ UIKit_AddDisplay(UIScreen *uiscreen, UIScreenMode *uimode, int w, int h)
mode
.
h
=
h
;
mode
.
h
=
h
;
mode
.
refresh_rate
=
0
;
mode
.
refresh_rate
=
0
;
[
uimode
retain
];
[
uimode
retain
];
// once for the desktop_mode
[
uimode
retain
];
// once for the current_mode
mode
.
driverdata
=
uimode
;
mode
.
driverdata
=
uimode
;
SDL_zero
(
display
);
SDL_zero
(
display
);
...
@@ -248,15 +249,16 @@ UIKit_VideoQuit(_THIS)
...
@@ -248,15 +249,16 @@ UIKit_VideoQuit(_THIS)
UIScreen
*
uiscreen
=
(
UIScreen
*
)
display
->
driverdata
;
UIScreen
*
uiscreen
=
(
UIScreen
*
)
display
->
driverdata
;
[
uiscreen
release
];
[
uiscreen
release
];
display
->
driverdata
=
NULL
;
display
->
driverdata
=
NULL
;
[((
UIScreenMode
*
)
display
->
desktop_mode
.
driverdata
)
release
];
display
->
desktop_mode
.
driverdata
=
NULL
;
[((
UIScreenMode
*
)
display
->
current_mode
.
driverdata
)
release
];
display
->
current_mode
.
driverdata
=
NULL
;
for
(
j
=
0
;
j
<
display
->
num_display_modes
;
j
++
)
{
for
(
j
=
0
;
j
<
display
->
num_display_modes
;
j
++
)
{
SDL_DisplayMode
*
mode
=
&
display
->
display_modes
[
j
];
SDL_DisplayMode
*
mode
=
&
display
->
display_modes
[
j
];
UIScreenMode
*
uimode
=
(
UIScreenMode
*
)
mode
->
driverdata
;
[((
UIScreenMode
*
)
mode
->
driverdata
)
release
];
if
(
uimode
)
{
[
uimode
release
];
mode
->
driverdata
=
NULL
;
mode
->
driverdata
=
NULL
;
}
}
}
}
}
}
}
/* vi: set ts=4 sw=4 expandtab: */
/* vi: set ts=4 sw=4 expandtab: */
src/video/uikit/SDL_uikitwindow.m
View file @
1d7cfea7
...
@@ -151,8 +151,13 @@ UIKit_CreateWindow(_THIS, SDL_Window *window)
...
@@ -151,8 +151,13 @@ UIKit_CreateWindow(_THIS, SDL_Window *window)
if
(
bestmode
)
{
if
(
bestmode
)
{
UIScreenMode
*
uimode
=
(
UIScreenMode
*
)
bestmode
->
driverdata
;
UIScreenMode
*
uimode
=
(
UIScreenMode
*
)
bestmode
->
driverdata
;
[
uiscreen
setCurrentMode
:
uimode
];
[
uiscreen
setCurrentMode
:
uimode
];
display
->
desktop_mode
=
*
bestmode
;
// desktop_mode doesn't change here (the higher level will
// use it to set all the screens back to their defaults
// upon window destruction, SDL_Quit(), etc.
[((
UIScreenMode
*
)
display
->
current_mode
.
driverdata
)
release
];
display
->
current_mode
=
*
bestmode
;
display
->
current_mode
=
*
bestmode
;
[((
UIScreenMode
*
)
display
->
current_mode
.
driverdata
)
retain
];
}
}
}
}
}
}
...
...
src/video/windows/SDL_windowswindow.c
View file @
1d7cfea7
...
@@ -88,6 +88,8 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
...
@@ -88,6 +88,8 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
data
->
mouse_pressed
=
SDL_FALSE
;
data
->
mouse_pressed
=
SDL_FALSE
;
data
->
videodata
=
videodata
;
data
->
videodata
=
videodata
;
window
->
driverdata
=
data
;
/* Associate the data with the window */
/* Associate the data with the window */
if
(
!
SetProp
(
hwnd
,
TEXT
(
"SDL_WindowData"
),
data
))
{
if
(
!
SetProp
(
hwnd
,
TEXT
(
"SDL_WindowData"
),
data
))
{
ReleaseDC
(
hwnd
,
data
->
hdc
);
ReleaseDC
(
hwnd
,
data
->
hdc
);
...
@@ -183,7 +185,6 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
...
@@ -183,7 +185,6 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
}
}
/* All done! */
/* All done! */
window
->
driverdata
=
data
;
return
0
;
return
0
;
}
}
...
...
src/video/x11/SDL_x11events.c
View file @
1d7cfea7
...
@@ -234,7 +234,6 @@ X11_DispatchEvent(_THIS)
...
@@ -234,7 +234,6 @@ X11_DispatchEvent(_THIS)
case
KeyPress
:{
case
KeyPress
:{
KeyCode
keycode
=
xevent
.
xkey
.
keycode
;
KeyCode
keycode
=
xevent
.
xkey
.
keycode
;
KeySym
keysym
=
NoSymbol
;
KeySym
keysym
=
NoSymbol
;
SDL_Scancode
scancode
;
char
text
[
SDL_TEXTINPUTEVENT_TEXT_SIZE
];
char
text
[
SDL_TEXTINPUTEVENT_TEXT_SIZE
];
Status
status
=
0
;
Status
status
=
0
;
...
@@ -243,7 +242,7 @@ X11_DispatchEvent(_THIS)
...
@@ -243,7 +242,7 @@ X11_DispatchEvent(_THIS)
#endif
#endif
SDL_SendKeyboardKey
(
SDL_PRESSED
,
videodata
->
key_layout
[
keycode
]);
SDL_SendKeyboardKey
(
SDL_PRESSED
,
videodata
->
key_layout
[
keycode
]);
#if 1
#if 1
if
(
videodata
->
key_layout
[
keycode
]
==
SDL
K
_UNKNOWN
)
{
if
(
videodata
->
key_layout
[
keycode
]
==
SDL
_SCANCODE
_UNKNOWN
)
{
int
min_keycode
,
max_keycode
;
int
min_keycode
,
max_keycode
;
XDisplayKeycodes
(
display
,
&
min_keycode
,
&
max_keycode
);
XDisplayKeycodes
(
display
,
&
min_keycode
,
&
max_keycode
);
keysym
=
XKeycodeToKeysym
(
display
,
keycode
,
0
);
keysym
=
XKeycodeToKeysym
(
display
,
keycode
,
0
);
...
@@ -522,6 +521,11 @@ X11_Pending(Display * display)
...
@@ -522,6 +521,11 @@ X11_Pending(Display * display)
return
(
0
);
return
(
0
);
}
}
/* !!! FIXME: this should be exposed in a header, or something. */
int
SDL_GetNumTouch
(
void
);
void
void
X11_PumpEvents
(
_THIS
)
X11_PumpEvents
(
_THIS
)
{
{
...
@@ -545,7 +549,6 @@ X11_PumpEvents(_THIS)
...
@@ -545,7 +549,6 @@ X11_PumpEvents(_THIS)
#ifdef SDL_INPUT_LINUXEV
#ifdef SDL_INPUT_LINUXEV
/* Process Touch events - TODO When X gets touch support, use that instead*/
/* Process Touch events - TODO When X gets touch support, use that instead*/
int
i
=
0
,
rd
;
int
i
=
0
,
rd
;
char
name
[
256
];
struct
input_event
ev
[
64
];
struct
input_event
ev
[
64
];
int
size
=
sizeof
(
struct
input_event
);
int
size
=
sizeof
(
struct
input_event
);
...
...
src/video/x11/SDL_x11framebuffer.c
View file @
1d7cfea7
...
@@ -183,7 +183,10 @@ X11_UpdateWindowFramebuffer(_THIS, SDL_Window * window, SDL_Rect * rects,
...
@@ -183,7 +183,10 @@ X11_UpdateWindowFramebuffer(_THIS, SDL_Window * window, SDL_Rect * rects,
rect
->
x
,
rect
->
y
,
rect
->
w
,
rect
->
h
);
rect
->
x
,
rect
->
y
,
rect
->
w
,
rect
->
h
);
}
}
}
}
XSync
(
display
,
False
);
XSync
(
display
,
False
);
return
0
;
}
}
void
void
...
...
src/video/x11/SDL_x11mouse.c
View file @
1d7cfea7
...
@@ -136,7 +136,7 @@ X11_CreatePixmapCursor(SDL_Surface * surface, int hot_x, int hot_y)
...
@@ -136,7 +136,7 @@ X11_CreatePixmapCursor(SDL_Surface * surface, int hot_x, int hot_y)
/* Code below assumes ARGB pixel format */
/* Code below assumes ARGB pixel format */
SDL_assert
(
surface
->
format
->
format
==
SDL_PIXELFORMAT_ARGB8888
);
SDL_assert
(
surface
->
format
->
format
==
SDL_PIXELFORMAT_ARGB8888
);
rfg
=
gfg
=
bfg
=
rbg
=
gbg
=
bbg
=
fgBits
=
0
;
rfg
=
gfg
=
bfg
=
rbg
=
gbg
=
bbg
=
fgBits
=
bgBits
=
0
;
for
(
y
=
0
;
y
<
surface
->
h
;
++
y
)
{
for
(
y
=
0
;
y
<
surface
->
h
;
++
y
)
{
ptr
=
(
Uint32
*
)((
Uint8
*
)
surface
->
pixels
+
y
*
surface
->
pitch
);
ptr
=
(
Uint32
*
)((
Uint8
*
)
surface
->
pixels
+
y
*
surface
->
pitch
);
for
(
x
=
0
;
x
<
surface
->
w
;
++
x
)
{
for
(
x
=
0
;
x
<
surface
->
w
;
++
x
)
{
...
...
src/video/x11/SDL_x11opengl.c
View file @
1d7cfea7
...
@@ -19,8 +19,8 @@
...
@@ -19,8 +19,8 @@
3. This notice may not be removed or altered from any source distribution.
3. This notice may not be removed or altered from any source distribution.
*/
*/
#include "SDL_config.h"
#include "SDL_config.h"
#include "SDL_x11video.h"
#include "SDL_x11video.h"
#include "SDL_assert.h"
/* GLX implementation of SDL OpenGL support */
/* GLX implementation of SDL OpenGL support */
...
@@ -388,8 +388,10 @@ X11_GL_GetVisual(_THIS, Display * display, int screen)
...
@@ -388,8 +388,10 @@ X11_GL_GetVisual(_THIS, Display * display, int screen)
XVisualInfo
*
vinfo
;
XVisualInfo
*
vinfo
;
/* 64 seems nice. */
/* 64 seems nice. */
int
attribs
[
64
];
const
int
max_attrs
=
64
;
int
i
=
X11_GL_GetAttributes
(
_this
,
display
,
screen
,
attribs
,
64
);
int
attribs
[
max_attrs
];
const
int
i
=
X11_GL_GetAttributes
(
_this
,
display
,
screen
,
attribs
,
max_attrs
);
SDL_assert
(
i
<=
max_attrs
);
vinfo
=
_this
->
gl_data
->
glXChooseVisual
(
display
,
screen
,
attribs
);
vinfo
=
_this
->
gl_data
->
glXChooseVisual
(
display
,
screen
,
attribs
);
if
(
!
vinfo
)
{
if
(
!
vinfo
)
{
...
...
src/video/x11/SDL_x11shape.c
View file @
1d7cfea7
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include "SDL_x11video.h"
#include "SDL_x11video.h"
#include "SDL_x11shape.h"
#include "SDL_x11shape.h"
#include "SDL_x11window.h"
#include "SDL_x11window.h"
#include "../SDL_shape_internals.h"
SDL_Window
*
SDL_Window
*
X11_CreateShapedWindow
(
const
char
*
title
,
unsigned
int
x
,
unsigned
int
y
,
unsigned
int
w
,
unsigned
int
h
,
Uint32
flags
)
{
X11_CreateShapedWindow
(
const
char
*
title
,
unsigned
int
x
,
unsigned
int
y
,
unsigned
int
w
,
unsigned
int
h
,
Uint32
flags
)
{
...
...
src/video/x11/SDL_x11sym.h
View file @
1d7cfea7
...
@@ -178,17 +178,17 @@ SDL_X11_SYM(int,ipUnallocateAndSendData,(ChannelPtr a,IPCard b),(a,b),return)
...
@@ -178,17 +178,17 @@ SDL_X11_SYM(int,ipUnallocateAndSendData,(ChannelPtr a,IPCard b),(a,b),return)
/* XCursor support */
/* XCursor support */
#if SDL_VIDEO_DRIVER_X11_XCURSOR
#if SDL_VIDEO_DRIVER_X11_XCURSOR
SDL_X11_MODULE
(
XCURSOR
)
SDL_X11_MODULE
(
XCURSOR
)
SDL_X11_SYM
(
XcursorImage
*
,
XcursorImageCreate
,(
int
a
,
int
b
),(
a
,
b
),)
SDL_X11_SYM
(
XcursorImage
*
,
XcursorImageCreate
,(
int
a
,
int
b
),(
a
,
b
),
return
)
SDL_X11_SYM
(
void
,
XcursorImageDestroy
,(
XcursorImage
*
a
),(
a
),)
SDL_X11_SYM
(
void
,
XcursorImageDestroy
,(
XcursorImage
*
a
),(
a
),)
SDL_X11_SYM
(
Cursor
,
XcursorImageLoadCursor
,(
Display
*
a
,
const
XcursorImage
*
b
),(
a
,
b
),)
SDL_X11_SYM
(
Cursor
,
XcursorImageLoadCursor
,(
Display
*
a
,
const
XcursorImage
*
b
),(
a
,
b
),
return
)
#endif
#endif
/* Xinerama support */
/* Xinerama support */
#if SDL_VIDEO_DRIVER_X11_XINERAMA
#if SDL_VIDEO_DRIVER_X11_XINERAMA
SDL_X11_MODULE
(
XINERAMA
)
SDL_X11_MODULE
(
XINERAMA
)
SDL_X11_SYM
(
Bool
,
XineramaIsActive
,(
Display
*
a
),(
a
),)
SDL_X11_SYM
(
Bool
,
XineramaIsActive
,(
Display
*
a
),(
a
),
return
)
SDL_X11_SYM
(
Bool
,
XineramaQueryExtension
,(
Display
*
a
,
int
*
b
,
int
*
c
),(
a
,
b
,
c
),)
SDL_X11_SYM
(
Bool
,
XineramaQueryExtension
,(
Display
*
a
,
int
*
b
,
int
*
c
),(
a
,
b
,
c
),
return
)
SDL_X11_SYM
(
XineramaScreenInfo
*
,
XineramaQueryScreens
,(
Display
*
a
,
int
*
b
),(
a
,
b
),)
SDL_X11_SYM
(
XineramaScreenInfo
*
,
XineramaQueryScreens
,(
Display
*
a
,
int
*
b
),(
a
,
b
),
return
)
#endif
#endif
/* XInput support for multiple mice, tablets, etc. */
/* XInput support for multiple mice, tablets, etc. */
...
@@ -229,12 +229,12 @@ SDL_X11_SYM(void,XShapeCombineMask,(Display *dpy,Window dest,int dest_kind,int x
...
@@ -229,12 +229,12 @@ SDL_X11_SYM(void,XShapeCombineMask,(Display *dpy,Window dest,int dest_kind,int x
#if SDL_VIDEO_DRIVER_X11_XVIDMODE
#if SDL_VIDEO_DRIVER_X11_XVIDMODE
SDL_X11_MODULE
(
XVIDMODE
)
SDL_X11_MODULE
(
XVIDMODE
)
SDL_X11_SYM
(
Bool
,
XF86VidModeGetAllModeLines
,(
Display
*
a
,
int
b
,
int
*
c
,
XF86VidModeModeInfo
***
d
),(
a
,
b
,
c
,
d
),)
SDL_X11_SYM
(
Bool
,
XF86VidModeGetAllModeLines
,(
Display
*
a
,
int
b
,
int
*
c
,
XF86VidModeModeInfo
***
d
),(
a
,
b
,
c
,
d
),
return
)
SDL_X11_SYM
(
Bool
,
XF86VidModeGetModeLine
,(
Display
*
a
,
int
b
,
int
*
c
,
XF86VidModeModeLine
*
d
),(
a
,
b
,
c
,
d
),)
SDL_X11_SYM
(
Bool
,
XF86VidModeGetModeLine
,(
Display
*
a
,
int
b
,
int
*
c
,
XF86VidModeModeLine
*
d
),(
a
,
b
,
c
,
d
),
return
)
SDL_X11_SYM
(
Bool
,
XF86VidModeGetViewPort
,(
Display
*
a
,
int
b
,
int
*
c
,
int
*
d
),(
a
,
b
,
c
,
d
),)
SDL_X11_SYM
(
Bool
,
XF86VidModeGetViewPort
,(
Display
*
a
,
int
b
,
int
*
c
,
int
*
d
),(
a
,
b
,
c
,
d
),
return
)
SDL_X11_SYM
(
Bool
,
XF86VidModeQueryExtension
,(
Display
*
a
,
int
*
b
,
int
*
c
),(
a
,
b
,
c
),)
SDL_X11_SYM
(
Bool
,
XF86VidModeQueryExtension
,(
Display
*
a
,
int
*
b
,
int
*
c
),(
a
,
b
,
c
),
return
)
SDL_X11_SYM
(
Bool
,
XF86VidModeQueryVersion
,(
Display
*
a
,
int
*
b
,
int
*
c
),(
a
,
b
,
c
),)
SDL_X11_SYM
(
Bool
,
XF86VidModeQueryVersion
,(
Display
*
a
,
int
*
b
,
int
*
c
),(
a
,
b
,
c
),
return
)
SDL_X11_SYM
(
Bool
,
XF86VidModeSwitchToMode
,(
Display
*
a
,
int
b
,
XF86VidModeModeInfo
*
c
),(
a
,
b
,
c
),)
SDL_X11_SYM
(
Bool
,
XF86VidModeSwitchToMode
,(
Display
*
a
,
int
b
,
XF86VidModeModeInfo
*
c
),(
a
,
b
,
c
),
return
)
#endif
#endif
/* *INDENT-ON* */
/* *INDENT-ON* */
...
...
src/video/x11/SDL_x11touch.c
View file @
1d7cfea7
...
@@ -39,7 +39,6 @@ X11_InitTouch(_THIS)
...
@@ -39,7 +39,6 @@ X11_InitTouch(_THIS)
FILE
*
fd
;
FILE
*
fd
;
fd
=
fopen
(
"/proc/bus/input/devices"
,
"r"
);
fd
=
fopen
(
"/proc/bus/input/devices"
,
"r"
);
char
c
;
int
i
=
0
;
int
i
=
0
;
int
tsfd
;
int
tsfd
;
char
line
[
256
];
char
line
[
256
];
...
@@ -111,7 +110,7 @@ X11_InitTouch(_THIS)
...
@@ -111,7 +110,7 @@ X11_InitTouch(_THIS)
}
}
}
}
close
(
fd
);
f
close
(
fd
);
#endif
#endif
}
}
...
...
src/video/x11/SDL_x11window.c
View file @
1d7cfea7
...
@@ -86,31 +86,6 @@ X11_GetWMStateProperty(_THIS, SDL_Window * window, Atom atoms[3])
...
@@ -86,31 +86,6 @@ X11_GetWMStateProperty(_THIS, SDL_Window * window, Atom atoms[3])
return
count
;
return
count
;
}
}
static
void
X11_GetDisplaySize
(
_THIS
,
SDL_Window
*
window
,
int
*
w
,
int
*
h
)
{
SDL_VideoData
*
data
=
(
SDL_VideoData
*
)
_this
->
driverdata
;
SDL_DisplayData
*
displaydata
=
(
SDL_DisplayData
*
)
SDL_GetDisplayForWindow
(
window
)
->
driverdata
;
XWindowAttributes
attr
;
XGetWindowAttributes
(
data
->
display
,
RootWindow
(
data
->
display
,
displaydata
->
screen
),
&
attr
);
if
(
window
->
flags
&
SDL_WINDOW_FULLSCREEN
)
{
/* The bounds when this window is visible is the fullscreen mode */
SDL_DisplayMode
fullscreen_mode
;
if
(
SDL_GetWindowDisplayMode
(
window
,
&
fullscreen_mode
)
==
0
)
{
attr
.
width
=
fullscreen_mode
.
w
;
attr
.
height
=
fullscreen_mode
.
h
;
}
}
if
(
w
)
{
*
w
=
attr
.
width
;
}
if
(
h
)
{
*
h
=
attr
.
height
;
}
}
static
int
static
int
SetupWindowData
(
_THIS
,
SDL_Window
*
window
,
Window
w
,
BOOL
created
)
SetupWindowData
(
_THIS
,
SDL_Window
*
window
,
Window
w
,
BOOL
created
)
{
{
...
@@ -320,7 +295,6 @@ X11_CreateWindow(_THIS, SDL_Window * window)
...
@@ -320,7 +295,6 @@ X11_CreateWindow(_THIS, SDL_Window * window)
xattr
.
border_pixel
=
0
;
xattr
.
border_pixel
=
0
;
if
(
visual
->
class
==
DirectColor
)
{
if
(
visual
->
class
==
DirectColor
)
{
Status
status
;
XColor
*
colorcells
;
XColor
*
colorcells
;
int
i
;
int
i
;
int
ncolors
;
int
ncolors
;
...
@@ -757,7 +731,6 @@ X11_SetWindowPosition(_THIS, SDL_Window * window)
...
@@ -757,7 +731,6 @@ X11_SetWindowPosition(_THIS, SDL_Window * window)
{
{
SDL_WindowData
*
data
=
(
SDL_WindowData
*
)
window
->
driverdata
;
SDL_WindowData
*
data
=
(
SDL_WindowData
*
)
window
->
driverdata
;
Display
*
display
=
data
->
videodata
->
display
;
Display
*
display
=
data
->
videodata
->
display
;
int
x
,
y
;
XMoveWindow
(
display
,
data
->
xwindow
,
window
->
x
,
window
->
y
);
XMoveWindow
(
display
,
data
->
xwindow
,
window
->
x
,
window
->
y
);
XFlush
(
display
);
XFlush
(
display
);
...
@@ -952,7 +925,7 @@ X11_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp)
...
@@ -952,7 +925,7 @@ X11_SetWindowGammaRamp(_THIS, SDL_Window * window, const Uint16 * ramp)
int
ncolors
;
int
ncolors
;
int
rmask
,
gmask
,
bmask
;
int
rmask
,
gmask
,
bmask
;
int
rshift
,
gshift
,
bshift
;
int
rshift
,
gshift
,
bshift
;
int
i
,
j
;
int
i
;
if
(
visual
->
class
!=
DirectColor
)
{
if
(
visual
->
class
!=
DirectColor
)
{
SDL_SetError
(
"Window doesn't have DirectColor visual"
);
SDL_SetError
(
"Window doesn't have DirectColor visual"
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment