view test/testnativex11.c @ 3415:1756b9569141

Adam Strzelecki to SDL Actually after my patch commited in r4928 MinGW configure seems to generate broken Makefile due MSYS bash bug. (Attaching cure/patch below) The problem is that: TEST=`echo 'one\\ two\\ three\\'` echo "$TEST" Should echo: one\ two\ three\ Does it on Linux, Mac.. all UNIX but not on MSYS (MinGW) which outputs: one\two\three\ (new lines removed, probably it doesn't like backslashes) Probably this bug should be submitted to MSYS team, but not waiting till MSYS gets it fixed (they have very slow release cycles) here goes simple cure... My patch simply replaces single quoted SED rules where we needed newlien injection with double quoted ones. Tested on Mac, Linux & MinGW. Please review it ASAP coz this may be showstopper for everybody compiling with MinGW.
author Sam Lantinga <slouken@libsdl.org>
date Wed, 28 Oct 2009 04:27:50 +0000
parents 089a77aebb7d
children
line wrap: on
line source


#include "testnative.h"

#ifdef TEST_NATIVE_X11

static void *CreateWindowX11(int w, int h);
static void DestroyWindowX11(void *window);

NativeWindowFactory X11WindowFactory = {
    "x11",
    CreateWindowX11,
    DestroyWindowX11
};

static Display *dpy;

static void *
CreateWindowX11(int w, int h)
{
    Window window = 0;

    dpy = XOpenDisplay(NULL);
    if (dpy) {
        window =
            XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), 0, 0, w, h, 0, 0,
                                0);
        XMapRaised(dpy, window);
        XSync(dpy, False);
    }
    return (void *) window;
}

static void
DestroyWindowX11(void *window)
{
    if (dpy) {
        XDestroyWindow(dpy, (Window) window);
        XCloseDisplay(dpy);
    }
}

#endif