Bug 248144 - [GTK4] PlatformKeyboardEvent::currentStateOfModifierKeys is not implemented
Summary: [GTK4] PlatformKeyboardEvent::currentStateOfModifierKeys is not implemented
Status: RESOLVED DUPLICATE of bug 258965
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: WebKit Nightly Build
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: GTK4
  Show dependency treegraph
 
Reported: 2022-11-20 07:44 PST by Michael Catanzaro
Modified: 2023-07-11 10:18 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Catanzaro 2022-11-20 07:44:27 PST
PlatformKeyboardEvent::getCurrentModifierState (which is renamed to PlatformKeyboardEvent::currentStateOfModifierKeys in https://github.com/WebKit/WebKit/pull/6672) has hardcoded shift/ctrl/alt/meta all to 0. In GTK 3 the code did gtk_get_current_event_state(), but that's not possible in GTK 4. I also notice that PlatformKeyboardEvent::modifiersContainCapsLock hardcodes caps lock to 0.

At least shift and caps lock both actually work when typing in this Bugzilla.
Comment 1 Alice Mikhaylenko 2022-11-23 19:14:28 PST
The real question is why it does that instead of having modifiers as part of the event already. Like that code was never correct to begin with.
Comment 2 Michael Catanzaro 2023-01-30 07:23:33 PST
(In reply to Alexander Mikhaylenko from comment #1)
> The real question is why it does that instead of having modifiers as part of
> the event already. Like that code was never correct to begin with.

The name of the function, PlatformKeyboardEvent::currentStateOfModifierKeys, is kinda unambiguous, though. It's asking for the *current* state of the modifier keys, not the state of modifier keys corresponding to any particular event. And it is a static function, not a method that operates on a particular event.

Looks like it's used only by DragController.cpp and EventHandler.cpp (plus some platform-specific places that don't affect GTK). In DragController it's used to synthesize mouse events, which looks pretty reasonable. In EventHandler.cpp it's again used to synthesize mouse events in EventHandler::fakeMouseMoveEventTimerFired.

So this code looks decent enough. Only problem is we need to implement it. I wonder if that's even possible with GTK 4.
Comment 3 Michael Catanzaro 2023-07-11 10:18:06 PDT

*** This bug has been marked as a duplicate of bug 258965 ***