kiran-menu/1014-fix-menu-Fixed-start-Menu-without-icon-application-d.patch
2024-04-09 18:20:17 +08:00

50 lines
1.7 KiB
Diff

From 1acb0598eb7b85e02e822c1b85771607b2b8c6f4 Mon Sep 17 00:00:00 2001
From: yangfeng <yangfeng@kylinsec.com.cn>
Date: Tue, 9 Apr 2024 14:55:44 +0800
Subject: [PATCH 1014/1014] fix(menu):Fixed start Menu without icon application
drag and drop causes the bottom panel to crash
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修复开始菜单无图标应用拖拽会导致底部面板崩溃
Related #34719
---
lib/app.cpp | 2 +-
src/menu/menu-app-item.cpp | 5 ++++-
2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/lib/app.cpp b/lib/app.cpp
index 6168e76..c27b53b 100644
--- a/lib/app.cpp
+++ b/lib/app.cpp
@@ -144,7 +144,7 @@ bool App::should_show()
RETURN_VAL_IF_FALSE(this->desktop_app_, false);
RETURN_VAL_IF_FALSE(get_kind() != AppKind::USER_TASKBAR, false);
- return (this->desktop_app_->should_show() && !this->x_kiran_no_display_);
+ return (this->desktop_app_->should_show() && !this->x_kiran_no_display_ && !this->icon_name_.empty());
}
bool App::is_active()
diff --git a/src/menu/menu-app-item.cpp b/src/menu/menu-app-item.cpp
index 3e2376b..732d708 100644
--- a/src/menu/menu-app-item.cpp
+++ b/src/menu/menu-app-item.cpp
@@ -101,7 +101,10 @@ void MenuAppItem::on_drag_begin(const Glib::RefPtr<Gdk::DragContext> &context)
* 设置拖动操作的Icon
*/
auto app = get_app();
- gtk_drag_set_icon_gicon(context->gobj(), app->get_icon()->gobj(), 0, 0);
+ if (app->get_icon())
+ {
+ gtk_drag_set_icon_gicon(context->gobj(), app->get_icon()->gobj(), 0, 0);
+ }
}
void MenuAppItem::on_drag_data_get(const Glib::RefPtr<Gdk::DragContext> &context, Gtk::SelectionData &selection, guint info, guint timestamp)
--
2.27.0