From 18e7e91131a6fbf9dd85e94a9b7494ceeec280f8 Mon Sep 17 00:00:00 2001 From: Ay1nDas Date: Thu, 13 Nov 2025 13:09:16 +0530 Subject: [PATCH] Fix Opacity is not applied with last style if set with object and dialog Add 'StyleSubject::Selection _subject' in 'ObjectPanel'. So that when style is changed last style used is notified. Fixes: https://gitlab.com/inkscape/inkscape/-/issues/5811 --- src/ui/dialog/objects.cpp | 12 ++++++++++-- src/ui/dialog/objects.h | 4 ++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/ui/dialog/objects.cpp b/src/ui/dialog/objects.cpp index 7b0bf5999c..6a5cba2bef 100644 --- a/src/ui/dialog/objects.cpp +++ b/src/ui/dialog/objects.cpp @@ -820,7 +820,10 @@ ObjectsPanel::ObjectsPanel() os << CLAMP(value, 0.0, 1.0); auto css = sp_repr_css_attr_new(); sp_repr_css_set_property(css, "opacity", os.str().c_str()); - current_item->changeCSS(css, "style"); + + // Apply the style change through the StyleSubject. + // This ensures the "last style used" system is notified + _subject.setCSS(css); sp_repr_css_attr_unref(css); DocumentUndo::maybeDone(current_item->document, ":opacity", _("Change opacity"), INKSCAPE_ICON("dialog-object-properties")); } @@ -1036,7 +1039,12 @@ void ObjectsPanel::desktopReplaced() { layer_changed.disconnect(); - if (auto desktop = getDesktop()) { + auto desktop = getDesktop(); + + // Update the _subject with the new desktop + _subject.setDesktop(desktop); + + if (desktop) { layer_changed = desktop->layerManager().connectCurrentLayerChanged(sigc::mem_fun(*this, &ObjectsPanel::layerChanged)); } } diff --git a/src/ui/dialog/objects.h b/src/ui/dialog/objects.h index dc5646de5f..06690a506f 100644 --- a/src/ui/dialog/objects.h +++ b/src/ui/dialog/objects.h @@ -26,6 +26,7 @@ #include "ui/widget/color-notebook.h" #include "ui/widget/popover-bin.h" #include "ui/widget/preferences-widget.h" +#include "ui/widget/style-subject.h" namespace Glib { class ValueBase; @@ -152,6 +153,9 @@ private: Gtk::TreeRow _clicked_item_row; UI::Widget::PopoverBin _popoverbin; + // Manage selection and apply style changes + UI::Widget::StyleSubject::Selection _subject; + void _activateAction(const std::string& layerAction, const std::string& selectionAction); bool blendModePopup(int x, int y, Gtk::TreeModel::Row row); -- GitLab