mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
feat: allow intercepting mouse events (#47364)
* feat: allow intercepting mouse events Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * test: add specs Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * Update spec/api-web-contents-spec.ts Co-authored-by: David Sanders <dsanders11@ucsbalum.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
@@ -1356,6 +1356,12 @@ bool WebContents::PlatformHandleKeyboardEvent(
|
||||
}
|
||||
#endif
|
||||
|
||||
bool WebContents::PreHandleMouseEvent(content::WebContents* source,
|
||||
const blink::WebMouseEvent& event) {
|
||||
// |true| means that the event should be prevented.
|
||||
return Emit("before-mouse-event", event);
|
||||
}
|
||||
|
||||
content::KeyboardEventProcessingResult WebContents::PreHandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const input::NativeWebKeyboardEvent& event) {
|
||||
|
||||
@@ -533,6 +533,8 @@ class WebContents final : public ExclusiveAccessContext,
|
||||
const input::NativeWebKeyboardEvent& event) override;
|
||||
bool PlatformHandleKeyboardEvent(content::WebContents* source,
|
||||
const input::NativeWebKeyboardEvent& event);
|
||||
bool PreHandleMouseEvent(content::WebContents* source,
|
||||
const blink::WebMouseEvent& event) override;
|
||||
content::KeyboardEventProcessingResult PreHandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const input::NativeWebKeyboardEvent& event) override;
|
||||
|
||||
Reference in New Issue
Block a user