GNOME Bugzilla – Bug 769302
Desktop margins do not scale on high-dpi setups.
Last modified: 2016-08-01 17:10:01 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.
Created attachment 332349 [details] [review] Patch to make sure the desktop margins are properly scaled for high-dpi setups.
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.
Created attachment 332365 [details] [review] [PATCH] desktop-canvas-view: scale desktop workarea
Review of attachment 332365 [details] [review]: Excellent thanks! Feel free to backport to any version.
Review of attachment 332365 [details] [review]: Just a nitpick before pushing, remove the "[PATCH]" from the tittle.
Created attachment 332373 [details] [review] desktop-canvas-view: scale desktop workarea
Review of attachment 332373 [details] [review]: Looks good now, good for fixing the width of the description too!
push using git-bz and obsolete the old patches so git-bz can work well.
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".
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 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
Using git-bz I cannot remove [PATCH] from the title.
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".
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".
Hope it's ok now. Sorry for the mess, I'm not used to this workflow.
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;
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".
Review of attachment 332393 [details] [review]: LGTM
pushing for Andrea, thanks! Attachment 332393 [details] pushed as 315a55d - desktop-canvas-view: scale desktop workarea
...and to gnome-3-{14,16,18.20} (!)