Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | add (many) selected SDL upstream changes |
---|---|
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
e3a70448c87d58fb5acdabbd051510fe |
User & Date: | chw 2016-03-02 07:01:01.538 |
Context
2016-03-02
| ||
07:03 | improved SDL to X11 event translation plus other changes check-in: 09c55e6490 user: chw tags: trunk | |
07:01 | add (many) selected SDL upstream changes check-in: e3a70448c8 user: chw tags: trunk | |
2016-03-01
| ||
08:36 | add tcllib upstream changes check-in: 9c05f98e14 user: chw tags: trunk | |
Changes
jni/SDL2/CMakeLists.txt became executable.
︙ | ︙ |
Changes to jni/SDL2/android-project/src/org/libsdl/app/SDLActivity.java.
︙ | ︙ | |||
1278 1279 1280 1281 1282 1283 1284 | int mouseButton; int i = -1; float x,y,p; // !!! FIXME: dump this SDK check after 2.0.4 ships and require API14. if (event.getSource() == InputDevice.SOURCE_MOUSE && SDLActivity.mSeparateMouseAndTouch) { if (Build.VERSION.SDK_INT < 14) { | | | 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 | int mouseButton; int i = -1; float x,y,p; // !!! FIXME: dump this SDK check after 2.0.4 ships and require API14. if (event.getSource() == InputDevice.SOURCE_MOUSE && SDLActivity.mSeparateMouseAndTouch) { if (Build.VERSION.SDK_INT < 14) { mouseButton = 1; // all mouse buttons are the left button } else { try { mouseButton = (Integer) event.getClass().getMethod("getButtonState").invoke(event); } catch(Exception e) { mouseButton = 1; // oh well. } } |
︙ | ︙ |
Changes to jni/SDL2/debian/copyright.
︙ | ︙ | |||
27 28 29 30 31 32 33 | Files: src/render/SDL_yuv_sw.c Copyright: 1995 Erik Corry 1995 The Regents of the University of California 1995 Brown University License: BrownUn_UnCalifornia_ErikCorry | < < < < | 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | Files: src/render/SDL_yuv_sw.c Copyright: 1995 Erik Corry 1995 The Regents of the University of California 1995 Brown University License: BrownUn_UnCalifornia_ErikCorry Files: src/test/SDL_test_md5.c Copyright: 1997-2016 Sam Lantinga <slouken@libsdl.org> 1990 RSA Data Security, Inc. License: zlib/libpng and RSA_Data_Security Files: src/thread/windows/win_ce_semaphore.c Copyright: 1998, Johnson M. Hart (with corrections 2001 by Rainer Loritz) |
︙ | ︙ | |||
266 267 268 269 270 271 272 | * BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" * BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ | < < < < < < < | 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | * BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" * BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ License: Johnson_M._Hart Permission is granted for any and all use providing that this copyright is properly acknowledged. There are no assurances of suitability for any use whatsoever. License: SunPro Developed at SunPro, a Sun Microsystems, Inc. business. |
︙ | ︙ |
Changes to jni/SDL2/docs/README-android.md.
︙ | ︙ | |||
63 64 65 66 67 68 69 | done in the build directory for the app! For more complex projects, follow these instructions: 1. Copy the android-project directory wherever you want to keep your projects and rename it to the name of your project. | | | | | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | done in the build directory for the app! For more complex projects, follow these instructions: 1. Copy the android-project directory wherever you want to keep your projects and rename it to the name of your project. 2. Move or symlink this SDL directory into the "<project>/jni" directory 3. Edit "<project>/jni/src/Android.mk" to include your source files 4. Run 'ndk-build' (a script provided by the NDK). This compiles the C source If you want to use the Eclipse IDE, skip to the Eclipse section below. 5. Create "<project>/local.properties" and use that to point to the Android SDK directory, by writing a line with the following form: sdk.dir=PATH_TO_ANDROID_SDK 6. Run 'ant debug' in android/project. This compiles the .java and eventually creates a .apk with the native code embedded 7. 'ant debug install' will push the apk to the device or emulator (if connected) |
︙ | ︙ | |||
117 118 119 120 121 122 123 | ================================================================================ This build uses the Android NDK module system. Instructions: 1. Copy the android-project directory wherever you want to keep your projects and rename it to the name of your project. | | | | | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | ================================================================================ This build uses the Android NDK module system. Instructions: 1. Copy the android-project directory wherever you want to keep your projects and rename it to the name of your project. 2. Rename "<project>/jni/src/Android_static.mk" to "<project>/jni/src/Android.mk" (overwrite the existing one) 3. Edit "<project>/jni/src/Android.mk" to include your source files 4. create and export an environment variable named NDK_MODULE_PATH that points to the parent directory of this SDL directory. e.g.: export NDK_MODULE_PATH="$PWD"/.. 5. Edit "<project>/src/org/libsdl/app/SDLActivity.java" and remove the call to System.loadLibrary("SDL2"). 6. Run 'ndk-build' (a script provided by the NDK). This compiles the C source ================================================================================ Customizing your application name ================================================================================ |
︙ | ︙ |
Changes to jni/SDL2/docs/README-macosx.md.
︙ | ︙ | |||
92 93 94 95 96 97 98 | mkdir -p $(bundle_contents)/Resources echo "APPL????" > $(bundle_contents)/PkgInfo $(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/ You should replace EXE_NAME with the name of the executable. APP_NAME is what will be visible to the user in the Finder. Usually it will be the same as EXE_NAME but capitalized. E.g. if EXE_NAME is "testgame" then APP_NAME | | | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | mkdir -p $(bundle_contents)/Resources echo "APPL????" > $(bundle_contents)/PkgInfo $(INSTALL_PROGRAM) $< $(bundle_contents)/MacOS/ You should replace EXE_NAME with the name of the executable. APP_NAME is what will be visible to the user in the Finder. Usually it will be the same as EXE_NAME but capitalized. E.g. if EXE_NAME is "testgame" then APP_NAME usually is "TestGame". You might also want to use `@PACKAGE@` to use the package name as specified in your configure.in file. If your project builds more than one application, you will have to do a bit more. For each of your target applications, you need a separate rule. If you want the created bundles to be installed, you may want to add this rule to your Makefile.am: |
︙ | ︙ |
Changes to jni/SDL2/docs/README-raspberrypi.md.
︙ | ︙ | |||
35 36 37 38 39 40 41 | Raspbian system root and the cross compilation tools. We'll assume these tools will be placed in /opt/rpi-tools sudo git clone --depth 1 https://github.com/raspberrypi/tools /opt/rpi-tools You'll also need a Rasbian binary image. Get it from: http://downloads.raspberrypi.org/raspbian_latest | | | 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | Raspbian system root and the cross compilation tools. We'll assume these tools will be placed in /opt/rpi-tools sudo git clone --depth 1 https://github.com/raspberrypi/tools /opt/rpi-tools You'll also need a Rasbian binary image. Get it from: http://downloads.raspberrypi.org/raspbian_latest After unzipping, you'll get file with a name like: "<date>-wheezy-raspbian.img" Let's assume the sysroot will be built in /opt/rpi-sysroot. export SYSROOT=/opt/rpi-sysroot sudo kpartx -a -v <path_to_raspbian_image>.img sudo mount -o loop /dev/mapper/loop0p2 /mnt sudo cp -r /mnt $SYSROOT sudo apt-get install qemu binfmt-support qemu-user-static |
︙ | ︙ |
Changes to jni/SDL2/include/SDL_events.h.
︙ | ︙ | |||
132 133 134 135 136 137 138 139 140 141 142 143 144 145 | SDL_MULTIGESTURE, /* Clipboard events */ SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */ /* Drag and drop events */ SDL_DROPFILE = 0x1000, /**< The system requests a file open */ /* Audio hotplug events */ SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */ SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */ /* Render events */ SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */ | > > > | 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | SDL_MULTIGESTURE, /* Clipboard events */ SDL_CLIPBOARDUPDATE = 0x900, /**< The clipboard changed */ /* Drag and drop events */ SDL_DROPFILE = 0x1000, /**< The system requests a file open */ SDL_DROPTEXT, /**< text/plain drag-and-drop event */ SDL_DROPBEGIN, /**< A new set of drops is beginning (NULL filename) */ SDL_DROPCOMPLETE, /**< Current set of drops is now complete (NULL filename) */ /* Audio hotplug events */ SDL_AUDIODEVICEADDED = 0x1100, /**< A new audio device is available */ SDL_AUDIODEVICEREMOVED, /**< An audio device has been removed. */ /* Render events */ SDL_RENDER_TARGETS_RESET = 0x2000, /**< The render targets have been reset and their contents need to be updated */ |
︙ | ︙ | |||
457 458 459 460 461 462 463 | /** * \brief An event used to request a file open by the system (event.drop.*) * This event is enabled by default, you can disable it with SDL_EventState(). * \note If this event is enabled, you must free the filename in the event. */ typedef struct SDL_DropEvent { | | | > | 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 | /** * \brief An event used to request a file open by the system (event.drop.*) * This event is enabled by default, you can disable it with SDL_EventState(). * \note If this event is enabled, you must free the filename in the event. */ typedef struct SDL_DropEvent { Uint32 type; /**< ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE */ Uint32 timestamp; char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */ Uint32 windowID; /**< The window that was dropped on, if any */ } SDL_DropEvent; /** * \brief The "quit requested" event */ typedef struct SDL_QuitEvent |
︙ | ︙ |
Changes to jni/SDL2/include/SDL_video.h.
︙ | ︙ | |||
112 113 114 115 116 117 118 119 | SDL_WINDOW_INPUT_GRABBED = 0x00000100, /**< window has grabbed input focus */ SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */ SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */ SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ), SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */ SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported */ SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to INPUT_GRABBED) */ #if defined(__ANDROID__) && __ANDROID__ | > > > > > | | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | SDL_WINDOW_INPUT_GRABBED = 0x00000100, /**< window has grabbed input focus */ SDL_WINDOW_INPUT_FOCUS = 0x00000200, /**< window has input focus */ SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */ SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ), SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */ SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported */ SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to INPUT_GRABBED) */ SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000, /**< window should always be above others */ SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */ SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */ SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */ SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */ #if defined(__ANDROID__) && __ANDROID__ SDL_PBUFFER_GLES1 = 0x00100000 #endif } SDL_WindowFlags; /** * \brief Used to indicate that you don't care what the window position is. */ #define SDL_WINDOWPOS_UNDEFINED_MASK 0x1FFF0000 |
︙ | ︙ | |||
159 160 161 162 163 164 165 | SDL_WINDOWEVENT_MAXIMIZED, /**< Window has been maximized */ SDL_WINDOWEVENT_RESTORED, /**< Window has been restored to normal size and position */ SDL_WINDOWEVENT_ENTER, /**< Window has gained mouse focus */ SDL_WINDOWEVENT_LEAVE, /**< Window has lost mouse focus */ SDL_WINDOWEVENT_FOCUS_GAINED, /**< Window has gained keyboard focus */ SDL_WINDOWEVENT_FOCUS_LOST, /**< Window has lost keyboard focus */ | | > | | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | SDL_WINDOWEVENT_MAXIMIZED, /**< Window has been maximized */ SDL_WINDOWEVENT_RESTORED, /**< Window has been restored to normal size and position */ SDL_WINDOWEVENT_ENTER, /**< Window has gained mouse focus */ SDL_WINDOWEVENT_LEAVE, /**< Window has lost mouse focus */ SDL_WINDOWEVENT_FOCUS_GAINED, /**< Window has gained keyboard focus */ SDL_WINDOWEVENT_FOCUS_LOST, /**< Window has lost keyboard focus */ SDL_WINDOWEVENT_CLOSE, /**< The window manager requests that the window be closed */ SDL_WINDOWEVENT_TAKE_FOCUS, /**< Window is being offered a focus (should SetWindowInputFocus() on itself or a subwindow, or ignore) */ SDL_WINDOWEVENT_HIT_TEST /**< Window had a hit test that wasn't SDL_HITTEST_NORMAL. */ } SDL_WindowEventID; /** * \brief An opaque handle to an OpenGL context. */ typedef void *SDL_GLContext; |
︙ | ︙ | |||
315 316 317 318 319 320 321 322 323 324 325 326 327 328 | * * \return 0 on success, or -1 if no DPI information is available or the index is out of range. * * \sa SDL_GetNumVideoDisplays() */ extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi); /** * \brief Returns the number of available display modes. * * \sa SDL_GetDisplayMode() */ extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex); | > > > > > > > > > > > > > > > > > > > | 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 | * * \return 0 on success, or -1 if no DPI information is available or the index is out of range. * * \sa SDL_GetNumVideoDisplays() */ extern DECLSPEC int SDLCALL SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi); /** * \brief Get the usable desktop area represented by a display, with the * primary display located at 0,0 * * This is the same area as SDL_GetDisplayBounds() reports, but with portions * reserved by the system removed. For example, on Mac OS X, this subtracts * the area occupied by the menu bar and dock. * * Setting a window to be fullscreen generally bypasses these unusable areas, * so these are good guidelines for the maximum space available to a * non-fullscreen window. * * \return 0 on success, or -1 if the index is out of range. * * \sa SDL_GetDisplayBounds() * \sa SDL_GetNumVideoDisplays() */ extern DECLSPEC int SDLCALL SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect); /** * \brief Returns the number of available display modes. * * \sa SDL_GetDisplayMode() */ extern DECLSPEC int SDLCALL SDL_GetNumDisplayModes(int displayIndex); |
︙ | ︙ | |||
599 600 601 602 603 604 605 606 607 608 609 610 611 612 | * SDL_GetRendererOutputSize() to get the real client area size in pixels. * * \sa SDL_SetWindowSize() */ extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w, int *h); /** * \brief Set the minimum size of a window's client area. * * \param window The window to set a new minimum size. * \param min_w The minimum width of the window, must be >0 * \param min_h The minimum height of the window, must be >0 * | > > > > > > > > > > > > > > > > > > > | 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 | * SDL_GetRendererOutputSize() to get the real client area size in pixels. * * \sa SDL_SetWindowSize() */ extern DECLSPEC void SDLCALL SDL_GetWindowSize(SDL_Window * window, int *w, int *h); /** * \brief Get the size of a window's borders (decorations) around the client area. * * \param window The window to query. * \param top Pointer to variable for storing the size of the top border. NULL is permitted. * \param left Pointer to variable for storing the size of the left border. NULL is permitted. * \param bottom Pointer to variable for storing the size of the bottom border. NULL is permitted. * \param right Pointer to variable for storing the size of the right border. NULL is permitted. * * \return 0 on success, or -1 if getting this information is not supported. * * \note if this function fails (returns -1), the size values will be * initialized to 0, 0, 0, 0 (if a non-NULL pointer is provided), as * if the window in question was borderless. */ extern DECLSPEC int SDLCALL SDL_GetWindowBordersSize(SDL_Window * window, int *top, int *left, int *bottom, int *right); /** * \brief Set the minimum size of a window's client area. * * \param window The window to set a new minimum size. * \param min_w The minimum width of the window, must be >0 * \param min_h The minimum height of the window, must be >0 * |
︙ | ︙ | |||
814 815 816 817 818 819 820 821 822 823 824 825 826 827 | * * \return The last brightness value passed to SDL_SetWindowBrightness() * * \sa SDL_SetWindowBrightness() */ extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window); /** * \brief Set the gamma ramp for a window. * * \param window The window for which the gamma ramp should be set. * \param red The translation table for the red channel, or NULL. * \param green The translation table for the green channel, or NULL. * \param blue The translation table for the blue channel, or NULL. | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 | * * \return The last brightness value passed to SDL_SetWindowBrightness() * * \sa SDL_SetWindowBrightness() */ extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window); /** * \brief Set the opacity for a window * * \param window The window which will be made transparent or opaque * \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be * clamped internally between 0.0f and 1.0f. * * \return 0 on success, or -1 if setting the opacity isn't supported. * * \sa SDL_GetWindowOpacity() */ extern DECLSPEC int SDLCALL SDL_SetWindowOpacity(SDL_Window * window, float opacity); /** * \brief Get the opacity of a window. * * If transparency isn't supported on this platform, opacity will be reported * as 1.0f without error. * * \param window The window in question. * \param out_opacity Opacity (0.0f - transparent, 1.0f - opaque) * * \return 0 on success, or -1 on error (invalid window, etc). * * \sa SDL_SetWindowOpacity() */ extern DECLSPEC int SDLCALL SDL_GetWindowOpacity(SDL_Window * window, float * out_opacity); /** * \brief Sets the window as a modal for another window (TODO: reconsider this function and/or its name) * * \param modal_window The window that should be modal * \param parent_window The parent window * * \return 0 on success, or -1 otherwise. */ extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window); /** * \brief Explicitly sets input focus to the window. * * You almost certainly want SDL_RaiseWindow() instead of this function. Use * this with caution, as you might give focus to a window that's completely * obscured by other windows. * * \param window The window that should get the input focus * * \return 0 on success, or -1 otherwise. * \sa SDL_RaiseWindow() */ extern DECLSPEC int SDLCALL SDL_SetWindowInputFocus(SDL_Window * window); /** * \brief Set the gamma ramp for a window. * * \param window The window for which the gamma ramp should be set. * \param red The translation table for the red channel, or NULL. * \param green The translation table for the green channel, or NULL. * \param blue The translation table for the blue channel, or NULL. |
︙ | ︙ |
Changes to jni/SDL2/src/core/android/SDL_android.c.
︙ | ︙ | |||
140 141 142 143 144 145 146 | /* Drop file */ void Java_org_libsdl_app_SDLActivity_onNativeDropFile( JNIEnv* env, jclass jcls, jstring filename) { const char *path = (*env)->GetStringUTFChars(env, filename, NULL); | | > | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | /* Drop file */ void Java_org_libsdl_app_SDLActivity_onNativeDropFile( JNIEnv* env, jclass jcls, jstring filename) { const char *path = (*env)->GetStringUTFChars(env, filename, NULL); SDL_SendDropFile(NULL, path); (*env)->ReleaseStringUTFChars(env, filename, path); SDL_SendDropComplete(NULL); } /* Resize */ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeResize( JNIEnv* env, jclass jcls, jint width, jint height, jint format, jint xdpi, jint ydpi, jfloat rate) |
︙ | ︙ | |||
564 565 566 567 568 569 570 571 572 573 574 575 576 577 | static jobject audioBuffer = NULL; static void* audioBufferPinned = NULL; int Android_JNI_OpenAudioDevice(int sampleRate, int is16Bit, int channelCount, int desiredBufferFrames) { jboolean audioBufferStereo; int audioBufferFrames; JNIEnv *env = Android_JNI_GetEnv(); if (!env) { LOGE("callback_handler: failed to attach current thread"); } Android_JNI_SetupThread(); | > | 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 | static jobject audioBuffer = NULL; static void* audioBufferPinned = NULL; int Android_JNI_OpenAudioDevice(int sampleRate, int is16Bit, int channelCount, int desiredBufferFrames) { jboolean audioBufferStereo; int audioBufferFrames; jboolean isCopy; JNIEnv *env = Android_JNI_GetEnv(); if (!env) { LOGE("callback_handler: failed to attach current thread"); } Android_JNI_SetupThread(); |
︙ | ︙ | |||
605 606 607 608 609 610 611 | } if (audioBuffer == NULL) { __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: could not allocate an audio buffer!"); return 0; } | | | 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 | } if (audioBuffer == NULL) { __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: could not allocate an audio buffer!"); return 0; } isCopy = JNI_FALSE; if (audioBuffer16Bit) { audioBufferPinned = (*env)->GetShortArrayElements(env, (jshortArray)audioBuffer, &isCopy); audioBufferFrames = (*env)->GetArrayLength(env, (jshortArray)audioBuffer); } else { audioBufferPinned = (*env)->GetByteArrayElements(env, (jbyteArray)audioBuffer, &isCopy); audioBufferFrames = (*env)->GetArrayLength(env, (jbyteArray)audioBuffer); } |
︙ | ︙ | |||
657 658 659 660 661 662 663 | } } /* Test for an exception and call SDL_SetError with its detail if one occurs */ /* If the parameter silent is truthy then SDL_SetError() will not be called. */ static SDL_bool Android_JNI_ExceptionOccurred(SDL_bool silent) { | < > > > | > > > | | | | 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 | } } /* Test for an exception and call SDL_SetError with its detail if one occurs */ /* If the parameter silent is truthy then SDL_SetError() will not be called. */ static SDL_bool Android_JNI_ExceptionOccurred(SDL_bool silent) { JNIEnv *mEnv = Android_JNI_GetEnv(); jthrowable exception; SDL_assert(LocalReferenceHolder_IsActive()); exception = (*mEnv)->ExceptionOccurred(mEnv); if (exception != NULL) { jmethodID mid; /* Until this happens most JNI operations have undefined behaviour */ (*mEnv)->ExceptionClear(mEnv); if (!silent) { jclass exceptionClass = (*mEnv)->GetObjectClass(mEnv, exception); jclass classClass = (*mEnv)->FindClass(mEnv, "java/lang/Class"); jstring exceptionName; const char* exceptionNameUTF8; jstring exceptionMessage; mid = (*mEnv)->GetMethodID(mEnv, classClass, "getName", "()Ljava/lang/String;"); exceptionName = (jstring)(*mEnv)->CallObjectMethod(mEnv, exceptionClass, mid); exceptionNameUTF8 = (*mEnv)->GetStringUTFChars(mEnv, exceptionName, 0); mid = (*mEnv)->GetMethodID(mEnv, exceptionClass, "getMessage", "()Ljava/lang/String;"); exceptionMessage = (jstring)(*mEnv)->CallObjectMethod(mEnv, exception, mid); if (exceptionMessage != NULL) { const char* exceptionMessageUTF8 = (*mEnv)->GetStringUTFChars(mEnv, exceptionMessage, 0); SDL_SetError("%s: %s", exceptionNameUTF8, exceptionMessageUTF8); (*mEnv)->ReleaseStringUTFChars(mEnv, exceptionMessage, exceptionMessageUTF8); } else { SDL_SetError("%s", exceptionNameUTF8); |
︙ | ︙ | |||
859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 | int Android_JNI_FileOpen(SDL_RWops* ctx, const char* fileName, const char* mode) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); JNIEnv *mEnv = Android_JNI_GetEnv(); int retval; if (!LocalReferenceHolder_Init(&refs, mEnv)) { LocalReferenceHolder_Cleanup(&refs); return -1; } if (!ctx) { LocalReferenceHolder_Cleanup(&refs); return -1; } | > | > | > > > > | | | | | 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 | int Android_JNI_FileOpen(SDL_RWops* ctx, const char* fileName, const char* mode) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); JNIEnv *mEnv = Android_JNI_GetEnv(); int retval; jstring fileNameJString; if (!LocalReferenceHolder_Init(&refs, mEnv)) { LocalReferenceHolder_Cleanup(&refs); return -1; } if (!ctx) { LocalReferenceHolder_Cleanup(&refs); return -1; } fileNameJString = (*mEnv)->NewStringUTF(mEnv, fileName); ctx->hidden.androidio.fileNameRef = (*mEnv)->NewGlobalRef(mEnv, fileNameJString); ctx->hidden.androidio.inputStreamRef = NULL; ctx->hidden.androidio.readableByteChannelRef = NULL; ctx->hidden.androidio.readMethod = NULL; ctx->hidden.androidio.assetFileDescriptorRef = NULL; retval = Internal_Android_JNI_FileOpen(ctx); LocalReferenceHolder_Cleanup(&refs); return retval; } size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, size_t size, size_t maxnum) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); if (ctx->hidden.androidio.assetFileDescriptorRef) { size_t bytesMax = size * maxnum; size_t result; if (ctx->hidden.androidio.size != -1 /* UNKNOWN_LENGTH */ && ctx->hidden.androidio.position + bytesMax > ctx->hidden.androidio.size) { bytesMax = ctx->hidden.androidio.size - ctx->hidden.androidio.position; } result = read(ctx->hidden.androidio.fd, buffer, bytesMax ); if (result > 0) { ctx->hidden.androidio.position += result; LocalReferenceHolder_Cleanup(&refs); return result / size; } LocalReferenceHolder_Cleanup(&refs); return 0; } else { jlong bytesRemaining = (jlong) (size * maxnum); jlong bytesMax = (jlong) (ctx->hidden.androidio.size - ctx->hidden.androidio.position); int bytesRead = 0; JNIEnv *mEnv; jobject readableByteChannel; jmethodID readMethod; jobject byteBuffer; /* Don't read more bytes than those that remain in the file, otherwise we get an exception */ if (bytesRemaining > bytesMax) bytesRemaining = bytesMax; mEnv = Android_JNI_GetEnv(); if (!LocalReferenceHolder_Init(&refs, mEnv)) { LocalReferenceHolder_Cleanup(&refs); return 0; } readableByteChannel = (jobject)ctx->hidden.androidio.readableByteChannelRef; readMethod = (jmethodID)ctx->hidden.androidio.readMethod; byteBuffer = (*mEnv)->NewDirectByteBuffer(mEnv, buffer, bytesRemaining); while (bytesRemaining > 0) { /* result = readableByteChannel.read(...); */ int result = (*mEnv)->CallIntMethod(mEnv, readableByteChannel, readMethod, byteBuffer); if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { LocalReferenceHolder_Cleanup(&refs); |
︙ | ︙ | |||
1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 | { return ctx->hidden.androidio.size; } Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence) { if (ctx->hidden.androidio.assetFileDescriptorRef) { switch (whence) { case RW_SEEK_SET: if (ctx->hidden.androidio.size != -1 /* UNKNOWN_LENGTH */ && offset > ctx->hidden.androidio.size) offset = ctx->hidden.androidio.size; offset += ctx->hidden.androidio.offset; break; case RW_SEEK_CUR: offset += ctx->hidden.androidio.position; if (ctx->hidden.androidio.size != -1 /* UNKNOWN_LENGTH */ && offset > ctx->hidden.androidio.size) offset = ctx->hidden.androidio.size; offset += ctx->hidden.androidio.offset; break; case RW_SEEK_END: offset = ctx->hidden.androidio.offset + ctx->hidden.androidio.size + offset; break; default: return SDL_SetError("Unknown value for 'whence'"); } whence = SEEK_SET; | > | > | 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 | { return ctx->hidden.androidio.size; } Sint64 Android_JNI_FileSeek(SDL_RWops* ctx, Sint64 offset, int whence) { if (ctx->hidden.androidio.assetFileDescriptorRef) { off_t ret; switch (whence) { case RW_SEEK_SET: if (ctx->hidden.androidio.size != -1 /* UNKNOWN_LENGTH */ && offset > ctx->hidden.androidio.size) offset = ctx->hidden.androidio.size; offset += ctx->hidden.androidio.offset; break; case RW_SEEK_CUR: offset += ctx->hidden.androidio.position; if (ctx->hidden.androidio.size != -1 /* UNKNOWN_LENGTH */ && offset > ctx->hidden.androidio.size) offset = ctx->hidden.androidio.size; offset += ctx->hidden.androidio.offset; break; case RW_SEEK_END: offset = ctx->hidden.androidio.offset + ctx->hidden.androidio.size + offset; break; default: return SDL_SetError("Unknown value for 'whence'"); } whence = SEEK_SET; ret = lseek(ctx->hidden.androidio.fd, (off_t)offset, SEEK_SET); if (ret == -1) return -1; ctx->hidden.androidio.position = ret - ctx->hidden.androidio.offset; } else { Sint64 newPosition; Sint64 movement; switch (whence) { case RW_SEEK_SET: newPosition = offset; break; case RW_SEEK_CUR: newPosition = ctx->hidden.androidio.position + offset; |
︙ | ︙ | |||
1052 1053 1054 1055 1056 1057 1058 | if (newPosition < 0) { return SDL_Error(SDL_EFSEEK); } if (newPosition > ctx->hidden.androidio.size) { newPosition = ctx->hidden.androidio.size; } | | > | | 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 | if (newPosition < 0) { return SDL_Error(SDL_EFSEEK); } if (newPosition > ctx->hidden.androidio.size) { newPosition = ctx->hidden.androidio.size; } movement = newPosition - ctx->hidden.androidio.position; if (movement > 0) { unsigned char buffer[4096]; /* The easy case where we're seeking forwards */ while (movement > 0) { Sint64 amount = sizeof (buffer); size_t result; if (amount > movement) { amount = movement; } result = Android_JNI_FileRead(ctx, buffer, 1, amount); if (result <= 0) { /* Failed to read/skip the required amount, so fail */ return -1; } movement -= result; } |
︙ | ︙ | |||
1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 | * returns truthy or falsy value in plugged, charged and battery * returns the value in seconds and percent or -1 if not available */ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seconds, int* percent) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); JNIEnv* env = Android_JNI_GetEnv(); if (!LocalReferenceHolder_Init(&refs, env)) { LocalReferenceHolder_Cleanup(&refs); return -1; } | > > > > > > > > > > < | | | | | < | > > | < | > > | > > > > > > > | > > > > | > > > | 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 | * returns truthy or falsy value in plugged, charged and battery * returns the value in seconds and percent or -1 if not available */ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seconds, int* percent) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); JNIEnv* env = Android_JNI_GetEnv(); jmethodID mid; jobject context; jstring action; jclass cls; jobject filter; jobject intent; jstring iname; jmethodID imid; jstring bname; jmethodID bmid; if (!LocalReferenceHolder_Init(&refs, env)) { LocalReferenceHolder_Cleanup(&refs); return -1; } mid = (*env)->GetStaticMethodID(env, mActivityClass, "getContext", "()Landroid/content/Context;"); context = (*env)->CallStaticObjectMethod(env, mActivityClass, mid); action = (*env)->NewStringUTF(env, "android.intent.action.BATTERY_CHANGED"); cls = (*env)->FindClass(env, "android/content/IntentFilter"); mid = (*env)->GetMethodID(env, cls, "<init>", "(Ljava/lang/String;)V"); filter = (*env)->NewObject(env, cls, mid, action); (*env)->DeleteLocalRef(env, action); mid = (*env)->GetMethodID(env, mActivityClass, "registerReceiver", "(Landroid/content/BroadcastReceiver;Landroid/content/IntentFilter;)Landroid/content/Intent;"); intent = (*env)->CallObjectMethod(env, context, mid, NULL, filter); (*env)->DeleteLocalRef(env, filter); cls = (*env)->GetObjectClass(env, intent); imid = (*env)->GetMethodID(env, cls, "getIntExtra", "(Ljava/lang/String;I)I"); /* Watch out for C89 scoping rules because of the macro */ #define GET_INT_EXTRA(var, key) \ int var; \ iname = (*env)->NewStringUTF(env, key); \ var = (*env)->CallIntMethod(env, intent, imid, iname, -1); \ (*env)->DeleteLocalRef(env, iname); bmid = (*env)->GetMethodID(env, cls, "getBooleanExtra", "(Ljava/lang/String;Z)Z"); /* Watch out for C89 scoping rules because of the macro */ #define GET_BOOL_EXTRA(var, key) \ int var; \ bname = (*env)->NewStringUTF(env, key); \ var = (*env)->CallBooleanMethod(env, intent, bmid, bname, JNI_FALSE); \ (*env)->DeleteLocalRef(env, bname); if (plugged) { /* Watch out for C89 scoping rules because of the macro */ GET_INT_EXTRA(plug, "plugged") /* == BatteryManager.EXTRA_PLUGGED (API 5) */ if (plug == -1) { LocalReferenceHolder_Cleanup(&refs); return -1; } /* 1 == BatteryManager.BATTERY_PLUGGED_AC */ /* 2 == BatteryManager.BATTERY_PLUGGED_USB */ *plugged = (0 < plug) ? 1 : 0; } if (charged) { /* Watch out for C89 scoping rules because of the macro */ GET_INT_EXTRA(status, "status") /* == BatteryManager.EXTRA_STATUS (API 5) */ if (status == -1) { LocalReferenceHolder_Cleanup(&refs); return -1; } /* 5 == BatteryManager.BATTERY_STATUS_FULL */ *charged = (status == 5) ? 1 : 0; } if (battery) { GET_BOOL_EXTRA(present, "present") /* == BatteryManager.EXTRA_PRESENT (API 5) */ *battery = present ? 1 : 0; } if (seconds) { *seconds = -1; /* not possible */ } if (percent) { int level; int scale; /* Watch out for C89 scoping rules because of the macro */ { GET_INT_EXTRA(level_temp, "level") /* == BatteryManager.EXTRA_LEVEL (API 5) */ level = level_temp; } /* Watch out for C89 scoping rules because of the macro */ { GET_INT_EXTRA(scale_temp, "scale") /* == BatteryManager.EXTRA_SCALE (API 5) */ scale = scale_temp; } if ((level == -1) || (scale == -1)) { LocalReferenceHolder_Cleanup(&refs); return -1; } *percent = level * 100 / scale; } |
︙ | ︙ | |||
1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 | /* See SDLActivity.java for constants. */ #define COMMAND_SET_KEEP_SCREEN_ON 5 /* sends message to be handled on the UI event dispatch thread */ int Android_JNI_SendMessage(int command, int param) { JNIEnv *env = Android_JNI_GetEnv(); if (!env) { return -1; } | > > | | > | | 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 | /* See SDLActivity.java for constants. */ #define COMMAND_SET_KEEP_SCREEN_ON 5 /* sends message to be handled on the UI event dispatch thread */ int Android_JNI_SendMessage(int command, int param) { JNIEnv *env = Android_JNI_GetEnv(); jmethodID mid; jboolean success; if (!env) { return -1; } mid = (*env)->GetStaticMethodID(env, mActivityClass, "sendMessage", "(II)Z"); if (!mid) { return -1; } success = (*env)->CallStaticBooleanMethod(env, mActivityClass, mid, command, param); return success ? 0 : -1; } void Android_JNI_SuspendScreenSaver(SDL_bool suspend) { Android_JNI_SendMessage(COMMAND_SET_KEEP_SCREEN_ON, (suspend == SDL_FALSE) ? 0 : 1); } void Android_JNI_ShowTextInput(SDL_Rect *inputRect, int hints) { JNIEnv *env = Android_JNI_GetEnv(); jmethodID mid; if (!env) { return; } mid = (*env)->GetStaticMethodID(env, mActivityClass, "showTextInput", "(IIIII)Z"); if (!mid) { return; } (*env)->CallStaticBooleanMethod(env, mActivityClass, mid, inputRect->x, inputRect->y, inputRect->w, |
︙ | ︙ |
Changes to jni/SDL2/src/dynapi/SDL_dynapi.c.
︙ | ︙ | |||
289 290 291 292 293 294 295 | * while the jump table is being initialized by the first. * In this case, a spinlock is really painful compared to what spinlocks * _should_ be used for, but this would only happen once, and should be * insanely rare, as you would have to spin a thread outside of SDL (as * SDL_CreateThread() would also call this function before building the * new thread). */ | | | 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 | * while the jump table is being initialized by the first. * In this case, a spinlock is really painful compared to what spinlocks * _should_ be used for, but this would only happen once, and should be * insanely rare, as you would have to spin a thread outside of SDL (as * SDL_CreateThread() would also call this function before building the * new thread). */ static SDL_bool already_initialized = SDL_FALSE; /* SDL_AtomicLock calls SDL mutex functions to emulate if SDL_ATOMIC_DISABLED, which we can't do here, so in such a configuration, you're on your own. */ #if !SDL_ATOMIC_DISABLED static SDL_SpinLock lock = 0; SDL_AtomicLock_REAL(&lock); |
︙ | ︙ |
Changes to jni/SDL2/src/dynapi/SDL_dynapi.h.
︙ | ︙ | |||
42 43 44 45 46 47 48 49 50 51 52 53 54 55 | #ifdef __APPLE__ #include "TargetConditionals.h" #endif #if TARGET_OS_IPHONE || __native_client__ || __EMSCRIPTEN__ /* probably not useful on iOS, NACL or Emscripten. */ #define SDL_DYNAMIC_API 0 #elif SDL_BUILDING_WINRT /* probaly not useful on WinRT, given current .dll loading restrictions */ #define SDL_DYNAMIC_API 0 #elif defined(__clang_analyzer__) #define SDL_DYNAMIC_API 0 /* Turn off for static analysis, so reports are more clear. */ #endif /* everyone else. This is where we turn on the API if nothing forced it off. */ #ifndef SDL_DYNAMIC_API | > > | 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | #ifdef __APPLE__ #include "TargetConditionals.h" #endif #if TARGET_OS_IPHONE || __native_client__ || __EMSCRIPTEN__ /* probably not useful on iOS, NACL or Emscripten. */ #define SDL_DYNAMIC_API 0 #elif SDL_BUILDING_WINRT /* probaly not useful on WinRT, given current .dll loading restrictions */ #define SDL_DYNAMIC_API 0 #elif __PSP__ #define SDL_DYNAMIC_API 0 #elif defined(__clang_analyzer__) #define SDL_DYNAMIC_API 0 /* Turn off for static analysis, so reports are more clear. */ #endif /* everyone else. This is where we turn on the API if nothing forced it off. */ #ifndef SDL_DYNAMIC_API |
︙ | ︙ |
Changes to jni/SDL2/src/dynapi/SDL_dynapi_overrides.h.
︙ | ︙ | |||
593 594 595 596 597 598 599 600 601 602 603 604 | #define SDL_GetQueuedAudioSize SDL_GetQueuedAudioSize_REAL #define SDL_ClearQueuedAudio SDL_ClearQueuedAudio_REAL #define SDL_GetGrabbedWindow SDL_GetGrabbedWindow_REAL #define SDL_SetWindowsMessageHook SDL_SetWindowsMessageHook_REAL #define SDL_JoystickCurrentPowerLevel SDL_JoystickCurrentPowerLevel_REAL #define SDL_GameControllerFromInstanceID SDL_GameControllerFromInstanceID_REAL #define SDL_JoystickFromInstanceID SDL_JoystickFromInstanceID_REAL #if defined(__ANDROID__) && __ANDROID__ #define SDL_CreateRendererGLES1 SDL_CreateRendererGLES1_REAL #endif #define SDL_GL_MakeCurrentQuick SDL_GL_MakeCurrentQuick_REAL #define SDL_SetRenderTargetQuick SDL_SetRenderTargetQuick_REAL | > > > > > > > > > | 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 | #define SDL_GetQueuedAudioSize SDL_GetQueuedAudioSize_REAL #define SDL_ClearQueuedAudio SDL_ClearQueuedAudio_REAL #define SDL_GetGrabbedWindow SDL_GetGrabbedWindow_REAL #define SDL_SetWindowsMessageHook SDL_SetWindowsMessageHook_REAL #define SDL_JoystickCurrentPowerLevel SDL_JoystickCurrentPowerLevel_REAL #define SDL_GameControllerFromInstanceID SDL_GameControllerFromInstanceID_REAL #define SDL_JoystickFromInstanceID SDL_JoystickFromInstanceID_REAL #define SDL_GetDisplayUsableBounds SDL_GetDisplayUsableBounds_REAL #define SDL_GetWindowBordersSize SDL_GetWindowBordersSize_REAL #define SDL_SetWindowOpacity SDL_SetWindowOpacity_REAL #define SDL_GetWindowOpacity SDL_GetWindowOpacity_REAL #define SDL_SetWindowInputFocus SDL_SetWindowInputFocus_REAL #define SDL_SetWindowModalFor SDL_SetWindowModalFor_REAL #define SDL_RenderSetIntegerScale SDL_RenderSetIntegerScale_REAL #define SDL_RenderGetIntegerScale SDL_RenderGetIntegerScale_REAL #if defined(__ANDROID__) && __ANDROID__ #define SDL_CreateRendererGLES1 SDL_CreateRendererGLES1_REAL #endif #define SDL_GL_MakeCurrentQuick SDL_GL_MakeCurrentQuick_REAL #define SDL_SetRenderTargetQuick SDL_SetRenderTargetQuick_REAL |
Changes to jni/SDL2/src/dynapi/SDL_dynapi_procs.h.
︙ | ︙ | |||
631 632 633 634 635 636 637 638 639 640 641 642 | #ifdef __WIN32__ SDL_DYNAPI_PROC(void,SDL_SetWindowsMessageHook,(SDL_WindowsMessageHook a, void *b),(a,b),) #endif SDL_DYNAPI_PROC(int,SDL_GetDisplayDPI,(int a, float *b, float *c, float *d),(a,b,c,d),return) SDL_DYNAPI_PROC(SDL_JoystickPowerLevel,SDL_JoystickCurrentPowerLevel,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(SDL_GameController*,SDL_GameControllerFromInstanceID,(SDL_JoystickID a),(a),return) SDL_DYNAPI_PROC(SDL_Joystick*,SDL_JoystickFromInstanceID,(SDL_JoystickID a),(a),return) #if defined(__ANDROID__) && __ANDROID__ SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateRendererGLES1,(SDL_Window *a),(a),return) #endif SDL_DYNAPI_PROC(int,SDL_GL_MakeCurrentQuick,(SDL_Window *a, SDL_GLContext b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SetRenderTargetQuick,(SDL_Renderer *a, SDL_Texture *b),(a,b),return) | > > > > > > > > > | 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 | #ifdef __WIN32__ SDL_DYNAPI_PROC(void,SDL_SetWindowsMessageHook,(SDL_WindowsMessageHook a, void *b),(a,b),) #endif SDL_DYNAPI_PROC(int,SDL_GetDisplayDPI,(int a, float *b, float *c, float *d),(a,b,c,d),return) SDL_DYNAPI_PROC(SDL_JoystickPowerLevel,SDL_JoystickCurrentPowerLevel,(SDL_Joystick *a),(a),return) SDL_DYNAPI_PROC(SDL_GameController*,SDL_GameControllerFromInstanceID,(SDL_JoystickID a),(a),return) SDL_DYNAPI_PROC(SDL_Joystick*,SDL_JoystickFromInstanceID,(SDL_JoystickID a),(a),return) SDL_DYNAPI_PROC(int,SDL_GetDisplayUsableBounds,(int a, SDL_Rect *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetWindowBordersSize,(SDL_Window *a, int *b, int *c, int *d, int *e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(int,SDL_SetWindowOpacity,(SDL_Window *a, float b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_GetWindowOpacity,(SDL_Window *a, float *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SetWindowInputFocus,(SDL_Window *a),(a),return) SDL_DYNAPI_PROC(int,SDL_SetWindowModalFor,(SDL_Window *a, SDL_Window *b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_RenderSetIntegerScale,(SDL_Renderer *a, SDL_bool b),(a,b),return) SDL_DYNAPI_PROC(SDL_bool,SDL_RenderGetIntegerScale,(SDL_Renderer *a),(a),return) #if defined(__ANDROID__) && __ANDROID__ SDL_DYNAPI_PROC(SDL_Renderer*,SDL_CreateRendererGLES1,(SDL_Window *a),(a),return) #endif SDL_DYNAPI_PROC(int,SDL_GL_MakeCurrentQuick,(SDL_Window *a, SDL_GLContext b),(a,b),return) SDL_DYNAPI_PROC(int,SDL_SetRenderTargetQuick,(SDL_Renderer *a, SDL_Texture *b),(a,b),return) |
Changes to jni/SDL2/src/events/SDL_dropevents.c.
︙ | ︙ | |||
22 23 24 25 26 27 28 29 | /* Drag and drop event handling code for SDL */ #include "SDL_events.h" #include "SDL_events_c.h" #include "SDL_dropevents_c.h" | > > | | > | < | > > > > | > > > > > > > > > > > > > > > > > > | > | > > > > > > > > | > > > > > > > > > > > > > > > > > > > | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | /* Drag and drop event handling code for SDL */ #include "SDL_events.h" #include "SDL_events_c.h" #include "SDL_dropevents_c.h" #include "../video/SDL_sysvideo.h" /* for SDL_Window internals. */ static int SDL_SendDrop(SDL_Window *window, const SDL_EventType evtype, const char *data) { static SDL_bool app_is_dropping = SDL_FALSE; int posted = 0; /* Post the event, if desired */ if (SDL_GetEventState(evtype) == SDL_ENABLE) { const SDL_bool need_begin = window ? !window->is_dropping : !app_is_dropping; SDL_Event event; if (need_begin) { SDL_zero(event); event.type = SDL_DROPBEGIN; if (window) { event.drop.windowID = window->id; } posted = (SDL_PushEvent(&event) > 0); if (!posted) { return 0; } if (window) { window->is_dropping = SDL_TRUE; } else { app_is_dropping = SDL_TRUE; } } SDL_zero(event); event.type = evtype; event.drop.file = data ? SDL_strdup(data) : NULL; event.drop.windowID = window ? window->id : 0; posted = (SDL_PushEvent(&event) > 0); if (posted && (evtype == SDL_DROPCOMPLETE)) { if (window) { window->is_dropping = SDL_FALSE; } else { app_is_dropping = SDL_FALSE; } } } return posted; } int SDL_SendDropFile(SDL_Window *window, const char *file) { return SDL_SendDrop(window, SDL_DROPFILE, file); } int SDL_SendDropText(SDL_Window *window, const char *text) { return SDL_SendDrop(window, SDL_DROPTEXT, text); } int SDL_SendDropComplete(SDL_Window *window) { return SDL_SendDrop(window, SDL_DROPCOMPLETE, NULL); } /* vi: set ts=4 sw=4 expandtab: */ |
Changes to jni/SDL2/src/events/SDL_dropevents_c.h.
︙ | ︙ | |||
19 20 21 22 23 24 25 | 3. This notice may not be removed or altered from any source distribution. */ #include "../SDL_internal.h" #ifndef _SDL_dropevents_c_h #define _SDL_dropevents_c_h | | > > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 3. This notice may not be removed or altered from any source distribution. */ #include "../SDL_internal.h" #ifndef _SDL_dropevents_c_h #define _SDL_dropevents_c_h extern int SDL_SendDropFile(SDL_Window *window, const char *file); extern int SDL_SendDropText(SDL_Window *window, const char *text); extern int SDL_SendDropComplete(SDL_Window *window); #endif /* _SDL_dropevents_c_h */ /* vi: set ts=4 sw=4 expandtab: */ |
Changes to jni/SDL2/src/events/SDL_events.c.
︙ | ︙ | |||
69 70 71 72 73 74 75 | SDL_SysWMmsg msg; struct _SDL_SysWMEntry *next; } SDL_SysWMEntry; static struct { SDL_mutex *lock; | | | | | | | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | SDL_SysWMmsg msg; struct _SDL_SysWMEntry *next; } SDL_SysWMEntry; static struct { SDL_mutex *lock; SDL_atomic_t active; SDL_atomic_t count; int max_events_seen; SDL_EventEntry *head; SDL_EventEntry *tail; SDL_EventEntry *free; SDL_SysWMEntry *wmmsg_used; SDL_SysWMEntry *wmmsg_free; } SDL_EventQ = { NULL, { 1 }, { 0 }, 0, NULL, NULL, NULL, NULL, NULL }; /* Public functions */ void SDL_StopEventLoop(void) { const char *report = SDL_GetHint("SDL_EVENT_QUEUE_STATISTICS"); int i; SDL_EventEntry *entry; SDL_SysWMEntry *wmmsg; if (SDL_EventQ.lock) { SDL_LockMutex(SDL_EventQ.lock); } SDL_AtomicSet(&SDL_EventQ.active, 0); if (report && SDL_atoi(report)) { SDL_Log("SDL EVENT QUEUE: Maximum events in-flight: %d\n", SDL_EventQ.max_events_seen); } /* Clean out EventQ */ |
︙ | ︙ | |||
123 124 125 126 127 128 129 | } for (wmmsg = SDL_EventQ.wmmsg_free; wmmsg; ) { SDL_SysWMEntry *next = wmmsg->next; SDL_free(wmmsg); wmmsg = next; } | | | 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | } for (wmmsg = SDL_EventQ.wmmsg_free; wmmsg; ) { SDL_SysWMEntry *next = wmmsg->next; SDL_free(wmmsg); wmmsg = next; } SDL_AtomicSet(&SDL_EventQ.count, 0); SDL_EventQ.max_events_seen = 0; SDL_EventQ.head = NULL; SDL_EventQ.tail = NULL; SDL_EventQ.free = NULL; SDL_EventQ.wmmsg_used = NULL; SDL_EventQ.wmmsg_free = NULL; |
︙ | ︙ | |||
167 168 169 170 171 172 173 | /* Create the lock and set ourselves active */ #if !SDL_THREADS_DISABLED if (!SDL_EventQ.lock) { SDL_EventQ.lock = SDL_CreateMutex(); } if (SDL_EventQ.lock == NULL) { | | | | > > | | | 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | /* Create the lock and set ourselves active */ #if !SDL_THREADS_DISABLED if (!SDL_EventQ.lock) { SDL_EventQ.lock = SDL_CreateMutex(); } if (SDL_EventQ.lock == NULL) { return -1; } #endif /* !SDL_THREADS_DISABLED */ /* Process most event types */ SDL_EventState(SDL_TEXTINPUT, SDL_DISABLE); SDL_EventState(SDL_TEXTEDITING, SDL_DISABLE); SDL_EventState(SDL_SYSWMEVENT, SDL_DISABLE); SDL_AtomicSet(&SDL_EventQ.active, 1); return 0; } /* Add an event to the event queue -- called with the queue locked */ static int SDL_AddEvent(SDL_Event * event) { SDL_EventEntry *entry; const int initial_count = SDL_AtomicGet(&SDL_EventQ.count); int final_count; if (initial_count >= SDL_MAX_QUEUED_EVENTS) { SDL_SetError("Event queue is full (%d events)", initial_count); return 0; } if (SDL_EventQ.free == NULL) { entry = (SDL_EventEntry *)SDL_malloc(sizeof(*entry)); if (!entry) { return 0; |
︙ | ︙ | |||
221 222 223 224 225 226 227 | } else { SDL_assert(!SDL_EventQ.head); SDL_EventQ.head = entry; SDL_EventQ.tail = entry; entry->prev = NULL; entry->next = NULL; } | < > | | | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 | } else { SDL_assert(!SDL_EventQ.head); SDL_EventQ.head = entry; SDL_EventQ.tail = entry; entry->prev = NULL; entry->next = NULL; } final_count = SDL_AtomicAdd(&SDL_EventQ.count, 1) + 1; if (final_count > SDL_EventQ.max_events_seen) { SDL_EventQ.max_events_seen = final_count; } return 1; } /* Remove an event from the queue -- called with the queue locked */ static void |
︙ | ︙ | |||
252 253 254 255 256 257 258 | if (entry == SDL_EventQ.tail) { SDL_assert(entry->next == NULL); SDL_EventQ.tail = entry->prev; } entry->next = SDL_EventQ.free; SDL_EventQ.free = entry; | | | | < < < < < < < | | | | | | | | | | | > | > | | | | | | | | | | | | | | | | | < | | | > > | 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | if (entry == SDL_EventQ.tail) { SDL_assert(entry->next == NULL); SDL_EventQ.tail = entry->prev; } entry->next = SDL_EventQ.free; SDL_EventQ.free = entry; SDL_assert(SDL_AtomicGet(&SDL_EventQ.count) > 0); SDL_AtomicAdd(&SDL_EventQ.count, -1); } /* Lock the event queue, take a peep at it, and unlock it */ int SDL_PeepEvents(SDL_Event * events, int numevents, SDL_eventaction action, Uint32 minType, Uint32 maxType) { int i, used; /* Don't look after we've quit */ if (!SDL_AtomicGet(&SDL_EventQ.active)) { /* We get a few spurious events at shutdown, so don't warn then */ if (action != SDL_ADDEVENT) { SDL_SetError("The event system has been shut down"); } return (-1); } /* Lock the event queue */ used = 0; if (!SDL_EventQ.lock || SDL_LockMutex(SDL_EventQ.lock) == 0) { if (action == SDL_ADDEVENT) { for (i = 0; i < numevents; ++i) { used += SDL_AddEvent(&events[i]); } } else { SDL_EventEntry *entry, *next; SDL_SysWMEntry *wmmsg, *wmmsg_next; Uint32 type; if (action == SDL_GETEVENT) { /* Clean out any used wmmsg data FIXME: Do we want to retain the data for some period of time? */ for (wmmsg = SDL_EventQ.wmmsg_used; wmmsg; wmmsg = wmmsg_next) { wmmsg_next = wmmsg->next; wmmsg->next = SDL_EventQ.wmmsg_free; SDL_EventQ.wmmsg_free = wmmsg; } SDL_EventQ.wmmsg_used = NULL; } for (entry = SDL_EventQ.head; entry && (!events || used < numevents); entry = next) { next = entry->next; type = entry->event.type; if (minType <= type && type <= maxType) { if (events) { events[used] = entry->event; if (entry->event.type == SDL_SYSWMEVENT) { /* We need to copy the wmmsg somewhere safe. For now we'll guarantee it's valid at least until the next call to SDL_PeepEvents() */ if (SDL_EventQ.wmmsg_free) { wmmsg = SDL_EventQ.wmmsg_free; SDL_EventQ.wmmsg_free = wmmsg->next; } else { wmmsg = (SDL_SysWMEntry *)SDL_malloc(sizeof(*wmmsg)); } wmmsg->msg = *entry->event.syswm.msg; wmmsg->next = SDL_EventQ.wmmsg_used; SDL_EventQ.wmmsg_used = wmmsg; events[used].syswm.msg = &wmmsg->msg; } if (action == SDL_GETEVENT) { SDL_CutEvent(entry); } } ++used; } } } SDL_UnlockMutex(SDL_EventQ.lock); } else { return SDL_SetError("Couldn't lock event queue"); } |
︙ | ︙ | |||
359 360 361 362 363 364 365 | SDL_FlushEvents(type, type); } void SDL_FlushEvents(Uint32 minType, Uint32 maxType) { /* Don't look after we've quit */ | | | 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | SDL_FlushEvents(type, type); } void SDL_FlushEvents(Uint32 minType, Uint32 maxType) { /* Don't look after we've quit */ if (!SDL_AtomicGet(&SDL_EventQ.active)) { return; } /* Make sure the events are current */ #if 0 /* Actually, we can't do this since we might be flushing while processing a resize event, and calling this might trigger further resize events. |
︙ | ︙ |
Changes to jni/SDL2/src/filesystem/unix/SDL_sysfilesystem.c.
︙ | ︙ | |||
29 30 31 32 33 34 35 | #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/types.h> #include <limits.h> | | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <sys/stat.h> #include <sys/types.h> #include <limits.h> #if defined(__FREEBSD__) || defined(__OPENBSD__) #include <sys/sysctl.h> #endif #include "SDL_error.h" #include "SDL_stdinc.h" #include "SDL_filesystem.h" |
︙ | ︙ | |||
86 87 88 89 90 91 92 | if (sysctl(mib, SDL_arraysize(mib), fullpath, &buflen, NULL, 0) != -1) { retval = SDL_strdup(fullpath); if (!retval) { SDL_OutOfMemory(); return NULL; } } | > > > > > > > > > > > > > > > > > > > | | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | if (sysctl(mib, SDL_arraysize(mib), fullpath, &buflen, NULL, 0) != -1) { retval = SDL_strdup(fullpath); if (!retval) { SDL_OutOfMemory(); return NULL; } } #endif #if defined(__OPENBSD__) char **retvalargs; size_t len; const int mib[] = { CTL_KERN, KERN_PROC_ARGS, getpid(), KERN_PROC_ARGV }; if (sysctl(mib, 4, NULL, &len, NULL, 0) != -1) { retvalargs = SDL_malloc(len); if (!retvalargs) { SDL_OutOfMemory(); return NULL; } sysctl(mib, 4, retvalargs, &len, NULL, 0); retval = SDL_malloc(PATH_MAX + 1); if (retval) realpath(retvalargs[0], retval); SDL_free(retvalargs); } #endif #if defined(__SOLARIS__) const char *path = getexecname(); if ((path != NULL) && (path[0] == '/')) { /* must be absolute path... */ retval = SDL_strdup(path); if (!retval) { SDL_OutOfMemory(); return NULL; } |
︙ | ︙ |
Changes to jni/SDL2/src/haptic/linux/SDL_syshaptic.c.
︙ | ︙ | |||
686 687 688 689 690 691 692 | case SDL_HAPTIC_CARTESIAN: if (!src->dir[1]) *dest = (src->dir[0] >= 0 ? 0x4000 : 0xC000); else if (!src->dir[0]) *dest = (src->dir[1] >= 0 ? 0x8000 : 0); else { | | | 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 | case SDL_HAPTIC_CARTESIAN: if (!src->dir[1]) *dest = (src->dir[0] >= 0 ? 0x4000 : 0xC000); else if (!src->dir[0]) *dest = (src->dir[1] >= 0 ? 0x8000 : 0); else { float f = SDL_atan2(src->dir[1], src->dir[0]); /* Ideally we'd use fixed point math instead of floats... */ /* atan2 takes the parameters: Y-axis-value and X-axis-value (in that order) - Y-axis-value is the second coordinate (from center to SOUTH) - X-axis-value is the first coordinate (from center to EAST) We add 36000, because atan2 also returns negative values. Then we practically have the first spherical value. Therefore we proceed as in case SDL_HAPTIC_SPHERICAL and add another 9000 to get the polar value. |
︙ | ︙ |
Changes to jni/SDL2/src/haptic/windows/SDL_windowshaptic.c.
︙ | ︙ | |||
251 252 253 254 255 256 257 | SDL_hapticlist_item *next = NULL; SDL_Haptic *hapticitem = NULL; extern SDL_Haptic *SDL_haptics; for (hapticitem = SDL_haptics; hapticitem; hapticitem = hapticitem->next) { if ((hapticitem->hwdata->bXInputHaptic) && (hapticitem->hwdata->thread)) { /* we _have_ to stop the thread before we free the XInput DLL! */ | | | 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | SDL_hapticlist_item *next = NULL; SDL_Haptic *hapticitem = NULL; extern SDL_Haptic *SDL_haptics; for (hapticitem = SDL_haptics; hapticitem; hapticitem = hapticitem->next) { if ((hapticitem->hwdata->bXInputHaptic) && (hapticitem->hwdata->thread)) { /* we _have_ to stop the thread before we free the XInput DLL! */ SDL_AtomicSet(&hapticitem->hwdata->stopThread, 1); SDL_WaitThread(hapticitem->hwdata->thread, NULL); hapticitem->hwdata->thread = NULL; } } for (item = SDL_hapticlist; item; item = next) { /* Opened and not closed haptics are leaked, this is on purpose. |
︙ | ︙ |
Changes to jni/SDL2/src/haptic/windows/SDL_windowshaptic_c.h.
︙ | ︙ | |||
38 39 40 41 42 43 44 | #endif DWORD axes[3]; /* Axes to use. */ SDL_bool is_joystick; /* Device is loaded as joystick. */ Uint8 bXInputHaptic; /* Supports force feedback via XInput. */ Uint8 userid; /* XInput userid index for this joystick */ SDL_Thread *thread; SDL_mutex *mutex; | | | | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | #endif DWORD axes[3]; /* Axes to use. */ SDL_bool is_joystick; /* Device is loaded as joystick. */ Uint8 bXInputHaptic; /* Supports force feedback via XInput. */ Uint8 userid; /* XInput userid index for this joystick */ SDL_Thread *thread; SDL_mutex *mutex; Uint32 stopTicks; SDL_atomic_t stopThread; }; /* * Haptic system effect data. */ struct haptic_hweffect |
︙ | ︙ |
Changes to jni/SDL2/src/haptic/windows/SDL_xinputhaptic.c.
︙ | ︙ | |||
142 143 144 145 146 147 148 | * are absent in the XInput path for now. :( */ static int SDLCALL SDL_RunXInputHaptic(void *arg) { struct haptic_hwdata *hwdata = (struct haptic_hwdata *) arg; | | | 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | * are absent in the XInput path for now. :( */ static int SDLCALL SDL_RunXInputHaptic(void *arg) { struct haptic_hwdata *hwdata = (struct haptic_hwdata *) arg; while (!SDL_AtomicGet(&hwdata->stopThread)) { SDL_Delay(50); SDL_LockMutex(hwdata->mutex); /* If we're currently running and need to stop... */ if (hwdata->stopTicks) { if ((hwdata->stopTicks != SDL_HAPTIC_INFINITY) && SDL_TICKS_PASSED(SDL_GetTicks(), hwdata->stopTicks)) { XINPUT_VIBRATION vibration = { 0, 0 }; hwdata->stopTicks = 0; |
︙ | ︙ | |||
257 258 259 260 261 262 263 | SDL_SetError("Couldn't find joystick in haptic device list"); return -1; } void SDL_XINPUT_HapticClose(SDL_Haptic * haptic) { | | | 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | SDL_SetError("Couldn't find joystick in haptic device list"); return -1; } void SDL_XINPUT_HapticClose(SDL_Haptic * haptic) { SDL_AtomicSet(&haptic->hwdata->stopThread, 1); SDL_WaitThread(haptic->hwdata->thread, NULL); SDL_DestroyMutex(haptic->hwdata->mutex); } void SDL_XINPUT_HapticQuit(void) { |
︙ | ︙ |
Changes to jni/SDL2/src/joystick/SDL_gamecontrollerdb.h.
︙ | ︙ | |||
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | "4c050000000000006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", "4c05000000000000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "11010000000000002014000000000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b12,x:b2,y:b3,", "11010000000000001714000000000000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b12,x:b2,y:b3,", "5e040000000000008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", #endif #if defined(__LINUX__) "03000000e82000006058000001010000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "030000006f0e00000104000000010000,Gamestop Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "03000000ba2200002010000001010000,Jess Technology USB Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,", "030000006d04000019c2000010010000,Logitech Cordless RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "030000006d0400001dc2000014400000,Logitech F310 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000006d0400001ec2000020200000,Logitech F510 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000006d04000019c2000011010000,Logitech F710 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ "030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000006d04000018c2000010010000,Logitech RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000550900001072000011010000,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", "050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b1,b:b0,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "050000003620000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,", "030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", "03000000341a00003608000011010000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "030000004c050000c405000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "050000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", | > > > > > > > | 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | "4c050000000000006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", "4c05000000000000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "11010000000000002014000000000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b12,x:b2,y:b3,", "11010000000000001714000000000000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b12,x:b2,y:b3,", "5e040000000000008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", #endif #if defined(__LINUX__) "03000000100000008200000011010000,Akishop Customs PS360+ v1.66,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", "03000000e82000006058000001010000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "030000006f0e00000104000000010000,Gamestop Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "03000000ba2200002010000001010000,Jess Technology USB Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,", "030000006d04000019c2000010010000,Logitech Cordless RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "030000006d0400001dc2000014400000,Logitech F310 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000006d0400001ec2000020200000,Logitech F510 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000006d04000019c2000011010000,Logitech F710 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ "030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000006d04000018c2000010010000,Logitech RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000380700008433000011010000,Mad Catz FightStick TE S+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000380700008483000011010000,Mad Catz FightStick TE S+ PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "03000000380700003847000090040000,Mad Catz Wired Xbox 360 Controller (SFIV),a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "03000000380700008034000011010000,Mad Catz fightstick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000380700008084000011010000,Mad Catz fightstick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "03000000380700001888000010010000,MadCatz PC USB Wired Stick 8818,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000550900001072000011010000,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", "050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b1,b:b0,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "050000003620000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,", "030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", "03000000341a00003608000011010000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "030000004c050000c405000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "050000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", |
︙ | ︙ |
Changes to jni/SDL2/src/joystick/android/SDL_sysjoystick.c.
︙ | ︙ | |||
336 337 338 339 340 341 342 | item = item->next; } if (item == NULL) { return -1; } | < | 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | item = item->next; } if (item == NULL) { return -1; } if (item->joystick) { item->joystick->hwdata = NULL; } if (prev != NULL) { prev->next = item->next; } else { |
︙ | ︙ | |||
372 373 374 375 376 377 378 | #ifdef DEBUG_JOYSTICK SDL_Log("Removed joystick with device_id %d", device_id); #endif SDL_free(item->name); SDL_free(item); | | | 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | #ifdef DEBUG_JOYSTICK SDL_Log("Removed joystick with device_id %d", device_id); #endif SDL_free(item->name); SDL_free(item); return numjoysticks; } int SDL_SYS_JoystickInit(void) { const char *hint; |
︙ | ︙ |
Changes to jni/SDL2/src/joystick/android/SDL_sysjoystick_c.h.
1 | /* | | | | | | | | | | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | /* Simple DirectMedia Layer Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #ifdef SDL_JOYSTICK_ANDROID #include "../SDL_sysjoystick.h" extern int Android_OnPadDown(int device_id, int keycode); |
︙ | ︙ |
Changes to jni/SDL2/src/joystick/emscripten/SDL_sysjoystick_c.h.
1 | /* | | | | | | | | | | | | | | | | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | /* Simple DirectMedia Layer Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #ifdef SDL_JOYSTICK_EMSCRIPTEN #include "../SDL_sysjoystick.h" |
︙ | ︙ |
Changes to jni/SDL2/src/joystick/windows/SDL_mmjoystick.c.
︙ | ︙ | |||
22 23 24 25 26 27 28 | #ifdef SDL_JOYSTICK_WINMM /* Win32 MultiMedia Joystick driver, contributed by Andrei de A. Formiga */ #include "../../core/windows/SDL_windows.h" #include <mmsystem.h> | < < | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #ifdef SDL_JOYSTICK_WINMM /* Win32 MultiMedia Joystick driver, contributed by Andrei de A. Formiga */ #include "../../core/windows/SDL_windows.h" #include <mmsystem.h> #include <regstr.h> #include "SDL_events.h" #include "SDL_joystick.h" #include "../SDL_sysjoystick.h" #include "../SDL_joystick_c.h" |
︙ | ︙ |
Changes to jni/SDL2/src/joystick/windows/SDL_xinputjoystick.c.
︙ | ︙ | |||
372 373 374 375 376 377 378 | { JoyStick_DeviceData *device = SYS_Joystick; int index; for (index = device_index; index > 0; index--) device = device->pNext; | | | 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | { JoyStick_DeviceData *device = SYS_Joystick; int index; for (index = device_index; index > 0; index--) device = device->pNext; return device->bXInputDevice; } #else /* !SDL_JOYSTICK_XINPUT */ typedef struct JoyStick_DeviceData JoyStick_DeviceData; SDL_bool SDL_XINPUT_Enabled(void) |
︙ | ︙ |
Changes to jni/SDL2/src/main/android/SDL_android_main.c.
︙ | ︙ | |||
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | /* Start up the SDL app */ JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject array) { int i; int argc; int status; /* This interface could expand with ABI negotiation, callbacks, etc. */ SDL_Android_Init(env, cls); SDL_SetMainReady(); /* Prepare the arguments. */ | > > | | | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | /* Start up the SDL app */ JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject array) { int i; int argc; int status; int len; char** argv; /* This interface could expand with ABI negotiation, callbacks, etc. */ SDL_Android_Init(env, cls); SDL_SetMainReady(); /* Prepare the arguments. */ len = (*env)->GetArrayLength(env, array); argv = SDL_stack_alloc(char*, 1 + len + 1); argc = 0; /* Use the name "app_process" so PHYSFS_platformCalcBaseDir() works. https://bitbucket.org/MartinFelis/love-android-sdl2/issue/23/release-build-crash-on-start */ argv[argc++] = SDL_strdup("app_process"); for (i = 0; i < len; ++i) { const char* utf; |
︙ | ︙ | |||
62 63 64 65 66 67 68 | status = SDL_main(argc, argv); /* Release the arguments. */ for (i = 0; i < argc; ++i) { SDL_free(argv[i]); } | | | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | status = SDL_main(argc, argv); /* Release the arguments. */ for (i = 0; i < argc; ++i) { SDL_free(argv[i]); } SDL_stack_free(argv); /* Do not issue an exit or the whole application will terminate instead of just the SDL thread */ /* exit(status); */ return status; } #endif /* __ANDROID__ */ /* vi: set ts=4 sw=4 expandtab: */ |
Changes to jni/SDL2/src/render/SDL_render.c.
︙ | ︙ | |||
1228 1229 1230 1231 1232 1233 1234 | want_aspect = (float)renderer->logical_w / renderer->logical_h; real_aspect = (float)w / h; /* Clear the scale because we're setting viewport in output coordinates */ SDL_RenderSetScale(renderer, 1.0f, 1.0f); | > > > > > > > > > > > > | | 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 | want_aspect = (float)renderer->logical_w / renderer->logical_h; real_aspect = (float)w / h; /* Clear the scale because we're setting viewport in output coordinates */ SDL_RenderSetScale(renderer, 1.0f, 1.0f); if (renderer->integer_scale) { if (want_aspect > real_aspect) { scale = (float)(w / renderer->logical_w); } else { scale = (float)(h / renderer->logical_h); } viewport.w = (int)SDL_ceil(renderer->logical_w * scale); viewport.x = (w - viewport.w) / 2; viewport.h = (int)SDL_ceil(renderer->logical_h * scale); viewport.y = (h - viewport.h) / 2; SDL_RenderSetViewport(renderer, &viewport); } else if (SDL_fabs(want_aspect-real_aspect) < 0.0001) { /* The aspect ratios are the same, just scale appropriately */ scale = (float)w / renderer->logical_w; SDL_RenderSetViewport(renderer, NULL); } else if (want_aspect > real_aspect) { /* We want a wider aspect ratio than is available - letterbox it */ scale = (float)w / renderer->logical_w; viewport.x = 0; |
︙ | ︙ | |||
1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 | if (w) { *w = renderer->logical_w; } if (h) { *h = renderer->logical_h; } } int SDL_RenderSetViewport(SDL_Renderer * renderer, const SDL_Rect * rect) { CHECK_RENDERER_MAGIC(renderer, -1); if (rect) { | > > > > > > > > > > > > > > > > > > | 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 | if (w) { *w = renderer->logical_w; } if (h) { *h = renderer->logical_h; } } int SDL_RenderSetIntegerScale(SDL_Renderer * renderer, SDL_bool enable) { CHECK_RENDERER_MAGIC(renderer, -1); renderer->integer_scale = enable; return UpdateLogicalSize(renderer); } SDL_bool SDLCALL SDL_RenderGetIntegerScale(SDL_Renderer * renderer) { CHECK_RENDERER_MAGIC(renderer, SDL_FALSE); return renderer->integer_scale; } int SDL_RenderSetViewport(SDL_Renderer * renderer, const SDL_Rect * rect) { CHECK_RENDERER_MAGIC(renderer, -1); if (rect) { |
︙ | ︙ |
Changes to jni/SDL2/src/render/SDL_sysrender.h.
︙ | ︙ | |||
130 131 132 133 134 135 136 137 138 139 140 141 142 143 | SDL_bool hidden; /* The logical resolution for rendering */ int logical_w; int logical_h; int logical_w_backup; int logical_h_backup; /* The drawable area within the window */ SDL_Rect viewport; SDL_Rect viewport_backup; /* The clip rectangle within the window */ SDL_Rect clip_rect; | > > > | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | SDL_bool hidden; /* The logical resolution for rendering */ int logical_w; int logical_h; int logical_w_backup; int logical_h_backup; /* Whether or not to force the viewport to even integer intervals */ SDL_bool integer_scale; /* The drawable area within the window */ SDL_Rect viewport; SDL_Rect viewport_backup; /* The clip rectangle within the window */ SDL_Rect clip_rect; |
︙ | ︙ |
Changes to jni/SDL2/src/stdlib/SDL_malloc.c.
︙ | ︙ | |||
2942 2943 2944 2945 2946 2947 2948 | } #endif /* !NO_MALLINFO */ static void internal_malloc_stats(mstate m) { if (!PREACTION(m)) { | < < < < | 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 | } #endif /* !NO_MALLINFO */ static void internal_malloc_stats(mstate m) { if (!PREACTION(m)) { size_t maxfp = 0; size_t fp = 0; size_t used = 0; check_malloc_state(m); if (is_initialized(m)) { msegmentptr s = &m->seg; maxfp = m->max_footprint; fp = m->footprint; used = fp - (m->topsize + TOP_FOOT_SIZE); while (s != 0) { mchunkptr q = align_as_chunk(s->base); while (segment_holds(s, q) && q != m->top && q->head != FENCEPOST_HEAD) { |
︙ | ︙ |
Changes to jni/SDL2/src/stdlib/SDL_qsort.c.
|
| | > | | < < > | < < < < | < | < < < > | < | < < < < < < < < | < < < < | < | < > > > | < < < < < > | < < < < < > | | | | | | | | > > > | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | | < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | /* Simple DirectMedia Layer Copyright (C) 1997-2016 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ #if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS) #define SDL_DISABLE_ANALYZE_MACROS 1 #endif #include "../SDL_internal.h" #include "SDL_stdinc.h" #include "SDL_assert.h" #if defined(HAVE_QSORT) void SDL_qsort(void *base, size_t nmemb, size_t size, int (*compare) (const void *, const void *)) { qsort(base, nmemb, size, compare); } #else #ifdef assert #undef assert #endif #define assert SDL_assert #ifdef malloc #undef malloc #endif #define malloc SDL_malloc #ifdef free #undef free #endif #define free SDL_free #ifdef memcpy #undef memcpy #endif #define memcpy SDL_memcpy #ifdef memmove #undef memmove #endif #define memmove SDL_memmove #ifdef qsortG #undef qsortG #endif #define qsortG SDL_qsort /* This code came from Gareth McCaughan, under the zlib license. Specifically this: https://www.mccaughan.org.uk/software/qsort.c-1.14 Everything below this comment until the HAVE_QSORT #endif was from Gareth (any minor changes will be noted inline). Thank you to Gareth for relicensing this code under the zlib license for our benefit! --ryan. */ /* This is a drop-in replacement for the C library's |qsort()| routine. * * It is intended for use where you know or suspect that your * platform's qsort is bad. If that isn't the case, then you * should probably use the qsort your system gives you in preference * to mine -- it will likely have been tested and tuned better. * * Features: * - Median-of-three pivoting (and more) * - Truncation and final polishing by a single insertion sort * - Early truncation when no swaps needed in pivoting step * - Explicit recursion, guaranteed not to overflow * - A few little wrinkles stolen from the GNU |qsort()|. * (For the avoidance of doubt, no code was stolen, only * broad ideas.) * - separate code for non-aligned / aligned / word-size objects * * Earlier releases of this code used an idiosyncratic licence * I wrote myself, because I'm an idiot. The code is now released * under the "zlib/libpng licence"; you will find the actual * terms in the next comment. I request (but do not require) * that if you make any changes beyond the name of the exported * routine and reasonable tweaks to the TRUNC_* and * PIVOT_THRESHOLD values, you modify the _ID string so as * to make it clear that you have changed the code. * * If you find problems with this code, or find ways of * making it significantly faster, please let me know! * My e-mail address, valid as of early 2016 and for the * foreseeable future, is * gareth.mccaughan@pobox.com * Thanks! * * Gareth McCaughan */ /* Copyright (c) 1998-2016 Gareth McCaughan * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any * damages arising from the use of this software. * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; * you must not claim that you wrote the original software. * If you use this software in a product, an acknowledgment * in the product documentation would be appreciated but * is not required. * * 2. Altered source versions must be plainly marked as such, * and must not be misrepresented as being the original software. * * 3. This notice may not be removed or altered from any source * distribution. */ /* Revision history since release: * 1998-03-19 v1.12 First release I have any records of. * 2007-09-02 v1.13 Fix bug kindly reported by Dan Bodoh * (premature termination of recursion). * Add a few clarifying comments. * Minor improvements to debug output. * 2016-02-21 v1.14 Replace licence with 2-clause BSD, * and clarify a couple of things in * comments. No code changes. */ /* BEGIN SDL CHANGE ... commented this out with an #if 0 block. --ryan. */ #if 0 #include <assert.h> #include <stdlib.h> #include <string.h> #define DEBUG_QSORT static char _ID[]="<qsort.c gjm 1.14 2016-02-21>"; #endif /* END SDL CHANGE ... commented this out with an #if 0 block. --ryan. */ /* How many bytes are there per word? (Must be a power of 2, * and must in fact equal sizeof(int).) */ #define WORD_BYTES sizeof(int) /* How big does our stack need to be? Answer: one entry per * bit in a |size_t|. */ #define STACK_SIZE (8*sizeof(size_t)) /* Different situations have slightly different requirements, * and we make life epsilon easier by using different truncation * points for the three different cases. * So far, I have tuned TRUNC_words and guessed that the same * value might work well for the other two cases. Of course * what works well on my machine might work badly on yours. */ #define TRUNC_nonaligned 12 #define TRUNC_aligned 12 #define TRUNC_words 12*WORD_BYTES /* nb different meaning */ /* We use a simple pivoting algorithm for shortish sub-arrays * and a more complicated one for larger ones. The threshold * is PIVOT_THRESHOLD. */ #define PIVOT_THRESHOLD 40 typedef struct { char * first; char * last; } stack_entry; #define pushLeft {stack[stacktop].first=ffirst;stack[stacktop++].last=last;} #define pushRight {stack[stacktop].first=first;stack[stacktop++].last=llast;} #define doLeft {first=ffirst;llast=last;continue;} #define doRight {ffirst=first;last=llast;continue;} #define pop {if (--stacktop<0) break;\ first=ffirst=stack[stacktop].first;\ last=llast=stack[stacktop].last;\ |
︙ | ︙ | |||
193 194 195 196 197 198 199 | * fail on systems that convert pointers to integers * in non-standard ways. * - I assume that |8*sizeof(size_t)<=INT_MAX|. This * would be false on a machine with 8-bit |char|s, * 16-bit |int|s and 4096-bit |size_t|s. :-) */ | | > > | | | 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 | * fail on systems that convert pointers to integers * in non-standard ways. * - I assume that |8*sizeof(size_t)<=INT_MAX|. This * would be false on a machine with 8-bit |char|s, * 16-bit |int|s and 4096-bit |size_t|s. :-) */ /* The recursion logic is the same in each case. * We keep chopping up until we reach subarrays of size * strictly less than Trunc; we leave these unsorted. */ #define Recurse(Trunc) \ { size_t l=last-ffirst,r=llast-first; \ if (l<Trunc) { \ if (r>=Trunc) doRight \ else pop \ } \ else if (l<=r) { pushLeft; doRight } \ else if (r>=Trunc) { pushRight; doLeft }\ else doLeft \ } /* and so is the pivoting logic (note: last is inclusive): */ #define Pivot(swapper,sz) \ if (last-first>PIVOT_THRESHOLD*sz) mid=pivot_big(first,mid,last,sz,compare);\ else { \ if (compare(first,mid)<0) { \ if (compare(mid,last)>0) { \ swapper(mid,last); \ if (compare(first,mid)>0) swapper(first,mid);\ } \ } \ |
︙ | ︙ | |||
231 232 233 234 235 236 237 | #ifdef DEBUG_QSORT #include <stdio.h> #endif /* and so is the partitioning logic: */ #define Partition(swapper,sz) { \ | < | < > > > > | | 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 | #ifdef DEBUG_QSORT #include <stdio.h> #endif /* and so is the partitioning logic: */ #define Partition(swapper,sz) { \ do { \ while (compare(first,pivot)<0) first+=sz; \ while (compare(pivot,last)<0) last-=sz; \ if (first<last) { \ swapper(first,last); \ first+=sz; last-=sz; } \ else if (first==last) { first+=sz; last-=sz; break; }\ } while (first<=last); \ } /* and so is the pre-insertion-sort operation of putting * the smallest element into place as a sentinel. * Doing this makes the inner loop nicer. I got this * idea from the GNU implementation of qsort(). * We find the smallest element from the first |nmemb|, * or the first |limit|, whichever is smaller; * therefore we must have ensured that the globally smallest * element is in the first |limit|. */ #define PreInsertion(swapper,limit,sz) \ first=base; \ last=first + ((nmemb>limit ? limit : nmemb)-1)*sz;\ while (last!=base) { \ if (compare(first,last)>0) first=last; \ last-=sz; } \ if (first!=base) swapper(first,(char*)base); /* and so is the insertion sort, in the first two cases: */ #define Insertion(swapper) \ |
︙ | ︙ | |||
290 291 292 293 294 295 296 | do { register int t=*aa;*aa++=*bb; *bb++=t; } while (sz-=WORD_BYTES); } #define SWAP_words(a,b) { \ register int t=*((int*)a); *((int*)a)=*((int*)b); *((int*)b)=t; } /* ---------------------------------------------------------------------- */ | < | | < | > > > | < | | | | | | < | | | | | | < | | | | | | | | | | < | > < | | | < | | | | | | | < | | | | < | | | | | | | | > | | | < | | | < | | | | | | | < | | | | < | | | | | | | | > | | | < | | | < | | | | | < | | | | | | | | < < | | | < | > | | > > > | | > | | | < | | | | | | < | < | | < | | | < | < | | | | | | > | > | 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 | do { register int t=*aa;*aa++=*bb; *bb++=t; } while (sz-=WORD_BYTES); } #define SWAP_words(a,b) { \ register int t=*((int*)a); *((int*)a)=*((int*)b); *((int*)b)=t; } /* ---------------------------------------------------------------------- */ static char * pivot_big(char *first, char *mid, char *last, size_t size, int compare(const void *, const void *)) { int d=(((last-first)/size)>>3)*size; #ifdef DEBUG_QSORT fprintf(stderr, "pivot_big: first=%p last=%p size=%lu n=%lu\n", first, (unsigned long)last, size, (unsigned long)((last-first+1)/size)); #endif char *m1,*m2,*m3; { char *a=first, *b=first+d, *c=first+2*d; #ifdef DEBUG_QSORT fprintf(stderr,"< %d %d %d @ %p %p %p\n",*(int*)a,*(int*)b,*(int*)c, a,b,c); #endif m1 = compare(a,b)<0 ? (compare(b,c)<0 ? b : (compare(a,c)<0 ? c : a)) : (compare(a,c)<0 ? a : (compare(b,c)<0 ? c : b)); } { char *a=mid-d, *b=mid, *c=mid+d; #ifdef DEBUG_QSORT fprintf(stderr,". %d %d %d @ %p %p %p\n",*(int*)a,*(int*)b,*(int*)c, a,b,c); #endif m2 = compare(a,b)<0 ? (compare(b,c)<0 ? b : (compare(a,c)<0 ? c : a)) : (compare(a,c)<0 ? a : (compare(b,c)<0 ? c : b)); } { char *a=last-2*d, *b=last-d, *c=last; #ifdef DEBUG_QSORT fprintf(stderr,"> %d %d %d @ %p %p %p\n",*(int*)a,*(int*)b,*(int*)c, a,b,c); #endif m3 = compare(a,b)<0 ? (compare(b,c)<0 ? b : (compare(a,c)<0 ? c : a)) : (compare(a,c)<0 ? a : (compare(b,c)<0 ? c : b)); } #ifdef DEBUG_QSORT fprintf(stderr,"-> %d %d %d @ %p %p %p\n",*(int*)m1,*(int*)m2,*(int*)m3, m1,m2,m3); #endif return compare(m1,m2)<0 ? (compare(m2,m3)<0 ? m2 : (compare(m1,m3)<0 ? m3 : m1)) : (compare(m1,m3)<0 ? m1 : (compare(m2,m3)<0 ? m3 : m2)); } /* ---------------------------------------------------------------------- */ static void qsort_nonaligned(void *base, size_t nmemb, size_t size, int (*compare)(const void *, const void *)) { stack_entry stack[STACK_SIZE]; int stacktop=0; char *first,*last; char *pivot=malloc(size); size_t trunc=TRUNC_nonaligned*size; assert(pivot!=0); first=(char*)base; last=first+(nmemb-1)*size; if (last-first>=trunc) { char *ffirst=first, *llast=last; while (1) { /* Select pivot */ { char * mid=first+size*((last-first)/size >> 1); Pivot(SWAP_nonaligned,size); memcpy(pivot,mid,size); } /* Partition. */ Partition(SWAP_nonaligned,size); /* Prepare to recurse/iterate. */ Recurse(trunc) } } PreInsertion(SWAP_nonaligned,TRUNC_nonaligned-1,size); Insertion(SWAP_nonaligned); free(pivot); } static void qsort_aligned(void *base, size_t nmemb, size_t size, int (*compare)(const void *, const void *)) { stack_entry stack[STACK_SIZE]; int stacktop=0; char *first,*last; char *pivot=malloc(size); size_t trunc=TRUNC_aligned*size; assert(pivot!=0); first=(char*)base; last=first+(nmemb-1)*size; if (last-first>=trunc) { char *ffirst=first,*llast=last; while (1) { /* Select pivot */ { char * mid=first+size*((last-first)/size >> 1); Pivot(SWAP_aligned,size); memcpy(pivot,mid,size); } /* Partition. */ Partition(SWAP_aligned,size); /* Prepare to recurse/iterate. */ Recurse(trunc) } } PreInsertion(SWAP_aligned,TRUNC_aligned-1,size); Insertion(SWAP_aligned); free(pivot); } static void qsort_words(void *base, size_t nmemb, int (*compare)(const void *, const void *)) { stack_entry stack[STACK_SIZE]; int stacktop=0; char *first,*last; char *pivot=malloc(WORD_BYTES); assert(pivot!=0); first=(char*)base; last=first+(nmemb-1)*WORD_BYTES; if (last-first>=TRUNC_words) { char *ffirst=first, *llast=last; while (1) { #ifdef DEBUG_QSORT fprintf(stderr,"Doing %d:%d: ", (first-(char*)base)/WORD_BYTES, (last-(char*)base)/WORD_BYTES); #endif /* Select pivot */ { char * mid=first+WORD_BYTES*((last-first) / (2*WORD_BYTES)); Pivot(SWAP_words,WORD_BYTES); *(int*)pivot=*(int*)mid; #ifdef DEBUG_QSORT fprintf(stderr,"pivot = %p = #%lu = %d\n", mid, (unsigned long)(((int*)mid)-((int*)base)), *(int*)mid); #endif } /* Partition. */ Partition(SWAP_words,WORD_BYTES); #ifdef DEBUG_QSORT fprintf(stderr, "after partitioning first=#%lu last=#%lu\n", (first-(char*)base)/4lu, (last-(char*)base)/4lu); #endif /* Prepare to recurse/iterate. */ Recurse(TRUNC_words) } } PreInsertion(SWAP_words,(TRUNC_words/WORD_BYTES)-1,WORD_BYTES); /* Now do insertion sort. */ last=((char*)base)+nmemb*WORD_BYTES; for (first=((char*)base)+WORD_BYTES;first!=last;first+=WORD_BYTES) { /* Find the right place for |first|. My apologies for var reuse */ int *pl=(int*)(first-WORD_BYTES),*pr=(int*)first; *(int*)pivot=*(int*)first; for (;compare(pl,pivot)>0;pr=pl,--pl) { *pr=*pl; } if (pr!=(int*)first) *pr=*(int*)pivot; } free(pivot); } /* ---------------------------------------------------------------------- */ extern void qsortG(void *base, size_t nmemb, size_t size, int (*compare)(const void *, const void *)) { if (nmemb<=1) return; if (((int)base|size)&(WORD_BYTES-1)) qsort_nonaligned(base,nmemb,size,compare); else if (size!=WORD_BYTES) qsort_aligned(base,nmemb,size,compare); else qsort_words(base,nmemb,compare); } #endif /* HAVE_QSORT */ /* vi: set ts=4 sw=4 expandtab: */ |
Changes to jni/SDL2/src/test/SDL_test_common.c.
︙ | ︙ | |||
1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 | if (window) { int w, h; SDL_GetWindowSize(window, &w, &h); SDL_SetWindowSize(window, w/2, h/2); } } break; case SDLK_c: if (withControl) { /* Ctrl-C copy awesome text! */ SDL_SetClipboardText("SDL rocks!\nYou know it!"); printf("Copied text to clipboard\n"); } if (withAlt) { | > > > > > > > > > > > > > > > > > > | 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 | if (window) { int w, h; SDL_GetWindowSize(window, &w, &h); SDL_SetWindowSize(window, w/2, h/2); } } break; case SDLK_o: if (withControl) { /* Ctrl-O (or Ctrl-Shift-O) changes window opacity. */ SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); if (window) { float opacity; if (SDL_GetWindowOpacity(window, &opacity) == 0) { if (withShift) { opacity += 0.20f; } else { opacity -= 0.20f; } SDL_SetWindowOpacity(window, opacity); } } } break; case SDLK_c: if (withControl) { /* Ctrl-C copy awesome text! */ SDL_SetClipboardText("SDL rocks!\nYou know it!"); printf("Copied text to clipboard\n"); } if (withAlt) { |
︙ | ︙ |
Changes to jni/SDL2/src/test/SDL_test_compare.c.
︙ | ︙ | |||
39 40 41 42 43 44 45 | int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error) { int ret; int i,j; int bpp, bpp_reference; Uint8 *p, *p_reference; int dist; | | | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, int allowable_error) { int ret; int i,j; int bpp, bpp_reference; Uint8 *p, *p_reference; int dist; int sampleErrorX = 0, sampleErrorY = 0, sampleDist = 0; Uint8 R, G, B, A; Uint8 Rd, Gd, Bd, Ad; char imageFilename[128]; char referenceFilename[128]; /* Validate input surfaces */ if (surface == NULL || referenceSurface == NULL) { |
︙ | ︙ |
Changes to jni/SDL2/src/thread/windows/SDL_systhread.c.
︙ | ︙ | |||
141 142 143 144 145 146 147 | } if (thread->handle == NULL) { return SDL_SetError("Not enough resources to create thread"); } return 0; } | < < < < < < < < < < < | < < | < < < < | < < < < < | < | < < < < < < < < | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | } if (thread->handle == NULL) { return SDL_SetError("Not enough resources to create thread"); } return 0; } #pragma pack(push,8) typedef struct tagTHREADNAME_INFO { DWORD dwType; /* must be 0x1000 */ LPCSTR szName; /* pointer to name (in user addr space) */ DWORD dwThreadID; /* thread ID (-1=caller thread) */ DWORD dwFlags; /* reserved for future use, must be zero */ } THREADNAME_INFO; #pragma pack(pop) void SDL_SYS_SetupThread(const char *name) { if ((name != NULL) && IsDebuggerPresent()) { /* This magic tells the debugger to name a thread if it's listening. */ THREADNAME_INFO inf; SDL_zero(inf); inf.dwType = 0x1000; inf.szName = name; inf.dwThreadID = (DWORD) -1; inf.dwFlags = 0; /* The debugger catches this, renames the thread, continues on. */ RaiseException(0x406D1388, 0, sizeof(inf) / sizeof(ULONG), (const ULONG_PTR*) &inf); } } SDL_threadID SDL_ThreadID(void) { return ((SDL_threadID) GetCurrentThreadId()); |
︙ | ︙ | |||
226 227 228 229 230 231 232 | } return 0; } void SDL_SYS_WaitThread(SDL_Thread * thread) { | < < < < | 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | } return 0; } void SDL_SYS_WaitThread(SDL_Thread * thread) { WaitForSingleObjectEx(thread->handle, INFINITE, FALSE); CloseHandle(thread->handle); } void SDL_SYS_DetachThread(SDL_Thread * thread) { CloseHandle(thread->handle); } #endif /* SDL_THREAD_WINDOWS */ /* vi: set ts=4 sw=4 expandtab: */ |
Changes to jni/SDL2/src/timer/SDL_timer.c.
︙ | ︙ | |||
31 32 33 34 35 36 37 | typedef struct _SDL_Timer { int timerID; SDL_TimerCallback callback; void *param; Uint32 interval; Uint32 scheduled; | | | 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | typedef struct _SDL_Timer { int timerID; SDL_TimerCallback callback; void *param; Uint32 interval; Uint32 scheduled; SDL_atomic_t canceled; struct _SDL_Timer *next; } SDL_Timer; typedef struct _SDL_TimerMap { int timerID; SDL_Timer *timer; |
︙ | ︙ | |||
56 57 58 59 60 61 62 | /* Padding to separate cache lines between threads */ char cache_pad[SDL_CACHELINE_SIZE]; /* Data used to communicate with the timer thread */ SDL_SpinLock lock; SDL_sem *sem; | | | | | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | /* Padding to separate cache lines between threads */ char cache_pad[SDL_CACHELINE_SIZE]; /* Data used to communicate with the timer thread */ SDL_SpinLock lock; SDL_sem *sem; SDL_Timer *pending; SDL_Timer *freelist; SDL_atomic_t active; /* List of timers - this is only touched by the timer thread */ SDL_Timer *timers; } SDL_TimerData; static SDL_TimerData SDL_timer_data; |
︙ | ︙ | |||
134 135 136 137 138 139 140 | pending = pending->next; SDL_AddTimerInternal(data, current); } freelist_head = NULL; freelist_tail = NULL; /* Check to see if we're still running, after maintenance */ | | | 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | pending = pending->next; SDL_AddTimerInternal(data, current); } freelist_head = NULL; freelist_tail = NULL; /* Check to see if we're still running, after maintenance */ if (!SDL_AtomicGet(&data->active)) { break; } /* Initial delay if there are no timers */ delay = SDL_MUTEX_MAXWAIT; tick = SDL_GetTicks(); |
︙ | ︙ | |||
156 157 158 159 160 161 162 | delay = (current->scheduled - tick); break; } /* We're going to do something with this timer */ data->timers = current->next; | | | | 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 | delay = (current->scheduled - tick); break; } /* We're going to do something with this timer */ data->timers = current->next; if (SDL_AtomicGet(¤t->canceled)) { interval = 0; } else { interval = current->callback(current->interval, current->param); } if (interval > 0) { /* Reschedule this timer */ current->scheduled = tick + interval; SDL_AddTimerInternal(data, current); } else { if (!freelist_head) { freelist_head = current; } if (freelist_tail) { freelist_tail->next = current; } freelist_tail = current; SDL_AtomicSet(¤t->canceled, 1); } } /* Adjust the delay based on processing time */ now = SDL_GetTicks(); interval = (now - tick); if (interval > delay) { |
︙ | ︙ | |||
203 204 205 206 207 208 209 | } int SDL_TimerInit(void) { SDL_TimerData *data = &SDL_timer_data; | | | | 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 | } int SDL_TimerInit(void) { SDL_TimerData *data = &SDL_timer_data; if (!SDL_AtomicGet(&data->active)) { const char *name = "SDLTimer"; data->timermap_lock = SDL_CreateMutex(); if (!data->timermap_lock) { return -1; } data->sem = SDL_CreateSemaphore(0); if (!data->sem) { SDL_DestroyMutex(data->timermap_lock); return -1; } SDL_AtomicSet(&data->active, 1); /* !!! FIXME: this is nasty. */ #if defined(__WIN32__) && !defined(HAVE_LIBC) #undef SDL_CreateThread #if SDL_DYNAMIC_API data->thread = SDL_CreateThread_REAL(SDL_TimerThread, name, data, NULL, NULL); #else data->thread = SDL_CreateThread(SDL_TimerThread, name, data, NULL, NULL); |
︙ | ︙ | |||
245 246 247 248 249 250 251 | void SDL_TimerQuit(void) { SDL_TimerData *data = &SDL_timer_data; SDL_Timer *timer; SDL_TimerMap *entry; | < < | | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | void SDL_TimerQuit(void) { SDL_TimerData *data = &SDL_timer_data; SDL_Timer *timer; SDL_TimerMap *entry; if (SDL_AtomicCAS(&data->active, 1, 0)) { /* active? Move to inactive. */ /* Shutdown the timer thread */ if (data->thread) { SDL_SemPost(data->sem); SDL_WaitThread(data->thread, NULL); data->thread = NULL; } |
︙ | ︙ | |||
287 288 289 290 291 292 293 | SDL_TimerID SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *param) { SDL_TimerData *data = &SDL_timer_data; SDL_Timer *timer; SDL_TimerMap *entry; | < < < | | | < | < < < | | 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | SDL_TimerID SDL_AddTimer(Uint32 interval, SDL_TimerCallback callback, void *param) { SDL_TimerData *data = &SDL_timer_data; SDL_Timer *timer; SDL_TimerMap *entry; SDL_AtomicLock(&data->lock); if (!SDL_AtomicGet(&data->active)) { if (SDL_TimerInit() < 0) { SDL_AtomicUnlock(&data->lock); return 0; } } timer = data->freelist; if (timer) { data->freelist = timer->next; } SDL_AtomicUnlock(&data->lock); if (timer) { SDL_RemoveTimer(timer->timerID); } else { timer = (SDL_Timer *)SDL_malloc(sizeof(*timer)); if (!timer) { SDL_OutOfMemory(); return 0; } } timer->timerID = SDL_AtomicIncRef(&data->nextID); timer->callback = callback; timer->param = param; timer->interval = interval; timer->scheduled = SDL_GetTicks() + interval; SDL_AtomicSet(&timer->canceled, 0); entry = (SDL_TimerMap *)SDL_malloc(sizeof(*entry)); if (!entry) { SDL_free(timer); SDL_OutOfMemory(); return 0; } |
︙ | ︙ | |||
373 374 375 376 377 378 379 | } break; } } SDL_UnlockMutex(data->timermap_lock); if (entry) { | | | | 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | } break; } } SDL_UnlockMutex(data->timermap_lock); if (entry) { if (!SDL_AtomicGet(&entry->timer->canceled)) { SDL_AtomicSet(&entry->timer->canceled, 1); canceled = SDL_TRUE; } SDL_free(entry); } return canceled; } /* vi: set ts=4 sw=4 expandtab: */ |
Changes to jni/SDL2/src/timer/windows/SDL_systimer.c.
︙ | ︙ | |||
185 186 187 188 189 190 191 192 193 194 195 196 197 198 | #if defined(__WINRT__) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER <= 180030723) static HANDLE mutex = 0; if (!mutex) { mutex = CreateEventEx(0, 0, 0, EVENT_ALL_ACCESS); } WaitForSingleObjectEx(mutex, ms, FALSE); #else Sleep(ms); #endif } #endif /* SDL_TIMER_WINDOWS */ /* vi: set ts=4 sw=4 expandtab: */ | > > > > | 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 | #if defined(__WINRT__) && defined(_MSC_FULL_VER) && (_MSC_FULL_VER <= 180030723) static HANDLE mutex = 0; if (!mutex) { mutex = CreateEventEx(0, 0, 0, EVENT_ALL_ACCESS); } WaitForSingleObjectEx(mutex, ms, FALSE); #else if (!ticks_started) { SDL_TicksInit(); } Sleep(ms); #endif } #endif /* SDL_TIMER_WINDOWS */ /* vi: set ts=4 sw=4 expandtab: */ |
Changes to jni/SDL2/src/video/SDL_sysvideo.h.
︙ | ︙ | |||
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | Uint32 last_fullscreen_flags; /* Stored position and size for windowed mode */ SDL_Rect windowed; SDL_DisplayMode fullscreen_mode; int xdpi, ydpi; float brightness; Uint16 *gamma; Uint16 *saved_gamma; /* (just offset into gamma) */ SDL_Surface *surface; SDL_bool surface_valid; SDL_bool is_hiding; SDL_bool is_destroying; SDL_WindowShaper *shaper; SDL_HitTest hit_test; void *hit_test_data; SDL_WindowUserData *data; | > > | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | Uint32 last_fullscreen_flags; /* Stored position and size for windowed mode */ SDL_Rect windowed; SDL_DisplayMode fullscreen_mode; float opacity; int xdpi, ydpi; float brightness; Uint16 *gamma; Uint16 *saved_gamma; /* (just offset into gamma) */ SDL_Surface *surface; SDL_bool surface_valid; SDL_bool is_hiding; SDL_bool is_destroying; SDL_bool is_dropping; /* drag/drop in progress, expecting SDL_SendDropComplete(). */ SDL_WindowShaper *shaper; SDL_HitTest hit_test; void *hit_test_data; SDL_WindowUserData *data; |
︙ | ︙ | |||
173 174 175 176 177 178 179 180 181 182 183 184 185 186 | int (*GetDisplayBounds) (_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); /* * Get the dots/pixels-per-inch of a display */ int (*GetDisplayDPI) (_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi); /* * Get a list of the available display modes for a display. */ void (*GetDisplayModes) (_THIS, SDL_VideoDisplay * display); /* * Setting the display mode is independent of creating windows, so | > > > > > | 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | int (*GetDisplayBounds) (_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); /* * Get the dots/pixels-per-inch of a display */ int (*GetDisplayDPI) (_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi); /* * Get the usable bounds of a display (bounds minus menubar or whatever) */ int (*GetDisplayUsableBounds) (_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); /* * Get a list of the available display modes for a display. */ void (*GetDisplayModes) (_THIS, SDL_VideoDisplay * display); /* * Setting the display mode is independent of creating windows, so |
︙ | ︙ | |||
198 199 200 201 202 203 204 205 206 207 208 209 210 211 | int (*CreateWindowFrom) (_THIS, SDL_Window * window, const void *data); void (*SetWindowTitle) (_THIS, SDL_Window * window); void (*SetWindowIcon) (_THIS, SDL_Window * window, SDL_Surface * icon); void (*SetWindowPosition) (_THIS, SDL_Window * window); void (*SetWindowSize) (_THIS, SDL_Window * window); void (*SetWindowMinimumSize) (_THIS, SDL_Window * window); void (*SetWindowMaximumSize) (_THIS, SDL_Window * window); void (*ShowWindow) (_THIS, SDL_Window * window); void (*HideWindow) (_THIS, SDL_Window * window); void (*RaiseWindow) (_THIS, SDL_Window * window); void (*MaximizeWindow) (_THIS, SDL_Window * window); void (*MinimizeWindow) (_THIS, SDL_Window * window); void (*RestoreWindow) (_THIS, SDL_Window * window); void (*SetWindowBordered) (_THIS, SDL_Window * window, SDL_bool bordered); | > > > > | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | int (*CreateWindowFrom) (_THIS, SDL_Window * window, const void *data); void (*SetWindowTitle) (_THIS, SDL_Window * window); void (*SetWindowIcon) (_THIS, SDL_Window * window, SDL_Surface * icon); void (*SetWindowPosition) (_THIS, SDL_Window * window); void (*SetWindowSize) (_THIS, SDL_Window * window); void (*SetWindowMinimumSize) (_THIS, SDL_Window * window); void (*SetWindowMaximumSize) (_THIS, SDL_Window * window); int (*GetWindowBordersSize) (_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right); int (*SetWindowOpacity) (_THIS, SDL_Window * window, float opacity); int (*SetWindowModalFor) (_THIS, SDL_Window * modal_window, SDL_Window * parent_window); int (*SetWindowInputFocus) (_THIS, SDL_Window * window); void (*ShowWindow) (_THIS, SDL_Window * window); void (*HideWindow) (_THIS, SDL_Window * window); void (*RaiseWindow) (_THIS, SDL_Window * window); void (*MaximizeWindow) (_THIS, SDL_Window * window); void (*MinimizeWindow) (_THIS, SDL_Window * window); void (*RestoreWindow) (_THIS, SDL_Window * window); void (*SetWindowBordered) (_THIS, SDL_Window * window, SDL_bool bordered); |
︙ | ︙ |
Changes to jni/SDL2/src/video/SDL_video.c.
︙ | ︙ | |||
680 681 682 683 684 685 686 | } else { SDL_GetDisplayBounds(displayIndex-1, rect); rect->x += rect->w; } rect->w = display->current_mode.w; rect->h = display->current_mode.h; } | > > > > > > > > > > > > | > > > > > > > | 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 | } else { SDL_GetDisplayBounds(displayIndex-1, rect); rect->x += rect->w; } rect->w = display->current_mode.w; rect->h = display->current_mode.h; } return 0; /* !!! FIXME: should this be an error if (rect==NULL) ? */ } int SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect) { CHECK_DISPLAY_INDEX(displayIndex, -1); if (rect) { SDL_VideoDisplay *display = &_this->displays[displayIndex]; if (_this->GetDisplayUsableBounds) { if (_this->GetDisplayUsableBounds(_this, display, rect) == 0) { return 0; } } /* Oh well, just give the entire display bounds. */ return SDL_GetDisplayBounds(displayIndex, rect); } return 0; /* !!! FIXME: should this be an error if (rect==NULL) ? */ } int SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi) { SDL_VideoDisplay *display; |
︙ | ︙ | |||
1281 1282 1283 1284 1285 1286 1287 | SDL_RestoreMousePosition(window); window->last_fullscreen_flags = window->flags; return 0; } #define CREATE_FLAGS \ | | < < < < < | 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 | SDL_RestoreMousePosition(window); window->last_fullscreen_flags = window->flags; return 0; } #define CREATE_FLAGS \ (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_SKIP_TASKBAR | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP) static void SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags) { if (flags & SDL_WINDOW_MAXIMIZED) { SDL_MaximizeWindow(window); } if (flags & SDL_WINDOW_MINIMIZED) { SDL_MinimizeWindow(window); } if (flags & SDL_WINDOW_FULLSCREEN) { |
︙ | ︙ | |||
1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 | if (!_this) { /* Initialize the video system if needed */ if (SDL_VideoInit(NULL) < 0) { return NULL; } } /* Some platforms can't create zero-sized windows */ if (w < 1) { w = 1; } if (h < 1) { h = 1; | > > > > > | 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 | if (!_this) { /* Initialize the video system if needed */ if (SDL_VideoInit(NULL) < 0) { return NULL; } } if ( (((flags & SDL_WINDOW_UTILITY) != 0) + ((flags & SDL_WINDOW_TOOLTIP) != 0) + ((flags & SDL_WINDOW_POPUP_MENU) != 0)) > 1 ) { SDL_SetError("Conflicting window flags specified"); return NULL; } /* Some platforms can't create zero-sized windows */ if (w < 1) { w = 1; } if (h < 1) { h = 1; |
︙ | ︙ | |||
1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 | if (SDL_WINDOWPOS_ISUNDEFINED(x) || SDL_WINDOWPOS_ISCENTERED(x)) { window->x = bounds.x + (bounds.w - w) / 2; } if (SDL_WINDOWPOS_ISUNDEFINED(y) || SDL_WINDOWPOS_ISCENTERED(y)) { window->y = bounds.y + (bounds.h - h) / 2; } } window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN); window->last_fullscreen_flags = window->flags; window->xdpi = window->ydpi = 0; window->brightness = 1.0f; window->next = _this->windows; window->is_destroying = SDL_FALSE; if (_this->windows) { _this->windows->prev = window; } | > > > > > > > > > > > > > > > > > > > > | 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 | if (SDL_WINDOWPOS_ISUNDEFINED(x) || SDL_WINDOWPOS_ISCENTERED(x)) { window->x = bounds.x + (bounds.w - w) / 2; } if (SDL_WINDOWPOS_ISUNDEFINED(y) || SDL_WINDOWPOS_ISCENTERED(y)) { window->y = bounds.y + (bounds.h - h) / 2; } } window->windowed.x = window->x; window->windowed.y = window->y; window->windowed.w = window->w; window->windowed.h = window->h; if (flags & SDL_WINDOW_FULLSCREEN) { SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); int displayIndex; SDL_Rect bounds; displayIndex = SDL_GetIndexOfDisplay(display); SDL_GetDisplayBounds(displayIndex, &bounds); window->x = bounds.x; window->y = bounds.y; window->w = bounds.w; window->h = bounds.h; } window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN); window->last_fullscreen_flags = window->flags; window->xdpi = window->ydpi = 0; window->opacity = 1.0f; window->brightness = 1.0f; window->next = _this->windows; window->is_destroying = SDL_FALSE; if (_this->windows) { _this->windows->prev = window; } |
︙ | ︙ | |||
1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 | return NULL; } window->magic = &_this->window_magic; window->id = _this->next_object_id++; window->flags = SDL_WINDOW_FOREIGN; window->last_fullscreen_flags = window->flags; window->is_destroying = SDL_FALSE; window->brightness = 1.0f; window->next = _this->windows; if (_this->windows) { _this->windows->prev = window; } _this->windows = window; | > | 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 | return NULL; } window->magic = &_this->window_magic; window->id = _this->next_object_id++; window->flags = SDL_WINDOW_FOREIGN; window->last_fullscreen_flags = window->flags; window->is_destroying = SDL_FALSE; window->opacity = 1.0f; window->brightness = 1.0f; window->next = _this->windows; if (_this->windows) { _this->windows->prev = window; } _this->windows = window; |
︙ | ︙ | |||
1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 | if (_this->SetWindowMinimumSize) { _this->SetWindowMinimumSize(_this, window); } /* Ensure that window is not smaller than minimal size */ SDL_SetWindowSize(window, SDL_max(window->w, window->min_w), SDL_max(window->h, window->min_h)); } } void SDL_GetWindowMinimumSize(SDL_Window * window, int *min_w, int *min_h) { CHECK_WINDOW_MAGIC(window,); if (min_w) { *min_w = window->min_w; | > > > > > > > > > > > > > > > > > > > > > > | 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 | if (_this->SetWindowMinimumSize) { _this->SetWindowMinimumSize(_this, window); } /* Ensure that window is not smaller than minimal size */ SDL_SetWindowSize(window, SDL_max(window->w, window->min_w), SDL_max(window->h, window->min_h)); } } int SDL_GetWindowBordersSize(SDL_Window * window, int *top, int *left, int *bottom, int *right) { int dummy = 0; if (!top) { top = &dummy; } if (!left) { left = &dummy; } if (!right) { right = &dummy; } if (!bottom) { bottom = &dummy; } /* Always initialize, so applications don't have to care */ *top = *left = *bottom = *right = 0; CHECK_WINDOW_MAGIC(window, -1); if (!_this->GetWindowBordersSize) { return SDL_Unsupported(); } return _this->GetWindowBordersSize(_this, window, top, left, bottom, right); } void SDL_GetWindowMinimumSize(SDL_Window * window, int *min_w, int *min_h) { CHECK_WINDOW_MAGIC(window,); if (min_w) { *min_w = window->min_w; |
︙ | ︙ | |||
2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 | float SDL_GetWindowBrightness(SDL_Window * window) { CHECK_WINDOW_MAGIC(window, 1.0f); return window->brightness; } int SDL_SetWindowGammaRamp(SDL_Window * window, const Uint16 * red, const Uint16 * green, const Uint16 * blue) { CHECK_WINDOW_MAGIC(window, -1); | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 | float SDL_GetWindowBrightness(SDL_Window * window) { CHECK_WINDOW_MAGIC(window, 1.0f); return window->brightness; } int SDL_SetWindowOpacity(SDL_Window * window, float opacity) { int retval; CHECK_WINDOW_MAGIC(window, -1); if (!_this->SetWindowOpacity) { return SDL_Unsupported(); } if (opacity < 0.0f) { opacity = 0.0f; } else if (opacity > 1.0f) { opacity = 1.0f; } retval = _this->SetWindowOpacity(_this, window, opacity); if (retval == 0) { window->opacity = opacity; } return retval; } int SDL_GetWindowOpacity(SDL_Window * window, float * out_opacity) { CHECK_WINDOW_MAGIC(window, -1); if (out_opacity) { *out_opacity = window->opacity; } return 0; } int SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window) { CHECK_WINDOW_MAGIC(modal_window, -1); CHECK_WINDOW_MAGIC(parent_window, -1); if (!_this->SetWindowModalFor) { return SDL_Unsupported(); } return _this->SetWindowModalFor(_this, modal_window, parent_window); } int SDL_SetWindowInputFocus(SDL_Window * window) { CHECK_WINDOW_MAGIC(window, -1); if (!_this->SetWindowInputFocus) { return SDL_Unsupported(); } return _this->SetWindowInputFocus(_this, window); } int SDL_SetWindowGammaRamp(SDL_Window * window, const Uint16 * red, const Uint16 * green, const Uint16 * blue) { CHECK_WINDOW_MAGIC(window, -1); |
︙ | ︙ |
Changes to jni/SDL2/src/video/android/SDL_androidtouch.c.
︙ | ︙ | |||
46 47 48 49 50 51 52 | int window_w, window_h; SDL_GetWindowSize(Android_Window, &window_w, &window_h); *window_x = (int)(x * window_w); *window_y = (int)(y * window_h); } | | | 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | int window_w, window_h; SDL_GetWindowSize(Android_Window, &window_w, &window_h); *window_x = (int)(x * window_w); *window_y = (int)(y * window_h); } static SDL_bool separate_mouse_and_touch = SDL_FALSE; static void SeparateEventsHintWatcher(void *userdata, const char *name, const char *oldValue, const char *newValue) { jclass mActivityClass = Android_JNI_GetActivityClass(); JNIEnv *env = Android_JNI_GetEnv(); |
︙ | ︙ |
Changes to jni/SDL2/src/video/directfb/SDL_DirectFB_video.c.
︙ | ︙ | |||
117 118 119 120 121 122 123 124 125 126 127 128 129 130 | device->PumpEvents = DirectFB_PumpEventsWindow; device->CreateWindow = DirectFB_CreateWindow; device->CreateWindowFrom = DirectFB_CreateWindowFrom; device->SetWindowTitle = DirectFB_SetWindowTitle; device->SetWindowIcon = DirectFB_SetWindowIcon; device->SetWindowPosition = DirectFB_SetWindowPosition; device->SetWindowSize = DirectFB_SetWindowSize; device->ShowWindow = DirectFB_ShowWindow; device->HideWindow = DirectFB_HideWindow; device->RaiseWindow = DirectFB_RaiseWindow; device->MaximizeWindow = DirectFB_MaximizeWindow; device->MinimizeWindow = DirectFB_MinimizeWindow; device->RestoreWindow = DirectFB_RestoreWindow; device->SetWindowGrab = DirectFB_SetWindowGrab; | > | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | device->PumpEvents = DirectFB_PumpEventsWindow; device->CreateWindow = DirectFB_CreateWindow; device->CreateWindowFrom = DirectFB_CreateWindowFrom; device->SetWindowTitle = DirectFB_SetWindowTitle; device->SetWindowIcon = DirectFB_SetWindowIcon; device->SetWindowPosition = DirectFB_SetWindowPosition; device->SetWindowSize = DirectFB_SetWindowSize; device->SetWindowOpacity = DirectFB_SetWindowOpacity; device->ShowWindow = DirectFB_ShowWindow; device->HideWindow = DirectFB_HideWindow; device->RaiseWindow = DirectFB_RaiseWindow; device->MaximizeWindow = DirectFB_MaximizeWindow; device->MinimizeWindow = DirectFB_MinimizeWindow; device->RestoreWindow = DirectFB_RestoreWindow; device->SetWindowGrab = DirectFB_SetWindowGrab; |
︙ | ︙ |
Changes to jni/SDL2/src/video/directfb/SDL_DirectFB_window.c.
︙ | ︙ | |||
524 525 526 527 528 529 530 531 532 | #if SDL_DIRECTFB_OPENGL DirectFB_GL_ReAllocWindowContexts(SDL_GetVideoDevice(), window); #endif } error: return; } #endif /* SDL_VIDEO_DRIVER_DIRECTFB */ | > > > > > > > > > > > > > | 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 | #if SDL_DIRECTFB_OPENGL DirectFB_GL_ReAllocWindowContexts(SDL_GetVideoDevice(), window); #endif } error: return; } int DirectFB_SetWindowOpacity(_THIS, SDL_Window * window, float opacity) { const Uint8 alpha = (Uint8) ((unsigned int) (opacity * 255.0f)); SDL_DFB_WINDOWDATA(window); SDL_DFB_CHECKERR(windata->dfbwin->SetOpacity(windata->dfbwin, alpha)); windata->opacity = alpha; return 0; error: return -1; } #endif /* SDL_VIDEO_DRIVER_DIRECTFB */ |
Changes to jni/SDL2/src/video/directfb/SDL_DirectFB_window.h.
︙ | ︙ | |||
71 72 73 74 75 76 77 78 79 80 81 | extern void DirectFB_RestoreWindow(_THIS, SDL_Window * window); extern void DirectFB_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed); extern void DirectFB_DestroyWindow(_THIS, SDL_Window * window); extern SDL_bool DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info); extern void DirectFB_AdjustWindowSurface(SDL_Window * window); #endif /* _SDL_directfb_window_h */ /* vi: set ts=4 sw=4 expandtab: */ | > | 71 72 73 74 75 76 77 78 79 80 81 82 | extern void DirectFB_RestoreWindow(_THIS, SDL_Window * window); extern void DirectFB_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed); extern void DirectFB_DestroyWindow(_THIS, SDL_Window * window); extern SDL_bool DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info); extern void DirectFB_AdjustWindowSurface(SDL_Window * window); extern int DirectFB_SetWindowOpacity(_THIS, SDL_Window * window, float opacity); #endif /* _SDL_directfb_window_h */ /* vi: set ts=4 sw=4 expandtab: */ |
Changes to jni/SDL2/src/video/wayland/SDL_waylanddyn.c.
︙ | ︙ | |||
90 91 92 93 94 95 96 | #endif /* SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */ /* Define all the function pointers and wrappers... */ #define SDL_WAYLAND_MODULE(modname) int SDL_WAYLAND_HAVE_##modname = 0; #define SDL_WAYLAND_SYM(rc,fn,params) SDL_DYNWAYLANDFN_##fn WAYLAND_##fn = NULL; #define SDL_WAYLAND_INTERFACE(iface) const struct wl_interface *WAYLAND_##iface = NULL; #include "SDL_waylandsym.h" | < < < < < < | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | #endif /* SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */ /* Define all the function pointers and wrappers... */ #define SDL_WAYLAND_MODULE(modname) int SDL_WAYLAND_HAVE_##modname = 0; #define SDL_WAYLAND_SYM(rc,fn,params) SDL_DYNWAYLANDFN_##fn WAYLAND_##fn = NULL; #define SDL_WAYLAND_INTERFACE(iface) const struct wl_interface *WAYLAND_##iface = NULL; #include "SDL_waylandsym.h" static int wayland_load_refcount = 0; void SDL_WAYLAND_UnloadSymbols(void) { /* Don't actually unload if more than one module is using the libs... */ if (wayland_load_refcount > 0) { if (--wayland_load_refcount == 0) { #ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC int i; #endif /* set all the function pointers to NULL. */ #define SDL_WAYLAND_MODULE(modname) SDL_WAYLAND_HAVE_##modname = 0; #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = NULL; #define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = NULL; #include "SDL_waylandsym.h" #ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC for (i = 0; i < SDL_TABLESIZE(waylandlibs); i++) { if (waylandlibs[i].lib != NULL) { SDL_UnloadObject(waylandlibs[i].lib); waylandlibs[i].lib = NULL; |
︙ | ︙ | |||
146 147 148 149 150 151 152 | for (i = 0; i < SDL_TABLESIZE(waylandlibs); i++) { if (waylandlibs[i].libname != NULL) { waylandlibs[i].lib = SDL_LoadObject(waylandlibs[i].libname); } } #define SDL_WAYLAND_MODULE(modname) SDL_WAYLAND_HAVE_##modname = 1; /* default yes */ | < < < < < < < < < < < | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | for (i = 0; i < SDL_TABLESIZE(waylandlibs); i++) { if (waylandlibs[i].libname != NULL) { waylandlibs[i].lib = SDL_LoadObject(waylandlibs[i].libname); } } #define SDL_WAYLAND_MODULE(modname) SDL_WAYLAND_HAVE_##modname = 1; /* default yes */ #include "SDL_waylandsym.h" #define SDL_WAYLAND_MODULE(modname) thismod = &SDL_WAYLAND_HAVE_##modname; #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = (SDL_DYNWAYLANDFN_##fn) WAYLAND_GetSym(#fn,thismod); #define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = (struct wl_interface *) WAYLAND_GetSym(#iface,thismod); #include "SDL_waylandsym.h" if (SDL_WAYLAND_HAVE_WAYLAND_CLIENT) { /* all required symbols loaded. */ SDL_ClearError(); } else { /* in case something got loaded... */ SDL_WAYLAND_UnloadSymbols(); rc = 0; } #else /* no dynamic WAYLAND */ #define SDL_WAYLAND_MODULE(modname) SDL_WAYLAND_HAVE_##modname = 1; /* default yes */ #define SDL_WAYLAND_SYM(rc,fn,params) WAYLAND_##fn = fn; #define SDL_WAYLAND_INTERFACE(iface) WAYLAND_##iface = &iface; #include "SDL_waylandsym.h" #endif } return rc; } #endif /* SDL_VIDEO_DRIVER_WAYLAND */ /* vi: set ts=4 sw=4 expandtab: */ |
Changes to jni/SDL2/src/video/wayland/SDL_waylanddyn.h.
︙ | ︙ | |||
49 50 51 52 53 54 55 | #define SDL_WAYLAND_MODULE(modname) extern int SDL_WAYLAND_HAVE_##modname; #define SDL_WAYLAND_SYM(rc,fn,params) \ typedef rc (*SDL_DYNWAYLANDFN_##fn) params; \ extern SDL_DYNWAYLANDFN_##fn WAYLAND_##fn; #define SDL_WAYLAND_INTERFACE(iface) extern const struct wl_interface *WAYLAND_##iface; #include "SDL_waylandsym.h" | < < < | | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | #define SDL_WAYLAND_MODULE(modname) extern int SDL_WAYLAND_HAVE_##modname; #define SDL_WAYLAND_SYM(rc,fn,params) \ typedef rc (*SDL_DYNWAYLANDFN_##fn) params; \ extern SDL_DYNWAYLANDFN_##fn WAYLAND_##fn; #define SDL_WAYLAND_INTERFACE(iface) extern const struct wl_interface *WAYLAND_##iface; #include "SDL_waylandsym.h" #ifdef __cplusplus } #endif #ifdef SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC |
︙ | ︙ | |||
75 76 77 78 79 80 81 82 83 84 85 86 87 88 | #define wl_proxy_create (*WAYLAND_wl_proxy_create) #define wl_proxy_destroy (*WAYLAND_wl_proxy_destroy) #define wl_proxy_marshal (*WAYLAND_wl_proxy_marshal) #define wl_proxy_set_user_data (*WAYLAND_wl_proxy_set_user_data) #define wl_proxy_get_user_data (*WAYLAND_wl_proxy_get_user_data) #define wl_proxy_add_listener (*WAYLAND_wl_proxy_add_listener) #define wl_proxy_marshal_constructor (*WAYLAND_wl_proxy_marshal_constructor) #define wl_seat_interface (*WAYLAND_wl_seat_interface) #define wl_surface_interface (*WAYLAND_wl_surface_interface) #define wl_shm_pool_interface (*WAYLAND_wl_shm_pool_interface) #define wl_buffer_interface (*WAYLAND_wl_buffer_interface) #define wl_registry_interface (*WAYLAND_wl_registry_interface) #define wl_shell_surface_interface (*WAYLAND_wl_shell_surface_interface) | > | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | #define wl_proxy_create (*WAYLAND_wl_proxy_create) #define wl_proxy_destroy (*WAYLAND_wl_proxy_destroy) #define wl_proxy_marshal (*WAYLAND_wl_proxy_marshal) #define wl_proxy_set_user_data (*WAYLAND_wl_proxy_set_user_data) #define wl_proxy_get_user_data (*WAYLAND_wl_proxy_get_user_data) #define wl_proxy_add_listener (*WAYLAND_wl_proxy_add_listener) #define wl_proxy_marshal_constructor (*WAYLAND_wl_proxy_marshal_constructor) #define wl_proxy_marshal_constructor_versioned (*WAYLAND_wl_proxy_marshal_constructor_versioned) #define wl_seat_interface (*WAYLAND_wl_seat_interface) #define wl_surface_interface (*WAYLAND_wl_surface_interface) #define wl_shm_pool_interface (*WAYLAND_wl_shm_pool_interface) #define wl_buffer_interface (*WAYLAND_wl_buffer_interface) #define wl_registry_interface (*WAYLAND_wl_registry_interface) #define wl_shell_surface_interface (*WAYLAND_wl_shell_surface_interface) |
︙ | ︙ |
Changes to jni/SDL2/src/video/wayland/SDL_waylandsym.h.
︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 | appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* *INDENT-OFF* */ SDL_WAYLAND_MODULE(WAYLAND_CLIENT) SDL_WAYLAND_SYM(void, wl_proxy_marshal, (struct wl_proxy *, uint32_t, ...)) SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_create, (struct wl_proxy *, const struct wl_interface *)) SDL_WAYLAND_SYM(void, wl_proxy_destroy, (struct wl_proxy *)) SDL_WAYLAND_SYM(int, wl_proxy_add_listener, (struct wl_proxy *, void (**)(void), void *)) SDL_WAYLAND_SYM(void, wl_proxy_set_user_data, (struct wl_proxy *, void *)) | > > > > > > > > > > > > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* *INDENT-OFF* */ #ifndef SDL_WAYLAND_MODULE #define SDL_WAYLAND_MODULE(modname) #endif #ifndef SDL_WAYLAND_SYM #define SDL_WAYLAND_SYM(rc,fn,params) #endif #ifndef SDL_WAYLAND_INTERFACE #define SDL_WAYLAND_INTERFACE(iface) #endif SDL_WAYLAND_MODULE(WAYLAND_CLIENT) SDL_WAYLAND_SYM(void, wl_proxy_marshal, (struct wl_proxy *, uint32_t, ...)) SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_create, (struct wl_proxy *, const struct wl_interface *)) SDL_WAYLAND_SYM(void, wl_proxy_destroy, (struct wl_proxy *)) SDL_WAYLAND_SYM(int, wl_proxy_add_listener, (struct wl_proxy *, void (**)(void), void *)) SDL_WAYLAND_SYM(void, wl_proxy_set_user_data, (struct wl_proxy *, void *)) |
︙ | ︙ | |||
51 52 53 54 55 56 57 58 59 60 61 62 63 64 | SDL_WAYLAND_SYM(int, wl_list_empty, (const struct wl_list *)) SDL_WAYLAND_SYM(void, wl_list_insert_list, (struct wl_list *, struct wl_list *)) /* These functions are available in Wayland >= 1.4 */ SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_4) SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_marshal_constructor, (struct wl_proxy *, uint32_t opcode, const struct wl_interface *interface, ...)) SDL_WAYLAND_INTERFACE(wl_seat_interface) SDL_WAYLAND_INTERFACE(wl_surface_interface) SDL_WAYLAND_INTERFACE(wl_shm_pool_interface) SDL_WAYLAND_INTERFACE(wl_buffer_interface) SDL_WAYLAND_INTERFACE(wl_registry_interface) SDL_WAYLAND_INTERFACE(wl_shell_surface_interface) SDL_WAYLAND_INTERFACE(wl_region_interface) | > > > | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | SDL_WAYLAND_SYM(int, wl_list_empty, (const struct wl_list *)) SDL_WAYLAND_SYM(void, wl_list_insert_list, (struct wl_list *, struct wl_list *)) /* These functions are available in Wayland >= 1.4 */ SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_4) SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_marshal_constructor, (struct wl_proxy *, uint32_t opcode, const struct wl_interface *interface, ...)) SDL_WAYLAND_MODULE(WAYLAND_CLIENT_1_10) SDL_WAYLAND_SYM(struct wl_proxy *, wl_proxy_marshal_constructor_versioned, (struct wl_proxy *proxy, uint32_t opcode, const struct wl_interface *interface, uint32_t version, ...)) SDL_WAYLAND_INTERFACE(wl_seat_interface) SDL_WAYLAND_INTERFACE(wl_surface_interface) SDL_WAYLAND_INTERFACE(wl_shm_pool_interface) SDL_WAYLAND_INTERFACE(wl_buffer_interface) SDL_WAYLAND_INTERFACE(wl_registry_interface) SDL_WAYLAND_INTERFACE(wl_shell_surface_interface) SDL_WAYLAND_INTERFACE(wl_region_interface) |
︙ | ︙ | |||
95 96 97 98 99 100 101 102 103 104 105 | xkb_mod_mask_t depressed_mods,\ xkb_mod_mask_t latched_mods,\ xkb_mod_mask_t locked_mods,\ xkb_layout_index_t depressed_layout,\ xkb_layout_index_t latched_layout,\ xkb_layout_index_t locked_layout) ) /* *INDENT-ON* */ /* vi: set ts=4 sw=4 expandtab: */ | > > > < | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | xkb_mod_mask_t depressed_mods,\ xkb_mod_mask_t latched_mods,\ xkb_mod_mask_t locked_mods,\ xkb_layout_index_t depressed_layout,\ xkb_layout_index_t latched_layout,\ xkb_layout_index_t locked_layout) ) #undef SDL_WAYLAND_MODULE #undef SDL_WAYLAND_SYM #undef SDL_WAYLAND_INTERFACE /* *INDENT-ON* */ /* vi: set ts=4 sw=4 expandtab: */ |
Changes to jni/SDL2/src/video/windows/SDL_windowsevents.c.
︙ | ︙ | |||
903 904 905 906 907 908 909 | UINT count = DragQueryFile(drop, 0xFFFFFFFF, NULL, 0); for (i = 0; i < count; ++i) { UINT size = DragQueryFile(drop, i, NULL, 0) + 1; LPTSTR buffer = SDL_stack_alloc(TCHAR, size); if (buffer) { if (DragQueryFile(drop, i, buffer, size)) { char *file = WIN_StringToUTF8(buffer); | | > > | | | | | | | | | > | 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 | UINT count = DragQueryFile(drop, 0xFFFFFFFF, NULL, 0); for (i = 0; i < count; ++i) { UINT size = DragQueryFile(drop, i, NULL, 0) + 1; LPTSTR buffer = SDL_stack_alloc(TCHAR, size); if (buffer) { if (DragQueryFile(drop, i, buffer, size)) { char *file = WIN_StringToUTF8(buffer); SDL_SendDropFile(data->window, file); SDL_free(file); } SDL_stack_free(buffer); } } SDL_SendDropComplete(data->window); DragFinish(drop); return 0; } break; case WM_NCHITTEST: { SDL_Window *window = data->window; if (window->hit_test) { POINT winpoint = { (int) LOWORD(lParam), (int) HIWORD(lParam) }; if (ScreenToClient(hwnd, &winpoint)) { const SDL_Point point = { (int) winpoint.x, (int) winpoint.y }; const SDL_HitTestResult rc = window->hit_test(window, &point, window->hit_test_data); switch (rc) { #define POST_HIT_TEST(ret) { SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); return ret; } case SDL_HITTEST_DRAGGABLE: POST_HIT_TEST(HTCAPTION); case SDL_HITTEST_RESIZE_TOPLEFT: POST_HIT_TEST(HTTOPLEFT); case SDL_HITTEST_RESIZE_TOP: POST_HIT_TEST(HTTOP); case SDL_HITTEST_RESIZE_TOPRIGHT: POST_HIT_TEST(HTTOPRIGHT); case SDL_HITTEST_RESIZE_RIGHT: POST_HIT_TEST(HTRIGHT); case SDL_HITTEST_RESIZE_BOTTOMRIGHT: POST_HIT_TEST(HTBOTTOMRIGHT); case SDL_HITTEST_RESIZE_BOTTOM: POST_HIT_TEST(HTBOTTOM); case SDL_HITTEST_RESIZE_BOTTOMLEFT: POST_HIT_TEST(HTBOTTOMLEFT); case SDL_HITTEST_RESIZE_LEFT: POST_HIT_TEST(HTLEFT); #undef POST_HIT_TEST case SDL_HITTEST_NORMAL: return HTCLIENT; } } /* If we didn't return, this will call DefWindowProc below. */ } } break; |
︙ | ︙ |
Changes to jni/SDL2/src/video/windows/SDL_windowsmodes.c.
︙ | ︙ | |||
19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #if SDL_VIDEO_DRIVER_WINDOWS #include "SDL_windowsvideo.h" /* Windows CE compatibility */ #ifndef CDS_FULLSCREEN #define CDS_FULLSCREEN 0 #endif typedef struct _WIN_GetMonitorDPIData { | > | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" #if SDL_VIDEO_DRIVER_WINDOWS #include "SDL_windowsvideo.h" #include "../../../include/SDL_assert.h" /* Windows CE compatibility */ #ifndef CDS_FULLSCREEN #define CDS_FULLSCREEN 0 #endif typedef struct _WIN_GetMonitorDPIData { |
︙ | ︙ | |||
327 328 329 330 331 332 333 334 335 336 337 338 339 340 | } if (vdpi) { *vdpi = data->VertDPI; } return data->DiagDPI != 0.0f ? 0 : -1; } void WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display) { SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata; DWORD i; SDL_DisplayMode mode; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 | } if (vdpi) { *vdpi = data->VertDPI; } return data->DiagDPI != 0.0f ? 0 : -1; } int WIN_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) { const SDL_DisplayModeData *data = (const SDL_DisplayModeData *) display->current_mode.driverdata; const DEVMODE *pDevMode = &data->DeviceMode; POINT pt = { /* !!! FIXME: no scale, right? */ (LONG) (pDevMode->dmPosition.x + (pDevMode->dmPelsWidth / 2)), (LONG) (pDevMode->dmPosition.y + (pDevMode->dmPelsHeight / 2)) }; HMONITOR hmon = MonitorFromPoint(pt, MONITOR_DEFAULTTONULL); MONITORINFO minfo; const RECT *work; BOOL rc = FALSE; SDL_assert(hmon != NULL); if (hmon != NULL) { SDL_zero(minfo); minfo.cbSize = sizeof (MONITORINFO); rc = GetMonitorInfo(hmon, &minfo); SDL_assert(rc); } if (!rc) { return SDL_SetError("Couldn't find monitor data"); } work = &minfo.rcWork; rect->x = (int)SDL_ceil(work->left * data->ScaleX); rect->y = (int)SDL_ceil(work->top * data->ScaleY); rect->w = (int)SDL_ceil((work->right - work->left) * data->ScaleX); rect->h = (int)SDL_ceil((work->bottom - work->top) * data->ScaleY); return 0; } void WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display) { SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata; DWORD i; SDL_DisplayMode mode; |
︙ | ︙ |
Changes to jni/SDL2/src/video/windows/SDL_windowsmodes.h.
︙ | ︙ | |||
36 37 38 39 40 41 42 43 44 45 46 47 48 49 | float DiagDPI; float HorzDPI; float VertDPI; } SDL_DisplayModeData; extern int WIN_InitModes(_THIS); extern int WIN_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); extern int WIN_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi); extern void WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display); extern int WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); extern void WIN_QuitModes(_THIS); #endif /* _SDL_windowsmodes_h */ | > | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | float DiagDPI; float HorzDPI; float VertDPI; } SDL_DisplayModeData; extern int WIN_InitModes(_THIS); extern int WIN_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); extern int WIN_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); extern int WIN_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi); extern void WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display); extern int WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); extern void WIN_QuitModes(_THIS); #endif /* _SDL_windowsmodes_h */ |
︙ | ︙ |
Changes to jni/SDL2/src/video/windows/SDL_windowsvideo.c.
︙ | ︙ | |||
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | data->GetDpiForMonitor = (HRESULT (WINAPI *)(HMONITOR, MONITOR_DPI_TYPE, UINT *, UINT *)) SDL_LoadFunction(data->shcoreDLL, "GetDpiForMonitor"); } /* Set the function pointers */ device->VideoInit = WIN_VideoInit; device->VideoQuit = WIN_VideoQuit; device->GetDisplayBounds = WIN_GetDisplayBounds; device->GetDisplayDPI = WIN_GetDisplayDPI; device->GetDisplayModes = WIN_GetDisplayModes; device->SetDisplayMode = WIN_SetDisplayMode; device->PumpEvents = WIN_PumpEvents; #undef CreateWindow device->CreateWindow = WIN_CreateWindow; device->CreateWindowFrom = WIN_CreateWindowFrom; device->SetWindowTitle = WIN_SetWindowTitle; device->SetWindowIcon = WIN_SetWindowIcon; device->SetWindowPosition = WIN_SetWindowPosition; device->SetWindowSize = WIN_SetWindowSize; device->ShowWindow = WIN_ShowWindow; device->HideWindow = WIN_HideWindow; device->RaiseWindow = WIN_RaiseWindow; device->MaximizeWindow = WIN_MaximizeWindow; device->MinimizeWindow = WIN_MinimizeWindow; device->RestoreWindow = WIN_RestoreWindow; device->SetWindowBordered = WIN_SetWindowBordered; | > > | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | data->GetDpiForMonitor = (HRESULT (WINAPI *)(HMONITOR, MONITOR_DPI_TYPE, UINT *, UINT *)) SDL_LoadFunction(data->shcoreDLL, "GetDpiForMonitor"); } /* Set the function pointers */ device->VideoInit = WIN_VideoInit; device->VideoQuit = WIN_VideoQuit; device->GetDisplayBounds = WIN_GetDisplayBounds; device->GetDisplayUsableBounds = WIN_GetDisplayUsableBounds; device->GetDisplayDPI = WIN_GetDisplayDPI; device->GetDisplayModes = WIN_GetDisplayModes; device->SetDisplayMode = WIN_SetDisplayMode; device->PumpEvents = WIN_PumpEvents; #undef CreateWindow device->CreateWindow = WIN_CreateWindow; device->CreateWindowFrom = WIN_CreateWindowFrom; device->SetWindowTitle = WIN_SetWindowTitle; device->SetWindowIcon = WIN_SetWindowIcon; device->SetWindowPosition = WIN_SetWindowPosition; device->SetWindowSize = WIN_SetWindowSize; device->SetWindowOpacity = WIN_SetWindowOpacity; device->ShowWindow = WIN_ShowWindow; device->HideWindow = WIN_HideWindow; device->RaiseWindow = WIN_RaiseWindow; device->MaximizeWindow = WIN_MaximizeWindow; device->MinimizeWindow = WIN_MinimizeWindow; device->RestoreWindow = WIN_RestoreWindow; device->SetWindowBordered = WIN_SetWindowBordered; |
︙ | ︙ |
Changes to jni/SDL2/src/video/windows/SDL_windowswindow.c.
︙ | ︙ | |||
821 822 823 824 825 826 827 828 829 830 831 | } int WIN_SetWindowHitTest(SDL_Window *window, SDL_bool enabled) { return 0; /* just succeed, the real work is done elsewhere. */ } #endif /* SDL_VIDEO_DRIVER_WINDOWS */ /* vi: set ts=4 sw=4 expandtab: */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 | } int WIN_SetWindowHitTest(SDL_Window *window, SDL_bool enabled) { return 0; /* just succeed, the real work is done elsewhere. */ } int WIN_SetWindowOpacity(_THIS, SDL_Window * window, float opacity) { const SDL_WindowData *data = (SDL_WindowData *) window->driverdata; const HWND hwnd = data->hwnd; const LONG style = GetWindowLong(hwnd, GWL_EXSTYLE); SDL_assert(style != 0); if (opacity == 1.0f) { /* want it fully opaque, just mark it unlayered if necessary. */ if (style & WS_EX_LAYERED) { if (SetWindowLong(hwnd, GWL_EXSTYLE, style & ~WS_EX_LAYERED) == 0) { return WIN_SetError("SetWindowLong()"); } } } else { const BYTE alpha = (BYTE) ((int) (opacity * 255.0f)); /* want it transparent, mark it layered if necessary. */ if ((style & WS_EX_LAYERED) == 0) { if (SetWindowLong(hwnd, GWL_EXSTYLE, style | WS_EX_LAYERED) == 0) { return WIN_SetError("SetWindowLong()"); } } if (SetLayeredWindowAttributes(hwnd, 0, alpha, LWA_ALPHA) == 0) { return WIN_SetError("SetLayeredWindowAttributes()"); } } return 0; } #endif /* SDL_VIDEO_DRIVER_WINDOWS */ /* vi: set ts=4 sw=4 expandtab: */ |
Changes to jni/SDL2/src/video/windows/SDL_windowswindow.h.
︙ | ︙ | |||
52 53 54 55 56 57 58 59 60 61 62 63 64 65 | extern int WIN_CreateWindow(_THIS, SDL_Window * window); extern int WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data); extern void WIN_SetWindowTitle(_THIS, SDL_Window * window); extern void WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon); extern void WIN_SetWindowPosition(_THIS, SDL_Window * window); extern void WIN_SetWindowSize(_THIS, SDL_Window * window); extern void WIN_ShowWindow(_THIS, SDL_Window * window); extern void WIN_HideWindow(_THIS, SDL_Window * window); extern void WIN_RaiseWindow(_THIS, SDL_Window * window); extern void WIN_MaximizeWindow(_THIS, SDL_Window * window); extern void WIN_MinimizeWindow(_THIS, SDL_Window * window); extern void WIN_RestoreWindow(_THIS, SDL_Window * window); extern void WIN_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered); | > | 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | extern int WIN_CreateWindow(_THIS, SDL_Window * window); extern int WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data); extern void WIN_SetWindowTitle(_THIS, SDL_Window * window); extern void WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon); extern void WIN_SetWindowPosition(_THIS, SDL_Window * window); extern void WIN_SetWindowSize(_THIS, SDL_Window * window); extern int WIN_SetWindowOpacity(_THIS, SDL_Window * window, float opacity); extern void WIN_ShowWindow(_THIS, SDL_Window * window); extern void WIN_HideWindow(_THIS, SDL_Window * window); extern void WIN_RaiseWindow(_THIS, SDL_Window * window); extern void WIN_MaximizeWindow(_THIS, SDL_Window * window); extern void WIN_MinimizeWindow(_THIS, SDL_Window * window); extern void WIN_RestoreWindow(_THIS, SDL_Window * window); extern void WIN_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered); |
︙ | ︙ |
Changes to jni/SDL2/src/video/x11/SDL_x11clipboard.c.
︙ | ︙ | |||
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | window = _this->windows; if (window) { return ((SDL_WindowData *) window->driverdata)->xwindow; } return None; } /* We use our own cut-buffer for intermediate storage instead of XA_CUT_BUFFER0 because their use isn't really defined for holding UTF8. */ Atom X11_GetSDLCutBufferClipboardType(Display *display) { return X11_XInternAtom(display, "SDL_CUTBUFFER", False); } int X11_SetClipboardText(_THIS, const char *text) { Display *display = ((SDL_VideoData *) _this->driverdata)->display; Atom format; Window window; Atom XA_CLIPBOARD = X11_XInternAtom(display, "CLIPBOARD", 0); /* Get the SDL window that will own the selection */ window = GetWindow(_this); if (window == None) { return SDL_SetError("Couldn't find a window to own the selection"); } /* Save the selection on the root window */ format = TEXT_FORMAT; X11_XChangeProperty(display, DefaultRootWindow(display), X11_GetSDLCutBufferClipboardType(display), format, 8, PropModeReplace, (const unsigned char *)text, SDL_strlen(text)); if (XA_CLIPBOARD != None && X11_XGetSelectionOwner(display, XA_CLIPBOARD) != window) { X11_XSetSelectionOwner(display, XA_CLIPBOARD, window, CurrentTime); } if (X11_XGetSelectionOwner(display, XA_PRIMARY) != window) { | > > > > > > > > > | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | window = _this->windows; if (window) { return ((SDL_WindowData *) window->driverdata)->xwindow; } return None; } #ifdef USE_SDL_CUTBUFFER /* We use our own cut-buffer for intermediate storage instead of XA_CUT_BUFFER0 because their use isn't really defined for holding UTF8. */ Atom X11_GetSDLCutBufferClipboardType(Display *display) { return X11_XInternAtom(display, "SDL_CUTBUFFER", False); } #endif int X11_SetClipboardText(_THIS, const char *text) { Display *display = ((SDL_VideoData *) _this->driverdata)->display; Atom format; Window window; Atom XA_CLIPBOARD = X11_XInternAtom(display, "CLIPBOARD", 0); /* Get the SDL window that will own the selection */ window = GetWindow(_this); if (window == None) { return SDL_SetError("Couldn't find a window to own the selection"); } /* Save the selection on the root window */ #ifdef USE_SDL_CUTBUFFER format = TEXT_FORMAT; X11_XChangeProperty(display, DefaultRootWindow(display), X11_GetSDLCutBufferClipboardType(display), format, 8, PropModeReplace, (const unsigned char *)text, SDL_strlen(text)); #else format = XA_STRING; X11_XChangeProperty(display, DefaultRootWindow(display), XA_CUT_BUFFER0, format, 8, PropModeReplace, (const unsigned char *)text, SDL_strlen(text)); #endif if (XA_CLIPBOARD != None && X11_XGetSelectionOwner(display, XA_CLIPBOARD) != window) { X11_XSetSelectionOwner(display, XA_CLIPBOARD, window, CurrentTime); } if (X11_XGetSelectionOwner(display, XA_PRIMARY) != window) { |
︙ | ︙ | |||
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | text = NULL; /* Get the window that holds the selection */ window = GetWindow(_this); format = TEXT_FORMAT; owner = X11_XGetSelectionOwner(display, XA_CLIPBOARD); if (owner == None) { /* Fall back to ancient X10 cut-buffers which do not support UTF8 strings*/ owner = DefaultRootWindow(display); selection = XA_CUT_BUFFER0; format = XA_STRING; } else if (owner == window) { owner = DefaultRootWindow(display); selection = X11_GetSDLCutBufferClipboardType(display); | > > > > > > > > > | | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | text = NULL; /* Get the window that holds the selection */ window = GetWindow(_this); format = TEXT_FORMAT; owner = X11_XGetSelectionOwner(display, XA_CLIPBOARD); #ifdef USE_SDL_CUTBUFFER if (owner == None) { /* Fall back to ancient X10 cut-buffers which do not support UTF8 strings*/ owner = DefaultRootWindow(display); selection = XA_CUT_BUFFER0; format = XA_STRING; } else if (owner == window) { owner = DefaultRootWindow(display); selection = X11_GetSDLCutBufferClipboardType(display); } #else if ((owner == None) || (owner == window)) { owner = DefaultRootWindow(display); format = XA_STRING; selection = XA_CUT_BUFFER0; } #endif else { /* Request that the selection owner copy the data to our window */ owner = window; selection = X11_XInternAtom(display, "SDL_SELECTION", False); X11_XConvertSelection(display, XA_CLIPBOARD, format, selection, owner, CurrentTime); /* When using synergy on Linux and when data has been put in the clipboard |
︙ | ︙ |
Changes to jni/SDL2/src/video/x11/SDL_x11dyn.c.
︙ | ︙ | |||
102 103 104 105 106 107 108 | return fn; } #endif /* SDL_VIDEO_DRIVER_X11_DYNAMIC */ /* Define all the function pointers and wrappers... */ | < < < < < < < < | 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | return fn; } #endif /* SDL_VIDEO_DRIVER_X11_DYNAMIC */ /* Define all the function pointers and wrappers... */ #define SDL_X11_SYM(rc,fn,params,args,ret) SDL_DYNX11FN_##fn X11_##fn = NULL; #include "SDL_x11sym.h" /* Annoying varargs entry point... */ #ifdef X_HAVE_UTF8_STRING SDL_DYNX11FN_XCreateIC X11_XCreateIC = NULL; SDL_DYNX11FN_XGetICValues X11_XGetICValues = NULL; #endif /* These SDL_X11_HAVE_* flags are here whether you have dynamic X11 or not. */ #define SDL_X11_MODULE(modname) int SDL_X11_HAVE_##modname = 0; #include "SDL_x11sym.h" static int x11_load_refcount = 0; void SDL_X11_UnloadSymbols(void) { /* Don't actually unload if more than one module is using the libs... */ if (x11_load_refcount > 0) { if (--x11_load_refcount == 0) { int i; /* set all the function pointers to NULL. */ #define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 0; #define SDL_X11_SYM(rc,fn,params,args,ret) X11_##fn = NULL; #include "SDL_x11sym.h" #ifdef X_HAVE_UTF8_STRING X11_XCreateIC = NULL; X11_XGetICValues = NULL; #endif #ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC |
︙ | ︙ | |||
173 174 175 176 177 178 179 | for (i = 0; i < SDL_TABLESIZE(x11libs); i++) { if (x11libs[i].libname != NULL) { x11libs[i].lib = SDL_LoadObject(x11libs[i].libname); } } #define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 1; /* default yes */ | < < < < < | 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | for (i = 0; i < SDL_TABLESIZE(x11libs); i++) { if (x11libs[i].libname != NULL) { x11libs[i].lib = SDL_LoadObject(x11libs[i].libname); } } #define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 1; /* default yes */ #include "SDL_x11sym.h" #define SDL_X11_MODULE(modname) thismod = &SDL_X11_HAVE_##modname; #define SDL_X11_SYM(a,fn,x,y,z) X11_##fn = (SDL_DYNX11FN_##fn) X11_GetSym(#fn,thismod); #include "SDL_x11sym.h" #ifdef X_HAVE_UTF8_STRING X11_XCreateIC = (SDL_DYNX11FN_XCreateIC) X11_GetSym("XCreateIC", &SDL_X11_HAVE_UTF8); X11_XGetICValues = (SDL_DYNX11FN_XGetICValues) X11_GetSym("XGetICValues", &SDL_X11_HAVE_UTF8); #endif |
︙ | ︙ | |||
205 206 207 208 209 210 211 | } #else /* no dynamic X11 */ #define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 1; /* default yes */ #define SDL_X11_SYM(a,fn,x,y,z) X11_##fn = (SDL_DYNX11FN_##fn) fn; #include "SDL_x11sym.h" | < < | 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | } #else /* no dynamic X11 */ #define SDL_X11_MODULE(modname) SDL_X11_HAVE_##modname = 1; /* default yes */ #define SDL_X11_SYM(a,fn,x,y,z) X11_##fn = (SDL_DYNX11FN_##fn) fn; #include "SDL_x11sym.h" #ifdef X_HAVE_UTF8_STRING X11_XCreateIC = XCreateIC; X11_XGetICValues = XGetICValues; #endif #endif } |
︙ | ︙ |
Changes to jni/SDL2/src/video/x11/SDL_x11dyn.h.
︙ | ︙ | |||
82 83 84 85 86 87 88 | typedef int (*SDL_X11_XSynchronizeRetType) (Display *); typedef Status(*SDL_X11_XESetEventToWireRetType) (Display *, XEvent *, xEvent *); int SDL_X11_LoadSymbols(void); void SDL_X11_UnloadSymbols(void); /* Declare all the function pointers and wrappers... */ | < < < < < < | 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | typedef int (*SDL_X11_XSynchronizeRetType) (Display *); typedef Status(*SDL_X11_XESetEventToWireRetType) (Display *, XEvent *, xEvent *); int SDL_X11_LoadSymbols(void); void SDL_X11_UnloadSymbols(void); /* Declare all the function pointers and wrappers... */ #define SDL_X11_SYM(rc,fn,params,args,ret) \ typedef rc (*SDL_DYNX11FN_##fn) params; \ extern SDL_DYNX11FN_##fn X11_##fn; #include "SDL_x11sym.h" /* Annoying varargs entry point... */ #ifdef X_HAVE_UTF8_STRING typedef XIC(*SDL_DYNX11FN_XCreateIC) (XIM,...); typedef char *(*SDL_DYNX11FN_XGetICValues) (XIC, ...); extern SDL_DYNX11FN_XCreateIC X11_XCreateIC; extern SDL_DYNX11FN_XGetICValues X11_XGetICValues; #endif /* These SDL_X11_HAVE_* flags are here whether you have dynamic X11 or not. */ #define SDL_X11_MODULE(modname) extern int SDL_X11_HAVE_##modname; #include "SDL_x11sym.h" #ifdef __cplusplus } #endif #endif /* !defined _SDL_x11dyn_h */ /* vi: set ts=4 sw=4 expandtab: */ |
Changes to jni/SDL2/src/video/x11/SDL_x11events.c.
︙ | ︙ | |||
113 114 115 116 117 118 119 | static Atom X11_PickTarget(Display *disp, Atom list[], int list_count) { Atom request = None; char *name; int i; for (i=0; i < list_count && request == None; i++) { name = X11_XGetAtomName(disp, list[i]); | > | > | 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | static Atom X11_PickTarget(Display *disp, Atom list[], int list_count) { Atom request = None; char *name; int i; for (i=0; i < list_count && request == None; i++) { name = X11_XGetAtomName(disp, list[i]); if ((SDL_strcmp("text/uri-list", name) == 0) || (SDL_strcmp("text/plain", name) == 0)) { request = list[i]; } X11_XFree(name); } return request; } /* Wrapper for X11_PickTarget for a maximum of three targets, a special case in the Xdnd protocol */ |
︙ | ︙ | |||
507 508 509 510 511 512 513 514 515 516 517 518 519 520 | default: return SDL_FALSE; } } return SDL_FALSE; } static void X11_DispatchEvent(_THIS) { SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; Display *display = videodata->display; SDL_WindowData *data; | > > > > > > > > > > > > > > > > > | 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 | default: return SDL_FALSE; } } return SDL_FALSE; } static void X11_UpdateUserTime(SDL_WindowData *data, const unsigned long latest) { if (latest && (latest != data->user_time)) { SDL_VideoData *videodata = data->videodata; Display *display = videodata->display; X11_XChangeProperty(display, data->xwindow, videodata->_NET_WM_USER_TIME, XA_CARDINAL, 32, PropModeReplace, (const unsigned char *) &latest, 1); #if DEBUG_XEVENTS printf("window %p: updating _NET_WM_USER_TIME to %lu\n", data, latest); #endif data->user_time = latest; } } static void X11_DispatchEvent(_THIS) { SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; Display *display = videodata->display; SDL_WindowData *data; |
︙ | ︙ | |||
613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 | return; } switch (xevent.type) { /* Gaining mouse coverage? */ case EnterNotify:{ #ifdef DEBUG_XEVENTS printf("window %p: EnterNotify! (%d,%d,%d)\n", data, xevent.xcrossing.x, xevent.xcrossing.y, xevent.xcrossing.mode); if (xevent.xcrossing.mode == NotifyGrab) printf("Mode: NotifyGrab\n"); if (xevent.xcrossing.mode == NotifyUngrab) printf("Mode: NotifyUngrab\n"); #endif SDL_SetMouseFocus(data->window); | > > > > | | 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 | return; } switch (xevent.type) { /* Gaining mouse coverage? */ case EnterNotify:{ SDL_Mouse *mouse = SDL_GetMouse(); #ifdef DEBUG_XEVENTS printf("window %p: EnterNotify! (%d,%d,%d)\n", data, xevent.xcrossing.x, xevent.xcrossing.y, xevent.xcrossing.mode); if (xevent.xcrossing.mode == NotifyGrab) printf("Mode: NotifyGrab\n"); if (xevent.xcrossing.mode == NotifyUngrab) printf("Mode: NotifyUngrab\n"); #endif SDL_SetMouseFocus(data->window); mouse->last_x = xevent.xcrossing.x; mouse->last_y = xevent.xcrossing.y; if (!mouse->relative_mode) { SDL_SendMouseMotion(data->window, 0, 0, xevent.xcrossing.x, xevent.xcrossing.y); } } break; /* Losing mouse coverage? */ case LeaveNotify:{ #ifdef DEBUG_XEVENTS |
︙ | ︙ | |||
769 770 771 772 773 774 775 776 777 778 779 780 781 782 | if (!handled_by_ime) { SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]); if(*text) { SDL_SendKeyboardText(text); } } } break; /* Key release? */ case KeyRelease:{ KeyCode keycode = xevent.xkey.keycode; | > | 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 | if (!handled_by_ime) { SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]); if(*text) { SDL_SendKeyboardText(text); } } X11_UpdateUserTime(data, xevent.xkey.time); } break; /* Key release? */ case KeyRelease:{ KeyCode keycode = xevent.xkey.keycode; |
︙ | ︙ | |||
807 808 809 810 811 812 813 814 815 816 817 818 | #endif X11_DispatchMapNotify(data); } break; /* Have we been resized or moved? */ case ConfigureNotify:{ #ifdef DEBUG_XEVENTS printf("window %p: ConfigureNotify! (position: %d,%d, size: %dx%d)\n", data, xevent.xconfigure.x, xevent.xconfigure.y, xevent.xconfigure.width, xevent.xconfigure.height); #endif | > > < < | 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 | #endif X11_DispatchMapNotify(data); } break; /* Have we been resized or moved? */ case ConfigureNotify:{ long border_left = 0; long border_top = 0; #ifdef DEBUG_XEVENTS printf("window %p: ConfigureNotify! (position: %d,%d, size: %dx%d)\n", data, xevent.xconfigure.x, xevent.xconfigure.y, xevent.xconfigure.width, xevent.xconfigure.height); #endif if (data->xwindow) { Atom _net_frame_extents = X11_XInternAtom(display, "_NET_FRAME_EXTENTS", 0); Atom type; int format; unsigned long nitems, bytes_after; unsigned char *property; if (X11_XGetWindowProperty(display, data->xwindow, |
︙ | ︙ | |||
955 956 957 958 959 960 961 962 963 964 965 966 967 968 | #ifdef DEBUG_XEVENTS printf("window %p: WM_DELETE_WINDOW\n", data); #endif SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0); break; } } break; /* Do we need to refresh ourselves? */ case Expose:{ #ifdef DEBUG_XEVENTS printf("window %p: Expose (count = %d)\n", data, xevent.xexpose.count); | > > > > > > > > > > | 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 | #ifdef DEBUG_XEVENTS printf("window %p: WM_DELETE_WINDOW\n", data); #endif SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_CLOSE, 0, 0); break; } else if ((xevent.xclient.message_type == videodata->WM_PROTOCOLS) && (xevent.xclient.format == 32) && (xevent.xclient.data.l[0] == videodata->WM_TAKE_FOCUS)) { #ifdef DEBUG_XEVENTS printf("window %p: WM_TAKE_FOCUS\n", data); #endif SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_TAKE_FOCUS, 0, 0); break; } } break; /* Do we need to refresh ourselves? */ case Expose:{ #ifdef DEBUG_XEVENTS printf("window %p: Expose (count = %d)\n", data, xevent.xexpose.count); |
︙ | ︙ | |||
987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 | int xticks = 0, yticks = 0; if (X11_IsWheelEvent(display,&xevent,&xticks, &yticks)) { SDL_SendMouseWheel(data->window, 0, xticks, yticks, SDL_MOUSEWHEEL_NORMAL); } else { int button = xevent.xbutton.button; if(button == Button1) { if (ProcessHitTest(_this, data, &xevent)) { break; /* don't pass this event on to app. */ } } else if(button > 7) { /* X button values 4-7 are used for scrolling, so X1 is 8, X2 is 9, ... => subtract (8-SDL_BUTTON_X1) to get value SDL expects */ button -= (8-SDL_BUTTON_X1); } SDL_SendMouseButton(data->window, 0, SDL_PRESSED, button); } } break; case ButtonRelease:{ int button = xevent.xbutton.button; /* The X server sends a Release event for each Press for wheels. Ignore them. */ int xticks = 0, yticks = 0; | > > | 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 | int xticks = 0, yticks = 0; if (X11_IsWheelEvent(display,&xevent,&xticks, &yticks)) { SDL_SendMouseWheel(data->window, 0, xticks, yticks, SDL_MOUSEWHEEL_NORMAL); } else { int button = xevent.xbutton.button; if(button == Button1) { if (ProcessHitTest(_this, data, &xevent)) { SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); break; /* don't pass this event on to app. */ } } else if(button > 7) { /* X button values 4-7 are used for scrolling, so X1 is 8, X2 is 9, ... => subtract (8-SDL_BUTTON_X1) to get value SDL expects */ button -= (8-SDL_BUTTON_X1); } SDL_SendMouseButton(data->window, 0, SDL_PRESSED, button); } X11_UpdateUserTime(data, xevent.xbutton.time); } break; case ButtonRelease:{ int button = xevent.xbutton.button; /* The X server sends a Release event for each Press for wheels. Ignore them. */ int xticks = 0, yticks = 0; |
︙ | ︙ | |||
1023 1024 1025 1026 1027 1028 1029 | unsigned char *propdata; int status, real_format; Atom real_type; unsigned long items_read, items_left; char *name = X11_XGetAtomName(display, xevent.xproperty.atom); if (name) { | | | 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 | unsigned char *propdata; int status, real_format; Atom real_type; unsigned long items_read, items_left; char *name = X11_XGetAtomName(display, xevent.xproperty.atom); if (name) { printf("window %p: PropertyNotify: %s %s time=%lu\n", data, name, (xevent.xproperty.state == PropertyDelete) ? "deleted" : "changed", xevent.xproperty.time); X11_XFree(name); } status = X11_XGetWindowProperty(display, data->xwindow, xevent.xproperty.atom, 0L, 8192L, False, AnyPropertyType, &real_type, &real_format, &items_read, &items_left, &propdata); if (status == Success && items_read > 0) { if (real_type == XA_INTEGER) { int *values = (int *)propdata; |
︙ | ︙ | |||
1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 | } } } if (status == Success) { X11_XFree(propdata); } #endif /* DEBUG_XEVENTS */ if (xevent.xproperty.atom == data->videodata->_NET_WM_STATE) { /* Get the new state from the window manager. Compositing window managers can alter visibility of windows without ever mapping / unmapping them, so we handle that here, because they use the NETWM protocol to notify us of changes. */ | > > > > > > > > > > > | 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 | } } } if (status == Success) { X11_XFree(propdata); } #endif /* DEBUG_XEVENTS */ /* Take advantage of this moment to make sure user_time has a valid timestamp from the X server, so if we later try to raise/restore this window, _NET_ACTIVE_WINDOW can have a non-zero timestamp, even if there's never been a mouse or key press to this window so far. Note that we don't try to set _NET_WM_USER_TIME here, though. That's only for legit user interaction with the window. */ if (!data->user_time) { data->user_time = xevent.xproperty.time; } if (xevent.xproperty.atom == data->videodata->_NET_WM_STATE) { /* Get the new state from the window manager. Compositing window managers can alter visibility of windows without ever mapping / unmapping them, so we handle that here, because they use the NETWM protocol to notify us of changes. */ |
︙ | ︙ | |||
1152 1153 1154 1155 1156 1157 1158 | sevent.xselection.selection = req->selection; sevent.xselection.target = None; sevent.xselection.property = None; sevent.xselection.requestor = req->requestor; sevent.xselection.time = req->time; if (X11_XGetWindowProperty(display, DefaultRootWindow(display), | > | > > > > | 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 | sevent.xselection.selection = req->selection; sevent.xselection.target = None; sevent.xselection.property = None; sevent.xselection.requestor = req->requestor; sevent.xselection.time = req->time; if (X11_XGetWindowProperty(display, DefaultRootWindow(display), #ifdef USE_SDL_CUTBUFFER X11_GetSDLCutBufferClipboardType(display), #else XA_CUT_BUFFER0, #endif 0, INT_MAX/4, False, req->target, &sevent.xselection.target, &seln_format, &nbytes, &overflow, &seln_data) == Success) { Atom XA_TARGETS = X11_XInternAtom(display, "TARGETS", 0); if (sevent.xselection.target == req->target) { X11_XChangeProperty(display, req->requestor, req->property, sevent.xselection.target, seln_format, PropModeReplace, seln_data, nbytes); |
︙ | ︙ | |||
1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 | } X11_XSendEvent(display, req->requestor, False, 0, &sevent); X11_XSync(display, False); } break; case SelectionNotify: { #ifdef DEBUG_XEVENTS printf("window %p: SelectionNotify (requestor = %ld, target = %ld)\n", data, xevent.xselection.requestor, xevent.xselection.target); #endif | > < < > | < | | < | | < | < < < < < < | < < < < | | | | < | < | | < > | < < | 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 | } X11_XSendEvent(display, req->requestor, False, 0, &sevent); X11_XSync(display, False); } break; case SelectionNotify: { Atom target = xevent.xselection.target; #ifdef DEBUG_XEVENTS printf("window %p: SelectionNotify (requestor = %ld, target = %ld)\n", data, xevent.xselection.requestor, xevent.xselection.target); #endif if (target == data->xdnd_req) { /* read data */ SDL_x11Prop p; X11_ReadProperty(&p, display, data->xwindow, videodata->PRIMARY); if (p.format == 8) { /* !!! FIXME: don't use strtok here. It's not reentrant and not in SDL_stdinc. */ char *name = X11_XGetAtomName(display, target); char *savep; char *token = strtok_r((char *) p.data, "\r\n", &savep); while (token != NULL) { if (SDL_strcmp("text/plain", name)==0) { SDL_SendDropText(data->window, token); } else if (SDL_strcmp("text/uri-list", name)==0) { char *fn = X11_URIToLocal(token); if (fn) { SDL_SendDropFile(data->window, fn); } } token = strtok_r(NULL, "\r\n", &savep); } SDL_SendDropComplete(data->window); } X11_XFree(p.data); /* send reply */ SDL_memset(&m, 0, sizeof(XClientMessageEvent)); m.type = ClientMessage; m.display = display; m.window = data->xdnd_source; |
︙ | ︙ |
Changes to jni/SDL2/src/video/x11/SDL_x11modes.c.
︙ | ︙ | |||
338 339 340 341 342 343 344 | } } if (props) { X11_XFree(props); } | | | 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 | } } if (props) { X11_XFree(props); } inches = (int)((SDL_sqrtf(widthmm * widthmm + heightmm * heightmm) / 25.4f) + 0.5f); if (*name && inches) { const size_t len = SDL_strlen(name); SDL_snprintf(&name[len], namelen-len, " %d\"", inches); } #ifdef X11MODES_DEBUG printf("Display name: %s\n", name); |
︙ | ︙ | |||
613 614 615 616 617 618 619 620 621 622 623 624 625 626 | if (CheckXRandR(data->display, &xrandr_major, &xrandr_minor) && (xrandr_major >= 2 || (xrandr_major == 1 && xrandr_minor >= 3))) { return X11_InitModes_XRandR(_this); } #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ /* !!! FIXME: eventually remove support for Xinerama and XVidMode (everything below here). */ #if SDL_VIDEO_DRIVER_X11_XINERAMA /* Query Xinerama extention * NOTE: This works with Nvidia Twinview correctly, but you need version 302.17 (released on June 2012) * or newer of the Nvidia binary drivers */ if (CheckXinerama(data->display, &xinerama_major, &xinerama_minor)) { | > > > > > > > > > > > > > > | 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 | if (CheckXRandR(data->display, &xrandr_major, &xrandr_minor) && (xrandr_major >= 2 || (xrandr_major == 1 && xrandr_minor >= 3))) { return X11_InitModes_XRandR(_this); } #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ /* !!! FIXME: eventually remove support for Xinerama and XVidMode (everything below here). */ /* This is a workaround for some apps (UnrealEngine4, for example) until we sort out the ramifications of removing XVidMode support outright. This block should be removed with the XVidMode support. */ { const char *env = SDL_GetHint("SDL_VIDEO_X11_REQUIRE_XRANDR"); if (env && SDL_atoi(env)) { #if SDL_VIDEO_DRIVER_X11_XRANDR return SDL_SetError("XRandR support is required but not available"); #else return SDL_SetError("XRandR support is required but not built into SDL!"); #endif } } #if SDL_VIDEO_DRIVER_X11_XINERAMA /* Query Xinerama extention * NOTE: This works with Nvidia Twinview correctly, but you need version 302.17 (released on June 2012) * or newer of the Nvidia binary drivers */ if (CheckXinerama(data->display, &xinerama_major, &xinerama_minor)) { |
︙ | ︙ | |||
1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 | } if (vdpi) { *vdpi = data->vdpi; } return data->ddpi != 0.0f ? 0 : -1; } #endif /* SDL_VIDEO_DRIVER_X11 */ /* vi: set ts=4 sw=4 expandtab: */ | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 | } if (vdpi) { *vdpi = data->vdpi; } return data->ddpi != 0.0f ? 0 : -1; } int X11_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect) { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; Display *display = data->display; Atom _NET_WORKAREA; int status, real_format; int retval = -1; Atom real_type; unsigned long items_read = 0, items_left = 0; unsigned char *propdata = NULL; if (X11_GetDisplayBounds(_this, sdl_display, rect) < 0) { return -1; } _NET_WORKAREA = X11_XInternAtom(display, "_NET_WORKAREA", False); status = X11_XGetWindowProperty(display, DefaultRootWindow(display), _NET_WORKAREA, 0L, 4L, False, XA_CARDINAL, &real_type, &real_format, &items_read, &items_left, &propdata); if ((status == Success) && (items_read >= 4)) { const long *p = (long*) propdata; const SDL_Rect usable = { (int)p[0], (int)p[1], (int)p[2], (int)p[3] }; retval = 0; if (!SDL_IntersectRect(rect, &usable, rect)) { SDL_zerop(rect); } } if (propdata) { X11_XFree(propdata); } return retval; } #endif /* SDL_VIDEO_DRIVER_X11 */ /* vi: set ts=4 sw=4 expandtab: */ |
Changes to jni/SDL2/src/video/x11/SDL_x11modes.h.
︙ | ︙ | |||
73 74 75 76 77 78 79 80 81 82 83 84 | /* Some utility functions for working with visuals */ extern int X11_GetVisualInfoFromVisual(Display * display, Visual * visual, XVisualInfo * vinfo); extern Uint32 X11_GetPixelFormatFromVisualInfo(Display * display, XVisualInfo * vinfo); extern int X11_GetDisplayBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect); extern int X11_GetDisplayDPI(_THIS, SDL_VideoDisplay * sdl_display, float * ddpi, float * hdpi, float * vdpi); #endif /* _SDL_x11modes_h */ /* vi: set ts=4 sw=4 expandtab: */ | > | 73 74 75 76 77 78 79 80 81 82 83 84 85 | /* Some utility functions for working with visuals */ extern int X11_GetVisualInfoFromVisual(Display * display, Visual * visual, XVisualInfo * vinfo); extern Uint32 X11_GetPixelFormatFromVisualInfo(Display * display, XVisualInfo * vinfo); extern int X11_GetDisplayBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect); extern int X11_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect); extern int X11_GetDisplayDPI(_THIS, SDL_VideoDisplay * sdl_display, float * ddpi, float * hdpi, float * vdpi); #endif /* _SDL_x11modes_h */ /* vi: set ts=4 sw=4 expandtab: */ |
Changes to jni/SDL2/src/video/x11/SDL_x11mouse.c.
︙ | ︙ | |||
362 363 364 365 366 367 368 369 370 371 372 373 374 | return 0; } static Uint32 X11_GetGlobalMouseState(int *x, int *y) { Display *display = GetDisplay(); const int num_screens = SDL_GetNumVideoDisplays(); int i; /* !!! FIXME: should we XSync() here first? */ | > > > > > > > > | | | | | | | | | | | | | | | | | | | > > | > | > > | | 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | return 0; } static Uint32 X11_GetGlobalMouseState(int *x, int *y) { SDL_VideoData *videodata = (SDL_VideoData *) SDL_GetVideoDevice()->driverdata; Display *display = GetDisplay(); const int num_screens = SDL_GetNumVideoDisplays(); int i; /* !!! FIXME: should we XSync() here first? */ #if !SDL_VIDEO_DRIVER_X11_XINPUT2 videodata->global_mouse_changed = SDL_TRUE; #endif /* check if we have this cached since XInput last saw the mouse move. */ /* !!! FIXME: can we just calculate this from XInput's events? */ if (videodata->global_mouse_changed) { for (i = 0; i < num_screens; i++) { SDL_DisplayData *data = (SDL_DisplayData *) SDL_GetDisplayDriverData(i); if (data != NULL) { Window root, child; int rootx, rooty, winx, winy; unsigned int mask; if (X11_XQueryPointer(display, RootWindow(display, data->screen), &root, &child, &rootx, &rooty, &winx, &winy, &mask)) { XWindowAttributes root_attrs; Uint32 buttons = 0; buttons |= (mask & Button1Mask) ? SDL_BUTTON_LMASK : 0; buttons |= (mask & Button2Mask) ? SDL_BUTTON_MMASK : 0; buttons |= (mask & Button3Mask) ? SDL_BUTTON_RMASK : 0; /* SDL_DisplayData->x,y point to screen origin, and adding them to mouse coordinates relative to root window doesn't do the right thing * (observed on dual monitor setup with primary display being the rightmost one - mouse was offset to the right). * * Adding root position to root-relative coordinates seems to be a better way to get absolute position. */ X11_XGetWindowAttributes(display, root, &root_attrs); videodata->global_mouse_position.x = root_attrs.x + rootx; videodata->global_mouse_position.y = root_attrs.y + rooty; videodata->global_mouse_buttons = buttons; videodata->global_mouse_changed = SDL_FALSE; break; } } } } SDL_assert(!videodata->global_mouse_changed); /* The pointer wasn't on any X11 screen?! */ *x = videodata->global_mouse_position.x; *y = videodata->global_mouse_position.y; return videodata->global_mouse_buttons; } void X11_InitMouse(_THIS) { SDL_Mouse *mouse = SDL_GetMouse(); |
︙ | ︙ |
Changes to jni/SDL2/src/video/x11/SDL_x11sym.h.
︙ | ︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 | appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* *INDENT-OFF* */ SDL_X11_MODULE(BASEXLIB) SDL_X11_SYM(XSizeHints*,XAllocSizeHints,(void),(),return) SDL_X11_SYM(XWMHints*,XAllocWMHints,(void),(),return) SDL_X11_SYM(XClassHint*,XAllocClassHint,(void),(),return) SDL_X11_SYM(int,XAutoRepeatOn,(Display* a),(a),return) SDL_X11_SYM(int,XAutoRepeatOff,(Display* a),(a),return) | > > > > > > > > | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ /* *INDENT-OFF* */ #ifndef SDL_X11_MODULE #define SDL_X11_MODULE(modname) #endif #ifndef SDL_X11_SYM #define SDL_X11_SYM(rc,fn,params,args,ret) #endif SDL_X11_MODULE(BASEXLIB) SDL_X11_SYM(XSizeHints*,XAllocSizeHints,(void),(),return) SDL_X11_SYM(XWMHints*,XAllocWMHints,(void),(),return) SDL_X11_SYM(XClassHint*,XAllocClassHint,(void),(),return) SDL_X11_SYM(int,XAutoRepeatOn,(Display* a),(a),return) SDL_X11_SYM(int,XAutoRepeatOff,(Display* a),(a),return) |
︙ | ︙ | |||
306 307 308 309 310 311 312 313 314 315 316 | 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),return) 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),return) SDL_X11_SYM(Bool,XF86VidModeSwitchToMode,(Display *a,int b,XF86VidModeModeInfo *c),(a,b,c),return) SDL_X11_SYM(Bool,XF86VidModeLockModeSwitch,(Display *a,int b,int c),(a,b,c),return) #endif /* *INDENT-ON* */ /* vi: set ts=4 sw=4 expandtab: */ | > > > | 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | 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),return) 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),return) SDL_X11_SYM(Bool,XF86VidModeSwitchToMode,(Display *a,int b,XF86VidModeModeInfo *c),(a,b,c),return) SDL_X11_SYM(Bool,XF86VidModeLockModeSwitch,(Display *a,int b,int c),(a,b,c),return) #endif #undef SDL_X11_MODULE #undef SDL_X11_SYM /* *INDENT-ON* */ /* vi: set ts=4 sw=4 expandtab: */ |
Changes to jni/SDL2/src/video/x11/SDL_x11video.c.
︙ | ︙ | |||
171 172 173 174 175 176 177 178 179 180 181 182 183 184 | if (!data) { SDL_free(device); SDL_OutOfMemory(); return NULL; } device->driverdata = data; /* FIXME: Do we need this? if ( (SDL_strncmp(X11_XDisplayName(display), ":", 1) == 0) || (SDL_strncmp(X11_XDisplayName(display), "unix:", 5) == 0) ) { local_X11 = 1; } else { local_X11 = 0; } | > > | 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 | if (!data) { SDL_free(device); SDL_OutOfMemory(); return NULL; } device->driverdata = data; data->global_mouse_changed = SDL_TRUE; /* FIXME: Do we need this? if ( (SDL_strncmp(X11_XDisplayName(display), ":", 1) == 0) || (SDL_strncmp(X11_XDisplayName(display), "unix:", 5) == 0) ) { local_X11 = 1; } else { local_X11 = 0; } |
︙ | ︙ | |||
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | orig_x11_errhandler = X11_XSetErrorHandler(X11_SafetyNetErrHandler); /* Set the function pointers */ device->VideoInit = X11_VideoInit; device->VideoQuit = X11_VideoQuit; device->GetDisplayModes = X11_GetDisplayModes; device->GetDisplayBounds = X11_GetDisplayBounds; device->GetDisplayDPI = X11_GetDisplayDPI; device->SetDisplayMode = X11_SetDisplayMode; device->SuspendScreenSaver = X11_SuspendScreenSaver; device->PumpEvents = X11_PumpEvents; device->CreateWindow = X11_CreateWindow; device->CreateWindowFrom = X11_CreateWindowFrom; device->SetWindowTitle = X11_SetWindowTitle; device->SetWindowIcon = X11_SetWindowIcon; device->SetWindowPosition = X11_SetWindowPosition; device->SetWindowSize = X11_SetWindowSize; device->SetWindowMinimumSize = X11_SetWindowMinimumSize; device->SetWindowMaximumSize = X11_SetWindowMaximumSize; device->ShowWindow = X11_ShowWindow; device->HideWindow = X11_HideWindow; device->RaiseWindow = X11_RaiseWindow; device->MaximizeWindow = X11_MaximizeWindow; device->MinimizeWindow = X11_MinimizeWindow; device->RestoreWindow = X11_RestoreWindow; device->SetWindowBordered = X11_SetWindowBordered; | > > > > > | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | orig_x11_errhandler = X11_XSetErrorHandler(X11_SafetyNetErrHandler); /* Set the function pointers */ device->VideoInit = X11_VideoInit; device->VideoQuit = X11_VideoQuit; device->GetDisplayModes = X11_GetDisplayModes; device->GetDisplayBounds = X11_GetDisplayBounds; device->GetDisplayUsableBounds = X11_GetDisplayUsableBounds; device->GetDisplayDPI = X11_GetDisplayDPI; device->SetDisplayMode = X11_SetDisplayMode; device->SuspendScreenSaver = X11_SuspendScreenSaver; device->PumpEvents = X11_PumpEvents; device->CreateWindow = X11_CreateWindow; device->CreateWindowFrom = X11_CreateWindowFrom; device->SetWindowTitle = X11_SetWindowTitle; device->SetWindowIcon = X11_SetWindowIcon; device->SetWindowPosition = X11_SetWindowPosition; device->SetWindowSize = X11_SetWindowSize; device->SetWindowMinimumSize = X11_SetWindowMinimumSize; device->SetWindowMaximumSize = X11_SetWindowMaximumSize; device->GetWindowBordersSize = X11_GetWindowBordersSize; device->SetWindowOpacity = X11_SetWindowOpacity; device->SetWindowModalFor = X11_SetWindowModalFor; device->SetWindowInputFocus = X11_SetWindowInputFocus; device->ShowWindow = X11_ShowWindow; device->HideWindow = X11_HideWindow; device->RaiseWindow = X11_RaiseWindow; device->MaximizeWindow = X11_MaximizeWindow; device->MinimizeWindow = X11_MinimizeWindow; device->RestoreWindow = X11_RestoreWindow; device->SetWindowBordered = X11_SetWindowBordered; |
︙ | ︙ | |||
369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 | /* Get the window class name, usually the name of the application */ data->classname = get_classname(); /* Get the process PID to be associated to the window */ data->pid = getpid(); /* Open a connection to the X input manager */ #ifdef X_HAVE_UTF8_STRING if (SDL_X11_HAVE_UTF8) { data->im = X11_XOpenIM(data->display, NULL, data->classname, data->classname); } #endif /* Look up some useful Atoms */ #define GET_ATOM(X) data->X = X11_XInternAtom(data->display, #X, False) GET_ATOM(WM_PROTOCOLS); GET_ATOM(WM_DELETE_WINDOW); GET_ATOM(_NET_WM_STATE); GET_ATOM(_NET_WM_STATE_HIDDEN); GET_ATOM(_NET_WM_STATE_FOCUSED); GET_ATOM(_NET_WM_STATE_MAXIMIZED_VERT); GET_ATOM(_NET_WM_STATE_MAXIMIZED_HORZ); GET_ATOM(_NET_WM_STATE_FULLSCREEN); GET_ATOM(_NET_WM_ALLOWED_ACTIONS); GET_ATOM(_NET_WM_ACTION_FULLSCREEN); GET_ATOM(_NET_WM_NAME); GET_ATOM(_NET_WM_ICON_NAME); GET_ATOM(_NET_WM_ICON); GET_ATOM(_NET_WM_PING); GET_ATOM(_NET_ACTIVE_WINDOW); GET_ATOM(UTF8_STRING); GET_ATOM(PRIMARY); GET_ATOM(XdndEnter); GET_ATOM(XdndPosition); GET_ATOM(XdndStatus); GET_ATOM(XdndTypeList); | > > > > > > > > > | 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 | /* Get the window class name, usually the name of the application */ data->classname = get_classname(); /* Get the process PID to be associated to the window */ data->pid = getpid(); /* I have no idea how random this actually is, or has to be. */ data->window_group = (XID) (((size_t) data->pid) ^ ((size_t) _this)); /* Open a connection to the X input manager */ #ifdef X_HAVE_UTF8_STRING if (SDL_X11_HAVE_UTF8) { data->im = X11_XOpenIM(data->display, NULL, data->classname, data->classname); } #endif /* Look up some useful Atoms */ #define GET_ATOM(X) data->X = X11_XInternAtom(data->display, #X, False) GET_ATOM(WM_PROTOCOLS); GET_ATOM(WM_DELETE_WINDOW); GET_ATOM(WM_TAKE_FOCUS); GET_ATOM(_NET_WM_STATE); GET_ATOM(_NET_WM_STATE_HIDDEN); GET_ATOM(_NET_WM_STATE_FOCUSED); GET_ATOM(_NET_WM_STATE_MAXIMIZED_VERT); GET_ATOM(_NET_WM_STATE_MAXIMIZED_HORZ); GET_ATOM(_NET_WM_STATE_FULLSCREEN); GET_ATOM(_NET_WM_STATE_ABOVE); GET_ATOM(_NET_WM_STATE_SKIP_TASKBAR); GET_ATOM(_NET_WM_STATE_SKIP_PAGER); GET_ATOM(_NET_WM_ALLOWED_ACTIONS); GET_ATOM(_NET_WM_ACTION_FULLSCREEN); GET_ATOM(_NET_WM_NAME); GET_ATOM(_NET_WM_ICON_NAME); GET_ATOM(_NET_WM_ICON); GET_ATOM(_NET_WM_PING); GET_ATOM(_NET_WM_WINDOW_OPACITY); GET_ATOM(_NET_WM_USER_TIME); GET_ATOM(_NET_ACTIVE_WINDOW); GET_ATOM(UTF8_STRING); GET_ATOM(PRIMARY); GET_ATOM(XdndEnter); GET_ATOM(XdndPosition); GET_ATOM(XdndStatus); GET_ATOM(XdndTypeList); |
︙ | ︙ |
Changes to jni/SDL2/src/video/x11/SDL_x11video.h.
︙ | ︙ | |||
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | char *classname; pid_t pid; XIM im; Uint32 screensaver_activity; int numwindows; SDL_WindowData **windowlist; int windowlistlength; /* This is true for ICCCM2.0-compliant window managers */ SDL_bool net_wm; /* Useful atoms */ Atom WM_PROTOCOLS; Atom WM_DELETE_WINDOW; Atom _NET_WM_STATE; Atom _NET_WM_STATE_HIDDEN; Atom _NET_WM_STATE_FOCUSED; Atom _NET_WM_STATE_MAXIMIZED_VERT; Atom _NET_WM_STATE_MAXIMIZED_HORZ; Atom _NET_WM_STATE_FULLSCREEN; Atom _NET_WM_ALLOWED_ACTIONS; Atom _NET_WM_ACTION_FULLSCREEN; Atom _NET_WM_NAME; Atom _NET_WM_ICON_NAME; Atom _NET_WM_ICON; Atom _NET_WM_PING; Atom _NET_ACTIVE_WINDOW; Atom UTF8_STRING; Atom PRIMARY; Atom XdndEnter; Atom XdndPosition; Atom XdndStatus; Atom XdndTypeList; Atom XdndActionCopy; Atom XdndDrop; Atom XdndFinished; Atom XdndSelection; Atom XKLAVIER_STATE; SDL_Scancode key_layout[256]; SDL_bool selection_waiting; Uint32 last_mode_change_deadline; } SDL_VideoData; extern SDL_bool X11_UseDirectColorVisuals(void); #endif /* _SDL_x11video_h */ /* vi: set ts=4 sw=4 expandtab: */ | > > > > > > > > > > > | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | char *classname; pid_t pid; XIM im; Uint32 screensaver_activity; int numwindows; SDL_WindowData **windowlist; int windowlistlength; XID window_group; /* This is true for ICCCM2.0-compliant window managers */ SDL_bool net_wm; /* Useful atoms */ Atom WM_PROTOCOLS; Atom WM_DELETE_WINDOW; Atom WM_TAKE_FOCUS; Atom _NET_WM_STATE; Atom _NET_WM_STATE_HIDDEN; Atom _NET_WM_STATE_FOCUSED; Atom _NET_WM_STATE_MAXIMIZED_VERT; Atom _NET_WM_STATE_MAXIMIZED_HORZ; Atom _NET_WM_STATE_FULLSCREEN; Atom _NET_WM_STATE_ABOVE; Atom _NET_WM_STATE_SKIP_TASKBAR; Atom _NET_WM_STATE_SKIP_PAGER; Atom _NET_WM_ALLOWED_ACTIONS; Atom _NET_WM_ACTION_FULLSCREEN; Atom _NET_WM_NAME; Atom _NET_WM_ICON_NAME; Atom _NET_WM_ICON; Atom _NET_WM_PING; Atom _NET_WM_WINDOW_OPACITY; Atom _NET_WM_USER_TIME; Atom _NET_ACTIVE_WINDOW; Atom UTF8_STRING; Atom PRIMARY; Atom XdndEnter; Atom XdndPosition; Atom XdndStatus; Atom XdndTypeList; Atom XdndActionCopy; Atom XdndDrop; Atom XdndFinished; Atom XdndSelection; Atom XKLAVIER_STATE; SDL_Scancode key_layout[256]; SDL_bool selection_waiting; Uint32 last_mode_change_deadline; SDL_bool global_mouse_changed; SDL_Point global_mouse_position; Uint32 global_mouse_buttons; } SDL_VideoData; extern SDL_bool X11_UseDirectColorVisuals(void); #endif /* _SDL_x11video_h */ /* vi: set ts=4 sw=4 expandtab: */ |
Changes to jni/SDL2/src/video/x11/SDL_x11window.c.
︙ | ︙ | |||
126 127 128 129 130 131 132 133 134 135 136 137 138 | #endif /* 0 */ void X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags) { SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; Display *display = videodata->display; Atom _NET_WM_STATE = videodata->_NET_WM_STATE; /* Atom _NET_WM_STATE_HIDDEN = videodata->_NET_WM_STATE_HIDDEN; */ Atom _NET_WM_STATE_FOCUSED = videodata->_NET_WM_STATE_FOCUSED; Atom _NET_WM_STATE_MAXIMIZED_VERT = videodata->_NET_WM_STATE_MAXIMIZED_VERT; Atom _NET_WM_STATE_MAXIMIZED_HORZ = videodata->_NET_WM_STATE_MAXIMIZED_HORZ; Atom _NET_WM_STATE_FULLSCREEN = videodata->_NET_WM_STATE_FULLSCREEN; | > > > > | > > > > > > > > > > > | 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | #endif /* 0 */ void X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags) { SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; Display *display = videodata->display; /* !!! FIXME: just dereference videodata below instead of copying to locals. */ Atom _NET_WM_STATE = videodata->_NET_WM_STATE; /* Atom _NET_WM_STATE_HIDDEN = videodata->_NET_WM_STATE_HIDDEN; */ Atom _NET_WM_STATE_FOCUSED = videodata->_NET_WM_STATE_FOCUSED; Atom _NET_WM_STATE_MAXIMIZED_VERT = videodata->_NET_WM_STATE_MAXIMIZED_VERT; Atom _NET_WM_STATE_MAXIMIZED_HORZ = videodata->_NET_WM_STATE_MAXIMIZED_HORZ; Atom _NET_WM_STATE_FULLSCREEN = videodata->_NET_WM_STATE_FULLSCREEN; Atom _NET_WM_STATE_ABOVE = videodata->_NET_WM_STATE_ABOVE; Atom _NET_WM_STATE_SKIP_TASKBAR = videodata->_NET_WM_STATE_SKIP_TASKBAR; Atom _NET_WM_STATE_SKIP_PAGER = videodata->_NET_WM_STATE_SKIP_PAGER; Atom atoms[16]; int count = 0; /* The window manager sets this property, we shouldn't set it. If we did, this would indicate to the window manager that we don't actually want to be mapped during X11_XMapRaised(), which would be bad. * if (flags & SDL_WINDOW_HIDDEN) { atoms[count++] = _NET_WM_STATE_HIDDEN; } */ if (flags & SDL_WINDOW_ALWAYS_ON_TOP) { atoms[count++] = _NET_WM_STATE_ABOVE; } if (flags & SDL_WINDOW_SKIP_TASKBAR) { atoms[count++] = _NET_WM_STATE_SKIP_TASKBAR; atoms[count++] = _NET_WM_STATE_SKIP_PAGER; } if (flags & SDL_WINDOW_INPUT_FOCUS) { atoms[count++] = _NET_WM_STATE_FOCUSED; } if (flags & SDL_WINDOW_MAXIMIZED) { atoms[count++] = _NET_WM_STATE_MAXIMIZED_VERT; atoms[count++] = _NET_WM_STATE_MAXIMIZED_HORZ; } if (flags & SDL_WINDOW_FULLSCREEN) { atoms[count++] = _NET_WM_STATE_FULLSCREEN; } SDL_assert(count <= SDL_arraysize(atoms)); if (count > 0) { X11_XChangeProperty(display, xwindow, _NET_WM_STATE, XA_ATOM, 32, PropModeReplace, (unsigned char *)atoms, count); } else { X11_XDeleteProperty(display, xwindow, _NET_WM_STATE); } } |
︙ | ︙ | |||
202 203 204 205 206 207 208 | maximized |= 2; } else if ( atoms[i] == _NET_WM_STATE_FULLSCREEN) { fullscreen = 1; } } if (maximized == 3) { flags |= SDL_WINDOW_MAXIMIZED; | > > | | 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | maximized |= 2; } else if ( atoms[i] == _NET_WM_STATE_FULLSCREEN) { fullscreen = 1; } } if (maximized == 3) { flags |= SDL_WINDOW_MAXIMIZED; } if (fullscreen == 1) { flags |= SDL_WINDOW_FULLSCREEN; } X11_XFree(propertyValue); } /* FIXME, check the size hints for resizable */ /* flags |= SDL_WINDOW_RESIZABLE; */ |
︙ | ︙ | |||
351 352 353 354 355 356 357 | Visual *visual; int depth; XSetWindowAttributes xattr; Window w; XSizeHints *sizehints; XWMHints *wmhints; XClassHint *classhints; | < | > > | 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 | Visual *visual; int depth; XSetWindowAttributes xattr; Window w; XSizeHints *sizehints; XWMHints *wmhints; XClassHint *classhints; Atom _NET_WM_BYPASS_COMPOSITOR; Atom _NET_WM_WINDOW_TYPE; Atom wintype; const char *wintype_name = NULL; int compositor = 1; Atom _NET_WM_PID; Atom XdndAware, xdnd_version = 5; long fevent = 0; #if SDL_VIDEO_OPENGL_GLX || SDL_VIDEO_OPENGL_EGL if ((window->flags & SDL_WINDOW_OPENGL) && !SDL_getenv("SDL_VIDEO_X11_VISUALID")) { |
︙ | ︙ | |||
392 393 394 395 396 397 398 | } else #endif { visual = displaydata->visual; depth = displaydata->depth; } | | | 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | } else #endif { visual = displaydata->visual; depth = displaydata->depth; } xattr.override_redirect = ((window->flags & SDL_WINDOW_TOOLTIP) || (window->flags & SDL_WINDOW_POPUP_MENU)) ? True : False; xattr.background_pixmap = None; xattr.border_pixel = 0; if (visual->class == DirectColor) { XColor *colorcells; int i; int ncolors; |
︙ | ︙ | |||
502 503 504 505 506 507 508 | sizehints->x = window->x; sizehints->y = window->y; sizehints->flags |= USPosition; /* Setup the input hints so we get keyboard input */ wmhints = X11_XAllocWMHints(); wmhints->input = True; | > | > | > > > > > > > > > > > > > | | | < | | | | | | < | 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 | sizehints->x = window->x; sizehints->y = window->y; sizehints->flags |= USPosition; /* Setup the input hints so we get keyboard input */ wmhints = X11_XAllocWMHints(); wmhints->input = True; wmhints->window_group = data->window_group; wmhints->flags = InputHint | WindowGroupHint; /* Setup the class hints so we can get an icon (AfterStep) */ classhints = X11_XAllocClassHint(); classhints->res_name = data->classname; classhints->res_class = data->classname; /* Set the size, input and class hints, and define WM_CLIENT_MACHINE and WM_LOCALE_NAME */ X11_XSetWMProperties(display, w, NULL, NULL, NULL, 0, sizehints, wmhints, classhints); X11_XFree(sizehints); X11_XFree(wmhints); X11_XFree(classhints); /* Set the PID related to the window for the given hostname, if possible */ if (data->pid > 0) { long pid = (long) data->pid; _NET_WM_PID = X11_XInternAtom(display, "_NET_WM_PID", False); X11_XChangeProperty(display, w, _NET_WM_PID, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &pid, 1); } /* Set the window manager state */ X11_SetNetWMState(_this, w, window->flags); compositor = 2; /* don't disable compositing except for "normal" windows */ if (window->flags & SDL_WINDOW_UTILITY) { wintype_name = "_NET_WM_WINDOW_TYPE_UTILITY"; } else if (window->flags & SDL_WINDOW_TOOLTIP) { wintype_name = "_NET_WM_WINDOW_TYPE_TOOLTIP"; } else if (window->flags & SDL_WINDOW_POPUP_MENU) { wintype_name = "_NET_WM_WINDOW_TYPE_POPUP_MENU"; } else { wintype_name = "_NET_WM_WINDOW_TYPE_NORMAL"; compositor = 1; /* disable compositing for "normal" windows */ } /* Let the window manager know what type of window we are. */ _NET_WM_WINDOW_TYPE = X11_XInternAtom(display, "_NET_WM_WINDOW_TYPE", False); wintype = X11_XInternAtom(display, wintype_name, False); X11_XChangeProperty(display, w, _NET_WM_WINDOW_TYPE, XA_ATOM, 32, PropModeReplace, (unsigned char *)&wintype, 1); _NET_WM_BYPASS_COMPOSITOR = X11_XInternAtom(display, "_NET_WM_BYPASS_COMPOSITOR", False); X11_XChangeProperty(display, w, _NET_WM_BYPASS_COMPOSITOR, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&compositor, 1); { Atom protocols[3]; int proto_count = 0; const char *ping_hint; protocols[proto_count++] = data->WM_DELETE_WINDOW; /* Allow window to be deleted by the WM */ protocols[proto_count++] = data->WM_TAKE_FOCUS; /* Since we will want to set input focus explicitly */ ping_hint = SDL_GetHint(SDL_HINT_VIDEO_X11_NET_WM_PING); /* Default to using ping if there is no hint */ if (!ping_hint || SDL_atoi(ping_hint)) { protocols[proto_count++] = data->_NET_WM_PING; /* Respond so WM knows we're alive */ } SDL_assert(proto_count <= sizeof(protocols) / sizeof(protocols[0])); X11_XSetWMProtocols(display, w, protocols, proto_count); } |
︙ | ︙ | |||
858 859 860 861 862 863 864 865 866 867 868 869 870 871 | X11_XRaiseWindow(display, data->xwindow); } else { X11_XResizeWindow(display, data->xwindow, window->w, window->h); } X11_XFlush(display); } void X11_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) { const SDL_bool focused = ((window->flags & SDL_WINDOW_INPUT_FOCUS) != 0); const SDL_bool visible = ((window->flags & SDL_WINDOW_HIDDEN) == 0); SDL_WindowData *data = (SDL_WindowData *) window->driverdata; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 | X11_XRaiseWindow(display, data->xwindow); } else { X11_XResizeWindow(display, data->xwindow, window->w, window->h); } X11_XFlush(display); } int X11_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right) { SDL_WindowData *data = (SDL_WindowData *)window->driverdata; Display *display = data->videodata->display; Atom _NET_FRAME_EXTENTS = X11_XInternAtom(display, "_NET_FRAME_EXTENTS", 0); Atom type; int format; unsigned long nitems, bytes_after; unsigned char *property; int result = -1; if (X11_XGetWindowProperty(display, data->xwindow, _NET_FRAME_EXTENTS, 0, 16, 0, XA_CARDINAL, &type, &format, &nitems, &bytes_after, &property) == Success) { if (type != None && nitems == 4) { *left = (int) (((long*)property)[0]); *right = (int) (((long*)property)[1]); *top = (int) (((long*)property)[2]); *bottom = (int) (((long*)property)[3]); result = 0; } X11_XFree(property); } return result; } int X11_SetWindowOpacity(_THIS, SDL_Window * window, float opacity) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Display *display = data->videodata->display; Atom _NET_WM_WINDOW_OPACITY = data->videodata->_NET_WM_WINDOW_OPACITY; if (opacity == 1.0f) { X11_XDeleteProperty(display, data->xwindow, _NET_WM_WINDOW_OPACITY); } else { const Uint32 FullyOpaque = 0xFFFFFFFF; const long alpha = (long) ((double)opacity * (double)FullyOpaque); X11_XChangeProperty(display, data->xwindow, _NET_WM_WINDOW_OPACITY, XA_CARDINAL, 32, PropModeReplace, (unsigned char *)&alpha, 1); } return 0; } int X11_SetWindowModalFor(_THIS, SDL_Window * modal_window, SDL_Window * parent_window) { SDL_WindowData *data = (SDL_WindowData *) modal_window->driverdata; SDL_WindowData *parent_data = (SDL_WindowData *) parent_window->driverdata; Display *display = data->videodata->display; X11_XSetTransientForHint(display, data->xwindow, parent_data->xwindow); return 0; } int X11_SetWindowInputFocus(_THIS, SDL_Window * window) { if (X11_IsWindowMapped(_this, window)) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Display *display = data->videodata->display; X11_XSetInputFocus(display, data->xwindow, RevertToNone, CurrentTime); X11_XFlush(display); return 0; } return -1; } void X11_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) { const SDL_bool focused = ((window->flags & SDL_WINDOW_INPUT_FOCUS) != 0); const SDL_bool visible = ((window->flags & SDL_WINDOW_HIDDEN) == 0); SDL_WindowData *data = (SDL_WindowData *) window->driverdata; |
︙ | ︙ | |||
942 943 944 945 946 947 948 949 950 951 952 953 954 | (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata; Display *display = data->videodata->display; Atom _NET_ACTIVE_WINDOW = data->videodata->_NET_ACTIVE_WINDOW; if (X11_IsWindowMapped(_this, window)) { XEvent e; SDL_zero(e); e.xany.type = ClientMessage; e.xclient.message_type = _NET_ACTIVE_WINDOW; e.xclient.format = 32; e.xclient.window = data->xwindow; e.xclient.data.l[0] = 1; /* source indication. 1 = application */ | > > | | 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 | (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata; Display *display = data->videodata->display; Atom _NET_ACTIVE_WINDOW = data->videodata->_NET_ACTIVE_WINDOW; if (X11_IsWindowMapped(_this, window)) { XEvent e; /*printf("SDL Window %p: sending _NET_ACTIVE_WINDOW with timestamp %lu\n", window, data->user_time);*/ SDL_zero(e); e.xany.type = ClientMessage; e.xclient.message_type = _NET_ACTIVE_WINDOW; e.xclient.format = 32; e.xclient.window = data->xwindow; e.xclient.data.l[0] = 1; /* source indication. 1 = application */ e.xclient.data.l[1] = data->user_time; e.xclient.data.l[2] = 0; X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0, SubstructureNotifyMask | SubstructureRedirectMask, &e); X11_XFlush(display); } |
︙ | ︙ | |||
1034 1035 1036 1037 1038 1039 1040 | X11_RestoreWindow(_THIS, SDL_Window * window) { SetWindowMaximized(_this, window, SDL_FALSE); X11_ShowWindow(_this, window); SetWindowActive(_this, window); } | | | 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 | X11_RestoreWindow(_THIS, SDL_Window * window) { SetWindowMaximized(_this, window, SDL_FALSE); X11_ShowWindow(_this, window); SetWindowActive(_this, window); } /* This asks the Window Manager to handle fullscreen for us. This is the modern way. */ static void X11_SetWindowFullscreenViaWM(_THIS, SDL_Window * window, SDL_VideoDisplay * _display, SDL_bool fullscreen) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; SDL_DisplayData *displaydata = (SDL_DisplayData *) _display->driverdata; Display *display = data->videodata->display; Atom _NET_WM_STATE = data->videodata->_NET_WM_STATE; |
︙ | ︙ | |||
1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 | e.xclient.data.l[0] = fullscreen ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE; e.xclient.data.l[1] = _NET_WM_STATE_FULLSCREEN; e.xclient.data.l[3] = 0l; X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0, SubstructureNotifyMask | SubstructureRedirectMask, &e); } else { Uint32 flags; flags = window->flags; if (fullscreen) { flags |= SDL_WINDOW_FULLSCREEN; } else { | > > > > > > > > > > > > > > > > | 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 | e.xclient.data.l[0] = fullscreen ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE; e.xclient.data.l[1] = _NET_WM_STATE_FULLSCREEN; e.xclient.data.l[3] = 0l; X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0, SubstructureNotifyMask | SubstructureRedirectMask, &e); /* Fullscreen windows sometimes end up being marked maximized by window managers. Force it back to how we expect it to be. */ if (!fullscreen && ((window->flags & SDL_WINDOW_MAXIMIZED) == 0)) { SDL_zero(e); e.xany.type = ClientMessage; e.xclient.message_type = _NET_WM_STATE; e.xclient.format = 32; e.xclient.window = data->xwindow; e.xclient.data.l[0] = _NET_WM_STATE_REMOVE; e.xclient.data.l[1] = data->videodata->_NET_WM_STATE_MAXIMIZED_VERT; e.xclient.data.l[2] = data->videodata->_NET_WM_STATE_MAXIMIZED_HORZ; e.xclient.data.l[3] = 0l; X11_XSendEvent(display, RootWindow(display, displaydata->screen), 0, SubstructureNotifyMask | SubstructureRedirectMask, &e); } } else { Uint32 flags; flags = window->flags; if (fullscreen) { flags |= SDL_WINDOW_FULLSCREEN; } else { |
︙ | ︙ |
Changes to jni/SDL2/src/video/x11/SDL_x11window.h.
︙ | ︙ | |||
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | GC gc; XIC ic; SDL_bool created; PendingFocusEnum pending_focus; Uint32 pending_focus_time; XConfigureEvent last_xconfigure; struct SDL_VideoData *videodata; Atom xdnd_req; Window xdnd_source; #if SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; #endif } SDL_WindowData; extern void X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags); extern Uint32 X11_GetNetWMState(_THIS, Window xwindow); extern int X11_CreateWindow(_THIS, SDL_Window * window); extern int X11_CreateWindowFrom(_THIS, SDL_Window * window, const void *data); extern char *X11_GetWindowTitle(_THIS, Window xwindow); extern void X11_SetWindowTitle(_THIS, SDL_Window * window); extern void X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon); extern void X11_SetWindowPosition(_THIS, SDL_Window * window); extern void X11_SetWindowMinimumSize(_THIS, SDL_Window * window); extern void X11_SetWindowMaximumSize(_THIS, SDL_Window * window); extern void X11_SetWindowSize(_THIS, SDL_Window * window); extern void X11_ShowWindow(_THIS, SDL_Window * window); extern void X11_HideWindow(_THIS, SDL_Window * window); extern void X11_RaiseWindow(_THIS, SDL_Window * window); extern void X11_MaximizeWindow(_THIS, SDL_Window * window); extern void X11_MinimizeWindow(_THIS, SDL_Window * window); extern void X11_RestoreWindow(_THIS, SDL_Window * window); | > > > > > | 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | GC gc; XIC ic; SDL_bool created; PendingFocusEnum pending_focus; Uint32 pending_focus_time; XConfigureEvent last_xconfigure; struct SDL_VideoData *videodata; unsigned long user_time; Atom xdnd_req; Window xdnd_source; #if SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; #endif } SDL_WindowData; extern void X11_SetNetWMState(_THIS, Window xwindow, Uint32 flags); extern Uint32 X11_GetNetWMState(_THIS, Window xwindow); extern int X11_CreateWindow(_THIS, SDL_Window * window); extern int X11_CreateWindowFrom(_THIS, SDL_Window * window, const void *data); extern char *X11_GetWindowTitle(_THIS, Window xwindow); extern void X11_SetWindowTitle(_THIS, SDL_Window * window); extern void X11_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon); extern void X11_SetWindowPosition(_THIS, SDL_Window * window); extern void X11_SetWindowMinimumSize(_THIS, SDL_Window * window); extern void X11_SetWindowMaximumSize(_THIS, SDL_Window * window); extern int X11_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right); extern int X11_SetWindowOpacity(_THIS, SDL_Window * window, float opacity); extern int X11_SetWindowModalFor(_THIS, SDL_Window * modal_window, SDL_Window * parent_window); extern int X11_SetWindowInputFocus(_THIS, SDL_Window * window); extern void X11_SetWindowSize(_THIS, SDL_Window * window); extern void X11_ShowWindow(_THIS, SDL_Window * window); extern void X11_HideWindow(_THIS, SDL_Window * window); extern void X11_RaiseWindow(_THIS, SDL_Window * window); extern void X11_MaximizeWindow(_THIS, SDL_Window * window); extern void X11_MinimizeWindow(_THIS, SDL_Window * window); extern void X11_RestoreWindow(_THIS, SDL_Window * window); |
︙ | ︙ |
Changes to jni/SDL2/src/video/x11/SDL_x11xinput2.c.
︙ | ︙ | |||
114 115 116 117 118 119 120 121 122 123 124 125 126 127 | /* Enable Raw motion events for this display */ eventmask.deviceid = XIAllMasterDevices; eventmask.mask_len = sizeof(mask); eventmask.mask = mask; XISetMask(mask, XI_RawMotion); if (X11_XISelectEvents(data->display,DefaultRootWindow(data->display),&eventmask,1) != Success) { return; } #endif } | > > | 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | /* Enable Raw motion events for this display */ eventmask.deviceid = XIAllMasterDevices; eventmask.mask_len = sizeof(mask); eventmask.mask = mask; XISetMask(mask, XI_RawMotion); XISetMask(mask, XI_RawButtonPress); XISetMask(mask, XI_RawButtonRelease); if (X11_XISelectEvents(data->display,DefaultRootWindow(data->display),&eventmask,1) != Success) { return; } #endif } |
︙ | ︙ | |||
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 | switch(cookie->evtype) { case XI_RawMotion: { const XIRawEvent *rawev = (const XIRawEvent*)cookie->data; SDL_Mouse *mouse = SDL_GetMouse(); double relative_coords[2]; static Time prev_time = 0; static double prev_rel_coords[2]; if (!mouse->relative_mode || mouse->relative_mode_warp) { return 0; } parse_valuators(rawev->raw_values,rawev->valuators.mask, rawev->valuators.mask_len,relative_coords,2); if ((rawev->time == prev_time) && (relative_coords[0] == prev_rel_coords[0]) && (relative_coords[1] == prev_rel_coords[1])) { return 0; /* duplicate event, drop it. */ } SDL_SendMouseMotion(mouse->focus,mouse->mouseID,1,(int)relative_coords[0],(int)relative_coords[1]); prev_rel_coords[0] = relative_coords[0]; prev_rel_coords[1] = relative_coords[1]; prev_time = rawev->time; return 1; } break; #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH case XI_TouchBegin: { const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data; SDL_SendTouch(xev->sourceid,xev->detail, SDL_TRUE, xev->event_x, xev->event_y, 1.0); return 1; } | > > > > > > > > | 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | switch(cookie->evtype) { case XI_RawMotion: { const XIRawEvent *rawev = (const XIRawEvent*)cookie->data; SDL_Mouse *mouse = SDL_GetMouse(); double relative_coords[2]; static Time prev_time = 0; static double prev_rel_coords[2]; videodata->global_mouse_changed = SDL_TRUE; if (!mouse->relative_mode || mouse->relative_mode_warp) { return 0; } parse_valuators(rawev->raw_values,rawev->valuators.mask, rawev->valuators.mask_len,relative_coords,2); if ((rawev->time == prev_time) && (relative_coords[0] == prev_rel_coords[0]) && (relative_coords[1] == prev_rel_coords[1])) { return 0; /* duplicate event, drop it. */ } SDL_SendMouseMotion(mouse->focus,mouse->mouseID,1,(int)relative_coords[0],(int)relative_coords[1]); prev_rel_coords[0] = relative_coords[0]; prev_rel_coords[1] = relative_coords[1]; prev_time = rawev->time; return 1; } break; case XI_RawButtonPress: case XI_RawButtonRelease: videodata->global_mouse_changed = SDL_TRUE; break; #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH case XI_TouchBegin: { const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data; SDL_SendTouch(xev->sourceid,xev->detail, SDL_TRUE, xev->event_x, xev->event_y, 1.0); return 1; } |
︙ | ︙ |
Changes to jni/SDL2/src/video/x11/edid-parse.c.
︙ | ︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Author: Soren Sandmann <sandmann@redhat.com> */ #include "edid.h" #include <stdlib.h> #include <string.h> #include <math.h> #include <stdio.h> | > > | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Author: Soren Sandmann <sandmann@redhat.com> */ #include "../../SDL_internal.h" #include "SDL_stdinc.h" #include "edid.h" #include <stdlib.h> #include <string.h> #include <math.h> #include <stdio.h> |
︙ | ︙ | |||
243 244 245 246 247 248 249 | { double result = 0.0; int i; high = (high << 2) | low; for (i = 0; i < 10; ++i) | | | 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | { double result = 0.0; int i; high = (high << 2) | low; for (i = 0; i < 10; ++i) result += get_bit (high, i) * SDL_pow (2, i - 10); return result; } static int decode_color_characteristics (const uchar *edid, MonitorInfo *info) { |
︙ | ︙ |
Changes to jni/SDL2/src/video/x11/imKStoUCS.c.
|
| > | > > > | | | | | | | | > | | | | | | < < < < > < < < | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 | /* Copyright (C) 2003-2006,2008 Jamey Sharp, Josh Triplett Copyright © 2009 Red Hat, Inc. Copyright 1990-1992,1999,2000,2004,2009,2010 Oracle and/or its affiliates. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "../../SDL_internal.h" #if SDL_VIDEO_DRIVER_X11 #include <X11/X.h> #include "imKStoUCS.h" static unsigned short const keysym_to_unicode_1a1_1ff[] = { 0x0104, 0x02d8, 0x0141, 0x0000, 0x013d, 0x015a, 0x0000, /* 0x01a0-0x01a7 */ 0x0000, 0x0160, 0x015e, 0x0164, 0x0179, 0x0000, 0x017d, 0x017b, /* 0x01a8-0x01af */ 0x0000, 0x0105, 0x02db, 0x0142, 0x0000, 0x013e, 0x015b, 0x02c7, /* 0x01b0-0x01b7 */ 0x0000, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, /* 0x01b8-0x01bf */ 0x0154, 0x0000, 0x0000, 0x0102, 0x0000, 0x0139, 0x0106, 0x0000, /* 0x01c0-0x01c7 */ 0x010c, 0x0000, 0x0118, 0x0000, 0x011a, 0x0000, 0x0000, 0x010e, /* 0x01c8-0x01cf */ 0x0110, 0x0143, 0x0147, 0x0000, 0x0000, 0x0150, 0x0000, 0x0000, /* 0x01d0-0x01d7 */ 0x0158, 0x016e, 0x0000, 0x0170, 0x0000, 0x0000, 0x0162, 0x0000, /* 0x01d8-0x01df */ 0x0155, 0x0000, 0x0000, 0x0103, 0x0000, 0x013a, 0x0107, 0x0000, /* 0x01e0-0x01e7 */ 0x010d, 0x0000, 0x0119, 0x0000, 0x011b, 0x0000, 0x0000, 0x010f, /* 0x01e8-0x01ef */ 0x0111, 0x0144, 0x0148, 0x0000, 0x0000, 0x0151, 0x0000, 0x0000, /* 0x01f0-0x01f7 */ 0x0159, 0x016f, 0x0000, 0x0171, 0x0000, 0x0000, 0x0163, 0x02d9 /* 0x01f8-0x01ff */ }; static unsigned short const keysym_to_unicode_2a1_2fe[] = { 0x0126, 0x0000, 0x0000, 0x0000, 0x0000, 0x0124, 0x0000, /* 0x02a0-0x02a7 */ 0x0000, 0x0130, 0x0000, 0x011e, 0x0134, 0x0000, 0x0000, 0x0000, /* 0x02a8-0x02af */ 0x0000, 0x0127, 0x0000, 0x0000, 0x0000, 0x0000, 0x0125, 0x0000, /* 0x02b0-0x02b7 */ 0x0000, 0x0131, 0x0000, 0x011f, 0x0135, 0x0000, 0x0000, 0x0000, /* 0x02b8-0x02bf */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x010a, 0x0108, 0x0000, /* 0x02c0-0x02c7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x02c8-0x02cf */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0120, 0x0000, 0x0000, /* 0x02d0-0x02d7 */ 0x011c, 0x0000, 0x0000, 0x0000, 0x0000, 0x016c, 0x015c, 0x0000, /* 0x02d8-0x02df */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x010b, 0x0109, 0x0000, /* 0x02e0-0x02e7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x02e8-0x02ef */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0121, 0x0000, 0x0000, /* 0x02f0-0x02f7 */ 0x011d, 0x0000, 0x0000, 0x0000, 0x0000, 0x016d, 0x015d /* 0x02f8-0x02ff */ }; static unsigned short const keysym_to_unicode_3a2_3fe[] = { 0x0138, 0x0156, 0x0000, 0x0128, 0x013b, 0x0000, /* 0x03a0-0x03a7 */ 0x0000, 0x0000, 0x0112, 0x0122, 0x0166, 0x0000, 0x0000, 0x0000, /* 0x03a8-0x03af */ 0x0000, 0x0000, 0x0000, 0x0157, 0x0000, 0x0129, 0x013c, 0x0000, /* 0x03b0-0x03b7 */ 0x0000, 0x0000, 0x0113, 0x0123, 0x0167, 0x014a, 0x0000, 0x014b, /* 0x03b8-0x03bf */ 0x0100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x012e, /* 0x03c0-0x03c7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0116, 0x0000, 0x0000, 0x012a, /* 0x03c8-0x03cf */ 0x0000, 0x0145, 0x014c, 0x0136, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x03d0-0x03d7 */ 0x0000, 0x0172, 0x0000, 0x0000, 0x0000, 0x0168, 0x016a, 0x0000, /* 0x03d8-0x03df */ 0x0101, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x012f, /* 0x03e0-0x03e7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0117, 0x0000, 0x0000, 0x012b, /* 0x03e8-0x03ef */ 0x0000, 0x0146, 0x014d, 0x0137, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x03f0-0x03f7 */ 0x0000, 0x0173, 0x0000, 0x0000, 0x0000, 0x0169, 0x016b /* 0x03f8-0x03ff */ }; static unsigned short const keysym_to_unicode_4a1_4df[] = { 0x3002, 0x3008, 0x3009, 0x3001, 0x30fb, 0x30f2, 0x30a1, /* 0x04a0-0x04a7 */ 0x30a3, 0x30a5, 0x30a7, 0x30a9, 0x30e3, 0x30e5, 0x30e7, 0x30c3, /* 0x04a8-0x04af */ 0x30fc, 0x30a2, 0x30a4, 0x30a6, 0x30a8, 0x30aa, 0x30ab, 0x30ad, /* 0x04b0-0x04b7 */ 0x30af, 0x30b1, 0x30b3, 0x30b5, 0x30b7, 0x30b9, 0x30bb, 0x30bd, /* 0x04b8-0x04bf */ 0x30bf, 0x30c1, 0x30c4, 0x30c6, 0x30c8, 0x30ca, 0x30cb, 0x30cc, /* 0x04c0-0x04c7 */ 0x30cd, 0x30ce, 0x30cf, 0x30d2, 0x30d5, 0x30d8, 0x30db, 0x30de, /* 0x04c8-0x04cf */ 0x30df, 0x30e0, 0x30e1, 0x30e2, 0x30e4, 0x30e6, 0x30e8, 0x30e9, /* 0x04d0-0x04d7 */ 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ef, 0x30f3, 0x309b, 0x309c /* 0x04d8-0x04df */ }; static unsigned short const keysym_to_unicode_590_5fe[] = { 0x06f0, 0x06f1, 0x06f2, 0x06f3, 0x06f4, 0x06f5, 0x06f6, 0x06f7, /* 0x0590-0x0597 */ 0x06f8, 0x06f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x0598-0x059f */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x066a, 0x0670, 0x0679, /* 0x05a0-0x05a7 */ 0x067e, 0x0686, 0x0688, 0x0691, 0x060c, 0x0000, 0x06d4, 0x0000, /* 0x05ac-0x05af */ 0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, /* 0x05b0-0x05b7 */ 0x0668, 0x0669, 0x0000, 0x061b, 0x0000, 0x0000, 0x0000, 0x061f, /* 0x05b8-0x05bf */ 0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, /* 0x05c0-0x05c7 */ 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, /* 0x05c8-0x05cf */ 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, /* 0x05d0-0x05d7 */ 0x0638, 0x0639, 0x063a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x05d8-0x05df */ 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, /* 0x05e0-0x05e7 */ 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, /* 0x05e8-0x05ef */ 0x0650, 0x0651, 0x0652, 0x0653, 0x0654, 0x0655, 0x0698, 0x06a4, /* 0x05f0-0x05f7 */ 0x06a9, 0x06af, 0x06ba, 0x06be, 0x06cc, 0x06d2, 0x06c1 /* 0x05f8-0x05fe */ }; static unsigned short keysym_to_unicode_680_6ff[] = { 0x0492, 0x0496, 0x049a, 0x049c, 0x04a2, 0x04ae, 0x04b0, 0x04b2, /* 0x0680-0x0687 */ 0x04b6, 0x04b8, 0x04ba, 0x0000, 0x04d8, 0x04e2, 0x04e8, 0x04ee, /* 0x0688-0x068f */ 0x0493, 0x0497, 0x049b, 0x049d, 0x04a3, 0x04af, 0x04b1, 0x04b3, /* 0x0690-0x0697 */ 0x04b7, 0x04b9, 0x04bb, 0x0000, 0x04d9, 0x04e3, 0x04e9, 0x04ef, /* 0x0698-0x069f */ 0x0000, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, /* 0x06a0-0x06a7 */ 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0491, 0x045e, 0x045f, /* 0x06a8-0x06af */ 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, /* 0x06b0-0x06b7 */ 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x0490, 0x040e, 0x040f, /* 0x06b8-0x06bf */ 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, /* 0x06c0-0x06c7 */ 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, /* 0x06c8-0x06cf */ 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, /* 0x06d0-0x06d7 */ 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, /* 0x06d8-0x06df */ 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, /* 0x06e0-0x06e7 */ 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, /* 0x06e8-0x06ef */ 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, /* 0x06f0-0x06f7 */ 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a /* 0x06f8-0x06ff */ }; static unsigned short const keysym_to_unicode_7a1_7f9[] = { 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, /* 0x07a0-0x07a7 */ 0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, /* 0x07a8-0x07af */ 0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, /* 0x07b0-0x07b7 */ 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x07b8-0x07bf */ 0x0000, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, /* 0x07c0-0x07c7 */ 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, /* 0x07c8-0x07cf */ 0x03a0, 0x03a1, 0x03a3, 0x0000, 0x03a4, 0x03a5, 0x03a6, 0x03a7, /* 0x07d0-0x07d7 */ 0x03a8, 0x03a9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x07d8-0x07df */ 0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, /* 0x07e0-0x07e7 */ 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, /* 0x07e8-0x07ef */ 0x03c0, 0x03c1, 0x03c3, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, /* 0x07f0-0x07f7 */ 0x03c8, 0x03c9 /* 0x07f8-0x07ff */ }; static unsigned short const keysym_to_unicode_8a4_8fe[] = { 0x2320, 0x2321, 0x0000, 0x231c, /* 0x08a0-0x08a7 */ 0x231d, 0x231e, 0x231f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08a8-0x08af */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08b0-0x08b7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x2264, 0x2260, 0x2265, 0x222b, /* 0x08b8-0x08bf */ 0x2234, 0x0000, 0x221e, 0x0000, 0x0000, 0x2207, 0x0000, 0x0000, /* 0x08c0-0x08c7 */ 0x2245, 0x2246, 0x0000, 0x0000, 0x0000, 0x0000, 0x21d2, 0x0000, /* 0x08c8-0x08cf */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x221a, 0x0000, /* 0x08d0-0x08d7 */ 0x0000, 0x0000, 0x2282, 0x2283, 0x2229, 0x222a, 0x2227, 0x2228, /* 0x08d8-0x08df */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08e0-0x08e7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2202, /* 0x08e8-0x08ef */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, /* 0x08f0-0x08f7 */ 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193 /* 0x08f8-0x08ff */ }; static unsigned short const keysym_to_unicode_9df_9f8[] = { 0x2422, /* 0x09d8-0x09df */ 0x2666, 0x25a6, 0x2409, 0x240c, 0x240d, 0x240a, 0x0000, 0x0000, /* 0x09e0-0x09e7 */ 0x240a, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c, 0x2500, /* 0x09e8-0x09ef */ 0x0000, 0x0000, 0x0000, 0x0000, 0x251c, 0x2524, 0x2534, 0x252c, /* 0x09f0-0x09f7 */ 0x2502 /* 0x09f8-0x09ff */ }; static unsigned short const keysym_to_unicode_aa1_afe[] = { 0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, /* 0x0aa0-0x0aa7 */ 0x200a, 0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, /* 0x0aa8-0x0aaf */ 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, /* 0x0ab0-0x0ab7 */ 0x2105, 0x0000, 0x0000, 0x2012, 0x2039, 0x2024, 0x203a, 0x0000, /* 0x0ab8-0x0abf */ 0x0000, 0x0000, 0x0000, 0x215b, 0x215c, 0x215d, 0x215e, 0x0000, /* 0x0ac0-0x0ac7 */ 0x0000, 0x2122, 0x2120, 0x0000, 0x25c1, 0x25b7, 0x25cb, 0x25ad, /* 0x0ac8-0x0acf */ 0x2018, 0x2019, 0x201c, 0x201d, 0x211e, 0x2030, 0x2032, 0x2033, /* 0x0ad0-0x0ad7 */ 0x0000, 0x271d, 0x0000, 0x220e, 0x25c2, 0x2023, 0x25cf, 0x25ac, /* 0x0ad8-0x0adf */ 0x25e6, 0x25ab, 0x25ae, 0x25b5, 0x25bf, 0x2606, 0x2022, 0x25aa, /* 0x0ae0-0x0ae7 */ 0x25b4, 0x25be, 0x261a, 0x261b, 0x2663, 0x2666, 0x2665, 0x0000, /* 0x0ae8-0x0aef */ 0x2720, 0x2020, 0x2021, 0x2713, 0x2612, 0x266f, 0x266d, 0x2642, /* 0x0af0-0x0af7 */ 0x2640, 0x2121, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e /* 0x0af8-0x0aff */ }; /* none of the APL keysyms match the Unicode characters */ static unsigned short const keysym_to_unicode_cdf_cfa[] = { 0x2017, /* 0x0cd8-0x0cdf */ 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, /* 0x0ce0-0x0ce7 */ 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, /* 0x0ce8-0x0cef */ 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, /* 0x0cf0-0x0cf7 */ 0x05e8, 0x05e9, 0x05ea /* 0x0cf8-0x0cff */ }; static unsigned short const keysym_to_unicode_da1_df9[] = { 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, /* 0x0da0-0x0da7 */ 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, /* 0x0da8-0x0daf */ 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, /* 0x0db0-0x0db7 */ 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, /* 0x0db8-0x0dbf */ 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, /* 0x0dc0-0x0dc7 */ 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, /* 0x0dc8-0x0dcf */ 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, /* 0x0dd0-0x0dd7 */ 0x0e38, 0x0e39, 0x0e3a, 0x0000, 0x0000, 0x0000, 0x0e3e, 0x0e3f, /* 0x0dd8-0x0ddf */ 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, /* 0x0de0-0x0de7 */ 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0000, 0x0000, /* 0x0de8-0x0def */ 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, /* 0x0df0-0x0df7 */ 0x0e58, 0x0e59 /* 0x0df8-0x0dff */ }; static unsigned short const keysym_to_unicode_ea0_eff[] = { 0x0000, 0x1101, 0x1101, 0x11aa, 0x1102, 0x11ac, 0x11ad, 0x1103, /* 0x0ea0-0x0ea7 */ 0x1104, 0x1105, 0x11b0, 0x11b1, 0x11b2, 0x11b3, 0x11b4, 0x11b5, /* 0x0ea8-0x0eaf */ 0x11b6, 0x1106, 0x1107, 0x1108, 0x11b9, 0x1109, 0x110a, 0x110b, /* 0x0eb0-0x0eb7 */ 0x110c, 0x110d, 0x110e, 0x110f, 0x1110, 0x1111, 0x1112, 0x1161, /* 0x0eb8-0x0ebf */ 0x1162, 0x1163, 0x1164, 0x1165, 0x1166, 0x1167, 0x1168, 0x1169, /* 0x0ec0-0x0ec7 */ 0x116a, 0x116b, 0x116c, 0x116d, 0x116e, 0x116f, 0x1170, 0x1171, /* 0x0ec8-0x0ecf */ 0x1172, 0x1173, 0x1174, 0x1175, 0x11a8, 0x11a9, 0x11aa, 0x11ab, /* 0x0ed0-0x0ed7 */ 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, /* 0x0ed8-0x0edf */ 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba, 0x11bb, /* 0x0ee0-0x0ee7 */ 0x11bc, 0x11bd, 0x11be, 0x11bf, 0x11c0, 0x11c1, 0x11c2, 0x0000, /* 0x0ee8-0x0eef */ 0x0000, 0x0000, 0x1140, 0x0000, 0x0000, 0x1159, 0x119e, 0x0000, /* 0x0ef0-0x0ef7 */ 0x11eb, 0x0000, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9, /* 0x0ef8-0x0eff */ }; static unsigned short keysym_to_unicode_12a1_12fe[] = { 0x1e02, 0x1e03, 0x0000, 0x0000, 0x0000, 0x1e0a, 0x0000, /* 0x12a0-0x12a7 */ 0x1e80, 0x0000, 0x1e82, 0x1e0b, 0x1ef2, 0x0000, 0x0000, 0x0000, /* 0x12a8-0x12af */ 0x1e1e, 0x1e1f, 0x0000, 0x0000, 0x1e40, 0x1e41, 0x0000, 0x1e56, /* 0x12b0-0x12b7 */ 0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61, /* 0x12b8-0x12bf */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12c0-0x12c7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12c8-0x12cf */ 0x0174, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1e6a, /* 0x12d0-0x12d7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0176, 0x0000, /* 0x12d8-0x12df */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e0-0x12e7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e8-0x12ef */ 0x0175, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1e6b, /* 0x12f0-0x12f7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0177 /* 0x12f0-0x12ff */ }; static unsigned short const keysym_to_unicode_13bc_13be[] = { 0x0152, 0x0153, 0x0178 /* 0x13b8-0x13bf */ }; static unsigned short keysym_to_unicode_14a1_14ff[] = { 0x2741, 0x00a7, 0x0589, 0x0029, 0x0028, 0x00bb, 0x00ab, /* 0x14a0-0x14a7 */ 0x2014, 0x002e, 0x055d, 0x002c, 0x2013, 0x058a, 0x2026, 0x055c, /* 0x14a8-0x14af */ 0x055b, 0x055e, 0x0531, 0x0561, 0x0532, 0x0562, 0x0533, 0x0563, /* 0x14b0-0x14b7 */ 0x0534, 0x0564, 0x0535, 0x0565, 0x0536, 0x0566, 0x0537, 0x0567, /* 0x14b8-0x14bf */ 0x0538, 0x0568, 0x0539, 0x0569, 0x053a, 0x056a, 0x053b, 0x056b, /* 0x14c0-0x14c7 */ 0x053c, 0x056c, 0x053d, 0x056d, 0x053e, 0x056e, 0x053f, 0x056f, /* 0x14c8-0x14cf */ 0x0540, 0x0570, 0x0541, 0x0571, 0x0542, 0x0572, 0x0543, 0x0573, /* 0x14d0-0x14d7 */ 0x0544, 0x0574, 0x0545, 0x0575, 0x0546, 0x0576, 0x0547, 0x0577, /* 0x14d8-0x14df */ 0x0548, 0x0578, 0x0549, 0x0579, 0x054a, 0x057a, 0x054b, 0x057b, /* 0x14e0-0x14e7 */ 0x054c, 0x057c, 0x054d, 0x057d, 0x054e, 0x057e, 0x054f, 0x057f, /* 0x14e8-0x14ef */ 0x0550, 0x0580, 0x0551, 0x0581, 0x0552, 0x0582, 0x0553, 0x0583, /* 0x14f0-0x14f7 */ 0x0554, 0x0584, 0x0555, 0x0585, 0x0556, 0x0586, 0x2019, 0x0027, /* 0x14f8-0x14ff */ }; static unsigned short keysym_to_unicode_15d0_15f6[] = { 0x10d0, 0x10d1, 0x10d2, 0x10d3, 0x10d4, 0x10d5, 0x10d6, 0x10d7, /* 0x15d0-0x15d7 */ 0x10d8, 0x10d9, 0x10da, 0x10db, 0x10dc, 0x10dd, 0x10de, 0x10df, /* 0x15d8-0x15df */ 0x10e0, 0x10e1, 0x10e2, 0x10e3, 0x10e4, 0x10e5, 0x10e6, 0x10e7, /* 0x15e0-0x15e7 */ 0x10e8, 0x10e9, 0x10ea, 0x10eb, 0x10ec, 0x10ed, 0x10ee, 0x10ef, /* 0x15e8-0x15ef */ 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6 /* 0x15f0-0x15f7 */ }; static unsigned short keysym_to_unicode_16a0_16f6[] = { 0x0000, 0x0000, 0xf0a2, 0x1e8a, 0x0000, 0xf0a5, 0x012c, 0xf0a7, /* 0x16a0-0x16a7 */ 0xf0a8, 0x01b5, 0x01e6, 0x0000, 0x0000, 0x0000, 0x0000, 0x019f, /* 0x16a8-0x16af */ 0x0000, 0x0000, 0xf0b2, 0x1e8b, 0x01d1, 0xf0b5, 0x012d, 0xf0b7, /* 0x16b0-0x16b7 */ 0xf0b8, 0x01b6, 0x01e7, 0x0000, 0x0000, 0x01d2, 0x0000, 0x0275, /* 0x16b8-0x16bf */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x018f, 0x0000, /* 0x16c0-0x16c7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16c8-0x16cf */ 0x0000, 0x1e36, 0xf0d2, 0xf0d3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d0-0x16d7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d8-0x16df */ 0x0000, 0x1e37, 0xf0e2, 0xf0e3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e0-0x16e7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e8-0x16ef */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0259 /* 0x16f0-0x16f6 */ }; static unsigned short const keysym_to_unicode_1e9f_1eff[] = { 0x0303, 0x1ea0, 0x1ea1, 0x1ea2, 0x1ea3, 0x1ea4, 0x1ea5, 0x1ea6, 0x1ea7, /* 0x1ea0-0x1ea7 */ 0x1ea8, 0x1ea9, 0x1eaa, 0x1eab, 0x1eac, 0x1ead, 0x1eae, 0x1eaf, /* 0x1ea8-0x1eaf */ 0x1eb0, 0x1eb1, 0x1eb2, 0x1eb3, 0x1eb4, 0x1eb5, 0x1eb6, 0x1eb7, /* 0x1eb0-0x1eb7 */ 0x1eb8, 0x1eb9, 0x1eba, 0x1ebb, 0x1ebc, 0x1ebd, 0x1ebe, 0x1ebf, /* 0x1eb8-0x1ebf */ 0x1ec0, 0x1ec1, 0x1ec2, 0x1ec3, 0x1ec4, 0x1ec5, 0x1ec6, 0x1ec7, /* 0x1ec0-0x1ec7 */ 0x1ec8, 0x1ec9, 0x1eca, 0x1ecb, 0x1ecc, 0x1ecd, 0x1ece, 0x1ecf, /* 0x1ec8-0x1ecf */ 0x1ed0, 0x1ed1, 0x1ed2, 0x1ed3, 0x1ed4, 0x1ed5, 0x1ed6, 0x1ed7, /* 0x1ed0-0x1ed7 */ 0x1ed8, 0x1ed9, 0x1eda, 0x1edb, 0x1edc, 0x1edd, 0x1ede, 0x1edf, /* 0x1ed8-0x1edf */ 0x1ee0, 0x1ee1, 0x1ee2, 0x1ee3, 0x1ee4, 0x1ee5, 0x1ee6, 0x1ee7, /* 0x1ee0-0x1ee7 */ 0x1ee8, 0x1ee9, 0x1eea, 0x1eeb, 0x1eec, 0x1eed, 0x1eee, 0x1eef, /* 0x1ee8-0x1eef */ 0x1ef0, 0x1ef1, 0x0300, 0x0301, 0x1ef4, 0x1ef5, 0x1ef6, 0x1ef7, /* 0x1ef0-0x1ef7 */ 0x1ef8, 0x1ef9, 0x01a0, 0x01a1, 0x01af, 0x01b0, 0x0309, 0x0323 /* 0x1ef8-0x1eff */ }; static unsigned short const keysym_to_unicode_20a0_20ac[] = { 0x20a0, 0x20a1, 0x20a2, 0x20a3, 0x20a4, 0x20a5, 0x20a6, 0x20a7, /* 0x20a0-0x20a7 */ 0x20a8, 0x20a9, 0x20aa, 0x20ab, 0x20ac /* 0x20a8-0x20af */ }; unsigned int X11_KeySymToUcs4(KeySym keysym) { /* 'Unicode keysym' */ if ((keysym & 0xff000000) == 0x01000000) return (keysym & 0x00ffffff); if (keysym > 0 && keysym < 0x100) return keysym; else if (keysym > 0x1a0 && keysym < 0x200) return keysym_to_unicode_1a1_1ff[keysym - 0x1a1]; else if (keysym > 0x2a0 && keysym < 0x2ff) return keysym_to_unicode_2a1_2fe[keysym - 0x2a1]; else if (keysym > 0x3a1 && keysym < 0x3ff) return keysym_to_unicode_3a2_3fe[keysym - 0x3a2]; else if (keysym > 0x4a0 && keysym < 0x4e0) return keysym_to_unicode_4a1_4df[keysym - 0x4a1]; else if (keysym > 0x589 && keysym < 0x5ff) return keysym_to_unicode_590_5fe[keysym - 0x590]; else if (keysym > 0x67f && keysym < 0x700) return keysym_to_unicode_680_6ff[keysym - 0x680]; else if (keysym > 0x7a0 && keysym < 0x7fa) return keysym_to_unicode_7a1_7f9[keysym - 0x7a1]; else if (keysym > 0x8a3 && keysym < 0x8ff) return keysym_to_unicode_8a4_8fe[keysym - 0x8a4]; else if (keysym > 0x9de && keysym < 0x9f9) return keysym_to_unicode_9df_9f8[keysym - 0x9df]; else if (keysym > 0xaa0 && keysym < 0xaff) return keysym_to_unicode_aa1_afe[keysym - 0xaa1]; else if (keysym > 0xcde && keysym < 0xcfb) return keysym_to_unicode_cdf_cfa[keysym - 0xcdf]; else if (keysym > 0xda0 && keysym < 0xdfa) return keysym_to_unicode_da1_df9[keysym - 0xda1]; else if (keysym > 0xe9f && keysym < 0xf00) return keysym_to_unicode_ea0_eff[keysym - 0xea0]; else if (keysym > 0x12a0 && keysym < 0x12ff) return keysym_to_unicode_12a1_12fe[keysym - 0x12a1]; else if (keysym > 0x13bb && keysym < 0x13bf) return keysym_to_unicode_13bc_13be[keysym - 0x13bc]; else if (keysym > 0x14a0 && keysym < 0x1500) return keysym_to_unicode_14a1_14ff[keysym - 0x14a1]; else if (keysym > 0x15cf && keysym < 0x15f7) return keysym_to_unicode_15d0_15f6[keysym - 0x15d0]; else if (keysym > 0x169f && keysym < 0x16f7) return keysym_to_unicode_16a0_16f6[keysym - 0x16a0]; else if (keysym > 0x1e9e && keysym < 0x1f00) return keysym_to_unicode_1e9f_1eff[keysym - 0x1e9f]; else if (keysym > 0x209f && keysym < 0x20ad) return keysym_to_unicode_20a0_20ac[keysym - 0x20a0]; else return 0; } #endif /* SDL_VIDEO_DRIVER_X11 */ |
Changes to jni/SDL2/src/video/x11/imKStoUCS.h.
1 2 3 | #ifndef _imKStoUCS_h #define _imKStoUCS_h | > | > > > | | | | | | | | > | | | | | | < < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #ifndef _imKStoUCS_h #define _imKStoUCS_h /* Copyright (C) 2003-2006,2008 Jamey Sharp, Josh Triplett Copyright © 2009 Red Hat, Inc. Copyright 1990-1992,1999,2000,2004,2009,2010 Oracle and/or its affiliates. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice (including the next paragraph) shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ extern unsigned int X11_KeySymToUcs4(KeySym keysym); #endif /* _imKStoUCS_h */ |
Changes to jni/SDL2/test/Makefile.in.
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 | TARGETS = \ checkkeys$(EXE) \ loopwave$(EXE) \ loopwavequeue$(EXE) \ testatomic$(EXE) \ testaudioinfo$(EXE) \ testautomation$(EXE) \ testdraw2$(EXE) \ testdrawchessboard$(EXE) \ testdropfile$(EXE) \ testerror$(EXE) \ testfile$(EXE) \ testgamecontroller$(EXE) \ testgesture$(EXE) \ | > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | TARGETS = \ checkkeys$(EXE) \ loopwave$(EXE) \ loopwavequeue$(EXE) \ testatomic$(EXE) \ testaudioinfo$(EXE) \ testautomation$(EXE) \ testbounds$(EXE) \ testdraw2$(EXE) \ testdrawchessboard$(EXE) \ testdropfile$(EXE) \ testerror$(EXE) \ testfile$(EXE) \ testgamecontroller$(EXE) \ testgesture$(EXE) \ |
︙ | ︙ | |||
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 | $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@ testmessage$(EXE): $(srcdir)/testmessage.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) testdisplayinfo$(EXE): $(srcdir)/testdisplayinfo.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) controllermap$(EXE): $(srcdir)/controllermap.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) clean: rm -f $(TARGETS) distclean: clean rm -f Makefile rm -f config.status config.cache config.log rm -rf $(srcdir)/autom4te* | > > > | 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @MATHLIB@ testmessage$(EXE): $(srcdir)/testmessage.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) testdisplayinfo$(EXE): $(srcdir)/testdisplayinfo.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) testbounds$(EXE): $(srcdir)/testbounds.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) controllermap$(EXE): $(srcdir)/controllermap.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) clean: rm -f $(TARGETS) distclean: clean rm -f Makefile rm -f config.status config.cache config.log rm -rf $(srcdir)/autom4te* |
Changes to jni/SDL2/test/testatomic.c.
︙ | ︙ | |||
280 281 282 283 284 285 286 | SDL_SpinLock lock; SDL_atomic_t rwcount; SDL_atomic_t watcher; char cache_pad4[SDL_CACHELINE_SIZE-sizeof(SDL_SpinLock)-2*sizeof(SDL_atomic_t)]; #endif | | | | 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 | SDL_SpinLock lock; SDL_atomic_t rwcount; SDL_atomic_t watcher; char cache_pad4[SDL_CACHELINE_SIZE-sizeof(SDL_SpinLock)-2*sizeof(SDL_atomic_t)]; #endif SDL_atomic_t active; /* Only needed for the mutex test */ SDL_mutex *mutex; } SDL_EventQueue; static void InitEventQueue(SDL_EventQueue *queue) { int i; for (i = 0; i < MAX_ENTRIES; ++i) { SDL_AtomicSet(&queue->entries[i].sequence, i); } SDL_AtomicSet(&queue->enqueue_pos, 0); SDL_AtomicSet(&queue->dequeue_pos, 0); #ifdef TEST_SPINLOCK_FIFO queue->lock = 0; SDL_AtomicSet(&queue->rwcount, 0); SDL_AtomicSet(&queue->watcher, 0); #endif SDL_AtomicSet(&queue->active, 1); } static SDL_bool EnqueueEvent_LockFree(SDL_EventQueue *queue, const SDL_Event *event) { SDL_EventQueueEntry *entry; unsigned queue_pos; unsigned entry_seq; |
︙ | ︙ | |||
534 535 536 537 538 539 540 | SDL_Event event; if (data->lock_free) { for ( ; ; ) { if (DequeueEvent_LockFree(queue, &event)) { WriterData *writer = (WriterData*)event.user.data1; ++data->counters[writer->index]; | | | | | 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 | SDL_Event event; if (data->lock_free) { for ( ; ; ) { if (DequeueEvent_LockFree(queue, &event)) { WriterData *writer = (WriterData*)event.user.data1; ++data->counters[writer->index]; } else if (SDL_AtomicGet(&queue->active)) { ++data->waits; SDL_Delay(0); } else { /* We drained the queue, we're done! */ break; } } } else { for ( ; ; ) { if (DequeueEvent_Mutex(queue, &event)) { WriterData *writer = (WriterData*)event.user.data1; ++data->counters[writer->index]; } else if (SDL_AtomicGet(&queue->active)) { ++data->waits; SDL_Delay(0); } else { /* We drained the queue, we're done! */ break; } } } SDL_AtomicAdd(&readersRunning, -1); SDL_SemPost(readersDone); return 0; } #ifdef TEST_SPINLOCK_FIFO /* This thread periodically locks the queue for no particular reason */ static int FIFO_Watcher(void* _data) { SDL_EventQueue *queue = (SDL_EventQueue *)_data; while (SDL_AtomicGet(&queue->active)) { SDL_AtomicLock(&queue->lock); SDL_AtomicIncRef(&queue->watcher); while (SDL_AtomicGet(&queue->rwcount) > 0) { SDL_Delay(0); } /* Do queue manipulation here... */ SDL_AtomicDecRef(&queue->watcher); |
︙ | ︙ | |||
648 649 650 651 652 653 654 | /* Wait for the writers */ while (SDL_AtomicGet(&writersRunning) > 0) { SDL_SemWait(writersDone); } /* Shut down the queue so readers exit */ | | | 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 | /* Wait for the writers */ while (SDL_AtomicGet(&writersRunning) > 0) { SDL_SemWait(writersDone); } /* Shut down the queue so readers exit */ SDL_AtomicSet(&queue.active, 0); /* Wait for the readers */ while (SDL_AtomicGet(&readersRunning) > 0) { SDL_SemWait(readersDone); } end = SDL_GetTicks(); |
︙ | ︙ |
Added jni/SDL2/test/testbounds.c.
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | /* Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org> This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely. */ #include "SDL.h" int main(int argc, char **argv) { int total, i; if (SDL_Init(SDL_INIT_VIDEO) < 0) { SDL_Log("SDL_Init(SDL_INIT_VIDEO) failed: %s", SDL_GetError()); } total = SDL_GetNumVideoDisplays(); for (i = 0; i < total; i++) { SDL_Rect bounds = { -1,-1,-1,-1 }, usable = { -1,-1,-1,-1 }; SDL_GetDisplayBounds(i, &bounds); SDL_GetDisplayUsableBounds(i, &usable); SDL_Log("Display #%d ('%s'): bounds={(%d,%d),%dx%d}, usable={(%d,%d),%dx%d}", i, SDL_GetDisplayName(i), bounds.x, bounds.y, bounds.w, bounds.h, usable.x, usable.y, usable.w, usable.h); } SDL_Quit(); return 0; } /* vi: set ts=4 sw=4 expandtab: */ |
Changes to jni/SDL2/test/testdisplayinfo.c.
︙ | ︙ | |||
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | num_displays = SDL_GetNumVideoDisplays(); SDL_Log("See %d displays.\n", num_displays); for (dpy = 0; dpy < num_displays; dpy++) { const int num_modes = SDL_GetNumDisplayModes(dpy); SDL_Rect rect = { 0, 0, 0, 0 }; int m; SDL_GetDisplayBounds(dpy, &rect); SDL_Log("%d: \"%s\" (%dx%d, (%d, %d)), %d modes.\n", dpy, SDL_GetDisplayName(dpy), rect.w, rect.h, rect.x, rect.y, num_modes); if (SDL_GetCurrentDisplayMode(dpy, &mode) == -1) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, " CURRENT: failed to query (%s)\n", SDL_GetError()); } else { print_mode("CURRENT", &mode); } | > > > > > > > | 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | num_displays = SDL_GetNumVideoDisplays(); SDL_Log("See %d displays.\n", num_displays); for (dpy = 0; dpy < num_displays; dpy++) { const int num_modes = SDL_GetNumDisplayModes(dpy); SDL_Rect rect = { 0, 0, 0, 0 }; float ddpi, hdpi, vdpi; int m; SDL_GetDisplayBounds(dpy, &rect); SDL_Log("%d: \"%s\" (%dx%d, (%d, %d)), %d modes.\n", dpy, SDL_GetDisplayName(dpy), rect.w, rect.h, rect.x, rect.y, num_modes); if (SDL_GetDisplayDPI(dpy, &ddpi, &hdpi, &vdpi) == -1) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, " DPI: failed to query (%s)\n", SDL_GetError()); } else { SDL_Log(" DPI: ddpi=%f; hdpi=%f; vdpi=%f\n", ddpi, hdpi, vdpi); } if (SDL_GetCurrentDisplayMode(dpy, &mode) == -1) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, " CURRENT: failed to query (%s)\n", SDL_GetError()); } else { print_mode("CURRENT", &mode); } |
︙ | ︙ |
Changes to jni/SDL2/test/testdropfile.c.
︙ | ︙ | |||
73 74 75 76 77 78 79 | /* Main render loop */ done = 0; while (!done) { /* Check for events */ while (SDL_PollEvent(&event)) { SDLTest_CommonEvent(state, &event, &done); | | > > > > > | | 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | /* Main render loop */ done = 0; while (!done) { /* Check for events */ while (SDL_PollEvent(&event)) { SDLTest_CommonEvent(state, &event, &done); if (event.type == SDL_DROPBEGIN) { SDL_Log("Drop beginning on window %u", (unsigned int) event.drop.windowID); } else if (event.type == SDL_DROPCOMPLETE) { SDL_Log("Drop complete on window %u", (unsigned int) event.drop.windowID); } else if ((event.type == SDL_DROPFILE) || (event.type == SDL_DROPTEXT)) { const char *typestr = (event.type == SDL_DROPFILE) ? "File" : "Text"; char *dropped_filedir = event.drop.file; SDL_Log("%s dropped on window %u: %s", typestr, (unsigned int) event.drop.windowID, dropped_filedir); SDL_free(dropped_filedir); } } } quit(0); /* keep the compiler happy ... */ |
︙ | ︙ |
Changes to jni/SDL2/test/testlock.c.
︙ | ︙ | |||
19 20 21 22 23 24 25 | #include <stdlib.h> /* for atexit() */ #include "SDL.h" static SDL_mutex *mutex = NULL; static SDL_threadID mainthread; static SDL_Thread *threads[6]; | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #include <stdlib.h> /* for atexit() */ #include "SDL.h" static SDL_mutex *mutex = NULL; static SDL_threadID mainthread; static SDL_Thread *threads[6]; static SDL_atomic_t doterminate; /* * SDL_Quit() shouldn't be used with atexit() directly because * calling conventions may differ... */ static void SDL_Quit_Wrapper(void) |
︙ | ︙ | |||
41 42 43 44 45 46 47 | SDL_Log("Process %lu: exiting\n", SDL_ThreadID()); } void terminate(int sig) { signal(SIGINT, terminate); | | | | | | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | SDL_Log("Process %lu: exiting\n", SDL_ThreadID()); } void terminate(int sig) { signal(SIGINT, terminate); SDL_AtomicSet(&doterminate, 1); } void closemutex(int sig) { SDL_threadID id = SDL_ThreadID(); int i; SDL_Log("Process %lu: Cleaning up...\n", id == mainthread ? 0 : id); SDL_AtomicSet(&doterminate, 1); for (i = 0; i < 6; ++i) SDL_WaitThread(threads[i], NULL); SDL_DestroyMutex(mutex); exit(sig); } int SDLCALL Run(void *data) { if (SDL_ThreadID() == mainthread) signal(SIGTERM, closemutex); while (!SDL_AtomicGet(&doterminate)) { SDL_Log("Process %lu ready to work\n", SDL_ThreadID()); if (SDL_LockMutex(mutex) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't lock mutex: %s", SDL_GetError()); exit(1); } SDL_Log("Process %lu, working!\n", SDL_ThreadID()); SDL_Delay(1 * 1000); SDL_Log("Process %lu, done!\n", SDL_ThreadID()); if (SDL_UnlockMutex(mutex) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't unlock mutex: %s", SDL_GetError()); exit(1); } /* If this sleep isn't done, then threads may starve */ SDL_Delay(10); } if (SDL_ThreadID() == mainthread && SDL_AtomicGet(&doterminate)) { SDL_Log("Process %lu: raising SIGTERM\n", SDL_ThreadID()); raise(SIGTERM); } return (0); } int |
︙ | ︙ | |||
100 101 102 103 104 105 106 107 108 109 110 111 112 113 | /* Load the SDL library */ if (SDL_Init(0) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError()); exit(1); } atexit(SDL_Quit_Wrapper); if ((mutex = SDL_CreateMutex()) == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create mutex: %s\n", SDL_GetError()); exit(1); } mainthread = SDL_ThreadID(); | > > | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | /* Load the SDL library */ if (SDL_Init(0) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "%s\n", SDL_GetError()); exit(1); } atexit(SDL_Quit_Wrapper); SDL_AtomicSet(&doterminate, 0); if ((mutex = SDL_CreateMutex()) == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create mutex: %s\n", SDL_GetError()); exit(1); } mainthread = SDL_ThreadID(); |
︙ | ︙ |
Changes to jni/SDL2/test/testmultiaudio.c.
︙ | ︙ | |||
21 22 23 24 25 26 27 | static Uint8 *sound = NULL; /* Pointer to wave data */ static Uint32 soundlen = 0; /* Length of wave data */ typedef struct { SDL_AudioDeviceID dev; int soundpos; | | | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | static Uint8 *sound = NULL; /* Pointer to wave data */ static Uint32 soundlen = 0; /* Length of wave data */ typedef struct { SDL_AudioDeviceID dev; int soundpos; SDL_atomic_t done; } callback_data; callback_data cbd[64]; void SDLCALL play_through_once(void *arg, Uint8 * stream, int len) { callback_data *cbd = (callback_data *) arg; Uint8 *waveptr = sound + cbd->soundpos; int waveleft = soundlen - cbd->soundpos; int cpy = len; if (cpy > waveleft) cpy = waveleft; SDL_memcpy(stream, waveptr, cpy); len -= cpy; cbd->soundpos += cpy; if (len > 0) { stream += cpy; SDL_memset(stream, spec.silence, len); SDL_AtomicSet(&cbd->done, 1); } } void loop() { if (SDL_AtomicGet(&cbd[0].done)) { #ifdef __EMSCRIPTEN__ emscripten_cancel_main_loop(); #endif SDL_PauseAudioDevice(cbd[0].dev, 1); SDL_CloseAudioDevice(cbd[0].dev); SDL_FreeWAV(sound); SDL_Quit(); |
︙ | ︙ | |||
96 97 98 99 100 101 102 | if (cbd[0].dev == 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Open device failed: %s\n", SDL_GetError()); } else { SDL_PauseAudioDevice(cbd[0].dev, 0); #ifdef __EMSCRIPTEN__ emscripten_set_main_loop(loop, 0, 1); #else | | < | 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | if (cbd[0].dev == 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Open device failed: %s\n", SDL_GetError()); } else { SDL_PauseAudioDevice(cbd[0].dev, 0); #ifdef __EMSCRIPTEN__ emscripten_set_main_loop(loop, 0, 1); #else while (!SDL_AtomicGet(&cbd[0].done)) { #ifdef __ANDROID__ /* Empty queue, some application events would prevent pause. */ while (SDL_PollEvent(&event)){} #endif SDL_Delay(100); } SDL_PauseAudioDevice(cbd[0].dev, 1); |
︙ | ︙ | |||
132 133 134 135 136 137 138 | SDL_PauseAudioDevice(cbd[i].dev, 0); } } while (keep_going) { keep_going = 0; for (i = 0; i < devcount; i++) { | | | 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | SDL_PauseAudioDevice(cbd[i].dev, 0); } } while (keep_going) { keep_going = 0; for (i = 0; i < devcount; i++) { if ((cbd[i].dev) && (!SDL_AtomicGet(&cbd[i].done))) { keep_going = 1; } } #ifdef __ANDROID__ /* Empty queue, some application events would prevent pause. */ while (SDL_PollEvent(&event)){} #endif |
︙ | ︙ |
Changes to jni/SDL2/test/torturethread.c.
︙ | ︙ | |||
17 18 19 20 21 22 23 | #include <signal.h> #include <string.h> #include "SDL.h" #define NUMTHREADS 10 | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | #include <signal.h> #include <string.h> #include "SDL.h" #define NUMTHREADS 10 static SDL_atomic_t time_for_threads_to_die[NUMTHREADS]; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void quit(int rc) { SDL_Quit(); exit(rc); |
︙ | ︙ | |||
54 55 56 57 58 59 60 | char name[64]; SDL_snprintf(name, sizeof (name), "Child%d_%d", tid, i); flags[i] = 0; sub_threads[i] = SDL_CreateThread(SubThreadFunc, name, &flags[i]); } SDL_Log("Thread '%d' waiting for signal\n", tid); | | | 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | char name[64]; SDL_snprintf(name, sizeof (name), "Child%d_%d", tid, i); flags[i] = 0; sub_threads[i] = SDL_CreateThread(SubThreadFunc, name, &flags[i]); } SDL_Log("Thread '%d' waiting for signal\n", tid); while (SDL_AtomicGet(&time_for_threads_to_die[tid]) != 1) { ; /* do nothing */ } SDL_Log("Thread '%d' sending signals to subthreads\n", tid); for (i = 0; i < NUMTHREADS; i++) { flags[i] = 1; SDL_WaitThread(sub_threads[i], NULL); |
︙ | ︙ | |||
88 89 90 91 92 93 94 | return (1); } signal(SIGSEGV, SIG_DFL); for (i = 0; i < NUMTHREADS; i++) { char name[64]; SDL_snprintf(name, sizeof (name), "Parent%d", i); | | | | 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | return (1); } signal(SIGSEGV, SIG_DFL); for (i = 0; i < NUMTHREADS; i++) { char name[64]; SDL_snprintf(name, sizeof (name), "Parent%d", i); SDL_AtomicSet(&time_for_threads_to_die[i], 0); threads[i] = SDL_CreateThread(ThreadFunc, name, (void*) (uintptr_t) i); if (threads[i] == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create thread: %s\n", SDL_GetError()); quit(1); } } for (i = 0; i < NUMTHREADS; i++) { SDL_AtomicSet(&time_for_threads_to_die[i], 1); } for (i = 0; i < NUMTHREADS; i++) { SDL_WaitThread(threads[i], NULL); } SDL_Quit(); return (0); } |