Comment 1 for bug 1658413

Revision history for this message
Emmanuel Boudreault (emmanuel-boudreault) wrote :

I have a potential fix but it has only received very light testing. First, we need to replace the sakura_tokeycode macro with a function:

static guint
sakura_tokeycode (guint key) {
    GdkKeymap *keymap = gdk_keymap_get_default();
    GdkKeymapKey *keys;
    gint n_keys;
    guint res = 0;

    if (gdk_keymap_get_entries_for_keyval(keymap, key,
                                          &keys, &n_keys)) {
        if (n_keys > 0) {
            res = keys[0].keycode;
        }
        g_free(keys);
    }

    return res;
}

We then have to remove the X11 includes:

#include <X11/Xlib.h>
#include <gdk/gdkx.h> -> #include <gdk/gdk.h>

We also have to remove the dpy member from the sakura structure.

Hope it helps