зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 64c6e5121479 (bug 1033483) for unexpected "Recursive GetService!" assertions
CLOSED TREE
This commit is contained in:
Родитель
a416002aa7
Коммит
155ef02c4f
|
@ -8,7 +8,6 @@
|
||||||
#include "prlink.h"
|
#include "prlink.h"
|
||||||
|
|
||||||
#include "nsBidiKeyboard.h"
|
#include "nsBidiKeyboard.h"
|
||||||
#include "WidgetUtils.h"
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS(nsBidiKeyboard, nsIBidiKeyboard)
|
NS_IMPL_ISUPPORTS(nsBidiKeyboard, nsIBidiKeyboard)
|
||||||
|
@ -31,7 +30,6 @@ nsBidiKeyboard::Reset()
|
||||||
|
|
||||||
GdkKeymap *keymap = gdk_keymap_get_for_display(display);
|
GdkKeymap *keymap = gdk_keymap_get_for_display(display);
|
||||||
mHaveBidiKeyboards = keymap && gdk_keymap_have_bidi_layouts(keymap);
|
mHaveBidiKeyboards = keymap && gdk_keymap_have_bidi_layouts(keymap);
|
||||||
mozilla::widget::WidgetUtils::SendBidiKeyboardInfoToContent();
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
#include <X11/XKBlib.h>
|
#include <X11/XKBlib.h>
|
||||||
#include "WidgetUtils.h"
|
#include "WidgetUtils.h"
|
||||||
#include "keysym2ucs.h"
|
#include "keysym2ucs.h"
|
||||||
#include "nsContentUtils.h"
|
|
||||||
#include "nsGtkUtils.h"
|
#include "nsGtkUtils.h"
|
||||||
#include "nsIBidiKeyboard.h"
|
#include "nsIBidiKeyboard.h"
|
||||||
#include "nsServiceManagerUtils.h"
|
#include "nsServiceManagerUtils.h"
|
||||||
|
@ -42,6 +41,7 @@ KeymapWrapper* KeymapWrapper::sInstance = nullptr;
|
||||||
guint KeymapWrapper::sLastRepeatableHardwareKeyCode = 0;
|
guint KeymapWrapper::sLastRepeatableHardwareKeyCode = 0;
|
||||||
KeymapWrapper::RepeatState KeymapWrapper::sRepeatState =
|
KeymapWrapper::RepeatState KeymapWrapper::sRepeatState =
|
||||||
KeymapWrapper::NOT_PRESSED;
|
KeymapWrapper::NOT_PRESSED;
|
||||||
|
nsIBidiKeyboard* sBidiKeyboard = nullptr;
|
||||||
|
|
||||||
static const char* GetBoolName(bool aBool)
|
static const char* GetBoolName(bool aBool)
|
||||||
{
|
{
|
||||||
|
@ -170,8 +170,6 @@ KeymapWrapper::KeymapWrapper() :
|
||||||
g_object_ref(mGdkKeymap);
|
g_object_ref(mGdkKeymap);
|
||||||
g_signal_connect(mGdkKeymap, "keys-changed",
|
g_signal_connect(mGdkKeymap, "keys-changed",
|
||||||
(GCallback)OnKeysChanged, this);
|
(GCallback)OnKeysChanged, this);
|
||||||
g_signal_connect(mGdkKeymap, "direction-changed",
|
|
||||||
(GCallback)OnDirectionChanged, this);
|
|
||||||
|
|
||||||
if (GDK_IS_X11_DISPLAY(gdk_display_get_default()))
|
if (GDK_IS_X11_DISPLAY(gdk_display_get_default()))
|
||||||
InitXKBExtension();
|
InitXKBExtension();
|
||||||
|
@ -444,9 +442,8 @@ KeymapWrapper::~KeymapWrapper()
|
||||||
gdk_window_remove_filter(nullptr, FilterEvents, this);
|
gdk_window_remove_filter(nullptr, FilterEvents, this);
|
||||||
g_signal_handlers_disconnect_by_func(mGdkKeymap,
|
g_signal_handlers_disconnect_by_func(mGdkKeymap,
|
||||||
FuncToGpointer(OnKeysChanged), this);
|
FuncToGpointer(OnKeysChanged), this);
|
||||||
g_signal_handlers_disconnect_by_func(mGdkKeymap,
|
|
||||||
FuncToGpointer(OnDirectionChanged), this);
|
|
||||||
g_object_unref(mGdkKeymap);
|
g_object_unref(mGdkKeymap);
|
||||||
|
NS_IF_RELEASE(sBidiKeyboard);
|
||||||
MOZ_LOG(gKeymapWrapperLog, LogLevel::Info,
|
MOZ_LOG(gKeymapWrapperLog, LogLevel::Info,
|
||||||
("%p Destructor", this));
|
("%p Destructor", this));
|
||||||
}
|
}
|
||||||
|
@ -522,16 +519,6 @@ KeymapWrapper::FilterEvents(GdkXEvent* aXEvent,
|
||||||
return GDK_FILTER_CONTINUE;
|
return GDK_FILTER_CONTINUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
ResetBidiKeyboard()
|
|
||||||
{
|
|
||||||
// Reset the bidi keyboard settings for the new GdkKeymap
|
|
||||||
nsCOMPtr<nsIBidiKeyboard> bidiKeyboard = nsContentUtils::GetBidiKeyboard();
|
|
||||||
if (bidiKeyboard) {
|
|
||||||
bidiKeyboard->Reset();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* static */ void
|
/* static */ void
|
||||||
KeymapWrapper::OnKeysChanged(GdkKeymap *aGdkKeymap,
|
KeymapWrapper::OnKeysChanged(GdkKeymap *aGdkKeymap,
|
||||||
KeymapWrapper* aKeymapWrapper)
|
KeymapWrapper* aKeymapWrapper)
|
||||||
|
@ -546,27 +533,14 @@ KeymapWrapper::OnKeysChanged(GdkKeymap *aGdkKeymap,
|
||||||
// We cannot reintialize here becasue we don't have GdkWindow which is using
|
// We cannot reintialize here becasue we don't have GdkWindow which is using
|
||||||
// the GdkKeymap. We'll reinitialize it when next GetInstance() is called.
|
// the GdkKeymap. We'll reinitialize it when next GetInstance() is called.
|
||||||
sInstance->mInitialized = false;
|
sInstance->mInitialized = false;
|
||||||
ResetBidiKeyboard();
|
|
||||||
}
|
|
||||||
|
|
||||||
// static
|
// Reset the bidi keyboard settings for the new GdkKeymap
|
||||||
void
|
if (!sBidiKeyboard) {
|
||||||
KeymapWrapper::OnDirectionChanged(GdkKeymap *aGdkKeymap,
|
CallGetService("@mozilla.org/widget/bidikeyboard;1", &sBidiKeyboard);
|
||||||
KeymapWrapper* aKeymapWrapper)
|
}
|
||||||
{
|
if (sBidiKeyboard) {
|
||||||
// XXX
|
sBidiKeyboard->Reset();
|
||||||
// A lot of diretion-changed signal might be fired on switching bidi
|
}
|
||||||
// keyboard when using both ibus (with arabic layout) and fcitx (with IME).
|
|
||||||
// See https://github.com/fcitx/fcitx/issues/257
|
|
||||||
//
|
|
||||||
// Also, when using ibus, switching to IM might not cause this signal.
|
|
||||||
// See https://github.com/ibus/ibus/issues/1848
|
|
||||||
|
|
||||||
MOZ_LOG(gKeymapWrapperLog, LogLevel::Info,
|
|
||||||
("OnDirectionChanged, aGdkKeymap=%p, aKeymapWrapper=%p",
|
|
||||||
aGdkKeymap, aKeymapWrapper));
|
|
||||||
|
|
||||||
ResetBidiKeyboard();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* static */ guint
|
/* static */ guint
|
||||||
|
|
|
@ -257,8 +257,6 @@ protected:
|
||||||
* Signal handlers.
|
* Signal handlers.
|
||||||
*/
|
*/
|
||||||
static void OnKeysChanged(GdkKeymap* aKeymap, KeymapWrapper* aKeymapWrapper);
|
static void OnKeysChanged(GdkKeymap* aKeymap, KeymapWrapper* aKeymapWrapper);
|
||||||
static void OnDirectionChanged(GdkKeymap *aGdkKeymap,
|
|
||||||
KeymapWrapper* aKeymapWrapper);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GetCharCodeFor() Computes what character is inputted by the key event
|
* GetCharCodeFor() Computes what character is inputted by the key event
|
||||||
|
|
Загрузка…
Ссылка в новой задаче