Skip to content

Commit

Permalink
Rename and reformat some files
Browse files Browse the repository at this point in the history
  • Loading branch information
saagarjha committed Feb 13, 2024
1 parent d6468bf commit d2f86e5
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 18 deletions.
16 changes: 8 additions & 8 deletions Ensemble.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
4901A1482B721BEF0040D2EE /* Permissions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4901A1472B721BEF0040D2EE /* Permissions.swift */; };
4901A1482B721BEF0040D2EE /* Permission.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4901A1472B721BEF0040D2EE /* Permission.swift */; };
4901A14A2B721EAB0040D2EE /* PermissionsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4901A1492B721EAB0040D2EE /* PermissionsView.swift */; };
4901A14C2B7246760040D2EE /* Preference.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4901A14B2B7246760040D2EE /* Preference.swift */; };
4901A14D2B7246760040D2EE /* Preference.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4901A14B2B7246760040D2EE /* Preference.swift */; };
Expand Down Expand Up @@ -60,11 +60,11 @@
49E09BD02AD52D9F00B56CD3 /* visionOSInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49E09BCF2AD52D9F00B56CD3 /* visionOSInterface.swift */; };
49E09BD12AD52D9F00B56CD3 /* visionOSInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49E09BCF2AD52D9F00B56CD3 /* visionOSInterface.swift */; };
49E09BD32AD5390500B56CD3 /* WindowPickerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49E09BD22AD5390500B56CD3 /* WindowPickerView.swift */; };
49EDAA6E2B28E58A00546EAB /* Events.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49EDAA6D2B28E58A00546EAB /* Events.swift */; };
49EDAA6E2B28E58A00546EAB /* EventDispatcher.swift in Sources */ = {isa = PBXBuildFile; fileRef = 49EDAA6D2B28E58A00546EAB /* EventDispatcher.swift */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
4901A1472B721BEF0040D2EE /* Permissions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Permissions.swift; sourceTree = "<group>"; };
4901A1472B721BEF0040D2EE /* Permission.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Permission.swift; sourceTree = "<group>"; };
4901A1492B721EAB0040D2EE /* PermissionsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PermissionsView.swift; sourceTree = "<group>"; };
4901A14B2B7246760040D2EE /* Preference.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Preference.swift; sourceTree = "<group>"; };
49226A2E2AE43EF50044CFC9 /* SPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SPI.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -113,7 +113,7 @@
49E09BCC2AD52D5900B56CD3 /* Multiplexer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Multiplexer.swift; sourceTree = "<group>"; };
49E09BCF2AD52D9F00B56CD3 /* visionOSInterface.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = visionOSInterface.swift; sourceTree = "<group>"; };
49E09BD22AD5390500B56CD3 /* WindowPickerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WindowPickerView.swift; sourceTree = "<group>"; };
49EDAA6D2B28E58A00546EAB /* Events.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Events.swift; sourceTree = "<group>"; };
49EDAA6D2B28E58A00546EAB /* EventDispatcher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventDispatcher.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -167,9 +167,9 @@
495A72332B78F0F500970992 /* ensemble_helper_v1.sh */,
49E09B582AD2EE5000B56CD3 /* ContentView.swift */,
49E09B562AD2EE5000B56CD3 /* EnsembleApp.swift */,
49EDAA6D2B28E58A00546EAB /* Events.swift */,
49EDAA6D2B28E58A00546EAB /* EventDispatcher.swift */,
49E09BC62AD52CCE00B56CD3 /* Local.swift */,
4901A1472B721BEF0040D2EE /* Permissions.swift */,
4901A1472B721BEF0040D2EE /* Permission.swift */,
4901A1492B721EAB0040D2EE /* PermissionsView.swift */,
49E09BC42AD52CC900B56CD3 /* Remote.swift */,
49226A302AE447C10044CFC9 /* ScreenRecorder.swift */,
Expand Down Expand Up @@ -396,7 +396,7 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
4901A1482B721BEF0040D2EE /* Permissions.swift in Sources */,
4901A1482B721BEF0040D2EE /* Permission.swift in Sources */,
49226A2F2AE43EF50044CFC9 /* SPI.swift in Sources */,
494DFBD12B29111C00205CAC /* Keys.swift in Sources */,
49E09BC72AD52CCE00B56CD3 /* Local.swift in Sources */,
Expand All @@ -411,7 +411,7 @@
4989D3402B0B9393005E2E7A /* shut_up_logging.c in Sources */,
4978BAAC2AD54EDB000C549C /* Video.swift in Sources */,
49E09BCD2AD52D5900B56CD3 /* Multiplexer.swift in Sources */,
49EDAA6E2B28E58A00546EAB /* Events.swift in Sources */,
49EDAA6E2B28E58A00546EAB /* EventDispatcher.swift in Sources */,
4901A14C2B7246760040D2EE /* Preference.swift in Sources */,
49E09BC22AD52C7800B56CD3 /* macOSInterface.swift in Sources */,
4992A6012B68291900844A16 /* WindowManager.swift in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion Shared/Bundle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ extension Bundle {
var name: String {
Bundle.main.infoDictionary![kCFBundleNameKey as String] as! String
}

var version: Int {
Int(Bundle.main.infoDictionary![kCFBundleVersionKey as String] as! String)!
}
Expand Down
6 changes: 3 additions & 3 deletions Shared/Preference.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ struct Preference<T>: DynamicProperty {
// Forces an update
@State
var value = false

let key: String
let defaultValue: T

Expand Down Expand Up @@ -61,7 +61,7 @@ struct CodablePreference<T: Codable> {
// Forces an update
@State
var value = false

var key: String
var defaultValue: T

Expand All @@ -87,7 +87,7 @@ struct CodablePreference<T: Codable> {
UserDefaults.standard.setValue(try! JSONEncoder().encode(newValue), forKey: key)
}
}

var projectedValue: Binding<T> {
Binding(
get: {
Expand Down
6 changes: 3 additions & 3 deletions macOS/Events.swift → macOS/EventDispatcher.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Events.swift
// EventDispatcher.swift
// macOS
//
// Created by Saagar Jha on 12/12/23.
Expand All @@ -12,7 +12,7 @@ actor EventDispatcher {
let event = CGEvent(mouseEventSource: nil, mouseType: .mouseMoved, mouseCursorPosition: location, mouseButton: .center)!
event.post(tap: .cghidEventTap)
}

var lastClick = ContinuousClock.Instant.now
var clickCount: Int64 = 0

Expand All @@ -21,7 +21,7 @@ actor EventDispatcher {
lastClick = .now
}
clickCount = ContinuousClock.Instant.now - lastClick < .seconds(NSEvent.doubleClickInterval) ? clickCount + 1 : 1

for direction in [.leftMouseDown, .leftMouseUp] as [CGEventType] {
let event = CGEvent(mouseEventSource: nil, mouseType: direction, mouseCursorPosition: location, mouseButton: .left)!
event.setIntegerValueField(.mouseEventClickState, value: clickCount)
Expand Down
2 changes: 1 addition & 1 deletion macOS/Permissions.swift → macOS/Permission.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Permissions.swift
// Permission.swift
// macOS
//
// Created by Saagar Jha on 2/5/24.
Expand Down
3 changes: 1 addition & 2 deletions macOS/SPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@

import CoreGraphics

typealias CGSConnectionID = CUnsignedInt

// FB13556001
typealias CGSConnectionID = CUnsignedInt
let skylight = dlopen("/System/Library/PrivateFrameworks/SkyLight.framework/SkyLight", RTLD_LAZY)
let SLSMainConnectionID = unsafeBitCast(dlsym(skylight, "SLSMainConnectionID"), to: (@convention(c) () -> CGSConnectionID)?.self)
let SLSCopyAssociatedWindows = unsafeBitCast(dlsym(skylight, "SLSCopyAssociatedWindows"), to: (@convention(c) (CGSConnectionID, CGWindowID) -> CFArray)?.self)
Expand Down

0 comments on commit d2f86e5

Please sign in to comment.