mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:38:10 +00:00
LibWebView+WebContent: Propagate unconsumed input events out of OOPWV
Since 9e2bd9d261a8c0c1b5eeafde95ca310efc667204, the OOPWV has been consuming all mouse and keyboard events, preventing action shortcuts from working. So let's fix that. :^) OOPWV now queues up input events, sending them one at a time to the WebContent process and waiting for the new `did_finish_handling_input_event(bool event_was_accepted) =|` IPC call before sending the next one. If the event was not accepted, OOPWV imitates the usual event bubbling: first passing the event to its superclass, then to its parent widget, and finally propagating to any Action shortcuts. With this, shortcuts like Ctrl+I to open Browser's JS console work again, except when a contenteditable field is selected. That's a whole separate stack of yaks. Co-authored-by: Zaggy1024 <zaggy1024@gmail.com>
This commit is contained in:
parent
2654bfead4
commit
d94d60219c
8 changed files with 168 additions and 14 deletions
|
@ -1,11 +1,13 @@
|
|||
/*
|
||||
* Copyright (c) 2020-2022, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Queue.h>
|
||||
#include <AK/URL.h>
|
||||
#include <LibGUI/AbstractScrollableWidget.h>
|
||||
#include <LibGUI/Widget.h>
|
||||
|
@ -182,6 +184,7 @@ private:
|
|||
virtual Gfx::IntRect notify_server_did_request_minimize_window() override;
|
||||
virtual Gfx::IntRect notify_server_did_request_fullscreen_window() override;
|
||||
virtual void notify_server_did_request_file(Badge<WebContentClient>, String const& path, i32) override;
|
||||
virtual void notify_server_did_finish_handling_input_event(bool event_was_accepted) override;
|
||||
|
||||
void request_repaint();
|
||||
void handle_resize();
|
||||
|
@ -191,6 +194,10 @@ private:
|
|||
|
||||
void handle_web_content_process_crash();
|
||||
|
||||
using InputEvent = Variant<GUI::KeyEvent, GUI::MouseEvent>;
|
||||
void enqueue_input_event(InputEvent const&);
|
||||
void process_next_input_event();
|
||||
|
||||
AK::URL m_url;
|
||||
|
||||
struct SharedBitmap {
|
||||
|
@ -210,6 +217,9 @@ private:
|
|||
|
||||
RefPtr<Gfx::Bitmap> m_backup_bitmap;
|
||||
RefPtr<GUI::Dialog> m_dialog;
|
||||
|
||||
bool m_is_awaiting_response_for_input_event { false };
|
||||
Queue<InputEvent> m_pending_input_events;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue