Fedora21切换分辨率,桌面图标不重新排列?

大分辨率切换小分辨率下,桌面内容图标显示不全,
左下的部分被隐藏。
只有手工重新排列后才能显示全部图标。

5.jpg

 
已邀请:

loongnix

赞同来自:

已经解决了。
这个问题是mate桌面的caja软件包的一个Bug。在Fedora25中仍然存在。
龙芯提供这个patch文件,原理是修改caja,响应screen的size-changed事件,强行执行clean_up(),问题解决。

并且考虑到实际使用的效果,加了一点“人性化”的特性:只有在屏幕变小时才重排图标。
在3A3000笔记本上测试:

1400切换到800:重排图标,不再被挡住。
800 再切换到1400:图标不重排,保持原来位置不变。

这个patch最早包含在Fedora21的包中caja-1.8.2-3.fc21.loongson.3.src.rpm。预计将在Fedora21的3月份版本中集成发布。
From c6bf978081af901eb6e9911b82f3ae8df9e9519b Mon Sep 17 00:00:00 2001
From: Jin Guojie <jinguojie@loongson.cn>
Date: Thu, 2 Mar 2017 11:29:48 +0800
Subject: [PATCH 1/1] 改变分辨率时重排桌面图标
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
libcaja-private/caja-icon-container.c | 9 +++++++++
src/file-manager/fm-desktop-icon-view.c | 14 ++++++++++++++
2 files changed, 23 insertions(+)

diff --git a/libcaja-private/caja-icon-container.c b/libcaja-private/caja-icon-container.c
index d785f3e..16d6b25 100644
--- a/libcaja-private/caja-icon-container.c
+++ b/libcaja-private/caja-icon-container.c
@@ -2184,6 +2184,7 @@ lay_down_icons_vertical_desktop (CajaIconContainer *container, GList *icons)
int total, new_length, placed;
CajaIcon *icon;
int height, max_width, column_width, icon_width, icon_height;
+ int screen_height;
int x, y, x1, x2, y1, y2;
EelDRect icon_rect;
GtkAllocation allocation;
@@ -2192,6 +2193,14 @@ lay_down_icons_vertical_desktop (CajaIconContainer *container, GList *icons)
gtk_widget_get_allocation (GTK_WIDGET (container), &allocation);
height = CANVAS_HEIGHT(container, allocation);

+ /* 2017/3/2 Jin: 任务 #5159 改变分辨率时重排桌面图标,
+ * screen_height是屏幕实际已经变成的高度,
+ * 而container的height还是之前的高度,
+ * 比较两者可以判断出是屏幕“变小”了,只有这种情况才重排图标。 */
+ screen_height = gdk_screen_get_height (gtk_widget_get_screen(GTK_WIDGET(container)));
+ if (height > screen_height)
+ height = screen_height;
+
/* Determine which icons have and have not been placed */
placed_icons = NULL;
unplaced_icons = NULL;
diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c
index 1637532..c7c2359 100644
--- a/src/file-manager/fm-desktop-icon-view.c
+++ b/src/file-manager/fm-desktop-icon-view.c
@@ -318,6 +318,15 @@ fm_desktop_icon_view_class_init (FMDesktopIconViewClass *class)
g_type_class_add_private (class, sizeof (FMDesktopIconViewDetails));
}

+/* 2017/3/2 Jin: 任务 #5159 改变分辨率时重排桌面图标,
+ * screen改变分辨率的响应事件:强行调用重排图标的函数 */
+static void
+fm_desktop_icon_view_handle_size_changed (GdkScreen *screen,
+ FMDesktopIconView *desktop_icon_view)
+{
+ FM_ICON_VIEW_CLASS (fm_desktop_icon_view_parent_class)->clean_up (desktop_icon_view);
+}
+
static void
fm_desktop_icon_view_handle_middle_click (CajaIconContainer *icon_container,
GdkEventButton *event,
@@ -666,6 +675,11 @@ fm_desktop_icon_view_init (FMDesktopIconView *desktop_icon_view)
CAJA_ICON_LAYOUT_T_B_R_L :
CAJA_ICON_LAYOUT_T_B_L_R);

+ /* 2017/3/2 Jin: 任务 #5159 改变分辨率时重排桌面图标,
+ * 增加screen改变分辨率的事件 */
+ g_signal_connect_after(gtk_widget_get_screen(GTK_WIDGET(icon_container)), "size_changed",
+ G_CALLBACK (fm_desktop_icon_view_handle_size_changed), desktop_icon_view);
+
g_signal_connect_object (icon_container, "middle_click",
G_CALLBACK (fm_desktop_icon_view_handle_middle_click), desktop_icon_view, 0);
g_signal_connect_object (desktop_icon_view, "realize",
--
2.9.3

要回复问题请先登录注册