Makefile.ds
author Sam Lantinga <slouken@libsdl.org>
Thu, 17 Apr 2014 22:36:14 -0700
branchSDL-1.2
changeset 8716 0aade9c0203f
parent 3976 8582c6a5ca16
permissions -rw-r--r--
Fixed bug 2325 - SDL_EnableUNICODE sometimes drops keyboard events completely

Rafał Mużyło

The most annoying part of this bug is that though I've found it in two separate apps, I don't have a trivial testcase for it.

The problem seems to be a condition race, as it's triggered quite randomly (therefore it will be hard to tell whether it really gets fixed, if a probable fix is found).

While it's specific to SDL 1.2, it seems quite similar to the problem described and fixed in http://forums.libsdl.org/viewtopic.php?p=40503.

Now, I should start describing the problem.

A game uses Escape to open menu (the exact key might not be important). Upon opening, it calls SDL_EnableUNICODE(1). Upon closing it calls SDL_EnableUNICODE(0).

I have an IME running.

Game uses SDL_PollEvent to get the events.

If Escape is pressed repeatedly, menu is opened and closed, till it eventually freezes in open state.
"freezes" in this context means "app itself still runs, but no keyboard events are getting delivered (though - for example - mouse events still are)". "getting delivered" should mean "SDL_PollEvent is not receiving any".
If it matters, the last delivered keyboard event is a keypress, the release never arrives.

It seems (no guarantees, due to random nature of the freeze) that unsetting XMODIFIERS (which - AFAIU - will disable IME as far as SDL is concerned) prevents the freeze, therefore the reference to that SDL2 thread.
     1 #LibSDL 1.2.12
     2 #DS porting by Troy Davis(GPF)
     3 
     4 
     5 ifeq ($(strip $(DEVKITPRO)),)
     6 $(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro)
     7 endif
     8 ifeq ($(strip $(DEVKITARM)),)
     9 DEVKITARM := $(DEVKITPRO)/devkitARM
    10 endif
    11 
    12 
    13 SRCS = $(shell echo ./src/*.c ./src/audio/*.c ./src/cdrom/*.c ./src/cpuinfo/*.c ./src/events/*.c ./src/file/*.c ./src/stdlib/*.c ./src/thread/*.c ./src/timer/*.c ./src/video/*.c ./src/joystick/*.c ./src/joystick/nds/*.c ./src/cdrom/dummy/*.c ./src/thread/generic/*.c ./src/timer/nds/*.c ./src/loadso/dummy/*.c ./src/audio/dummy/*.c ./src/audio/nds/*.c ./src/video/dummy/*.c ./src/video/nds/*.c)
    14 
    15 OBJS = $(SRCS:.c=.o) 
    16 	
    17 
    18 SUBDIRS=
    19 
    20 CC=arm-eabi-gcc
    21 CXX=arm-eabi-g++ 
    22 LDSHARED=$(CXX)
    23 AR=arm-eabi-ar rc
    24 RANLIB=arm-eabi-ranlib 
    25 
    26 CFLAGS	=	-mthumb -mthumb-interwork \
    27 		-march=armv5te -mtune=arm946e-s \
    28 		-O2 -Wall -Wwrite-strings -Wpointer-arith \
    29 		-DARM9 -D__NDS__ -I$(DEVKITPRO)/libnds/include -Iinclude
    30 
    31 CXXFLAGS += $(CFLAGS)
    32 
    33 all: $(DEVKITPRO)/libnds/lib/libSDL.a       
    34 
    35 
    36 $(DEVKITPRO)/libnds/lib/libSDL.a:		$(OBJS)
    37 	$(AR) $@ $(OBJS)
    38 	-@ ($(RANLIB) $@ || true) >/dev/null 2>&1 	
    39 
    40 clean: 
    41 	find . -name "*.o" |xargs rm -f
    42 	find . -name "*.d" |xargs rm -f
    43 	-rm -f *.elf
    44 	-rm -f *.nds
    45 	-rm -f *.gba
    46 	-rm -f *.arm9
    47 	-rm -f *.map
    48 	-rm -f *.img
    49 	-rm -Rf *.d
    50 
    51 
    52 subdirs: $(patsubst %, _dir_%, $(SUBDIRS))
    53 
    54 $(patsubst %, _dir_%, $(SUBDIRS)):
    55 	$(MAKE) -C $(patsubst _dir_%, %, $@)
    56 
    57 clean_subdirs: $(patsubst %, _clean_dir_%, $(SUBDIRS))
    58 
    59 $(patsubst %, _clean_dir_%, $(SUBDIRS)):
    60 	$(MAKE) -C $(patsubst _clean_dir_%, %, $@) clean
    61 
    62 #include $(DEVKITARM)/ds_rules
    63