view test/testwm2.c @ 2825:620a91b6d263

Date: Tue, 02 Dec 2008 23:38:26 +0100 From: Couriersud Subject: Re: SDL: Keyboard layout unknown I have attached a diff which will add an additional keyboard layout to the x11 driver. The issue arose, when I moved to ubuntu intrepid. I was only able to map the keys available on my keyboard. The differences to the existing keyboard was the mapping of HOME,UP,DOWN and some other keys. Now only one issue remains. Dead keys (e.g. ^, ` ') on european keyboards do not generate a "scancode" event. Just a text event when the key is composed (e.g. ?? ?? ??).
author Sam Lantinga <slouken@libsdl.org>
date Wed, 03 Dec 2008 04:32:24 +0000
parents 8055185ae4ed
children 9de326b3099c
line wrap: on
line source


#include <stdlib.h>
#include <stdio.h>

#include "common.h"

static CommonState *state;

/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */
static void
quit(int rc)
{
    CommonQuit(state);
    exit(rc);
}

int
main(int argc, char *argv[])
{
    int i, done;
    SDL_Event event;

    /* Initialize test framework */
    state = CommonCreateState(argv, SDL_INIT_VIDEO);
    if (!state) {
        return 1;
    }
    state->skip_renderer = SDL_TRUE;
    for (i = 1; i < argc;) {
        int consumed;

        consumed = CommonArg(state, i);
        if (consumed == 0) {
            consumed = -1;
        }
        if (consumed < 0) {
            fprintf(stderr, "Usage: %s %s\n", argv[0], CommonUsage(state));
            quit(1);
        }
        i += consumed;
    }
    if (!CommonInit(state)) {
        quit(2);
    }

    /* Main render loop */
    done = 0;
    while (!done) {
        /* Check for events */
        while (SDL_PollEvent(&event)) {
            CommonEvent(state, &event, &done);
        }
    }
    quit(0);
}

/* vi: set ts=4 sw=4 expandtab: */