Created
November 12, 2014 17:42
-
-
Save jeromenerf/56a6bd951c1d08c2f851 to your computer and use it in GitHub Desktop.
POC for useless gaps in Spectacle App
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Spectacle/SpectacleConstants.h b/Spectacle/SpectacleConstants.h | |
index 7ffec1d..b605b83 100644 | |
--- a/Spectacle/SpectacleConstants.h | |
+++ b/Spectacle/SpectacleConstants.h | |
@@ -59,7 +59,7 @@ extern const NSInteger SpectacleEscapeKey; | |
#pragma mark - | |
extern const CGFloat SpectacleWindowSizeOffset; | |
- | |
+extern const CGFloat SpectacleUselessGap; | |
extern const CGFloat SpectacleMinimumWindowSizeRatio; | |
#pragma mark - | |
diff --git a/Spectacle/SpectacleConstants.m b/Spectacle/SpectacleConstants.m | |
index b50ae80..c94c04c 100644 | |
--- a/Spectacle/SpectacleConstants.m | |
+++ b/Spectacle/SpectacleConstants.m | |
@@ -61,7 +61,7 @@ const NSInteger SpectacleEscapeKey = 53; | |
#pragma mark - | |
const CGFloat SpectacleWindowSizeOffset = 30.0f; | |
- | |
+const CGFloat SpectacleUselessGap = 10.0f; | |
const CGFloat SpectacleMinimumWindowSizeRatio = 4.0f; | |
#pragma mark - | |
diff --git a/Spectacle/SpectacleWindowPositionCalculator.m b/Spectacle/SpectacleWindowPositionCalculator.m | |
index cb7422a..bbdc184 100644 | |
--- a/Spectacle/SpectacleWindowPositionCalculator.m | |
+++ b/Spectacle/SpectacleWindowPositionCalculator.m | |
@@ -21,7 +21,7 @@ | |
} else if (!MovingToThirdOfDisplay(action)) { | |
calculatedWindowRect.origin.x = visibleFrameOfScreen.origin.x; | |
} | |
- | |
+ | |
if (MovingToTopRegionOfDisplay(action)) { | |
calculatedWindowRect.origin.y = visibleFrameOfScreen.origin.y + floor(visibleFrameOfScreen.size.height / 2.0f); | |
} else if (MovingToCenterRegionOfDisplay(action)) { | |
@@ -42,11 +42,17 @@ | |
calculatedWindowRect.size.width = visibleFrameOfScreen.size.width; | |
calculatedWindowRect.size.height = visibleFrameOfScreen.size.height; | |
} | |
+ | |
if (MovingToThirdOfDisplay(action)) { | |
calculatedWindowRect = [SpectacleWindowPositionCalculator findThirdForWindowRect: calculatedWindowRect visibleFrameOfScreen: visibleFrameOfScreen withAction: action]; | |
} | |
- | |
+ | |
+ calculatedWindowRect.origin.x += SpectacleUselessGap; | |
+ calculatedWindowRect.origin.y += SpectacleUselessGap; | |
+ calculatedWindowRect.size.width -= 2*SpectacleUselessGap; | |
+ calculatedWindowRect.size.height -= 2*SpectacleUselessGap; | |
+ | |
return calculatedWindowRect; | |
} | |
@@ -104,6 +110,11 @@ | |
windowRect = previousWindowRect; | |
} | |
+ windowRect.size.height -= 2*SpectacleUselessGap; | |
+ windowRect.size.width -= 2*SpectacleUselessGap; | |
+ windowRect.origin.x -= SpectacleUselessGap; | |
+ windowRect.origin.y -= SpectacleUselessGap; | |
+ | |
return windowRect; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment