Getting colder with our second freeze... it's 3.31.91 release day and string freeze, upload a tarball and lock those strings 🏂

Commit e97da503 authored by Oblomov's avatar Oblomov

X11 mixed dpi: scale intersection when finding monitor

If a window spans both a low- and high-DPI monitor, we need to take the
scaling factor into consideration, or the HiDPI monitor will appear to
have a larger part of the window (because it spans more physical
pixels) even though it actually intersects a smaller (scaled) area.
parent ba3e309c
......@@ -2713,12 +2713,17 @@ gdk_display_get_monitor_at_window (GdkDisplay *display,
GdkMonitor *monitor;
GdkRectangle mon, intersect;
int scale2;
int overlap;
monitor = gdk_display_get_monitor (display, i);
scale2 = gdk_monitor_get_scale_factor (monitor);
scale2 *= scale2;
gdk_monitor_get_geometry (monitor, &mon);
gdk_rectangle_intersect (&win, &mon, &intersect);
overlap = intersect.width *intersect.height;
overlap /= scale2;
if (overlap > area)
area = overlap;
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