Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop - export configuration #211

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions ShiftIt/Base.lproj/MainMenu.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13D65" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11201" systemVersion="16A323" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment defaultVersion="1070" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11201"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
Expand All @@ -11,7 +11,7 @@
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customObject id="494" customClass="ShiftItAppDelegate">
<connections>
<outlet property="statusMenu_" destination="535" id="789"/>
Expand Down
14 changes: 6 additions & 8 deletions ShiftIt/Base.lproj/PreferencesWindow.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="5056" systemVersion="13D65" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="10117" systemVersion="15F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment defaultVersion="1080" identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="5056"/>
<deployment version="0.0" identifier="macosx"/>
<development version="5100" identifier="xcode"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="10117"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="PreferencesWindowController">
Expand All @@ -17,7 +18,7 @@
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" animationBehavior="default" id="1">
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
Expand Down Expand Up @@ -174,7 +175,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" columnSelection="YES" multipleSelection="NO" autosaveColumns="NO" rowSizeStyle="automatic" viewBased="YES" id="A5L-ln-QBX">
<rect key="frame" x="0.0" y="0.0" width="324" height="415"/>
<rect key="frame" x="0.0" y="0.0" width="324" height="0.0"/>
<autoresizingMask key="autoresizingMask"/>
<size key="intercellSpacing" width="6" height="2"/>
<color key="backgroundColor" white="1" alpha="0.0" colorSpace="calibratedWhite"/>
Expand Down Expand Up @@ -353,9 +354,6 @@
<numberFormatter key="formatter" formatterBehavior="default10_4" localizesFormat="NO" numberStyle="decimal" minimumIntegerDigits="1" maximumIntegerDigits="309" maximumFractionDigits="3" id="741">
<real key="minimum" value="1"/>
<real key="maximum" value="100"/>
<metadata>
<real key="inspectorSampleValue" value="12.449999999999999"/>
</metadata>
</numberFormatter>
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
Expand Down
2 changes: 1 addition & 1 deletion ShiftIt/FMT Tests/FMT Tests-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>net.fikovnik.projects.FMT.${PRODUCT_NAME:rfc1034identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
Expand Down
9 changes: 5 additions & 4 deletions ShiftIt/FMT/FMTHotKeyManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ of this software and associated documentation files (the "Software"), to deal
*/

#import <ShortcutRecorder/SRCommon.h>
#import <objc/runtime.h>
#import <objc/message.h>

#import "FMTHotKeyManager.h"
Expand Down Expand Up @@ -106,12 +107,12 @@ static inline OSStatus hotKeyHandler(EventHandlerCallRef inHandlerCallRef,EventR
GetEventParameter(inEvent,kEventParamDirectObject,typeEventHotKeyID,NULL,
sizeof(hotKeyID),NULL,&hotKeyID);

NSNumber *id = [NSNumber numberWithInt:hotKeyID.id];

TWHotKeyRegistartion* hotKeyReg = [allHotKeys objectForKey:id];
NSNumber *nid = [NSNumber numberWithInt:hotKeyID.id];

TWHotKeyRegistartion* hotKeyReg = [allHotKeys objectForKey:nid];

if (hotKeyReg != nil) {
objc_msgSend([hotKeyReg provider], [hotKeyReg handler], [hotKeyReg userData]);
((id (*)(id, SEL, id))objc_msgSend)([hotKeyReg provider], [hotKeyReg handler], [hotKeyReg userData]);
return noErr;
} else {
return eventNotHandledErr;
Expand Down
6 changes: 4 additions & 2 deletions ShiftIt/SIWindowManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,11 @@ - (BOOL) getFocusedWindow:(id<SIWindow> *)window error:(NSError **)error {
// get all windows order front to back
NSArray *allWindowsInfoList = (NSArray *) CGWindowListCopyWindowInfo(kCGWindowListOptionOnScreenOnly + kCGWindowListExcludeDesktopElements,
kCGNullWindowID);
// filter only real windows - layer 0
// filter only real windows - layer 0 && alpha != 0
NSArray *windowInfoList = [allWindowsInfoList filter:^BOOL(NSDictionary *item) {
return [[item objectForKey:(id)kCGWindowLayer] integerValue] == 0;
long layer = [[item objectForKey:(id)kCGWindowLayer] integerValue];
double alpha = [[item objectForKey:(id)kCGWindowAlpha] doubleValue];
return layer == 0 && alpha != 0;
}];

// get the first one - the front most window
Expand Down
171 changes: 85 additions & 86 deletions ShiftIt/ShiftIt Tests/SIAdjacentRectanglesTest.m
Original file line number Diff line number Diff line change
@@ -1,86 +1,85 @@
/*
ShiftIt: Window Organizer for OSX
Copyright (c) 2010-2011 Filip Krikava

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.

*/

#import <SenTestingKit/SenTestingKit.h>
#import "SIAdjacentRectangles.h"

@interface SIAdjacentRectanglesTest : SenTestCase
@end

@implementation SIAdjacentRectanglesTest

- (void)setUp {
[super setUp];
}

- (void)tearDown {
[super tearDown];
}

- (void)testTwoRectangles {
NSRect a = NSMakeRect(5, 5, 5, 5);
NSRect b = NSMakeRect(11, 6, 3, 3);
NSRect c = NSMakeRect(11, 15, 3, 3);
NSRect d = NSMakeRect(14, 11, 3, 3);
NSRect e = NSMakeRect(14, 6, 3, 3);
NSRect f = NSMakeRect(6, 13, 3, 3);
NSRect g = NSMakeRect(2, 13, 3, 3);
NSRect h = NSMakeRect(4, 17, 3, 3);
NSRect i = NSMakeRect(1, 8, 3, 3);
NSRect j = NSMakeRect(1, 4, 3, 3);
NSRect k = NSMakeRect(6, 1, 3, 3);

NSArray *rectValues = [NSArray arrayWithObjects:
[SIValueRect rect:a withValue:@"A"],
[SIValueRect rect:b withValue:@"B"],
[SIValueRect rect:c withValue:@"C"],
[SIValueRect rect:d withValue:@"D"],
[SIValueRect rect:e withValue:@"E"],
[SIValueRect rect:f withValue:@"F"],
[SIValueRect rect:g withValue:@"G"],
[SIValueRect rect:h withValue:@"H"],
[SIValueRect rect:i withValue:@"I"],
[SIValueRect rect:j withValue:@"J"],
[SIValueRect rect:k withValue:@"K"],
nil
];

SIAdjacentRectangles *adjr = [SIAdjacentRectangles adjacentRect:rectValues];
FMTDirection directions[] = {kRightDirection, kBottomDirection, kLeftDirection, kTopDirection};
NSArray *path = [adjr buildDirectionalPath:directions fromValue:@"A"];

STAssertEquals((NSUInteger)11, [path count], @"There is only one rectangle in right direction from A");
NSLog(@"%@",path);
}

- (void)testDirectionalPath {
NSRect a = NSMakeRect(5, 5, 5, 5);
NSRect b = NSMakeRect(11, 6, 3, 3);

NSArray *rectValues = [NSArray arrayWithObjects:
[SIValueRect rect:a withValue:@"A"],
[SIValueRect rect:b withValue:@"B"],
nil
];

SIAdjacentRectangles *adjr = [SIAdjacentRectangles adjacentRect:rectValues];

}

@end
///*
// ShiftIt: Window Organizer for OSX
// Copyright (c) 2010-2011 Filip Krikava
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
// */
//
//#import "SIAdjacentRectangles.h"
//
//@interface SIAdjacentRectanglesTest : SenTestCase
//@end
//
//@implementation SIAdjacentRectanglesTest
//
//- (void)setUp {
// [super setUp];
//}
//
//- (void)tearDown {
// [super tearDown];
//}
//
//- (void)testTwoRectangles {
// NSRect a = NSMakeRect(5, 5, 5, 5);
// NSRect b = NSMakeRect(11, 6, 3, 3);
// NSRect c = NSMakeRect(11, 15, 3, 3);
// NSRect d = NSMakeRect(14, 11, 3, 3);
// NSRect e = NSMakeRect(14, 6, 3, 3);
// NSRect f = NSMakeRect(6, 13, 3, 3);
// NSRect g = NSMakeRect(2, 13, 3, 3);
// NSRect h = NSMakeRect(4, 17, 3, 3);
// NSRect i = NSMakeRect(1, 8, 3, 3);
// NSRect j = NSMakeRect(1, 4, 3, 3);
// NSRect k = NSMakeRect(6, 1, 3, 3);
//
// NSArray *rectValues = [NSArray arrayWithObjects:
// [SIValueRect rect:a withValue:@"A"],
// [SIValueRect rect:b withValue:@"B"],
// [SIValueRect rect:c withValue:@"C"],
// [SIValueRect rect:d withValue:@"D"],
// [SIValueRect rect:e withValue:@"E"],
// [SIValueRect rect:f withValue:@"F"],
// [SIValueRect rect:g withValue:@"G"],
// [SIValueRect rect:h withValue:@"H"],
// [SIValueRect rect:i withValue:@"I"],
// [SIValueRect rect:j withValue:@"J"],
// [SIValueRect rect:k withValue:@"K"],
// nil
// ];
//
// SIAdjacentRectangles *adjr = [SIAdjacentRectangles adjacentRect:rectValues];
// FMTDirection directions[] = {kRightDirection, kBottomDirection, kLeftDirection, kTopDirection};
// NSArray *path = [adjr buildDirectionalPath:directions fromValue:@"A"];
//
// STAssertEquals((NSUInteger)11, [path count], @"There is only one rectangle in right direction from A");
// NSLog(@"%@",path);
//}
//
//- (void)testDirectionalPath {
// NSRect a = NSMakeRect(5, 5, 5, 5);
// NSRect b = NSMakeRect(11, 6, 3, 3);
//
// NSArray *rectValues = [NSArray arrayWithObjects:
// [SIValueRect rect:a withValue:@"A"],
// [SIValueRect rect:b withValue:@"B"],
// nil
// ];
//
// SIAdjacentRectangles *adjr = [SIAdjacentRectangles adjacentRect:rectValues];
//
//}
//
//@end
2 changes: 1 addition & 1 deletion ShiftIt/ShiftIt Tests/ShiftIt Tests-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>org.shiftitapp.shiftit.${PRODUCT_NAME:rfc1034identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
Expand Down
2 changes: 1 addition & 1 deletion ShiftIt/ShiftIt-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<key>CFBundleIconFile</key>
<string>ShiftIt.icns</string>
<key>CFBundleIdentifier</key>
<string>org.shiftitapp.${PRODUCT_NAME:rfc1034identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
Loading