Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 610326
Collapse All | Expand All

(-)a/src/video/x11/SDL_x11events.c (-1 / +5 lines)
Lines 568-581 Link Here
568
        printf("Filtered event type = %d display = %d window = %d\n",
568
        printf("Filtered event type = %d display = %d window = %d\n",
569
               xevent.type, xevent.xany.display, xevent.xany.window);
569
               xevent.type, xevent.xany.display, xevent.xany.window);
570
#endif
570
#endif
571
        /* Make sure dead key press/release events are sent */
572
        /* But only if we're using one of the DBus IMEs, otherwise
573
           some XIM IMEs will generate duplicate events */
571
        if (orig_keycode) {
574
        if (orig_keycode) {
572
            /* Make sure dead key press/release events are sent */
575
#if defined(HAVE_IBUS_IBUS_H) || defined(HAVE_FCITX_FRONTEND_H)
573
            SDL_Scancode scancode = videodata->key_layout[orig_keycode];
576
            SDL_Scancode scancode = videodata->key_layout[orig_keycode];
574
            if (orig_event_type == KeyPress) {
577
            if (orig_event_type == KeyPress) {
575
                SDL_SendKeyboardKey(SDL_PRESSED, scancode);
578
                SDL_SendKeyboardKey(SDL_PRESSED, scancode);
576
            } else {
579
            } else {
577
                SDL_SendKeyboardKey(SDL_RELEASED, scancode);
580
                SDL_SendKeyboardKey(SDL_RELEASED, scancode);
578
            }
581
            }
582
#endif
579
        }
583
        }
580
        return;
584
        return;
581
    }
585
    }
(-)a/src/video/x11/SDL_x11keyboard.c (-7 / +74 lines)
Lines 33-38 Link Here
33
33
34
#include "imKStoUCS.h"
34
#include "imKStoUCS.h"
35
35
36
#ifdef X_HAVE_UTF8_STRING
37
#include <locale.h>
38
#endif
39
36
/* *INDENT-OFF* */
40
/* *INDENT-OFF* */
37
static const struct {
41
static const struct {
38
    KeySym keysym;
42
    KeySym keysym;
Lines 262-280 Link Here
262
    int best_distance;
266
    int best_distance;
263
    int best_index;
267
    int best_index;
264
    int distance;
268
    int distance;
265
269
    BOOL xkb_repeat = 0;
270
    
266
    X11_XAutoRepeatOn(data->display);
271
    X11_XAutoRepeatOn(data->display);
267
272
268
#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
273
#if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM
269
    {
274
    {
270
	    int xkb_major = XkbMajorVersion;
275
        int xkb_major = XkbMajorVersion;
271
	    int xkb_minor = XkbMinorVersion;
276
        int xkb_minor = XkbMinorVersion;
272
	    if (X11_XkbQueryExtension(data->display, NULL, NULL, NULL, &xkb_major, &xkb_minor)) {
277
273
	        data->xkb = X11_XkbGetMap(data->display, XkbAllClientInfoMask, XkbUseCoreKbd);
278
        if (X11_XkbQueryExtension(data->display, NULL, NULL, NULL, &xkb_major, &xkb_minor)) {
274
	    }
279
            data->xkb = X11_XkbGetMap(data->display, XkbAllClientInfoMask, XkbUseCoreKbd);
275
	}
280
        }
281
282
        /* This will remove KeyRelease events for held keys */
283
        X11_XkbSetDetectableAutoRepeat(data->display, True, &xkb_repeat);
284
    }
276
#endif
285
#endif
286
    
287
    /* Open a connection to the X input manager */
288
#ifdef X_HAVE_UTF8_STRING
289
    if (SDL_X11_HAVE_UTF8) {
290
        /* Set the locale, and call XSetLocaleModifiers before XOpenIM so that 
291
           Compose keys will work correctly. */
292
        char *prev_locale = setlocale(LC_ALL, NULL);
293
        char *prev_xmods  = X11_XSetLocaleModifiers(NULL);
294
        const char *new_xmods = "";
295
#if defined(HAVE_IBUS_IBUS_H) || defined(HAVE_FCITX_FRONTEND_H)
296
        const char *env_xmods = SDL_getenv("XMODIFIERS");
297
#endif
298
        SDL_bool has_dbus_ime_support = SDL_FALSE;
277
299
300
        if (prev_locale) {
301
            prev_locale = SDL_strdup(prev_locale);
302
        }
303
304
        if (prev_xmods) {
305
            prev_xmods = SDL_strdup(prev_xmods);
306
        }
307
308
        /* IBus resends some key events that were filtered by XFilterEvents
309
           when it is used via XIM which causes issues. Prevent this by forcing
310
           @im=none if XMODIFIERS contains @im=ibus. IBus can still be used via 
311
           the DBus implementation, which also has support for pre-editing. */
312
#ifdef HAVE_IBUS_IBUS_H
313
        if (env_xmods && SDL_strstr(env_xmods, "@im=ibus") != NULL) {
314
            has_dbus_ime_support = SDL_TRUE;
315
        }
316
#endif
317
#ifdef HAVE_FCITX_FRONTEND_H
318
        if (env_xmods && SDL_strstr(env_xmods, "@im=fcitx") != NULL) {
319
            has_dbus_ime_support = SDL_TRUE;
320
        }
321
#endif
322
        if (has_dbus_ime_support || !xkb_repeat) {
323
            new_xmods = "@im=none";
324
        }
325
326
        setlocale(LC_ALL, "");
327
        X11_XSetLocaleModifiers(new_xmods);
328
329
        data->im = X11_XOpenIM(data->display, NULL, data->classname, data->classname);
330
331
        /* Reset the locale + X locale modifiers back to how they were,
332
           locale first because the X locale modifiers depend on it. */
333
        setlocale(LC_ALL, prev_locale);
334
        X11_XSetLocaleModifiers(prev_xmods);
335
336
        if (prev_locale) {
337
            SDL_free(prev_locale);
338
        }
339
340
        if (prev_xmods) {
341
            SDL_free(prev_xmods);
342
        }
343
    }
344
#endif
278
    /* Try to determine which scancodes are being used based on fingerprint */
345
    /* Try to determine which scancodes are being used based on fingerprint */
279
    best_distance = SDL_arraysize(fingerprint) + 1;
346
    best_distance = SDL_arraysize(fingerprint) + 1;
280
    best_index = -1;
347
    best_index = -1;
(-)a/src/video/x11/SDL_x11sym.h (+1 lines)
Lines 179-184 Link Here
179
SDL_X11_SYM(Status,XkbGetUpdatedMap,(Display* a,unsigned int b,XkbDescPtr c),(a,b,c),return)
179
SDL_X11_SYM(Status,XkbGetUpdatedMap,(Display* a,unsigned int b,XkbDescPtr c),(a,b,c),return)
180
SDL_X11_SYM(XkbDescPtr,XkbGetMap,(Display* a,unsigned int b,unsigned int c),(a,b,c),return)
180
SDL_X11_SYM(XkbDescPtr,XkbGetMap,(Display* a,unsigned int b,unsigned int c),(a,b,c),return)
181
SDL_X11_SYM(void,XkbFreeClientMap,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),)
181
SDL_X11_SYM(void,XkbFreeClientMap,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),)
182
SDL_X11_SYM(BOOL,XkbSetDetectableAutoRepeat,(Display* a, BOOL b, BOOL* c),(a,b,c),return)
182
#endif
183
#endif
183
184
184
#if NeedWidePrototypes
185
#if NeedWidePrototypes
(-)a/src/video/x11/SDL_x11video.c (-63 lines)
Lines 39-48 Link Here
39
#include "SDL_x11opengles.h"
39
#include "SDL_x11opengles.h"
40
#endif
40
#endif
41
41
42
#ifdef X_HAVE_UTF8_STRING
43
#include <locale.h>
44
#endif
45
46
/* Initialization/Query functions */
42
/* Initialization/Query functions */
47
static int X11_VideoInit(_THIS);
43
static int X11_VideoInit(_THIS);
48
static void X11_VideoQuit(_THIS);
44
static void X11_VideoQuit(_THIS);
Lines 388-452 Link Here
388
    /* I have no idea how random this actually is, or has to be. */
384
    /* I have no idea how random this actually is, or has to be. */
389
    data->window_group = (XID) (((size_t) data->pid) ^ ((size_t) _this));
385
    data->window_group = (XID) (((size_t) data->pid) ^ ((size_t) _this));
390
386
391
    /* Open a connection to the X input manager */
392
#ifdef X_HAVE_UTF8_STRING
393
    if (SDL_X11_HAVE_UTF8) {
394
        /* Set the locale, and call XSetLocaleModifiers before XOpenIM so that 
395
           Compose keys will work correctly. */
396
        char *prev_locale = setlocale(LC_ALL, NULL);
397
        char *prev_xmods  = X11_XSetLocaleModifiers(NULL);
398
        const char *new_xmods = "";
399
#if defined(HAVE_IBUS_IBUS_H) || defined(HAVE_FCITX_FRONTEND_H)
400
        const char *env_xmods = SDL_getenv("XMODIFIERS");
401
#endif
402
        SDL_bool has_dbus_ime_support = SDL_FALSE;
403
404
        if (prev_locale) {
405
            prev_locale = SDL_strdup(prev_locale);
406
        }
407
408
        if (prev_xmods) {
409
            prev_xmods = SDL_strdup(prev_xmods);
410
        }
411
412
        /* IBus resends some key events that were filtered by XFilterEvents
413
           when it is used via XIM which causes issues. Prevent this by forcing
414
           @im=none if XMODIFIERS contains @im=ibus. IBus can still be used via 
415
           the DBus implementation, which also has support for pre-editing. */
416
#ifdef HAVE_IBUS_IBUS_H
417
        if (env_xmods && SDL_strstr(env_xmods, "@im=ibus") != NULL) {
418
            has_dbus_ime_support = SDL_TRUE;
419
        }
420
#endif
421
#ifdef HAVE_FCITX_FRONTEND_H
422
        if (env_xmods && SDL_strstr(env_xmods, "@im=fcitx") != NULL) {
423
            has_dbus_ime_support = SDL_TRUE;
424
        }
425
#endif
426
        if (has_dbus_ime_support) {
427
            new_xmods = "@im=none";
428
        }
429
430
        setlocale(LC_ALL, "");
431
        X11_XSetLocaleModifiers(new_xmods);
432
433
        data->im = X11_XOpenIM(data->display, NULL, data->classname, data->classname);
434
435
        /* Reset the locale + X locale modifiers back to how they were,
436
           locale first because the X locale modifiers depend on it. */
437
        setlocale(LC_ALL, prev_locale);
438
        X11_XSetLocaleModifiers(prev_xmods);
439
440
        if (prev_locale) {
441
            SDL_free(prev_locale);
442
        }
443
444
        if (prev_xmods) {
445
            SDL_free(prev_xmods);
446
        }
447
    }
448
#endif
449
450
    /* Look up some useful Atoms */
387
    /* Look up some useful Atoms */
451
#define GET_ATOM(X) data->X = X11_XInternAtom(data->display, #X, False)
388
#define GET_ATOM(X) data->X = X11_XInternAtom(data->display, #X, False)
452
    GET_ATOM(WM_PROTOCOLS);
389
    GET_ATOM(WM_PROTOCOLS);

Return to bug 610326