Makefile.dc
author Sam Lantinga <slouken@libsdl.org>
Thu, 17 Apr 2014 22:36:14 -0700
branchSDL-1.2
changeset 8716 0aade9c0203f
parent 1868 c8f42ed8805e
child 1895 c121d94672cb
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 #GL=1
     2 
     3 CC = sh-elf-gcc
     4 AR = sh-elf-ar
     5 
     6 ifdef GL
     7 DEFS += -DSDL_VIDEO_OPENGL=1
     8 TARGET = libSDL_gl.a
     9 else
    10 TARGET = libSDL.a
    11 endif
    12 
    13 CFLAGS=$(KOS_CFLAGS) $(DEFS) -Iinclude
    14 
    15 SRCS = \
    16 	src/audio/dc/SDL_dcaudio.c \
    17 	src/audio/dc/aica.c \
    18 	src/audio/dummy/SDL_dummyaudio.c \
    19 	src/audio/SDL_audio.c \
    20 	src/audio/SDL_audiocvt.c \
    21 	src/audio/SDL_audiodev.c \
    22 	src/audio/SDL_mixer.c \
    23 	src/audio/SDL_wave.c \
    24 	src/cdrom/dc/SDL_syscdrom.c \
    25 	src/cdrom/SDL_cdrom.c \
    26 	src/events/SDL_active.c \
    27 	src/events/SDL_events.c \
    28 	src/events/SDL_expose.c \
    29 	src/events/SDL_keyboard.c \
    30 	src/events/SDL_mouse.c \
    31 	src/events/SDL_quit.c \
    32 	src/events/SDL_resize.c \
    33 	src/file/SDL_rwops.c \
    34 	src/joystick/dc/SDL_sysjoystick.c \
    35 	src/joystick/SDL_joystick.c \
    36 	src/loadso/dummy/SDL_sysloadso.c \
    37 	src/SDL.c \
    38 	src/SDL_error.c \
    39 	src/SDL_fatal.c \
    40 	src/stdlib/SDL_getenv.c \
    41 	src/stdlib/SDL_iconv.c \
    42 	src/stdlib/SDL_malloc.c \
    43 	src/stdlib/SDL_qsort.c \
    44 	src/stdlib/SDL_stdlib.c \
    45 	src/stdlib/SDL_string.c \
    46 	src/thread/dc/SDL_syscond.c \
    47 	src/thread/dc/SDL_sysmutex.c \
    48 	src/thread/dc/SDL_syssem.c \
    49 	src/thread/dc/SDL_systhread.c \
    50 	src/thread/SDL_thread.c \
    51 	src/timer/dc/SDL_systimer.c \
    52 	src/timer/SDL_timer.c \
    53 	src/video/dc/SDL_dcevents.c \
    54 	src/video/dc/SDL_dcvideo.c \
    55 	src/video/dummy/SDL_nullevents.c \
    56 	src/video/dummy/SDL_nullmouse.c \
    57 	src/video/dummy/SDL_nullvideo.c \
    58 	src/video/SDL_blit.c \
    59 	src/video/SDL_blit_0.c \
    60 	src/video/SDL_blit_1.c \
    61 	src/video/SDL_blit_A.c \
    62 	src/video/SDL_blit_N.c \
    63 	src/video/SDL_bmp.c \
    64 	src/video/SDL_cursor.c \
    65 	src/video/SDL_gamma.c \
    66 	src/video/SDL_pixels.c \
    67 	src/video/SDL_RLEaccel.c \
    68 	src/video/SDL_stretch.c \
    69 	src/video/SDL_surface.c \
    70 	src/video/SDL_video.c \
    71 	src/video/SDL_yuv.c \
    72 	src/video/SDL_yuv_sw.c \
    73 
    74 OBJS = $(SRCS:.c=.o)
    75 
    76 TEST = \
    77 	test/checkkeys.c \
    78 	test/graywin.c \
    79 	test/loopwave.c \
    80 	test/testalpha.c \
    81 	test/testbitmap.c \
    82 	test/testcdrom.c \
    83 	test/testerror.c \
    84 	test/testgamma.c \
    85 	test/testgl.c \
    86 	test/testhread.c \
    87 	test/testjoystick.c \
    88 	test/testkeys.c \
    89 	test/testlock.c \
    90 	test/testoverlay.c \
    91 	test/testpalette.c \
    92 	test/testsem.c \
    93 	test/testsprite.c \
    94 	test/testtimer.c \
    95 	test/testtypes.c \
    96 	test/testver.c \
    97 	test/testvidinfo.c \
    98 	test/testwin.c \
    99 	test/testwm.c \
   100 	test/threadwin.c \
   101 	test/torturethread.c \
   102 
   103 $(TARGET): copy_config \
   104 	$(OBJS)
   105 	$(AR) rcs $(TARGET) $(OBJS) 
   106 
   107 copy_config:
   108 	@cp include/SDL_config.h.default include/SDL_config.h
   109 
   110 clean:
   111 	rm -f include/SDL_config.h $(OBJS)