From abeb3aab5a0f41c29c5d1e8ba7aeef39a21f7072 Mon Sep 17 00:00:00 2001 From: Hue Date: Sun, 22 Feb 2026 19:35:28 +0100 Subject: [PATCH 1/3] =?UTF-8?q?Code=20style=C2=A0:=20use=20.value=20on=20e?= =?UTF-8?q?very=20WfOption=20instead=20of=20(implicit)=20casts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/dock/dock-app.cpp | 2 +- src/dock/dock.cpp | 4 +- src/dock/toplevel-icon.cpp | 2 +- src/panel/panel.cpp | 22 ++++----- src/panel/widgets/clock.cpp | 2 +- src/panel/widgets/command-output.cpp | 6 +-- src/panel/widgets/menu.cpp | 48 +++++++++---------- src/panel/widgets/network.cpp | 6 +-- .../notifications/notification-center.cpp | 6 +-- src/panel/widgets/tray/item.cpp | 4 +- src/panel/widgets/volume.cpp | 14 +++--- src/panel/widgets/window-list/layout.cpp | 4 +- src/panel/widgets/wp-mixer/wf-wp-control.cpp | 8 ++-- src/panel/widgets/wp-mixer/wp-common.cpp | 2 +- src/panel/widgets/wp-mixer/wp-mixer.cpp | 8 ++-- src/util/background-gl.cpp | 2 +- src/util/wf-autohide-window.cpp | 16 +++---- src/util/wf-shell-app.cpp | 3 +- 18 files changed, 79 insertions(+), 80 deletions(-) diff --git a/src/dock/dock-app.cpp b/src/dock/dock-app.cpp index c10f0164e..848d05486 100644 --- a/src/dock/dock-app.cpp +++ b/src/dock/dock-app.cpp @@ -118,7 +118,7 @@ void WfDockApp::handle_toplevel_closed(zwlr_foreign_toplevel_handle_v1 *handle) { priv->toplevels[handle]->close(); WfOption use_close_animations{"dock/show_close"}; - if (use_close_animations) + if (use_close_animations.value()) { Glib::signal_timeout().connect([=] { diff --git a/src/dock/dock.cpp b/src/dock/dock.cpp index 763cbfdb1..6da7d3d1a 100644 --- a/src/dock/dock.cpp +++ b/src/dock/dock.cpp @@ -45,9 +45,9 @@ class WfDock::impl out_box.set_halign(Gtk::Align::CENTER); - if ((std::string)css_path != "") + if (css_path.value() != "") { - auto css = load_css_from_path(css_path); + auto css = load_css_from_path(css_path.value()); if (css) { auto display = Gdk::Display::get_default(); diff --git a/src/dock/toplevel-icon.cpp b/src/dock/toplevel-icon.cpp index 9a4b33535..22cbb40fe 100644 --- a/src/dock/toplevel-icon.cpp +++ b/src/dock/toplevel-icon.cpp @@ -90,7 +90,7 @@ class WfToplevelIcon::impl this->app_id = app_id; IconProvider::set_image_from_icon(image, app_id, - icon_height, + icon_height.value(), button.get_scale_factor()); } diff --git a/src/panel/panel.cpp b/src/panel/panel.cpp index 0a7fccbf7..b13dddde3 100644 --- a/src/panel/panel.cpp +++ b/src/panel/panel.cpp @@ -55,22 +55,22 @@ class WayfirePanel::impl WfOption panel_layer{"panel/layer"}; std::function set_panel_layer = [=] () { - if ((std::string)panel_layer == "overlay") + if (panel_layer.value() == "overlay") { gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_OVERLAY); } - if ((std::string)panel_layer == "top") + if (panel_layer.value() == "top") { gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_TOP); } - if ((std::string)panel_layer == "bottom") + if (panel_layer.value() == "bottom") { gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_BOTTOM); } - if ((std::string)panel_layer == "background") + if (panel_layer.value() == "background") { gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_BACKGROUND); } @@ -82,7 +82,7 @@ class WayfirePanel::impl { window = std::make_unique(output, "panel"); - window->set_default_size(0, minimal_panel_height); + window->set_default_size(0, minimal_panel_height.value()); window->add_css_class("wf-panel"); panel_layer.set_callback(set_panel_layer); set_panel_layer(); // initial setting @@ -350,15 +350,15 @@ class WayfirePanel::impl { left_widgets_opt.set_callback([=] () { - reload_widgets((std::string)left_widgets_opt, left_widgets, left_box); + reload_widgets(left_widgets_opt.value(), left_widgets, left_box); }); right_widgets_opt.set_callback([=] () { - reload_widgets((std::string)right_widgets_opt, right_widgets, right_box); + reload_widgets(right_widgets_opt.value(), right_widgets, right_box); }); center_widgets_opt.set_callback([=] () { - reload_widgets((std::string)center_widgets_opt, center_widgets, center_box); + reload_widgets(center_widgets_opt.value(), center_widgets, center_box); if (center_box.get_children().empty()) { content_box.unset_center_widget(); @@ -368,9 +368,9 @@ class WayfirePanel::impl } }); - reload_widgets((std::string)left_widgets_opt, left_widgets, left_box); - reload_widgets((std::string)right_widgets_opt, right_widgets, right_box); - reload_widgets((std::string)center_widgets_opt, center_widgets, center_box); + reload_widgets(left_widgets_opt.value(), left_widgets, left_box); + reload_widgets(right_widgets_opt.value(), right_widgets, right_box); + reload_widgets(center_widgets_opt.value(), center_widgets, center_box); } std::shared_ptr get_ipc_server_instance() diff --git a/src/panel/widgets/clock.cpp b/src/panel/widgets/clock.cpp index a521c4b89..72c59bb05 100644 --- a/src/panel/widgets/clock.cpp +++ b/src/panel/widgets/clock.cpp @@ -37,7 +37,7 @@ void WayfireClock::on_calendar_shown() bool WayfireClock::update_label() { auto time = Glib::DateTime::create_now_local(); - auto text = time.format((std::string)format); + auto text = time.format(format.value()); /* Sometimes GLib::DateTime will add leading spaces. This results in * unevenly balanced padding around the text, which looks quite bad. diff --git a/src/panel/widgets/command-output.cpp b/src/panel/widgets/command-output.cpp index f0b3bd7bd..1291d5ca9 100644 --- a/src/panel/widgets/command-output.cpp +++ b/src/panel/widgets/command-output.cpp @@ -70,15 +70,15 @@ WfCommandOutputButtons::CommandOutput::CommandOutput(const std::string & name, add_css_class("icon-" + icon_position); main_label.set_ellipsize(Pango::EllipsizeMode::END); - main_label.set_max_width_chars(max_chars_opt); + main_label.set_max_width_chars(max_chars_opt.value()); max_chars_opt.set_callback([=] { - main_label.set_max_width_chars(max_chars_opt); + main_label.set_max_width_chars(max_chars_opt.value()); }); // main_label.set_alignment(Gtk::ALIGN_CENTER); max_chars_opt.set_callback([this] { - main_label.set_max_width_chars(max_chars_opt); + main_label.set_max_width_chars(max_chars_opt.value()); }); box.set_orientation( diff --git a/src/panel/widgets/menu.cpp b/src/panel/widgets/menu.cpp index e2295eda0..2b06eaf5b 100644 --- a/src/panel/widgets/menu.cpp +++ b/src/panel/widgets/menu.cpp @@ -91,7 +91,7 @@ WfMenuMenuItem::WfMenuMenuItem(WayfireMenu *_menu, Glib::RefPtrmenu_list) + if (menu->menu_list.value()) { m_padding_box.append(m_extra_actions_button); this->set_size_request(menu->menu_min_content_width, 48); @@ -451,7 +451,7 @@ void WayfireMenu::on_search_changed() /* Text has been unset, show categories again */ populate_menu_items(category); category_scrolled_window.show(); - app_scrolled_window.set_min_content_width(int(menu_min_content_width)); + app_scrolled_window.set_min_content_width(menu_min_content_width.value()); } else { /* User is filtering, hide categories, ignore chosen category */ @@ -549,7 +549,7 @@ void WayfireMenu::setup_popover_layout() flowbox.set_sort_func(sigc::mem_fun(*this, &WayfireMenu::on_sort)); flowbox.set_filter_func(sigc::mem_fun(*this, &WayfireMenu::on_filter)); flowbox.add_css_class("app-list"); - flowbox.set_size_request(int(menu_min_content_width), int(menu_min_content_height)); + flowbox.set_size_request(menu_min_content_width.value(), menu_min_content_height.value()); flowbox_container.append(flowbox); @@ -557,8 +557,8 @@ void WayfireMenu::setup_popover_layout() scroll_pair.append(app_scrolled_window); scroll_pair.set_homogeneous(false); - app_scrolled_window.set_min_content_width(int(menu_min_content_width)); - app_scrolled_window.set_min_content_height(int(menu_min_content_height)); + app_scrolled_window.set_min_content_width(menu_min_content_width.value()); + app_scrolled_window.set_min_content_height(menu_min_content_height.value()); app_scrolled_window.set_child(flowbox_container); app_scrolled_window.add_css_class("app-list-scroll"); app_scrolled_window.set_policy(Gtk::PolicyType::NEVER, Gtk::PolicyType::AUTOMATIC); @@ -566,8 +566,8 @@ void WayfireMenu::setup_popover_layout() category_box.add_css_class("category-list"); category_box.set_orientation(Gtk::Orientation::VERTICAL); - category_scrolled_window.set_min_content_width(int(menu_min_category_width)); - category_scrolled_window.set_min_content_height(int(menu_min_content_height)); + category_scrolled_window.set_min_content_width(menu_min_category_width.value()); + category_scrolled_window.set_min_content_height(menu_min_content_height.value()); category_scrolled_window.set_child(category_box); category_scrolled_window.add_css_class("categtory-list-scroll"); category_scrolled_window.set_policy(Gtk::PolicyType::NEVER, Gtk::PolicyType::AUTOMATIC); @@ -620,22 +620,22 @@ void WayfireMenu::setup_popover_layout() Gtk::Window *window = dynamic_cast(button->get_root()); WfOption panel_layer{"panel/layer"}; - if ((std::string)panel_layer == "overlay") + if (panel_layer.value() == "overlay") { gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_OVERLAY); } - if ((std::string)panel_layer == "top") + if (panel_layer.value() == "top") { gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_TOP); } - if ((std::string)panel_layer == "bottom") + if (panel_layer.value() == "bottom") { gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_BOTTOM); } - if ((std::string)panel_layer == "background") + if (panel_layer.value() == "background") { gtk_layer_set_layer(window->gobj(), GTK_LAYER_SHELL_LAYER_BACKGROUND); } @@ -651,7 +651,7 @@ void WayfireMenu::update_popover_layout() popover_layout_box.remove(separator); popover_layout_box.remove(box_bottom); - if ((std::string)panel_position == WF_WINDOW_POSITION_TOP) + if (panel_position.value() == WF_WINDOW_POSITION_TOP) { popover_layout_box.append(search_entry); popover_layout_box.append(scroll_pair); @@ -674,37 +674,37 @@ void WayfireMenu::update_popover_layout() void WayfireLogoutUI::on_logout_click() { ui.hide(); - g_spawn_command_line_async(std::string(logout_command).c_str(), NULL); + g_spawn_command_line_async(logout_command.value().c_str(), NULL); } void WayfireLogoutUI::on_reboot_click() { ui.hide(); - g_spawn_command_line_async(std::string(reboot_command).c_str(), NULL); + g_spawn_command_line_async(reboot_command.value().c_str(), NULL); } void WayfireLogoutUI::on_shutdown_click() { ui.hide(); - g_spawn_command_line_async(std::string(shutdown_command).c_str(), NULL); + g_spawn_command_line_async(shutdown_command.value().c_str(), NULL); } void WayfireLogoutUI::on_suspend_click() { ui.hide(); - g_spawn_command_line_async(std::string(suspend_command).c_str(), NULL); + g_spawn_command_line_async(suspend_command.value().c_str(), NULL); } void WayfireLogoutUI::on_hibernate_click() { ui.hide(); - g_spawn_command_line_async(std::string(hibernate_command).c_str(), NULL); + g_spawn_command_line_async(hibernate_command.value().c_str(), NULL); } void WayfireLogoutUI::on_switchuser_click() { ui.hide(); - g_spawn_command_line_async(std::string(switchuser_command).c_str(), NULL); + g_spawn_command_line_async(switchuser_command.value().c_str(), NULL); } void WayfireLogoutUI::on_cancel_click() @@ -803,9 +803,9 @@ WayfireLogoutUI::~WayfireLogoutUI() void WayfireMenu::on_logout_click() { button->get_popover()->hide(); - if (!std::string(menu_logout_command).empty()) + if (!menu_logout_command.value().empty()) { - g_spawn_command_line_async(std::string(menu_logout_command).c_str(), NULL); + g_spawn_command_line_async(menu_logout_command.value().c_str(), NULL); return; } @@ -941,18 +941,18 @@ void WayfireMenu::init(Gtk::Box *container) void WayfireMenu::update_category_width() { - category_scrolled_window.set_min_content_width(int(menu_min_category_width)); + category_scrolled_window.set_min_content_width(menu_min_category_width.value()); } void WayfireMenu::update_content_height() { - category_scrolled_window.set_min_content_height(int(menu_min_content_height)); - app_scrolled_window.set_min_content_height(int(menu_min_content_height)); + category_scrolled_window.set_min_content_height(menu_min_content_height.value()); + app_scrolled_window.set_min_content_height(menu_min_content_height.value()); } void WayfireMenu::update_content_width() { - app_scrolled_window.set_min_content_width(int(menu_min_content_width)); + app_scrolled_window.set_min_content_width(menu_min_content_width.value()); } void WayfireMenu::toggle_menu() diff --git a/src/panel/widgets/network.cpp b/src/panel/widgets/network.cpp index 5b9bb1815..af16f06dc 100644 --- a/src/panel/widgets/network.cpp +++ b/src/panel/widgets/network.cpp @@ -286,7 +286,7 @@ void WayfireNetworkInfo::update_status() status.remove_css_class("good"); status.remove_css_class("weak"); status.remove_css_class("none"); - if (status_color_opt) + if (status_color_opt.value()) { status.add_css_class(info->get_strength_str()); } @@ -398,9 +398,9 @@ bool WayfireNetworkInfo::setup_dbus() void WayfireNetworkInfo::on_click() { - if ((std::string)click_command_opt != "default") + if (click_command_opt.value() != "default") { - Glib::spawn_command_line_async((std::string)click_command_opt); + Glib::spawn_command_line_async(click_command_opt.value()); } else { info->spawn_control_center(nm_proxy); diff --git a/src/panel/widgets/notifications/notification-center.cpp b/src/panel/widgets/notifications/notification-center.cpp index 2ffa30076..fca482f96 100644 --- a/src/panel/widgets/notifications/notification-center.cpp +++ b/src/panel/widgets/notifications/notification-center.cpp @@ -77,10 +77,10 @@ void WayfireNotificationCenter::newNotification(Notification::id_type id, bool s auto & widget = notification_widgets.at(id); box.append(*widget); widget->set_reveal_child(); - if (show_popup && !dnd_enabled || (show_critical_in_dnd && (notification.hints.urgency == 2))) + if (show_popup && !dnd_enabled || (show_critical_in_dnd.value() && (notification.hints.urgency == 2))) { auto *popover = button->get_popover(); - if ((timeout > 0) && (!popover_timeout.empty() || !popover->is_visible())) + if ((timeout.value() > 0) && (!popover_timeout.empty() || !popover->is_visible())) { popover_timeout.disconnect(); popover_timeout = Glib::signal_timeout().connect( @@ -91,7 +91,7 @@ void WayfireNotificationCenter::newNotification(Notification::id_type id, bool s popover_timeout.disconnect(); return true; }, - timeout * 1000); + timeout.value() * 1000); } button->set_keyboard_interactive(false); diff --git a/src/panel/widgets/tray/item.cpp b/src/panel/widgets/tray/item.cpp index fae840344..3c0df2429 100644 --- a/src/panel/widgets/tray/item.cpp +++ b/src/panel/widgets/tray/item.cpp @@ -119,8 +119,8 @@ void StatusNotifierItem::init_widget() const auto ev_coords = Glib::Variant>::create({0, 0}); const int primary_click = 1; - const int secondary_click = menu_on_middle_click ? 2 : 3; - const int tertiary_click = menu_on_middle_click ? 3 : 2; + const int secondary_click = menu_on_middle_click.value() ? 2 : 3; + const int tertiary_click = menu_on_middle_click.value() ? 3 : 2; if (butt == primary_click) { if (get_item_property("ItemIsMenu", true)) diff --git a/src/panel/widgets/volume.cpp b/src/panel/widgets/volume.cpp index b8f347b5f..814d47b1e 100644 --- a/src/panel/widgets/volume.cpp +++ b/src/panel/widgets/volume.cpp @@ -26,7 +26,7 @@ void WayfireVolume::check_set_popover_timeout() popover_timeout.disconnect(); popover_timeout = Glib::signal_timeout().connect(sigc::bind(sigc::mem_fun(*this, - &WayfireVolume::on_popover_timeout), 0), timeout * 1000); + &WayfireVolume::on_popover_timeout), 0), timeout.value() * 1000); } void WayfireVolume::set_volume(pa_volume_t volume, set_volume_flags_t flags) @@ -113,8 +113,8 @@ void WayfireVolume::on_default_sink_changed() /* Update the scale attributes */ max_norm = gvc_mixer_control_get_vol_max_norm(gvc_control); volume_scale.set_range(0.0, max_norm); - volume_scale.set_increments(max_norm * scroll_sensitivity, - max_norm * scroll_sensitivity * 2); + volume_scale.set_increments(max_norm * scroll_sensitivity.value(), + max_norm * scroll_sensitivity.value() * 2); /* Finally, update the displayed volume. However, do not show the popup */ set_volume(gvc_mixer_stream_get_volume(gvc_stream), VOLUME_FLAG_NO_ACTION); @@ -150,11 +150,11 @@ void WayfireVolume::init(Gtk::Box *container) if (scroll_gesture->get_unit() == Gdk::ScrollUnit::WHEEL) { // +- number of clicks. - change = dy * max_norm * scroll_sensitivity; + change = dy * max_norm * scroll_sensitivity.value(); } else { // Number of pixels expected to have scrolled. usually in 100s - change = (dy / 100.0) * max_norm * scroll_sensitivity; + change = (dy / 100.0) * max_norm * scroll_sensitivity.value(); } set_volume(std::clamp(volume_scale.get_target_value() - change, @@ -178,11 +178,11 @@ void WayfireVolume::init(Gtk::Box *container) if (scroll_gesture->get_unit() == Gdk::ScrollUnit::WHEEL) { // +- number of clicks. - change = dy * max_norm * scroll_sensitivity; + change = dy * max_norm * scroll_sensitivity.value(); } else { // Number of pixels expected to have scrolled. usually in 100s - change = (dy / 100.0) * max_norm * scroll_sensitivity; + change = (dy / 100.0) * max_norm * scroll_sensitivity.value(); } set_volume(std::clamp(volume_scale.get_target_value() - change, diff --git a/src/panel/widgets/window-list/layout.cpp b/src/panel/widgets/window-list/layout.cpp index 271f4afba..e44222009 100644 --- a/src/panel/widgets/window-list/layout.cpp +++ b/src/panel/widgets/window-list/layout.cpp @@ -17,7 +17,7 @@ void WayfireWindowListLayout::allocate_vfunc(const Gtk::Widget& widget, int widt int per_child = width / child_count; // user preference is ignored if too small - int preference = std::max(height, (int)user_size); + int preference = std::max(height, user_size.value()); // At minimum use ratio of 1:1, at max use user preference per_child = std::max(per_child, height); per_child = std::min(per_child, preference); @@ -61,7 +61,7 @@ void WayfireWindowListLayout::measure_vfunc(const Gtk::Widget& widget, Gtk::Orie int child_count = widget.get_children().size(); // Use max of user preference and ratio 1:1 - int per_child = std::max(for_size, (int)user_size); + int per_child = std::max(for_size, user_size.value()); minimum = child_count * for_size; natural = per_child * child_count; diff --git a/src/panel/widgets/wp-mixer/wf-wp-control.cpp b/src/panel/widgets/wp-mixer/wf-wp-control.cpp index b2450c964..aa274d808 100644 --- a/src/panel/widgets/wp-mixer/wf-wp-control.cpp +++ b/src/panel/widgets/wp-mixer/wf-wp-control.cpp @@ -34,7 +34,7 @@ void WfWpControl::init() button.add_css_class("flat"); scale.set_range(0.0, 1.0); - scale.set_size_request(slider_length, 0); + scale.set_size_request(slider_length.value(), 0); const gchar *name; // try to find a name to display @@ -161,7 +161,7 @@ void WfWpControl::update_icons_pos() { static WfOption icons_on_left{"panel/wp_icons_on_left"}; - if (icons_on_left) + if (icons_on_left.value()) { attach(label, 1, 0); attach(scale, 1, 1); @@ -206,7 +206,7 @@ void WfWpControl::handle_config_reload() right_conn.disconnect(); update_icons_pos(); update_gestures(); - scale.set_size_request(slider_length); + scale.set_size_request(slider_length.value()); } // used to make a copy to the face of the widget @@ -268,7 +268,7 @@ void WfWpControlDevice::update_icons_pos() WfWpControl::update_icons_pos(); static WfOption icons_on_left{"panel/wp_icons_on_left"}; - if (icons_on_left) + if (icons_on_left.value()) { attach(default_btn, 0, 0); } else diff --git a/src/panel/widgets/wp-mixer/wp-common.cpp b/src/panel/widgets/wp-mixer/wp-common.cpp index 49462ee6e..51bb7da8f 100644 --- a/src/panel/widgets/wp-mixer/wp-common.cpp +++ b/src/panel/widgets/wp-mixer/wp-common.cpp @@ -287,7 +287,7 @@ void WpCommon::on_mixer_changed(gpointer mixer_api, guint id, gpointer data) { // put the quick_target in the popover and show widget->popover->set_child(*widget->quick_target); - if (widget->popup_on_change && change) + if (widget->popup_on_change.value() && change) { widget->popover->popup(); } diff --git a/src/panel/widgets/wp-mixer/wp-mixer.cpp b/src/panel/widgets/wp-mixer/wp-mixer.cpp index 0e051c689..84db54ec7 100644 --- a/src/panel/widgets/wp-mixer/wp-mixer.cpp +++ b/src/panel/widgets/wp-mixer/wp-mixer.cpp @@ -18,7 +18,7 @@ void WayfireWpMixer::check_set_popover_timeout() popover_timeout.disconnect(); popover_timeout = Glib::signal_timeout().connect(sigc::bind(sigc::mem_fun(*this, - &WayfireWpMixer::on_popover_timeout), 0), timeout * 1000); + &WayfireWpMixer::on_popover_timeout), 0), timeout.value() * 1000); } void WayfireWpMixer::cancel_popover_timeout() @@ -243,18 +243,18 @@ void WayfireWpMixer::init(Gtk::Box *container) return false; // no quick_target means we have nothing to change by scrolling } - dy = invert_scroll ? dy : dy * -1; // for the same scrolling as volume widget, which we will agree it + dy = invert_scroll.value() ? dy : dy * -1; // for the same scrolling as volume widget, which we will agree it // is more intuitive for more people double change = 0; const double SCROLL_MULT = 0.2; // corrects the scrolling to have the default scroll sensitivity as 1 if (scroll_gesture->get_unit() == Gdk::ScrollUnit::WHEEL) { // +- number of clicks. - change = (dy * scroll_sensitivity * SCROLL_MULT) / 10; + change = (dy * scroll_sensitivity.value() * SCROLL_MULT) / 10; } else { // Number of pixels expected to have scrolled. usually in 100s - change = (dy * scroll_sensitivity * SCROLL_MULT) / 100; + change = (dy * scroll_sensitivity.value() * SCROLL_MULT) / 100; } guint32 id = wp_proxy_get_bound_id(WP_PROXY(quick_target->object)); diff --git a/src/util/background-gl.cpp b/src/util/background-gl.cpp index 53e06d654..039651a16 100644 --- a/src/util/background-gl.cpp +++ b/src/util/background-gl.cpp @@ -205,7 +205,7 @@ void BackgroundImage::generate_adjustments(int width, int height) bool BackgroundGLArea::show_image(std::string path) { std::shared_ptr image = std::make_shared(); - std::string fill_mode = WfOption{"background/fill_mode"}; + std::string fill_mode = WfOption{"background/fill_mode"}.value(); image->fill_type = fill_mode; diff --git a/src/util/wf-autohide-window.cpp b/src/util/wf-autohide-window.cpp index 81734ba29..2dc36431b 100644 --- a/src/util/wf-autohide-window.cpp +++ b/src/util/wf-autohide-window.cpp @@ -208,7 +208,7 @@ void WayfireAutohidingWindow::setup_hotspot() } this->last_hotspot_height = get_allocated_height(); - this->last_edge_offset = edge_offset; + this->last_edge_offset = edge_offset.value(); if (this->edge_hotspot) { @@ -225,7 +225,7 @@ void WayfireAutohidingWindow::setup_hotspot() ZWF_OUTPUT_V2_HOTSPOT_EDGE_TOP : ZWF_OUTPUT_V2_HOTSPOT_EDGE_BOTTOM; this->edge_hotspot = zwf_output_v2_create_hotspot(output->output, - edge, edge_offset, AUTOHIDE_SHOW_DELAY); + edge, edge_offset.value(), AUTOHIDE_SHOW_DELAY); this->panel_hotspot = zwf_output_v2_create_hotspot(output->output, edge, this->get_allocated_height(), 0); // immediate @@ -294,7 +294,7 @@ void WayfireAutohidingWindow::update_auto_exclusive_zone() void WayfireAutohidingWindow::set_auto_exclusive_zone(bool has_zone) { - if (has_zone && (output->output && autohide_opt)) + if (has_zone && (output->output && autohide_opt.value())) { std::cerr << "WARNING: Trying to enable auto_exclusive_zone with " << "autohide enabled might look jarring; preventing it." << std::endl; @@ -467,7 +467,7 @@ void WayfireAutohidingWindow::unset_active_popover(WayfireMenuButton& button) void WayfireAutohidingWindow::setup_autohide() { - if (!output->output && autohide_opt) + if (!output->output && autohide_opt.value()) { std::cerr << "WARNING: Attempting to enable autohide, but the " << "compositor does not support zwf_shell_manager_v2; ignoring" << @@ -475,18 +475,18 @@ void WayfireAutohidingWindow::setup_autohide() std::endl; } - this->set_auto_exclusive_zone(!(output->output && autohide_opt)); + this->set_auto_exclusive_zone(!(output->output && autohide_opt.value())); this->update_autohide(); } void WayfireAutohidingWindow::update_autohide() { - if ((output->output && autohide_opt) == last_autohide_value) + if ((output->output && autohide_opt.value()) == last_autohide_value) { return; } - if (output->output && autohide_opt) + if (output->output && autohide_opt.value()) { increase_autohide(); } else @@ -494,6 +494,6 @@ void WayfireAutohidingWindow::update_autohide() decrease_autohide(); } - last_autohide_value = output->output && autohide_opt; + last_autohide_value = output->output && autohide_opt.value(); setup_auto_exclusive_zone(); } diff --git a/src/util/wf-shell-app.cpp b/src/util/wf-shell-app.cpp index 8a90b18de..0a88a79a2 100644 --- a/src/util/wf-shell-app.cpp +++ b/src/util/wf-shell-app.cpp @@ -74,8 +74,7 @@ void WayfireShellApp::on_css_reload() } /* Add one user file */ - auto custom_css_config = WfOption{"panel/css_path"}; - std::string custom_css = custom_css_config; + auto custom_css = WfOption{"panel/css_path"}.value(); if (custom_css != "") { add_css_file(custom_css, GTK_STYLE_PROVIDER_PRIORITY_USER); From 93f114a9f3c3f199755959de4941bb793d5747f2 Mon Sep 17 00:00:00 2001 From: Hue Date: Sun, 22 Feb 2026 19:45:16 +0100 Subject: [PATCH 2/3] remove dead code --- metadata/panel.xml | 5 ----- src/panel/widgets/command-output.cpp | 6 ------ src/panel/widgets/tray/item.hpp | 1 - src/panel/widgets/volume.hpp | 2 -- src/util/wf-popover.cpp | 5 ----- src/util/wf-shell-app.cpp | 1 - 6 files changed, 20 deletions(-) diff --git a/metadata/panel.xml b/metadata/panel.xml index 6508a9db4..75de7f336 100644 --- a/metadata/panel.xml +++ b/metadata/panel.xml @@ -385,11 +385,6 @@ <_short>Tray -