it's 3.31.3 release day, upload a tarball and show that our software is more stable than this table 彡┻━┻

Commit dd0aa5cb authored by Oblomov's avatar Oblomov

X11 mixed dpi: set screen scale factor from reported DPI

parent 2e7ac262
......@@ -876,6 +876,17 @@ init_multihead (GdkScreen *screen)
return any_changed;
}
static gint
auto_window_scale(GdkScreen *screen)
{
const gint height = HeightOfScreen (GDK_X11_SCREEN (screen)->xscreen);
const gint height_mm = gdk_x11_screen_get_height_mm (screen);
const double dpi = height * 25.4 / height_mm;
const gint scale = (gint)(dpi/96);
return MAX(scale, 1);
}
static void
update_bounding_box (GdkScreen *screen)
{
......@@ -940,6 +951,7 @@ _gdk_x11_screen_new (GdkDisplay *display,
_gdk_x11_screen_init_visuals (screen);
_gdk_x11_screen_init_root_window (screen);
update_bounding_box (screen);
_gdk_x11_screen_set_window_scale (x11_screen, auto_window_scale (screen) );
return screen;
}
......@@ -1030,13 +1042,15 @@ void
_gdk_x11_screen_size_changed (GdkScreen *screen,
XEvent *event)
{
gint width, height;
gint width, height, width_mm, height_mm;
#ifdef HAVE_RANDR
GdkX11Display *display_x11;
#endif
width = gdk_x11_screen_get_width (screen);
height = gdk_x11_screen_get_height (screen);
width_mm = gdk_x11_screen_get_width_mm (screen);
height_mm = gdk_x11_screen_get_height_mm (screen);
#ifdef HAVE_RANDR
display_x11 = GDK_X11_DISPLAY (gdk_screen_get_display (screen));
......@@ -1060,6 +1074,10 @@ _gdk_x11_screen_size_changed (GdkScreen *screen,
process_monitors_change (screen);
if (width_mm != gdk_x11_screen_get_width_mm (screen) ||
height_mm != gdk_x11_screen_get_height_mm (screen) )
_gdk_x11_screen_set_window_scale (GDK_X11_SCREEN (screen), auto_window_scale (screen));
if (width != gdk_x11_screen_get_width (screen) ||
height != gdk_x11_screen_get_height (screen))
g_signal_emit_by_name (screen, "size-changed");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment