mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 842013 - Suppress key up events during key down event; r=cpeterson
This commit is contained in:
parent
91d7b77155
commit
bf42ff4640
@ -39,6 +39,7 @@ interface GeckoEditableClient {
|
||||
void sendEvent(GeckoEvent event);
|
||||
Editable getEditable();
|
||||
void setUpdateGecko(boolean update);
|
||||
void setSuppressKeyUp(boolean suppress);
|
||||
Handler getInputConnectionHandler();
|
||||
boolean setInputConnectionHandler(Handler handler);
|
||||
}
|
||||
@ -98,6 +99,7 @@ final class GeckoEditable
|
||||
private int mLastIcUpdateSeqno;
|
||||
private boolean mUpdateGecko;
|
||||
private boolean mFocused;
|
||||
private volatile boolean mSuppressKeyUp;
|
||||
|
||||
/* An action that alters the Editable
|
||||
|
||||
@ -276,6 +278,9 @@ final class GeckoEditable
|
||||
if (KeyEvent.isModifierKey(event.getKeyCode())) {
|
||||
continue;
|
||||
}
|
||||
if (event.getAction() == KeyEvent.ACTION_UP && mSuppressKeyUp) {
|
||||
continue;
|
||||
}
|
||||
if (DEBUG) {
|
||||
Log.d(LOGTAG, "sending: " + event);
|
||||
}
|
||||
@ -584,10 +589,20 @@ final class GeckoEditable
|
||||
}
|
||||
|
||||
@Override
|
||||
public Handler getInputConnectionHandler() {
|
||||
public void setSuppressKeyUp(boolean suppress) {
|
||||
if (DEBUG) {
|
||||
assertOnIcThread();
|
||||
// only used by key event handler
|
||||
ThreadUtils.assertOnUiThread();
|
||||
}
|
||||
// Suppress key up event generated as a result of
|
||||
// translating characters to key events
|
||||
mSuppressKeyUp = suppress;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Handler getInputConnectionHandler() {
|
||||
// Can be called from either UI thread or IC thread;
|
||||
// care must be taken to avoid race conditions
|
||||
return mIcRunHandler;
|
||||
}
|
||||
|
||||
|
@ -727,7 +727,9 @@ class GeckoInputConnection
|
||||
Handler icHandler = mEditableClient.getInputConnectionHandler();
|
||||
Editable uiEditable = mThreadUtils.getEditableForUiThread(uiHandler, icHandler);
|
||||
boolean skip = shouldSkipKeyListener(keyCode, event);
|
||||
|
||||
if (down) {
|
||||
mEditableClient.setSuppressKeyUp(true);
|
||||
}
|
||||
if (skip ||
|
||||
(down && !keyListener.onKeyDown(view, uiEditable, keyCode, event)) ||
|
||||
(!down && !keyListener.onKeyUp(view, uiEditable, keyCode, event))) {
|
||||
@ -740,6 +742,9 @@ class GeckoInputConnection
|
||||
TextKeyListener.adjustMetaAfterKeypress(uiEditable);
|
||||
}
|
||||
}
|
||||
if (down) {
|
||||
mEditableClient.setSuppressKeyUp(false);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user