kiran-menu/1008-fix-tray-when-resize-icon-window-it-is-necessary-to-.patch
2024-04-09 16:16:16 +08:00

48 lines
2.1 KiB
Diff
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

From 0de2a19f3935fd25dffc7e6b4931bb5c4a377d6a Mon Sep 17 00:00:00 2001
From: luoqing <luoqing@kylinsec.com.cn>
Date: Tue, 27 Feb 2024 11:06:34 +0800
Subject: [PATCH 1008/1008] fix(tray):when resize icon window, it is necessary
to consider the impact of the scale factor.The correct resize height is the
height of the container multiplied by the scale factor of the container.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 在resize icon window时,需要考虑缩放率的影响,正确的resize高度为容器的高乘以容器的缩放率
Close #30889
---
src/tray/kiran-tray.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/tray/kiran-tray.c b/src/tray/kiran-tray.c
index 9744ccc..fc361d8 100644
--- a/src/tray/kiran-tray.c
+++ b/src/tray/kiran-tray.c
@@ -1049,15 +1049,19 @@ void kiran_tray_resize_x11_icon_window(GdkDisplay *display,Window icon_window,Gt
GtkAllocation icon_allocation;
gtk_widget_get_allocation(widget, &icon_allocation);
- g_debug("icon container allocation height:%d",icon_allocation.height);
+ int scale = gtk_widget_get_scale_factor(widget);
+ g_debug("icon container allocation height:%d , scale:%d",icon_allocation.height, scale);
/**
+ * NOTE:
* 这里只将window的高与图标容器的高保持一致暂不限制window的宽 (#22117)
+ * 匹配window的高和容器的高时需要考虑缩放率的影响。
+ * 例如缩放率设置为200%在X协议层会对icon window的高度进行缩放 ,但是icon container容器高度没有变化
*/
- if(window_attributes.height != icon_allocation.height)
+ if(window_attributes.height != (icon_allocation.height * scale))
{
g_debug("resize X window");
- XResizeWindow(GDK_DISPLAY_XDISPLAY(display),icon_window,window_attributes.width,icon_allocation.height);
+ XResizeWindow(GDK_DISPLAY_XDISPLAY(display),icon_window,window_attributes.width,icon_allocation.height * scale);
XFlush(GDK_DISPLAY_XDISPLAY(display));
}
}
--
2.27.0