Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(143)

Unified Diff: chromeos/ime/ime_keyboard_x11.cc

Issue 689873004: Revert of Adds ozone support for ime keyboard. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chromeos/ime/ime_keyboard_x11.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromeos/ime/ime_keyboard_x11.cc
diff --git a/chromeos/ime/ime_keyboard_x11.cc b/chromeos/ime/ime_keyboard_x11.cc
index e230d3893576c23e895297455395b991622fba0f..775287c1237e41ada8176305b4117faa5611a95e 100644
--- a/chromeos/ime/ime_keyboard_x11.cc
+++ b/chromeos/ime/ime_keyboard_x11.cc
@@ -18,6 +18,54 @@
// A string for obtaining a mask value for Num Lock.
const char kNumLockVirtualModifierString[] = "NumLock";
+
+const char *kISOLevel5ShiftLayoutIds[] = {
+ "ca(multix)",
+ "de(neo)",
+};
+
+const char *kAltGrLayoutIds[] = {
+ "be",
+ "be",
+ "be",
+ "bg",
+ "bg(phonetic)",
+ "br",
+ "ca",
+ "ca(eng)",
+ "ca(multix)",
+ "ch",
+ "ch(fr)",
+ "cz",
+ "de",
+ "de(neo)",
+ "dk",
+ "ee",
+ "es",
+ "es(cat)",
+ "fi",
+ "fr",
+ "gb(dvorak)",
+ "gb(extd)",
+ "gr",
+ "hr",
+ "il",
+ "it",
+ "latam",
+ "lt",
+ "no",
+ "pl",
+ "pt",
+ "ro",
+ "se",
+ "si",
+ "sk",
+ "tr",
+ "ua",
+ "us(altgr-intl)",
+ "us(intl)",
+};
+
// Returns false if |layout_name| contains a bad character.
bool CheckLayoutName(const std::string& layout_name) {
@@ -37,8 +85,6 @@
return true;
}
-
-} // namespace
ImeKeyboardX11::ImeKeyboardX11()
: is_running_on_chrome_os_(base::SysInfo::IsRunningOnChromeOS()),
@@ -58,12 +104,20 @@
<< "NumLock is not assigned to Mod2Mask. : " << num_lock_mask_;
}
- caps_lock_is_enabled_ = CapsLockIsEnabled();
+ current_caps_lock_status_ = CapsLockIsEnabled();
// Disable Num Lock on X start up for http://crosbug.com/29169.
DisableNumLock();
}
ImeKeyboardX11::~ImeKeyboardX11() {};
+
+void ImeKeyboardX11::AddObserver(Observer* observer) {
+ observers_.AddObserver(observer);
+}
+
+void ImeKeyboardX11::RemoveObserver(Observer* observer) {
+ observers_.RemoveObserver(observer);
+}
unsigned int ImeKeyboardX11::GetNumLockMask() {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -108,7 +162,7 @@
affect_mask |= LockMask;
value_mask |= (caps_lock_enabled ? LockMask : 0);
- caps_lock_is_enabled_ = caps_lock_enabled;
+ current_caps_lock_status_ = caps_lock_enabled;
XkbLockModifiers(gfx::GetXDisplay(), XkbUseCoreKbd, affect_mask, value_mask);
}
@@ -124,7 +178,7 @@
if (!CheckLayoutName(layout_name))
return false;
- if (!force && (last_layout_ == layout_name)) {
+ if (!force && (current_layout_name_ == layout_name)) {
DVLOG(1) << "The requested layout is already set: " << layout_name;
return true;
}
@@ -211,6 +265,22 @@
return (status.locked_mods & LockMask);
}
+bool ImeKeyboardX11::IsISOLevel5ShiftAvailable() const {
+ for (size_t i = 0; i < arraysize(kISOLevel5ShiftLayoutIds); ++i) {
+ if (current_layout_name_ == kISOLevel5ShiftLayoutIds[i])
+ return true;
+ }
+ return false;
+}
+
+bool ImeKeyboardX11::IsAltGrAvailable() const {
+ for (size_t i = 0; i < arraysize(kAltGrLayoutIds); ++i) {
+ if (current_layout_name_ == kAltGrLayoutIds[i])
+ return true;
+ }
+ return false;
+}
+
bool ImeKeyboardX11::SetAutoRepeatEnabled(bool enabled) {
if (enabled)
XAutoRepeatOn(gfx::GetXDisplay());
@@ -234,7 +304,7 @@
}
void ImeKeyboardX11::SetCapsLockEnabled(bool enable_caps_lock) {
- bool old_state = caps_lock_is_enabled_;
+ bool old_state = current_caps_lock_status_;
SetLockedModifiers(enable_caps_lock);
if (old_state != enable_caps_lock) {
FOR_EACH_OBSERVER(ImeKeyboard::Observer, observers_,
@@ -245,26 +315,26 @@
bool ImeKeyboardX11::SetCurrentKeyboardLayoutByName(
const std::string& layout_name) {
if (SetLayoutInternal(layout_name, false)) {
- last_layout_ = layout_name;
+ current_layout_name_ = layout_name;
return true;
}
return false;
}
bool ImeKeyboardX11::ReapplyCurrentKeyboardLayout() {
- if (last_layout_.empty()) {
+ if (current_layout_name_.empty()) {
DVLOG(1) << "Can't reapply XKB layout: layout unknown";
return false;
}
- return SetLayoutInternal(last_layout_, true /* force */);
+ return SetLayoutInternal(current_layout_name_, true /* force */);
}
void ImeKeyboardX11::ReapplyCurrentModifierLockStatus() {
- SetLockedModifiers(caps_lock_is_enabled_);
+ SetLockedModifiers(current_caps_lock_status_);
}
void ImeKeyboardX11::DisableNumLock() {
- SetCapsLockEnabled(caps_lock_is_enabled_);
+ SetCapsLockEnabled(current_caps_lock_status_);
}
void ImeKeyboardX11::OnSetLayoutFinish() {
@@ -276,6 +346,8 @@
execute_queue_.pop();
MaybeExecuteSetLayoutCommand();
}
+
+} // namespace
// static
bool ImeKeyboard::GetAutoRepeatEnabledForTesting() {
« no previous file with comments | « chromeos/ime/ime_keyboard_x11.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698