adium/adium

a0b7e4250562
Parents 780fbb0dd353
Children b8acc0b7188c
Fixes HiDPI mode detection if a secondary display is connected and set as primary
- if a secondary display was connected to a retina mbp and set as the primary display, adium would fail to detect HiDPI and set avatar images too large for some services, causing disconnects from i.e. jabber services due to "policy violation"
- Fixes Ticket #16552

r=xnyhps
--- a/Copyright.txt Wed Dec 04 17:25:21 2013 +0100
+++ b/Copyright.txt Wed Dec 04 17:17:21 2013 +0100
@@ -72,6 +72,7 @@
Jack M.H. Lin
Paul R. Livesey
Daniel Ljungborg
+Johannes Loepelmann
Casey Lutz
Jeff Mahoney
Andreas Marienborg
--- a/Frameworks/AIUtilities Framework/Source/AIImageDrawingAdditions.m Wed Dec 04 17:25:21 2013 +0100
+++ b/Frameworks/AIUtilities Framework/Source/AIImageDrawingAdditions.m Wed Dec 04 17:17:21 2013 +0100
@@ -67,10 +67,18 @@
- (NSImage *)imageByScalingToSize:(NSSize)size DPI:(CGFloat)dpi
{
CGFloat backingScaleFactor = dpi / 72.0;
-
- if ([[NSScreen mainScreen] respondsToSelector:@selector(backingScaleFactor)]) {
- backingScaleFactor /= [[NSScreen mainScreen] backingScaleFactor];
- }
+
+ CGFloat screenScalingFactor = 1.0;
+
+ for(NSScreen* screen in [NSScreen screens]) {
+ if ([screen respondsToSelector:@selector(backingScaleFactor)]) {
+ if([screen backingScaleFactor] > screenScalingFactor) {
+ screenScalingFactor = [screen backingScaleFactor];
+ }
+ }
+ }
+
+ backingScaleFactor /= screenScalingFactor;
return ([self imageByScalingToSize:NSMakeSize(size.width * backingScaleFactor, size.height * backingScaleFactor) fraction:1.0f flipImage:NO proportionally:YES allowAnimation:YES]);
}