mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 706336 - Use meta states from KeyListener; r=cpeterson
This commit is contained in:
parent
7c176ffc62
commit
47e557c907
@ -184,9 +184,9 @@ public class GeckoEvent {
|
||||
return new GeckoEvent(NOOP);
|
||||
}
|
||||
|
||||
public static GeckoEvent createKeyEvent(KeyEvent k) {
|
||||
public static GeckoEvent createKeyEvent(KeyEvent k, int metaState) {
|
||||
GeckoEvent event = new GeckoEvent(KEY_EVENT);
|
||||
event.initKeyEvent(k);
|
||||
event.initKeyEvent(k, metaState);
|
||||
return event;
|
||||
}
|
||||
|
||||
@ -198,10 +198,14 @@ public class GeckoEvent {
|
||||
return new GeckoEvent(COMPOSITOR_RESUME);
|
||||
}
|
||||
|
||||
private void initKeyEvent(KeyEvent k) {
|
||||
private void initKeyEvent(KeyEvent k, int metaState) {
|
||||
mAction = k.getAction();
|
||||
mTime = k.getEventTime();
|
||||
mMetaState = k.getMetaState();
|
||||
// Normally we expect k.getMetaState() to reflect the current meta-state; however,
|
||||
// some software-generated key events may not have k.getMetaState() set, e.g. key
|
||||
// events from Swype. Therefore, it's necessary to combine the key's meta-states
|
||||
// with the meta-states that we keep separately in KeyListener
|
||||
mMetaState = k.getMetaState() | metaState;
|
||||
mFlags = k.getFlags();
|
||||
mKeyCode = k.getKeyCode();
|
||||
mUnicodeChar = k.getUnicodeChar();
|
||||
|
@ -716,7 +716,7 @@ class GeckoInputConnection
|
||||
|
||||
View view = getView();
|
||||
if (view == null) {
|
||||
mEditableClient.sendEvent(GeckoEvent.createKeyEvent(event));
|
||||
mEditableClient.sendEvent(GeckoEvent.createKeyEvent(event, 0));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -731,7 +731,8 @@ class GeckoInputConnection
|
||||
if (skip ||
|
||||
(down && !keyListener.onKeyDown(view, uiEditable, keyCode, event)) ||
|
||||
(!down && !keyListener.onKeyUp(view, uiEditable, keyCode, event))) {
|
||||
mEditableClient.sendEvent(GeckoEvent.createKeyEvent(event));
|
||||
mEditableClient.sendEvent(
|
||||
GeckoEvent.createKeyEvent(event, TextKeyListener.getMetaState(uiEditable)));
|
||||
if (skip && down) {
|
||||
// Usually, the down key listener call above adjusts meta states for us.
|
||||
// However, if we skip that call above, we have to manually adjust meta
|
||||
|
Loading…
Reference in New Issue
Block a user