summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2018-03-29 16:09:16 -0400
committerlukefromdc <[email protected]>2018-04-04 21:53:21 -0400
commitef78aa3fe9043d256f269b4aa25234e42b9eecae (patch)
tree53c4185c0857e159d610c92eca71eee9698177c4 /src
parentcfd502157420406aa56a6b5319f0bd8dc90df8e4 (diff)
downloadcaja-ef78aa3fe9043d256f269b4aa25234e42b9eecae.tar.bz2
caja-ef78aa3fe9043d256f269b4aa25234e42b9eecae.tar.xz
Scale screen dimensions
Diffstat (limited to 'src')
-rw-r--r--src/caja-desktop-window.c14
-rw-r--r--src/caja-window.c6
-rw-r--r--src/file-manager/fm-desktop-icon-view.c6
3 files changed, 18 insertions, 8 deletions
diff --git a/src/caja-desktop-window.c b/src/caja-desktop-window.c
index 2aa0c2f5..16242dcd 100644
--- a/src/caja-desktop-window.c
+++ b/src/caja-desktop-window.c
@@ -114,9 +114,12 @@ caja_desktop_window_screen_size_changed (GdkScreen *screen,
CajaDesktopWindow *window)
{
int width_request, height_request;
+ int scale;
- width_request = WidthOfScreen (gdk_x11_screen_get_xscreen (screen));
- height_request = HeightOfScreen (gdk_x11_screen_get_xscreen (screen));
+ scale = gdk_window_get_scale_factor (gdk_screen_get_root_window (screen));
+
+ width_request = WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale;
+ height_request = HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale;
g_object_set (window,
"width_request", width_request,
@@ -130,9 +133,12 @@ caja_desktop_window_new (CajaApplication *application,
{
CajaDesktopWindow *window;
int width_request, height_request;
+ int scale;
+
+ scale = gdk_window_get_scale_factor (gdk_screen_get_root_window (screen));
- width_request = WidthOfScreen (gdk_x11_screen_get_xscreen (screen));
- height_request = HeightOfScreen (gdk_x11_screen_get_xscreen (screen));
+ width_request = WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale;
+ height_request = HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale;
window = CAJA_DESKTOP_WINDOW
(gtk_widget_new (caja_desktop_window_get_type(),
diff --git a/src/caja-window.c b/src/caja-window.c
index ac22b6d8..132ffd96 100644
--- a/src/caja-window.c
+++ b/src/caja-window.c
@@ -507,7 +507,8 @@ caja_window_zoom_to_default (CajaWindow *window)
static guint
get_max_forced_height (GdkScreen *screen)
{
- return (HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) * 90) / 100;
+ gint scale = gdk_window_get_scale_factor (gdk_screen_get_root_window (screen));
+ return (HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale * 90) / 100;
}
/* Code should never force the window wider than this size.
@@ -516,7 +517,8 @@ get_max_forced_height (GdkScreen *screen)
static guint
get_max_forced_width (GdkScreen *screen)
{
- return (WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) * 90) / 100;
+ gint scale = gdk_window_get_scale_factor (gdk_screen_get_root_window (screen));
+ return (WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale * 90) / 100;
}
/* This must be called when construction of CajaWindow is finished,
diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c
index 8cbf0b62..42186a70 100644
--- a/src/file-manager/fm-desktop-icon-view.c
+++ b/src/file-manager/fm-desktop-icon-view.c
@@ -392,10 +392,12 @@ realized_callback (GtkWidget *widget, FMDesktopIconView *desktop_icon_view)
GdkWindow *root_window;
GdkScreen *screen;
GtkAllocation allocation;
+ gint scale;
g_return_if_fail (desktop_icon_view->details->root_window == NULL);
screen = gtk_widget_get_screen (widget);
+ scale = gtk_widget_get_scale_factor (widget);
/* Ugly HACK for the problem that the views realize at the
* wrong size and then get resized. (This is a problem with
@@ -405,8 +407,8 @@ realized_callback (GtkWidget *widget, FMDesktopIconView *desktop_icon_view)
*/
allocation.x = 0;
allocation.y = 0;
- allocation.width = WidthOfScreen (gdk_x11_screen_get_xscreen (screen));
- allocation.height = HeightOfScreen (gdk_x11_screen_get_xscreen (screen));
+ allocation.width = WidthOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale;
+ allocation.height = HeightOfScreen (gdk_x11_screen_get_xscreen (screen)) / scale;
gtk_widget_size_allocate (GTK_WIDGET(get_icon_container(desktop_icon_view)),
&allocation);