KeyboardLayoutEngine and XKB layout strings

21 views
Skip to first unread message

Michael Forney

unread,
Feb 25, 2016, 11:28:21 PM2/25/16
to ozon...@chromium.org
Hi,

I'd like to revive http://crrev.com/849563002 somehow.

Since XkbKeyboardLayoutEngine already has SetKeymapFromStringForTest, could we
just drop "ForTest"? Then, we could either

1. Have the platform static_cast
KeyboardLayoutEngineManager::GetKeyboardLayoutEngine() to
XkbKeyboardLayoutEngine* before setting the layout.

2. Make SetKeymapFromString a virtual method method in KeyboardLayoutEngine, and
stub it out for all other subclasses.

I'm not sure how safe 1 is (is anything else allowed to call
SetKeyboardLayoutEngine?), and I'm not sure how much sense 2 makes (I would only
expect the XKB engine to know how to deal with XKB layout strings).

At first I was confused about the point of KeyboardLayoutEngineManager and why
the platform didn't own the KeyboardLayoutEngine, but I guess that's to prevent
a circular dependency between ozone and events? It looks like there is just one
call to GetKeyboardLayoutEngine from KeyEvent, but removing that seems to be
blocked on http://crbug.com/444045.

--
Michael Forney <for...@google.com>

Michael Spang

unread,
Feb 25, 2016, 11:48:16 PM2/25/16
to Michael Forney, ozon...@chromium.org, Kevin Schoedel

Moving ownership to the platform sounds right to me. Could just change the argument of SetKeyboardLayoutEngine to an unowned pointer since ui::KeyEvent still uses it.

Should also fix whatever tests are relying on the default instantiation of StubKeyboardLayoutEngine. 

Michael
Reply all
Reply to author
Forward
0 new messages