@@ -299,6 +299,14 @@ bool QKeyConverter::ConvertKeysToWebKeyEvents(const string16& client_keys,
299
299
if (i > 0 && key == keys[i - 1 ])
300
300
autoPress = true ;
301
301
302
+ bool sendRelease;
303
+ #if WD_ENABLE_ONE_KEYRELEASE
304
+ // Send only last key release
305
+ sendRelease = !autoRelease;
306
+ #else
307
+ // Send key release in all cases
308
+ sendRelease = true ;
309
+ #endif
302
310
// Create the key events.
303
311
bool necessary_modifiers[3 ];
304
312
for (int i = 0 ; i < 3 ; ++i) {
@@ -313,18 +321,25 @@ bool QKeyConverter::ConvertKeysToWebKeyEvents(const string16& client_keys,
313
321
314
322
if (unmodified_text.length () || modified_text.length ()) {
315
323
key_events.push_back (QKeyEvent (QEvent::KeyPress, key_code, all_modifiers, unmodified_text.c_str (), autoPress));
316
- key_events.push_back (QKeyEvent (QEvent::KeyRelease, key_code, all_modifiers, unmodified_text.c_str (), autoRelease));
324
+ if (sendRelease) {
325
+ key_events.push_back (QKeyEvent (QEvent::KeyRelease, key_code, all_modifiers, unmodified_text.c_str (), autoRelease));
326
+ }
317
327
}
318
328
else
319
329
{
320
330
key_events.push_back (QKeyEvent (QEvent::KeyPress, key_code, all_modifiers, QString::null, autoPress));
321
- key_events.push_back (QKeyEvent (QEvent::KeyRelease, key_code, all_modifiers, QString::null, autoRelease));
331
+ if (sendRelease) {
332
+ key_events.push_back (QKeyEvent (QEvent::KeyRelease, key_code, all_modifiers, QString::null, autoRelease));
333
+ }
322
334
}
323
335
324
- for (int i = 2 ; i > -1 ; --i) {
325
- if (necessary_modifiers[i]) {
326
- key_events.push_back (
327
- QKeyEvent (QEvent::KeyRelease, kModifiers [i].key_code , sticky_modifiers, QString::null, autoRelease));
336
+
337
+ if (sendRelease) {
338
+ for (int i = 2 ; i > -1 ; --i) {
339
+ if (necessary_modifiers[i]) {
340
+ key_events.push_back (
341
+ QKeyEvent (QEvent::KeyRelease, kModifiers [i].key_code , sticky_modifiers, QString::null, autoRelease));
342
+ }
328
343
}
329
344
}
330
345
}
0 commit comments