diff options
author | Andrea Azzarone <[email protected]> | 2016-07-30 17:33:40 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2018-04-05 09:06:38 +0200 |
commit | efb0d54b3bf73655f1e30c5e182c9239cb4fc61a (patch) | |
tree | 54241b8588c3ce621d0cae7cab1b1dca4c195edf /src/file-manager | |
parent | 7f22b3020c3b8acd1c062abc5f98fa5c2b38b544 (diff) | |
download | caja-efb0d54b3bf73655f1e30c5e182c9239cb4fc61a.tar.bz2 caja-efb0d54b3bf73655f1e30c5e182c9239cb4fc61a.tar.xz |
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
Diffstat (limited to 'src/file-manager')
-rw-r--r-- | src/file-manager/fm-desktop-icon-view.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c index a790d3f8..98a0258e 100644 --- a/src/file-manager/fm-desktop-icon-view.c +++ b/src/file-manager/fm-desktop-icon-view.c @@ -115,6 +115,7 @@ icon_container_set_workarea (CajaIconContainer *icon_container, { int left, right, top, bottom; int screen_width, screen_height; + int scale; int i; left = right = top = bottom = 0; @@ -122,12 +123,15 @@ icon_container_set_workarea (CajaIconContainer *icon_container, screen_width = WidthOfScreen (gdk_x11_screen_get_xscreen (screen)); screen_height = HeightOfScreen (gdk_x11_screen_get_xscreen (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; |