Skip to content

Commit

Permalink
Consistent formatting and xcode project things
Browse files Browse the repository at this point in the history
  • Loading branch information
cschep committed Apr 12, 2024
1 parent 39b3f7f commit 59e7409
Show file tree
Hide file tree
Showing 6 changed files with 128 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6ED47B60183BF3E800859244"
BuildableName = "Easy Move+Resize.app"
BlueprintName = "easy-move-resize"
ReferencedContainer = "container:easy-move-resize.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "65CF01611F229C34002259F2"
BuildableName = "easy-move-resizeTests.xctest"
BlueprintName = "easy-move-resizeTests"
ReferencedContainer = "container:easy-move-resize.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6ED47B60183BF3E800859244"
BuildableName = "Easy Move+Resize.app"
BlueprintName = "easy-move-resize"
ReferencedContainer = "container:easy-move-resize.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "6ED47B60183BF3E800859244"
BuildableName = "Easy Move+Resize.app"
BlueprintName = "easy-move-resize"
ReferencedContainer = "container:easy-move-resize.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
30 changes: 17 additions & 13 deletions easy-move-resize/EMRAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ - (id) init {
}

CGEventRef myCGEventCallback(CGEventTapProxy __unused proxy, CGEventType type, CGEventRef event, void *refcon) {

EMRAppDelegate *ourDelegate = (__bridge EMRAppDelegate*)refcon;
int keyModifierFlags = [ourDelegate modifierFlags];
bool shouldMiddleClickResize = [ourDelegate shouldMiddleClickResize];
Expand All @@ -37,7 +36,7 @@ CGEventRef myCGEventCallback(CGEventTapProxy __unused proxy, CGEventType type, C
return event;
}

if (shouldMiddleClickResize){
if (shouldMiddleClickResize) {
resizeModifierDown = kCGEventOtherMouseDown;
resizeModifierDragged = kCGEventOtherMouseDragged;
resizeModifierUp = kCGEventOtherMouseUp;
Expand Down Expand Up @@ -92,7 +91,7 @@ CGEventRef myCGEventCallback(CGEventTapProxy __unused proxy, CGEventType type, C

pid_t PID;
NSRunningApplication* app;
if(!AXUIElementGetPid(_clickedWindow, &PID)) {
if (!AXUIElementGetPid(_clickedWindow, &PID)) {
app = [NSRunningApplication runningApplicationWithProcessIdentifier:PID];
if ([[ourDelegate getDisabledApps] objectForKey:[app bundleIdentifier]] != nil) {
[moveResize setTracking:0];
Expand All @@ -101,7 +100,7 @@ CGEventRef myCGEventCallback(CGEventTapProxy __unused proxy, CGEventType type, C
[ourDelegate setMostRecentApp:app];
}

if([ourDelegate shouldBringWindowToFront]){
if ([ourDelegate shouldBringWindowToFront]) {
if (app != nil) {
[app activateWithOptions:NSApplicationActivateIgnoringOtherApps];
}
Expand Down Expand Up @@ -352,7 +351,7 @@ - (void)becameInactive:(NSNotification*) notification {
_sessionActive = false;
}

-(void)awakeFromNib{
- (void)awakeFromNib{
NSImage *icon = [NSImage imageNamed:@"MenuIcon"];
statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
[statusItem setMenu:statusMenu];
Expand Down Expand Up @@ -385,13 +384,13 @@ - (void)initMenuItems {
bool shouldMiddleClickResize = [preferences shouldMiddleClickResize];
bool resizeOnly = [preferences resizeOnly];

if(shouldBringWindowToFront){
if (shouldBringWindowToFront) {
[_bringWindowFrontMenu setState:1];
}
if(shouldMiddleClickResize){
if (shouldMiddleClickResize) {
[_middleClickResizeMenu setState:1];
}
if(resizeOnly){
if (resizeOnly) {
[_resizeOnlyMenu setState:1];
}

Expand Down Expand Up @@ -520,21 +519,26 @@ - (IBAction)toggleRefreshRate:(id)sender {
- (int)modifierFlags {
return keyModifierFlags;
}
- (void) setMostRecentApp:(NSRunningApplication*)app {

- (void)setMostRecentApp:(NSRunningApplication*)app {
lastApp = app;
[_lastAppMenu setTitle:[NSString stringWithFormat:@"Disable for %@", [app localizedName]]];
[_lastAppMenu setEnabled:YES];
}
- (NSDictionary*) getDisabledApps {

- (NSDictionary*)getDisabledApps {
return [preferences getDisabledApps];
}
-(BOOL)shouldBringWindowToFront {

- (BOOL)shouldBringWindowToFront {
return [preferences shouldBringWindowToFront];
}
-(BOOL)shouldMiddleClickResize {

- (BOOL)shouldMiddleClickResize {
return [preferences shouldMiddleClickResize];
}
-(BOOL)resizeOnly {

- (BOOL)resizeOnly {
return [preferences resizeOnly];
}

Expand Down
2 changes: 1 addition & 1 deletion easy-move-resize/EMRMoveResize.m
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ - (void)setWindow:(AXUIElementRef)window {
_window = window;
}

- (CFRunLoopSourceRef) runLoopSource {
- (CFRunLoopSourceRef)runLoopSource {
return _runLoopSource;
}

Expand Down
7 changes: 3 additions & 4 deletions easy-move-resize/EMRPreferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#define FN_KEY @"FN"

@interface EMRPreferences : NSObject {

}

@property (nonatomic) BOOL shouldBringWindowToFront;
Expand All @@ -33,13 +32,13 @@
- (id)initWithUserDefaults:(NSUserDefaults *)defaults;

// Get the modifier flags from the standard preferences
- (int) modifierFlags;
- (int)modifierFlags;

// Set or unset the given modifier key in the preferences
- (void) setModifierKey:(NSString*)singleFlagString enabled:(BOOL)enabled;
- (void)setModifierKey:(NSString*)singleFlagString enabled:(BOOL)enabled;

// returns a set of the currently persisted key constants
- (NSSet*) getFlagStringSet;
- (NSSet*)getFlagStringSet;

// returns a dict of disabled apps
- (NSDictionary*)getDisabledApps;
Expand Down
16 changes: 9 additions & 7 deletions easy-move-resize/EMRPreferences.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ - (void)setModifierFlagString:(NSString *)flagString {
[userDefaults setObject:flagString forKey:MODIFIER_FLAGS_DEFAULTS_KEY];
}


- (void)setModifierKey:(NSString *)singleFlagString enabled:(BOOL)enabled {
singleFlagString = [singleFlagString uppercaseString];
NSString *modifierFlagString = [userDefaults stringForKey:MODIFIER_FLAGS_DEFAULTS_KEY];
Expand Down Expand Up @@ -143,24 +142,27 @@ - (int)flagsFromFlagString:(NSString*)modifierFlagString {
return modifierFlags;
}

-(BOOL)shouldBringWindowToFront {
- (BOOL)shouldBringWindowToFront {
return [userDefaults boolForKey:SHOULD_BRING_WINDOW_TO_FRONT];
}
-(void)setShouldBringWindowToFront:(BOOL)bringToFront {

- (void)setShouldBringWindowToFront:(BOOL)bringToFront {
[userDefaults setBool:bringToFront forKey:SHOULD_BRING_WINDOW_TO_FRONT];
}

-(BOOL)shouldMiddleClickResize {
- (BOOL)shouldMiddleClickResize {
return [userDefaults boolForKey:SHOULD_MIDDLE_CLICK_RESIZE];
}
-(void)setShouldMiddleClickResize:(BOOL)middleClickResize {

- (void)setShouldMiddleClickResize:(BOOL)middleClickResize {
[userDefaults setBool:middleClickResize forKey:SHOULD_MIDDLE_CLICK_RESIZE];
}

-(BOOL)resizeOnly {
- (BOOL)resizeOnly {
return [userDefaults boolForKey:RESIZE_ONLY];
}
-(void)setResizeOnly:(BOOL)resizeOnly {

- (void)setResizeOnly:(BOOL)resizeOnly {
[userDefaults setBool:resizeOnly forKey:RESIZE_ONLY];
}

Expand Down

0 comments on commit 59e7409

Please sign in to comment.