diff --git a/0001-fix-tray-Fix-the-dbus-icon-can-not-scaled-when-syste.patch b/0001-fix-tray-Fix-the-dbus-icon-can-not-scaled-when-syste.patch new file mode 100644 index 0000000..a3efe99 --- /dev/null +++ b/0001-fix-tray-Fix-the-dbus-icon-can-not-scaled-when-syste.patch @@ -0,0 +1,132 @@ +From 49591a3b1b1c2f58b8b4a7cacfa7093fad26a3ab Mon Sep 17 00:00:00 2001 +From: wangxiaoqing +Date: Tue, 6 Sep 2022 10:20:27 +0800 +Subject: [PATCH] fix(tray):Fix the dbus icon can not scaled when system scale + changed +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 修复当系统显示设置放大2倍数,托盘声音,网络通知图标未放大的问题 + +Signed-off-by: wangxiaoqing +--- + src/tray/kiran-sn-icon.c | 51 +++++++++++++++++++++++----------------- + 1 file changed, 29 insertions(+), 22 deletions(-) + +diff --git a/src/tray/kiran-sn-icon.c b/src/tray/kiran-sn-icon.c +index b6644c3..f312458 100644 +--- a/src/tray/kiran-sn-icon.c ++++ b/src/tray/kiran-sn-icon.c +@@ -202,9 +202,10 @@ kiran_sn_tooltip_new(GVariant *variant) + return tooltip; + } + +-static GdkPixbuf * ++static cairo_surface_t * + get_icon_by_name(const gchar *icon_name, +- gint requested_size) ++ gint requested_size, ++ gint scale) + { + GtkIconTheme *icon_theme; + gint *sizes; +@@ -235,9 +236,9 @@ get_icon_by_name(const gchar *icon_name, + if (chosen_size == 0) + chosen_size = requested_size; + +- return gtk_icon_theme_load_icon(icon_theme, icon_name, +- chosen_size, GTK_ICON_LOOKUP_FORCE_SIZE, +- NULL); ++ return gtk_icon_theme_load_surface(icon_theme, icon_name, ++ chosen_size, scale, ++ NULL, GTK_ICON_LOOKUP_FORCE_SIZE, NULL); + } + + static cairo_surface_t * +@@ -501,44 +502,46 @@ update(KiranSnIcon *icon) + KiranSnIconPrivate *priv; + KiranSnTooltip *tip; + gint icon_size; +- gint scale; + + priv = KIRAN_SN_ICON_GET_PRIVATE(icon); +- scale = gtk_widget_get_scale_factor(GTK_WIDGET(priv->image)); + + if (priv->icon_size > 0) + icon_size = priv->icon_size; + else + icon_size = MAX(1, priv->effective_icon_size); + +- icon_size = icon_size * scale; +- + if (priv->icon_name != NULL && priv->icon_name[0] != '\0') + { +- GdkPixbuf *pixbuf; +- pixbuf = get_icon_by_name(priv->icon_name, icon_size); +- if (!pixbuf) ++ cairo_surface_t *surface; ++ gint scale; ++ ++ scale = gtk_widget_get_scale_factor(GTK_WIDGET(priv->image)); ++ surface = get_icon_by_name(priv->icon_name, icon_size, scale); ++ if (!surface) + { ++ GdkPixbuf *pixbuf; ++ + /*try to find icons specified by path and filename*/ + pixbuf = gdk_pixbuf_new_from_file(priv->icon_name, NULL); + if (pixbuf && icon_size > 1) + { + /*An icon specified by path and filename may be the wrong size for the tray */ +- pixbuf = gdk_pixbuf_scale_simple(pixbuf, scale * icon_size - 2, scale * icon_size - 2, GDK_INTERP_BILINEAR); ++ pixbuf = gdk_pixbuf_scale_simple(pixbuf, icon_size - 2, icon_size - 2, GDK_INTERP_BILINEAR); ++ surface = gdk_cairo_surface_create_from_pixbuf(pixbuf, scale, NULL); ++ } ++ ++ if (pixbuf) ++ { ++ g_object_unref(pixbuf); + } + } +- if (!pixbuf) ++ if (!surface) + { + /*deal with missing icon or failure to load icon*/ +- pixbuf = get_icon_by_name("image-missing", icon_size); +- } +- +- if (pixbuf) +- { +- gtk_image_set_from_pixbuf(GTK_IMAGE(priv->image), pixbuf); +- g_object_unref(pixbuf); ++ surface = get_icon_by_name("image-missing", icon_size, scale); + } + ++ gtk_image_set_from_surface(GTK_IMAGE(priv->image), surface); + g_free(priv->icon); + priv->icon = g_strdup(priv->icon_name); + } +@@ -551,7 +554,6 @@ update(KiranSnIcon *icon) + icon_size); + if (surface != NULL) + { +- cairo_surface_set_device_scale(surface, scale, scale); + gtk_image_set_from_surface(GTK_IMAGE(priv->image), surface); + + g_free(priv->icon); +@@ -579,6 +581,11 @@ update(KiranSnIcon *icon) + cairo_surface_destroy(surface); + } + } ++ else ++ { ++ gtk_image_set_from_icon_name(GTK_IMAGE(priv->image), "image-missing", GTK_ICON_SIZE_MENU); ++ gtk_image_set_pixel_size(GTK_IMAGE(priv->image), icon_size); ++ } + + tip = priv->tooltip; + if (tip != NULL) +-- +2.36.1 + diff --git a/0001-fix-tray-Fix-the-icon-location-error-when-system-res.patch b/0001-fix-tray-Fix-the-icon-location-error-when-system-res.patch new file mode 100644 index 0000000..f39bb8a --- /dev/null +++ b/0001-fix-tray-Fix-the-icon-location-error-when-system-res.patch @@ -0,0 +1,33 @@ +From b2dc162c8ebaea927582a423b7467fd00023ab98 Mon Sep 17 00:00:00 2001 +From: wangxiaoqing +Date: Tue, 30 Aug 2022 11:22:55 +0800 +Subject: [PATCH] fix(tray):Fix the icon location error when system resolution + change +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +- 修复托盘区域获取托盘位置图标,更改分辨率后错误问题 + Releated #I5O77O + +Signed-off-by: wangxiaoqing +--- + src/tray/kiran-tray.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/tray/kiran-tray.c b/src/tray/kiran-tray.c +index 2e7d1b9..c169a1e 100644 +--- a/src/tray/kiran-tray.c ++++ b/src/tray/kiran-tray.c +@@ -992,7 +992,7 @@ get_widget_geometry(GtkWidget *widget) + { + window = gtk_widget_get_window(parent); + { +- gdk_window_get_position(window, &x, &y); ++ gdk_window_get_origin(window, &x, &y); + } + parent = gtk_widget_get_parent(parent); + } +-- +2.36.1 + diff --git a/kiran-menu.spec b/kiran-menu.spec index 9fd0520..7fe72ad 100644 --- a/kiran-menu.spec +++ b/kiran-menu.spec @@ -1,6 +1,6 @@ Name: kiran-menu Version: 2.3.0 -Release: 9 +Release: 11 Summary: Applets for mate panel from Kiran Desktop License: MulanPSL-2.0 @@ -14,7 +14,9 @@ Patch1004: 0001-fix-connect-Fix-some-possible-crash-problems-caused-.patch Patch1005: 0002-fix-coredump-Fix-the-coredump-problem-caused-by-null.patch Patch1006: 0001-fix-coredump-Fix-the-coredump-problem-caused-by-Rece.patch Patch1007: 0002-feature-gitlab-Add-.gitlab-ci.yml.patch -Patch1008: 0001-feature-menu-Add-flat-class-for-button-to-keep-consi.patch +Patch1008: 0001-fix-tray-Fix-the-icon-location-error-when-system-res.patch +Patch1009: 0001-fix-tray-Fix-the-dbus-icon-can-not-scaled-when-syste.patch +Patch1010: 0001-feature-menu-Add-flat-class-for-button-to-keep-consi.patch BuildRequires: cmake > 3.0 @@ -95,9 +97,15 @@ gtk-update-icon-cache -f /usr/share/icons/hicolor/ %changelog -* Thu Oct 13 2022 tangjie02 - 2.3.0-9 +* Thu Oct 13 2022 tangjie02 - 2.3.0-11 - KYOS-F: Add flat class for button to keep consistent with the color of color block. +* Tue Sep 06 2022 wangxiaoqing - 2.3.0-10 +- KYOS-B: Fix the dbus icon can not scaled when system scale changed.(#I5LQVE) + +* Tue Aug 30 2022 wangxiaoqing - 2.3.0-9 +- KYOS-B: Fix the icon location error when system resolution change. + * Thu Aug 25 2022 tangjie02 - 2.3.0-8 - KYOS-B: Fix the coredump problem caused by RecentFilesListBox::load