summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrea Azzarone <azzaronea@gmail.com>2016-07-30 17:33:40 +0200
committerIain Lane <iain@orangesquash.org.uk>2016-08-01 18:03:47 +0100
commite781e9894d53e8a995ba32ccb816536d3b461cba (patch)
tree7ba6eb43cbaf1480a312402f5fcdf91fd874e6c3
parent3c1e1709164bcbf19eb24dbd9bf9801ce4be5f01 (diff)
downloadnautilus-e781e9894d53e8a995ba32ccb816536d3b461cba.tar.gz
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
-rw-r--r--src/nautilus-desktop-canvas-view.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/nautilus-desktop-canvas-view.c b/src/nautilus-desktop-canvas-view.c
index 49224aab6..ae320f0bf 100644
--- a/src/nautilus-desktop-canvas-view.c
+++ b/src/nautilus-desktop-canvas-view.c
@@ -85,6 +85,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;
@@ -92,11 +93,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;