It is better to use the explicit keymap getter - the default display may not even use the current gdk backend.