Skip to content

Commit

Permalink
Fixed a couple of warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jerrykrinock committed Aug 15, 2015
1 parent 25eedff commit 26dddc1
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 3 deletions.
8 changes: 5 additions & 3 deletions NSTableView+MoreSizing.m
@@ -1,4 +1,5 @@
#import "NSTableView+MoreSizing.h"
#import "NSWindow+Screening.h"

NSString* const constKeyMinWidthAnyColumn = @"minWidthAnyColumn" ;
NSString* const constKeyMinWidthFirstColumn = @"minWidthFirstColumn" ;
Expand Down Expand Up @@ -249,9 +250,10 @@ - (void)proportionWidths:(CGFloat[])defaultWidths {
}

- (NSTableColumn*)tableColumnOfCurrentMouseLocationWithInset:(CGFloat)inset {
NSPoint point = [[self window] convertScreenToBase:[NSEvent mouseLocation]] ;
CGFloat mouseX = [self convertPoint:point
fromView:nil].x ;
NSPoint screenPoint = [NSEvent mouseLocation] ;
NSPoint windowPoint = [[self window] pointFromScreenPoint:screenPoint] ;
CGFloat mouseX = [self convertPoint:windowPoint
fromView:nil].x ;

CGFloat spacing = [self intercellSpacing].width ;

Expand Down
11 changes: 11 additions & 0 deletions NSWindow+Screening.h
@@ -0,0 +1,11 @@
#import <Cocoa/Cocoa.h>

/*
@brief Replacement for deprecated -convertScreenToBase:
@details Why does Apple deprecate stuff you need without providing a
replacement? I do agree that -convertScreenToBase: was poorly named! */
@interface NSWindow (Screening)

- (NSPoint)pointFromScreenPoint:(NSPoint)screenPoint ;

@end
13 changes: 13 additions & 0 deletions NSWindow+Screening.m
@@ -0,0 +1,13 @@
#import "NSWindow+Screening.h"

@implementation NSWindow (Screening)

- (NSPoint)pointFromScreenPoint:(NSPoint)screenPoint {
NSRect screenRect ;
screenRect.origin = screenPoint ;
NSRect pointRect = [self convertRectFromScreen:screenRect] ;
NSPoint windowPoint = pointRect.origin ;
return windowPoint ;
}

@end

0 comments on commit 26dddc1

Please sign in to comment.