Use load_symbolic for gtk icon instead of load_icon.
This commit is contained in:
@ -388,14 +388,17 @@ Glib::RefPtr<Gdk::Pixbuf> Item::getIconPixbuf() {
|
||||
Glib::RefPtr<Gdk::Pixbuf> Item::getIconByName(const std::string& name, int request_size) {
|
||||
icon_theme->rescan_if_needed();
|
||||
|
||||
if (!icon_theme_path.empty() &&
|
||||
icon_theme->lookup_icon(name.c_str(), request_size,
|
||||
Gtk::IconLookupFlags::ICON_LOOKUP_FORCE_SIZE)) {
|
||||
return icon_theme->load_icon(name.c_str(), request_size,
|
||||
Gtk::IconLookupFlags::ICON_LOOKUP_FORCE_SIZE);
|
||||
if (!icon_theme_path.empty()) {
|
||||
auto icon_info = icon_theme->lookup_icon(name.c_str(), request_size,
|
||||
Gtk::IconLookupFlags::ICON_LOOKUP_FORCE_SIZE);
|
||||
if (icon_info) {
|
||||
bool is_sym = false;
|
||||
return icon_info.load_symbolic(event_box.get_style_context(), is_sym);
|
||||
}
|
||||
}
|
||||
return DefaultGtkIconThemeWrapper::load_icon(name.c_str(), request_size,
|
||||
Gtk::IconLookupFlags::ICON_LOOKUP_FORCE_SIZE);
|
||||
Gtk::IconLookupFlags::ICON_LOOKUP_FORCE_SIZE,
|
||||
event_box.get_style_context());
|
||||
}
|
||||
|
||||
double Item::getScaledIconSize() {
|
||||
|
@ -15,11 +15,20 @@ bool DefaultGtkIconThemeWrapper::has_icon(const std::string& value) {
|
||||
return Gtk::IconTheme::get_default()->has_icon(value);
|
||||
}
|
||||
|
||||
Glib::RefPtr<Gdk::Pixbuf> DefaultGtkIconThemeWrapper::load_icon(const char* name, int tmp_size,
|
||||
Gtk::IconLookupFlags flags) {
|
||||
Glib::RefPtr<Gdk::Pixbuf> DefaultGtkIconThemeWrapper::load_icon(
|
||||
const char* name, int tmp_size, Gtk::IconLookupFlags flags,
|
||||
Glib::RefPtr<Gtk::StyleContext> style) {
|
||||
const std::lock_guard<std::mutex> lock(default_theme_mutex);
|
||||
|
||||
auto default_theme = Gtk::IconTheme::get_default();
|
||||
default_theme->rescan_if_needed();
|
||||
return default_theme->load_icon(name, tmp_size, flags);
|
||||
|
||||
auto icon_info = default_theme->lookup_icon(name, tmp_size, flags);
|
||||
|
||||
if (style.get() == nullptr) {
|
||||
return icon_info.load_icon();
|
||||
}
|
||||
|
||||
bool is_sym = false;
|
||||
return icon_info.load_symbolic(style, is_sym);
|
||||
}
|
||||
|
Reference in New Issue
Block a user