Commit 319c5cd
KeyBindingDispatcher: suppress duplicate command execution for same
native key event (Linux/GTK)
On GTK (Linux), a single physical key press can, in some situations, be
delivered to KeyBindingDispatcher twice for the very same native event:
once synchronously via an SWT.Traverse event dispatched from within the
native gtk3_key_press_event handling, and once more later via the async
message queue. Both deliveries resolve to and execute the exact same
bound command, which for page-traversal shortcuts like Ctrl+PageUp /
Ctrl+PageDown (Next/Previous Editor) causes an extra tab to be skipped,
since the CTabFolder selection is advanced twice per key press.
This does not reproduce on Windows or macOS, only on GTK.
Fix: track the last executed command together with the native timestamp
(Event#time) of its triggering event in executeCommand(...), and skip
(without re-executing the handler) a call that matches both the same
command and the same event timestamp, since that combination can only
happen when the very same native key event is redelivered. Genuinely
distinct key presses - including fast auto-repeat - always carry
different timestamps, so normal navigation and repeated shortcuts are
unaffected.
This is reported as the 'bonus' issue in
#4135 (Javadoc View tab cycling two
tabs per Ctrl+PageUp/PageDown on Linux).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent b95f727 commit 319c5cd
1 file changed
Lines changed: 54 additions & 0 deletions
File tree
- bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/keys
Lines changed: 54 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
267 | 267 | | |
268 | 268 | | |
269 | 269 | | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
270 | 285 | | |
271 | 286 | | |
272 | 287 | | |
| |||
292 | 307 | | |
293 | 308 | | |
294 | 309 | | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
295 | 318 | | |
296 | 319 | | |
297 | 320 | | |
| |||
324 | 347 | | |
325 | 348 | | |
326 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
327 | 381 | | |
328 | 382 | | |
329 | 383 | | |
| |||
0 commit comments