Bug 1158791 - Try harder to avoid Gtk-Critical errors in xpcshell tests. r=karlt

This commit is contained in:
Blake Kaplan 2015-05-04 10:12:43 -07:00
parent 51f4882b20
commit 0fa6a41d07
2 changed files with 8 additions and 1 deletions

View File

@ -42,6 +42,7 @@ STUB(gdk_get_program_class)
STUB(gdk_keymap_get_default)
STUB(gdk_keymap_get_direction)
STUB(gdk_keymap_get_entries_for_keyval)
STUB(gdk_keymap_get_for_display)
STUB(gdk_keymap_have_bidi_layouts)
STUB(gdk_keymap_translate_keyboard_state)
STUB(gdk_keyval_name)

View File

@ -22,7 +22,13 @@ nsBidiKeyboard::Reset()
{
// NB: The default keymap can be null (e.g. in xpcshell). In that case,
// simply assume that we don't have bidi keyboards.
GdkKeymap *keymap = gdk_keymap_get_default();
mHaveBidiKeyboards = false;
GdkDisplay *display = gdk_display_get_default();
if (!display)
return NS_OK;
GdkKeymap *keymap = gdk_keymap_get_for_display(display);
mHaveBidiKeyboards = keymap && gdk_keymap_have_bidi_layouts(keymap);
return NS_OK;
}