gtk+3: add patch for Retina screens

master
Tom Schoonjans 2017-05-11 13:30:22 +01:00
parent a4f965f026
commit 7717bf1b79
1 changed files with 32 additions and 0 deletions

View File

@ -10,6 +10,9 @@ class Gtkx3 < Formula
sha256 "9ae80358c79627df484a6e5c144efb86f14cf63f36c52d89234f0853977007f0" => :yosemite
end
# see https://bugzilla.gnome.org/show_bug.cgi?id=781118
patch :DATA
option "with-quartz-relocation", "Build with quartz relocation support"
depends_on "pkg-config" => :build
@ -111,3 +114,32 @@ class Gtkx3 < Formula
system "./test"
end
end
__END__
diff --git a/gdk/quartz/gdkscreen-quartz.c b/gdk/quartz/gdkscreen-quartz.c
index 586f7af..d032643 100644
--- a/gdk/quartz/gdkscreen-quartz.c
+++ b/gdk/quartz/gdkscreen-quartz.c
@@ -79,7 +79,7 @@ gdk_quartz_screen_init (GdkQuartzScreen *quartz_screen)
NSDictionary *dd = [[[NSScreen screens] objectAtIndex:0] deviceDescription];
NSSize size = [[dd valueForKey:NSDeviceResolution] sizeValue];
- _gdk_screen_set_resolution (screen, size.width);
+ _gdk_screen_set_resolution (screen, 72.0);
gdk_quartz_screen_calculate_layout (quartz_screen);
@@ -334,11 +334,8 @@ gdk_quartz_screen_get_height (GdkScreen *screen)
static gint
get_mm_from_pixels (NSScreen *screen, int pixels)
{
- const float mm_per_inch = 25.4;
- NSDictionary *dd = [[[NSScreen screens] objectAtIndex:0] deviceDescription];
- NSSize size = [[dd valueForKey:NSDeviceResolution] sizeValue];
- float dpi = size.width;
- return (pixels / dpi) * mm_per_inch;
+ const float dpi = 72.0;
+ return (pixels / dpi) * 25.4;
}
static gchar *