From 50831e539dc2988ee8fbc9538523b65dbc32563b Mon Sep 17 00:00:00 2001 From: Eric Czarny Date: Fri, 17 Apr 2015 11:45:05 -0400 Subject: [PATCH] Attempt to handle thirds in a bit more loosely. --- Spectacle/SpectacleWindowPositionManager.m | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/Spectacle/SpectacleWindowPositionManager.m b/Spectacle/SpectacleWindowPositionManager.m index 751a723..9b6ee37 100644 --- a/Spectacle/SpectacleWindowPositionManager.m +++ b/Spectacle/SpectacleWindowPositionManager.m @@ -242,14 +242,6 @@ - (void)moveWindowRect: (CGRect)windowRect frameOfScreen: (CGRect)frameOfScreen [self moveWindowRect: windowRect frontMostWindowElement: frontMostWindowElement]; CGRect movedWindowRect = [self rectOfWindowWithAccessibilityElement: frontMostWindowElement]; - - if (MovingToThirdOfDisplay(action) && !RectCenteredWithinRect(movedWindowRect, windowRect)) { - NSBeep(); - - [self moveWindowRect: previousWindowRect frontMostWindowElement: frontMostWindowElement]; - - return; - } if ((action != SpectacleWindowActionUndo) && (action != SpectacleWindowActionRedo)) { [self moveWindowRect:windowRect frontMostWindowElement: frontMostWindowElement]; @@ -292,6 +284,12 @@ - (void)moveWindowRect: (CGRect)windowRect frameOfScreen: (CGRect)frameOfScreen [self moveWindowRect: adjustedWindowRect frontMostWindowElement: frontMostWindowElement]; } } + + if (MovingToThirdOfDisplay(action) && !CGRectContainsRect(windowRect, movedWindowRect)) { + NSBeep(); + + [self moveWindowRect: previousWindowRect frontMostWindowElement: frontMostWindowElement]; + } } - (void)moveWindowRect: (CGRect)windowRect frontMostWindowElement: (ZKAccessibilityElement *)frontMostWindowElement {