mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-16 06:30:41 +00:00
Browser: Allow Ctrl+clicking on bookmark bar buttons :^)
This commit is contained in:
parent
977863ea07
commit
a87f5e4154
|
@ -123,9 +123,9 @@ void BookmarksBarWidget::did_update_model()
|
|||
button.set_preferred_size(font().width(title) + 32, 20);
|
||||
button.set_relative_rect(rect);
|
||||
|
||||
button.on_click = [title, url, this](auto) {
|
||||
button.on_click = [title, url, this](auto modifiers) {
|
||||
if (on_bookmark_click)
|
||||
on_bookmark_click(title, url);
|
||||
on_bookmark_click(title, url, modifiers);
|
||||
};
|
||||
|
||||
width += rect.width();
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
GUI::Model* model() { return m_model.ptr(); }
|
||||
const GUI::Model* model() const { return m_model.ptr(); }
|
||||
|
||||
Function<void(const String&, const String&)> on_bookmark_click;
|
||||
Function<void(const String&, const String&, unsigned modifiers)> on_bookmark_click;
|
||||
Function<void(const String&, const String&)> on_bookmark_hover;
|
||||
|
||||
bool contains_bookmark(const String& url);
|
||||
|
|
|
@ -332,8 +332,11 @@ void Tab::did_become_active()
|
|||
m_statusbar->set_text(String::format("Loading (%d pending resources...)", Web::ResourceLoader::the().pending_loads()));
|
||||
};
|
||||
|
||||
BookmarksBarWidget::the().on_bookmark_click = [this](auto&, auto& url) {
|
||||
m_html_widget->load(url);
|
||||
BookmarksBarWidget::the().on_bookmark_click = [this](auto&, auto& url, unsigned modifiers) {
|
||||
if (modifiers & Mod_Ctrl)
|
||||
on_tab_open_request(url);
|
||||
else
|
||||
m_html_widget->load(url);
|
||||
};
|
||||
|
||||
BookmarksBarWidget::the().on_bookmark_hover = [this](auto&, auto& url) {
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
void did_become_active();
|
||||
|
||||
Function<void(String)> on_title_change;
|
||||
Function<void(URL&)> on_tab_open_request;
|
||||
Function<void(const URL&)> on_tab_open_request;
|
||||
Function<void(Tab&)> on_tab_close_request;
|
||||
Function<void(const Gfx::Bitmap&)> on_favicon_change;
|
||||
|
||||
|
|
Loading…
Reference in a new issue