forked from AuroraMiddleware/gtk
Replace convertBaseToScreen & convertScreenToBase.
With convertPointToScreen & convertPointFromScreen when MacOS version is > =10.7, when the earlier functions were deprecated and replaced.
This commit is contained in:
parent
74aecac6fe
commit
4d0cae4468
@ -366,6 +366,22 @@
|
||||
|
||||
initialPositionKnown = NO;
|
||||
}
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101200
|
||||
- (NSPoint)convertPointToScreen:(NSPoint)point
|
||||
{
|
||||
NSRect inrect = NSMakeRect (point.x, point.y, 0.0, 0.0);
|
||||
NSRect outrect = [self convertRectToScreen: inrect];
|
||||
return (NSPoint)((CGRect)outrect).origin;
|
||||
|
||||
}
|
||||
|
||||
- (NSPoint)convertPointFromScreen:(NSPoint)point
|
||||
{
|
||||
NSRect inrect = NSMakeRect (point.x, point.y, 0.0, 0.0);
|
||||
NSRect outrect = [self convertRectFromScreen: inrect];
|
||||
return (NSPoint)((CGRect)outrect).origin;
|
||||
}
|
||||
#endif
|
||||
|
||||
- (BOOL)trackManualMove
|
||||
{
|
||||
@ -378,8 +394,11 @@
|
||||
|
||||
if (!inManualMove)
|
||||
return NO;
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
|
||||
currentLocation = [self convertBaseToScreen:[self mouseLocationOutsideOfEventStream]];
|
||||
#else
|
||||
currentLocation = [self convertPointToScreen:[self mouseLocationOutsideOfEventStream]];
|
||||
#endif
|
||||
newOrigin.x = currentLocation.x - initialMoveLocation.x;
|
||||
newOrigin.y = currentLocation.y - initialMoveLocation.y;
|
||||
|
||||
@ -410,7 +429,11 @@
|
||||
|
||||
inManualMove = YES;
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
|
||||
initialMoveLocation = [self convertBaseToScreen:[self mouseLocationOutsideOfEventStream]];
|
||||
#else
|
||||
initialMoveLocation = [self convertPointToScreen:[self mouseLocationOutsideOfEventStream]];
|
||||
#endif
|
||||
initialMoveLocation.x -= frame.origin.x;
|
||||
initialMoveLocation.y -= frame.origin.y;
|
||||
}
|
||||
@ -427,7 +450,11 @@
|
||||
|
||||
inTrackManualResize = YES;
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
|
||||
mouse_location = [self convertBaseToScreen:[self mouseLocationOutsideOfEventStream]];
|
||||
#else
|
||||
mouse_location = [self convertPointToScreen:[self mouseLocationOutsideOfEventStream]];
|
||||
#endif
|
||||
mdx = initialResizeLocation.x - mouse_location.x;
|
||||
mdy = initialResizeLocation.y - mouse_location.y;
|
||||
|
||||
@ -512,7 +539,12 @@
|
||||
resizeEdge = edge;
|
||||
|
||||
initialResizeFrame = [self frame];
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
|
||||
initialResizeLocation = [self convertBaseToScreen:[self mouseLocationOutsideOfEventStream]];
|
||||
#else
|
||||
initialResizeLocation = [self convertPointToScreen:[self mouseLocationOutsideOfEventStream]];
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@ -647,7 +679,13 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
|
||||
- (NSDragOperation)draggingUpdated:(id <NSDraggingInfo>)sender
|
||||
{
|
||||
NSPoint point = [sender draggingLocation];
|
||||
NSPoint screen_point = [self convertBaseToScreen:point];
|
||||
NSPoint screen_point;
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
|
||||
screen_point = [self convertBaseToScreen:point];
|
||||
#else
|
||||
screen_point = [self convertPointToScreen:point];
|
||||
#endif
|
||||
GdkEvent *event;
|
||||
int gx, gy;
|
||||
|
||||
@ -675,7 +713,13 @@ update_context_from_dragging_info (id <NSDraggingInfo> sender)
|
||||
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender
|
||||
{
|
||||
NSPoint point = [sender draggingLocation];
|
||||
NSPoint screen_point = [self convertBaseToScreen:point];
|
||||
NSPoint screen_point;
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
|
||||
screen_point = [self convertBaseToScreen:point];
|
||||
#else
|
||||
screen_point = [self convertPointToScreen:point];
|
||||
#endif
|
||||
GdkEvent *event;
|
||||
int gy, gx;
|
||||
|
||||
|
@ -53,7 +53,10 @@
|
||||
#ifdef AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER
|
||||
-(void)setStyleMask:(NSUInteger)styleMask;
|
||||
#endif
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 101200
|
||||
- (NSPoint)convertPointToScreen:(NSPoint)point;
|
||||
- (NSPoint)convertPointFromScreen:(NSPoint)point;
|
||||
#endif
|
||||
@end
|
||||
|
||||
|
||||
|
@ -394,12 +394,15 @@ get_window_point_from_screen_point (GdkWindow *window,
|
||||
gint *y)
|
||||
{
|
||||
NSPoint point;
|
||||
NSWindow *nswindow;
|
||||
GdkQuartzNSWindow *nswindow;
|
||||
|
||||
nswindow = ((GdkWindowImplQuartz *)window->impl)->toplevel;
|
||||
nswindow = (GdkQuartzNSWindow*)(((GdkWindowImplQuartz *)window->impl)->toplevel);
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070
|
||||
point = [nswindow convertScreenToBase:screen_point];
|
||||
|
||||
#else
|
||||
point = [nswindow convertPointFromScreen:screen_point];
|
||||
#endif
|
||||
*x = point.x;
|
||||
*y = window->height - point.y;
|
||||
}
|
||||
@ -413,6 +416,8 @@ is_mouse_button_press_event (NSEventType type)
|
||||
case NSRightMouseDown:
|
||||
case NSOtherMouseDown:
|
||||
return TRUE;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
@ -473,8 +478,12 @@ get_toplevel_from_ns_event (NSEvent *nsevent,
|
||||
}
|
||||
else
|
||||
{
|
||||
*screen_point = [[nsevent window] convertBaseToScreen:point];
|
||||
|
||||
if (gdk_quartz_osx_version () >= GDK_OSX_LION)
|
||||
*screen_point = [(GdkQuartzNSWindow*)[nsevent window] convertPointToScreen:point];
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 10700
|
||||
else
|
||||
*screen_point = [[nsevent window] convertBaseToScreen:point];
|
||||
#endif
|
||||
*x = point.x;
|
||||
*y = toplevel->height - point.y;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user