mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 20:15:17 +00:00
Browser: Go back/forward when pressing back/forward mouse buttons
This currently doesn't work when running Serenity through QEMU, as it doesn't pass the side button events over to Serenity due to some bug or missing feature.
This commit is contained in:
parent
2f3ebce7c8
commit
af1c26f05b
Notes:
sideshowbarker
2024-07-17 03:22:29 +09:00
Author: https://github.com/Baitinq Commit: https://github.com/SerenityOS/serenity/commit/af1c26f05b Pull-request: https://github.com/SerenityOS/serenity/pull/16069 Reviewed-by: https://github.com/linusg
3 changed files with 18 additions and 0 deletions
|
@ -445,6 +445,16 @@ Tab::Tab(BrowserWindow& window)
|
|||
load(url);
|
||||
};
|
||||
|
||||
view().on_back_button = [this] {
|
||||
if (m_history.can_go_back())
|
||||
go_back();
|
||||
};
|
||||
|
||||
view().on_forward_button = [this] {
|
||||
if (m_history.can_go_forward())
|
||||
go_forward();
|
||||
};
|
||||
|
||||
m_tab_context_menu = GUI::Menu::construct();
|
||||
m_tab_context_menu->add_action(GUI::CommonActions::make_reload_action([this](auto&) {
|
||||
reload();
|
||||
|
|
|
@ -174,6 +174,12 @@ void OutOfProcessWebView::mousedown_event(GUI::MouseEvent& event)
|
|||
void OutOfProcessWebView::mouseup_event(GUI::MouseEvent& event)
|
||||
{
|
||||
enqueue_input_event(event);
|
||||
|
||||
if (event.button() == GUI::MouseButton::Backward && on_back_button) {
|
||||
on_back_button();
|
||||
} else if (event.button() == GUI::MouseButton::Forward && on_forward_button) {
|
||||
on_forward_button();
|
||||
}
|
||||
}
|
||||
|
||||
void OutOfProcessWebView::mousemove_event(GUI::MouseEvent& event)
|
||||
|
|
|
@ -111,6 +111,8 @@ public:
|
|||
Function<Gfx::IntRect()> on_maximize_window;
|
||||
Function<Gfx::IntRect()> on_minimize_window;
|
||||
Function<Gfx::IntRect()> on_fullscreen_window;
|
||||
Function<void()> on_back_button;
|
||||
Function<void()> on_forward_button;
|
||||
|
||||
private:
|
||||
OutOfProcessWebView();
|
||||
|
|
Loading…
Add table
Reference in a new issue