Skip to content

Commit

Permalink
Better fix. Fixes Codeux-Software#301
Browse files Browse the repository at this point in the history
  • Loading branch information
emsquared committed Jul 28, 2012
1 parent 29feb95 commit 6def6c7
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 4 deletions.
42 changes: 42 additions & 0 deletions Classes/Headers/NSScreenHelper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/* *********************************************************************
_____ _ _ ___ ____ ____
|_ _|___ _| |_ _ _ __ _| | |_ _| _ \ / ___|
| |/ _ \ \/ / __| | | |/ _` | | | || |_) | |
| | __/> <| |_| |_| | (_| | | | || _ <| |___
|_|\___/_/\_\\__|\__,_|\__,_|_| |___|_| \_\\____|
Copyright (c) 2010 — 2012 Codeux Software & respective contributors.
Please see Contributors.pdf and Acknowledgements.pdf
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Textual IRC Client & Codeux Software nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*********************************************************************** */

#import "TextualApplication.h"

@interface NSScreen (TXScreenHelper)
- (BOOL)runningInHighResolutionMode;
@end
1 change: 1 addition & 0 deletions Classes/Headers/TextualApplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
#import "NSOutlineViewHelper.h"
#import "NSPasteboardHelper.h"
#import "NSRectHelper.h"
#import "NSScreenHelper.h"
#import "NSSplitViewHelper.h"
#import "NSStringHelper.h"
#import "NSTextFieldHelper.h"
Expand Down
53 changes: 53 additions & 0 deletions Classes/Helpers/Cocoa (Objective-C)/NSScreenHelper.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/* *********************************************************************
_____ _ _ ___ ____ ____
|_ _|___ _| |_ _ _ __ _| | |_ _| _ \ / ___|
| |/ _ \ \/ / __| | | |/ _` | | | || |_) | |
| | __/> <| |_| |_| | (_| | | | || _ <| |___
|_|\___/_/\_\\__|\__,_|\__,_|_| |___|_| \_\\____|
Copyright (c) 2010 — 2012 Codeux Software & respective contributors.
Please see Contributors.pdf and Acknowledgements.pdf
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Textual IRC Client & Codeux Software nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
*********************************************************************** */

#import "TextualApplication.h"

@implementation NSScreen (TXScreenHelper)

- (BOOL)runningInHighResolutionMode
{
if ([self respondsToSelector:@selector(backingScaleFactor)]) {
CGFloat scale = [self performSelector:@selector(backingScaleFactor)];

return (scale == 2.0f);
}

return NO;
}

@end
2 changes: 1 addition & 1 deletion Classes/Preferences/TPCPreferences.m
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ + (NSString *)applicationBundleIdentifier

+ (BOOL)runningInHighResolutionMode
{
return ([_NSMainScreen() backingScaleFactor] == 2.0f);
return ([_NSMainScreen() runningInHighResolutionMode]);
}

#pragma mark -
Expand Down
8 changes: 8 additions & 0 deletions Main Project (Textual).xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@
4C46CCCB1580469E00846B64 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C46CCC21580469E00846B64 /* WebKit.framework */; };
4C52379415C18F6700414852 /* Style Default Templates in Resources */ = {isa = PBXBuildFile; fileRef = 4C52379215C18F6700414852 /* Style Default Templates */; };
4C52379515C18F6700414852 /* Styles in Resources */ = {isa = PBXBuildFile; fileRef = 4C52379315C18F6700414852 /* Styles */; };
4C5A6DBF15C39B1900143574 /* NSScreenHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C5A6DBE15C39B1900143574 /* NSScreenHelper.h */; };
4C5A6DC115C39BD600143574 /* NSScreenHelper.m in Headers */ = {isa = PBXBuildFile; fileRef = 4C5A6DC015C39BD600143574 /* NSScreenHelper.m */; };
4C63C6B61592F0B0009F1635 /* TPWTB_Alerts.tif in Resources */ = {isa = PBXBuildFile; fileRef = 4C63C6B01592F0B0009F1635 /* TPWTB_Alerts.tif */; };
4C63C6B71592F0B0009F1635 /* [email protected] in Resources */ = {isa = PBXBuildFile; fileRef = 4C63C6B11592F0B0009F1635 /* [email protected] */; };
4C63C6BC1592F360009F1635 /* TPWTB_Extensions.tif in Resources */ = {isa = PBXBuildFile; fileRef = 4C63C6BA1592F360009F1635 /* TPWTB_Extensions.tif */; };
Expand Down Expand Up @@ -513,6 +515,8 @@
4C46CCC21580469E00846B64 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = /System/Library/Frameworks/WebKit.framework; sourceTree = "<absolute>"; };
4C52379215C18F6700414852 /* Style Default Templates */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "Style Default Templates"; path = "Resources/Styles/Style Default Templates"; sourceTree = SOURCE_ROOT; };
4C52379315C18F6700414852 /* Styles */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Styles; path = Resources/Styles/Styles; sourceTree = SOURCE_ROOT; };
4C5A6DBE15C39B1900143574 /* NSScreenHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSScreenHelper.h; sourceTree = "<group>"; };
4C5A6DC015C39BD600143574 /* NSScreenHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSScreenHelper.m; sourceTree = "<group>"; };
4C63C6B01592F0B0009F1635 /* TPWTB_Alerts.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = TPWTB_Alerts.tif; sourceTree = "<group>"; };
4C63C6B11592F0B0009F1635 /* [email protected] */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = "[email protected]"; sourceTree = "<group>"; };
4C63C6BA1592F360009F1635 /* TPWTB_Extensions.tif */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = TPWTB_Extensions.tif; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1326,6 +1330,7 @@
4C8AF54E158E99520026668C /* NSOutlineViewHelper.h */,
4C8AF54F158E99520026668C /* NSPasteboardHelper.h */,
4C8AF550158E99520026668C /* NSRectHelper.h */,
4C5A6DBE15C39B1900143574 /* NSScreenHelper.h */,
4C8AF551158E99520026668C /* NSSplitViewHelper.h */,
4C8AF552158E99520026668C /* NSStringHelper.h */,
4C8AF553158E99520026668C /* NSTextFieldHelper.h */,
Expand Down Expand Up @@ -1425,6 +1430,7 @@
4C8AF5A2158E99520026668C /* NSOutlineViewHelper.m */,
4C8AF5A3158E99520026668C /* NSPasteboardHelper.m */,
4C8AF5A4158E99520026668C /* NSRectHelper.m */,
4C5A6DC015C39BD600143574 /* NSScreenHelper.m */,
4C8AF5A5158E99520026668C /* NSSplitViewHelper.m */,
4C8AF5A6158E99520026668C /* NSStringHelper.m */,
4C8AF5A7158E99520026668C /* NSTextFieldHelper.m */,
Expand Down Expand Up @@ -1848,6 +1854,8 @@
4C211D5315BF1FCE00E218DA /* GRMustacheTemplateDelegate.h in Headers */,
4C211D5415BF1FCE00E218DA /* GRMustacheTemplateRepository.h in Headers */,
4C211D5515BF1FCE00E218DA /* GRMustacheVersion.h in Headers */,
4C5A6DBF15C39B1900143574 /* NSScreenHelper.h in Headers */,
4C5A6DC115C39BD600143574 /* NSScreenHelper.m in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
4 changes: 2 additions & 2 deletions Resources/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
<key>TXBundleBuildCodeName</key>
<string>Turtle Soup</string>
<key>TXBundleBuildNumber</key>
<string>12128</string>
<string>12131</string>
<key>TXBundleBuildReference</key>
<string>2.1.1-264-g5ac3028-debug</string>
<string>2.1.1-265-g29feb95-appstore</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion Resources/Plugins/System Profiler/TPI_SP_SysInfo.m
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ + (NSString *)activeScreenResolutions
screen.frame.size.height)];
}

if ([screen backingScaleFactor] == 2.0f) {
if ([screen runningInHighResolutionMode]) {
[result appendString:@"SystemInformationScreensCommandResultHighResoMode"];
}
}
Expand Down

0 comments on commit 6def6c7

Please sign in to comment.