Skip to content

Commit 35eb416

Browse files
azzar1lukefromdc
authored andcommitted
desktop-canvas-view: scale desktop workarea
The problem is that in the function canvas_container_set_workarea the screen width and height are in "application pixels" while the workarea ones are in "device pixels" so when the scaling is > 1, the margins are not properly setted. We need to scale-down the workarea geometries to "application pixels". https://bugzilla.gnome.org/show_bug.cgi?id=769302 origin commit: https://gitlab.gnome.org/GNOME/nautilus/commit/315a55df
1 parent 37ebfa8 commit 35eb416

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/file-manager/fm-desktop-icon-view.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,19 +115,23 @@ icon_container_set_workarea (CajaIconContainer *icon_container,
115115
{
116116
int left, right, top, bottom;
117117
int screen_width, screen_height;
118+
int scale;
118119
int i;
119120

120121
left = right = top = bottom = 0;
121122

122123
screen_width = WidthOfScreen (gdk_x11_screen_get_xscreen (screen));
123124
screen_height = HeightOfScreen (gdk_x11_screen_get_xscreen (screen));
124125

126+
scale = gdk_window_get_scale_factor (gdk_screen_get_root_window (screen));
127+
scale = scale ? scale : 1;
128+
125129
for (i = 0; i < n_items; i += 4)
126130
{
127-
int x = workareas [i];
128-
int y = workareas [i + 1];
129-
int width = workareas [i + 2];
130-
int height = workareas [i + 3];
131+
int x = workareas [i] / scale;
132+
int y = workareas [i + 1] / scale;
133+
int width = workareas [i + 2] / scale;
134+
int height = workareas [i + 3] / scale;
131135

132136
if ((x + width) > screen_width || (y + height) > screen_height)
133137
continue;

0 commit comments

Comments
 (0)