After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 769302 - Desktop margins do not scale on high-dpi setups.
Desktop margins do not scale on high-dpi setups.
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: Desktop
unspecified
Other Linux
: Normal minor
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-07-29 12:31 UTC by Andrea Azzarone
Modified: 2016-08-01 17:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to make sure the desktop margins are properly scaled for high-dpi setups. (1.56 KB, patch)
2016-07-29 12:34 UTC, Andrea Azzarone
reviewed Details | Review
[PATCH] desktop-canvas-view: scale desktop workarea (1.86 KB, patch)
2016-07-29 18:27 UTC, Andrea Azzarone
accepted-commit_now Details | Review
desktop-canvas-view: scale desktop workarea (1.85 KB, patch)
2016-07-30 07:59 UTC, Andrea Azzarone
none Details | Review
desktop-canvas-view: scale desktop workarea (1.85 KB, patch)
2016-07-30 09:24 UTC, Andrea Azzarone
none Details | Review
desktop-canvas-view: scale desktop workarea (1.85 KB, patch)
2016-07-30 09:27 UTC, Andrea Azzarone
none Details | Review
desktop-canvas-view: scale desktop workarea (1.85 KB, patch)
2016-07-30 09:43 UTC, Andrea Azzarone
none Details | Review
desktop-canvas-view: scale desktop workarea (1.85 KB, patch)
2016-07-30 09:46 UTC, Andrea Azzarone
none Details | Review
desktop-canvas-view: scale desktop workarea (1.85 KB, patch)
2016-07-30 15:35 UTC, Andrea Azzarone
committed Details | Review

Description Andrea Azzarone 2016-07-29 12:31:28 UTC
On hidpi displays newly created desktop icons are positioned under the Ubuntu Unity Launcher. Nautilus should take the monitor scaling into account when determining the offset for the desktop area. See bug https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/1564375 and a screenshot of the problem https://launchpadlibrarian.net/250528741/desktop-icon-screenshot.png.
Comment 1 Andrea Azzarone 2016-07-29 12:34:11 UTC
Created attachment 332349 [details] [review]
Patch to make sure the desktop margins are properly scaled for high-dpi setups.
Comment 2 Carlos Soriano 2016-07-29 12:59:36 UTC
Review of attachment 332349 [details] [review]:

The code looks good, thanks!

However, please follow commit messages guidelines.
https://wiki.gnome.org/Newcomers/CodeContributionWorkflow#Commit_guidelines

In this case:
- Tittle is too long
- The name of the modified file is inside brakets
- There is no description

Also you can take a look to any recent commit message in Nautilus log to do it properly.
Comment 3 Andrea Azzarone 2016-07-29 18:27:59 UTC
Created attachment 332365 [details] [review]
[PATCH] desktop-canvas-view: scale desktop workarea
Comment 4 Carlos Soriano 2016-07-30 07:32:45 UTC
Review of attachment 332365 [details] [review]:

Excellent thanks! Feel free to backport to any version.
Comment 5 Carlos Soriano 2016-07-30 07:33:37 UTC
Review of attachment 332365 [details] [review]:

Just a nitpick before pushing, remove the "[PATCH]" from the tittle.
Comment 6 Andrea Azzarone 2016-07-30 07:59:13 UTC
Created attachment 332373 [details] [review]
desktop-canvas-view: scale desktop workarea
Comment 7 Carlos Soriano 2016-07-30 08:07:41 UTC
Review of attachment 332373 [details] [review]:

Looks good now, good for fixing the width of the description too!
Comment 8 Carlos Soriano 2016-07-30 08:08:17 UTC
push using git-bz and obsolete the old patches so git-bz can work well.
Comment 9 Andrea Azzarone 2016-07-30 09:24:43 UTC
Created attachment 332380 [details] [review]
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".
Comment 10 Andrea Azzarone 2016-07-30 09:27:50 UTC
Created attachment 332381 [details] [review]
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".
Comment 11 Andrea Azzarone 2016-07-30 09:28:47 UTC
Comment on attachment 332381 [details] [review]
desktop-canvas-view: scale desktop workarea

>From 2a354784d5d328ac4eba1a578ec32369e333153d Mon Sep 17 00:00:00 2001
>From: Andrea Azzarone <azzaronea@gmail.com>
>Date: Sat, 30 Jul 2016 11:26:17 +0200
>Subject: 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
>---
> nautilus-desktop/nautilus-desktop-canvas-view.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
>diff --git a/nautilus-desktop/nautilus-desktop-canvas-view.c b/nautilus-desktop/nautilus-desktop-canvas-view.c
>index 1bb5052..4aa618a 100644
>--- a/nautilus-desktop/nautilus-desktop-canvas-view.c
>+++ b/nautilus-desktop/nautilus-desktop-canvas-view.c
>@@ -87,6 +87,7 @@ canvas_container_set_workarea (NautilusCanvasContainer *canvas_container,
> {
> 	int left, right, top, bottom;
> 	int screen_width, screen_height;
>+	int scale;
> 	int i;
> 
> 	left = right = top = bottom = 0;
>@@ -94,11 +95,14 @@ canvas_container_set_workarea (NautilusCanvasContainer *canvas_container,
> 	screen_width  = gdk_screen_get_width (screen);
> 	screen_height = gdk_screen_get_height (screen);
> 
>+	scale = gdk_window_get_scale_factor (gdk_screen_get_root_window (screen));
>+	scale = scale ? scale : 1;
>+
> 	for (i = 0; i < n_items; i += 4) {
>-		int x      = workareas [i];
>-		int y      = workareas [i + 1];
>-		int width  = workareas [i + 2];
>-		int height = workareas [i + 3];
>+		int x      = workareas [i] / scale;
>+		int y      = workareas [i + 1] / scale;
>+		int width  = workareas [i + 2] / scale;
>+		int height = workareas [i + 3] / scale;
> 
> 		if ((x + width) > screen_width || (y + height) > screen_height)
> 			continue;
>-- 
>2.7.4
Comment 12 Andrea Azzarone 2016-07-30 09:29:44 UTC
Using git-bz I cannot remove [PATCH] from the title.
Comment 13 Andrea Azzarone 2016-07-30 09:43:25 UTC
Created attachment 332382 [details] [review]
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".
Comment 14 Andrea Azzarone 2016-07-30 09:46:35 UTC
Created attachment 332383 [details] [review]
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".
Comment 15 Andrea Azzarone 2016-07-30 09:48:21 UTC
Hope it's ok now. Sorry for the mess, I'm not used to this workflow.
Comment 16 Carlos Soriano 2016-07-30 14:31:44 UTC
No worries, you can take a look at our guide for newcomers https://wiki.gnome.org/Newcomers

Specifically https://wiki.gnome.org/Newcomers/CodeContributionWorkflow

The patch was already ok. You just need to:
git bz attach 769302 HEAD;
git bz push origin HEAD;
Comment 17 Andrea Azzarone 2016-07-30 15:35:42 UTC
Created attachment 332393 [details] [review]
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".
Comment 18 Carlos Soriano 2016-08-01 07:14:27 UTC
Review of attachment 332393 [details] [review]:

LGTM
Comment 19 Iain Lane 2016-08-01 17:00:45 UTC
pushing for Andrea, thanks!

Attachment 332393 [details] pushed as 315a55d - desktop-canvas-view: scale desktop workarea
Comment 20 Iain Lane 2016-08-01 17:10:01 UTC
...and to gnome-3-{14,16,18.20} (!)