roundabout,
created on Saturday, 21 June 2025, 11:09:02 (1750504142),
received on Saturday, 21 June 2025, 11:09:05 (1750504145)
Author identity: vlad <vlad.muntoiu@gmail.com>
b53d0044b63db17a96b83def45fdad90da4b34dd
panthera-www.cc
@@ -342,12 +342,22 @@ protected:
}
static gboolean on_decide_policy(WebKitWebView *source, WebKitPolicyDecision *decision, WebKitPolicyDecisionType type, gpointer user_data) {
// Middle-click opens in a new window
if(auto self = static_cast<PantheraWww*>(user_data)) {
if(type == WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION) {
auto action = webkit_navigation_policy_decision_get_navigation_action(WEBKIT_NAVIGATION_POLICY_DECISION(decision));
Glib::ustring url = Glib::ustring(webkit_uri_request_get_uri(webkit_navigation_action_get_request(action)));
if(url.find("://") == Glib::ustring::npos) {
// It is a special scheme (mailto:, tel: etc.)
try {
Gio::AppInfo::launch_default_for_uri(url);
} catch(const Glib::Error &exception) {
std::cerr << "Failed to launch special URI: " << exception.what() << std::endl;
}
webkit_policy_decision_ignore(decision);
return true;
}
if(webkit_navigation_action_get_mouse_button(action) == 2) {
Glib::ustring url = Glib::ustring(webkit_uri_request_get_uri(webkit_navigation_action_get_request(action)));
// Middle-click opens in a new window
self->on_new_tab(nullptr, url, false);
webkit_policy_decision_ignore(decision);
return true;
@@ -446,8 +456,8 @@ protected:
dock_stack_2->set_expand(true);
auto outer_grid = Gtk::make_managed<Gtk::Grid>();
outer_grid->attach(*switcher_2, 0, 1, 1, 1);
outer_grid->attach(*switcher_1, 1, 2, 1, 1);
outer_grid->attach(*switcher_2, 0, 2, 1, 1);
outer_grid->attach(*switcher_1, 1, 3, 1, 1);
auto outer_paned = Gtk::make_managed<Gtk::Paned>(Gtk::Orientation::HORIZONTAL);
outer_paned->set_start_child(*dock_stack_2);
auto inner_paned = Gtk::make_managed<Gtk::Paned>(Gtk::Orientation::VERTICAL);
@@ -487,7 +497,7 @@ protected:
inner_paned->set_start_child(*content);
inner_paned->set_end_child(*dock_stack_1);
outer_paned->set_end_child(*inner_paned);
outer_grid->attach(*outer_paned, 1, 1, 1, 1);
outer_grid->attach(*outer_paned, 1, 2, 1, 1);
// Get search engines
std::ifstream search_engines_file_in("search_engines.json");
@@ -621,7 +631,7 @@ protected:
search_button->signal_clicked().connect(search_callback);
main_toolbar->append(*search_button);
}
outer_grid->attach(*main_toolbar, 0, 0, 2, 1);
outer_grid->attach(*main_toolbar, 0, 1, 2, 1);
window->set_child(*outer_grid);
debug_button->signal_clicked().connect([this]() {
if(content_manager->get_last_operated_page()) {
@@ -708,6 +718,9 @@ protected:
plugin_file_out << empty_json.dump(4);
plugin_file_out.close();
}
auto menu_bar = Gtk::make_managed<Gtk::PopoverMenuBar>();
outer_grid->attach(*menu_bar, 0, 0, 2, 1);
}
void on_activate() override {