test/testnativex11.c
author Sam Lantinga <slouken@libsdl.org>
Sat, 27 Jan 2018 12:05:26 -0800
changeset 11836 a42b155124a3
parent 11811 5d94cb6b24d3
child 12503 806492103856
permissions -rw-r--r--
Fixed bug 4065 - SDL_wave.c fail to compile in armeabi with ndk r16b

Sylvain

armeabi is almost deprecated for android-ndk higher that r13b.
either it doesn't compile (ICE), or it executes wrongly (using long long for instance).

android people advices to use armeabi-v7a (or use r13b).
slouken@5535
     1
/*
slouken@11811
     2
  Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
slouken@5535
     3
slouken@5535
     4
  This software is provided 'as-is', without any express or implied
slouken@5535
     5
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     6
  arising from the use of this software.
slouken@5535
     7
slouken@5535
     8
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
     9
  including commercial applications, and to alter it and redistribute it
slouken@5535
    10
  freely.
slouken@5535
    11
*/
slouken@3057
    12
slouken@3057
    13
#include "testnative.h"
slouken@3057
    14
slouken@3057
    15
#ifdef TEST_NATIVE_X11
slouken@3057
    16
slouken@3057
    17
static void *CreateWindowX11(int w, int h);
slouken@3057
    18
static void DestroyWindowX11(void *window);
slouken@3057
    19
slouken@3057
    20
NativeWindowFactory X11WindowFactory = {
slouken@3057
    21
    "x11",
slouken@3057
    22
    CreateWindowX11,
slouken@3057
    23
    DestroyWindowX11
slouken@3057
    24
};
slouken@3057
    25
slouken@3057
    26
static Display *dpy;
slouken@3057
    27
slouken@3057
    28
static void *
slouken@3057
    29
CreateWindowX11(int w, int h)
slouken@3057
    30
{
slouken@3057
    31
    Window window = 0;
slouken@3057
    32
slouken@3057
    33
    dpy = XOpenDisplay(NULL);
slouken@3057
    34
    if (dpy) {
slouken@3057
    35
        window =
slouken@3057
    36
            XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, w, h, 0, 0,
slouken@3057
    37
                                0);
slouken@3057
    38
        XMapRaised(dpy, window);
slouken@3057
    39
        XSync(dpy, False);
slouken@3057
    40
    }
slouken@3057
    41
    return (void *) window;
slouken@3057
    42
}
slouken@3057
    43
slouken@3057
    44
static void
slouken@3057
    45
DestroyWindowX11(void *window)
slouken@3057
    46
{
slouken@3057
    47
    if (dpy) {
slouken@3057
    48
        XDestroyWindow(dpy, (Window) window);
slouken@3057
    49
        XCloseDisplay(dpy);
slouken@3057
    50
    }
slouken@3057
    51
}
slouken@3057
    52
slouken@3057
    53
#endif