Skip to content

Commit

Permalink
Address more feedback.
Browse files Browse the repository at this point in the history
  • Loading branch information
metakirby5 committed Jun 8, 2024
1 parent e7c10cd commit 1de31d8
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions Phoenix/PHSpace.m
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ @implementation PHSpace
void CGSMoveWindowsToManagedSpace(CGSConnectionID connection, CFArrayRef windowIds, CGSSpaceID spaceId);

// XXX: Undocumented private API to set a space’s (legacy) compatId
CGError CGSSpaceSetCompatID(CGSConnectionID connection, CGSSpaceID spaceId, CGSMoveWindowCompatID compatID);
CGError CGSSpaceSetCompatID(CGSConnectionID connection, CGSSpaceID spaceId, CGSMoveWindowCompatID compatId);

// XXX: Undocumented private API to move the given windows (CGWindowIDs) to the given space by its (legacy) compatId
CGError CGSSetWindowListWorkspace(CGSConnectionID connection,
Expand Down Expand Up @@ -237,17 +237,6 @@ - (void)removeWindows:(NSArray<PHWindow *> *)windows {
(__bridge CFArrayRef) @[@(self.identifier)]);
}

- (void)moveWindows:(NSArray<PHWindow *> *)windows {
if (![NSProcessInfo isOperatingSystemAtLeastSonoma145]) {
CGSMoveWindowsToManagedSpace(
CGSMainConnectionID(), (__bridge CFArrayRef)[self identifiersForWindows:windows], self.identifier);
return;
}

// CGSMoveWindowsToManagedSpace is broken in MacOS 14.5, so use the legacy Compat ID API instead.
[self moveWindowsWithCompatId:windows];
}

/**
* - https://github.com/kasper/phoenix/issues/348
* - https://github.com/koekeishiya/yabai/issues/2240#issuecomment-2116326165
Expand All @@ -268,4 +257,15 @@ - (void)moveWindowsWithCompatId:(NSArray<PHWindow *> *)windows {
CGSSpaceSetCompatID(connection, self.identifier, 0x0);
}

- (void)moveWindows:(NSArray<PHWindow *> *)windows {
if (![NSProcessInfo isOperatingSystemAtLeastSonoma145]) {
CGSMoveWindowsToManagedSpace(
CGSMainConnectionID(), (__bridge CFArrayRef)[self identifiersForWindows:windows], self.identifier);
return;
}

// CGSMoveWindowsToManagedSpace is broken in MacOS 14.5, so use the legacy Compat ID API instead.
[self moveWindowsWithCompatId:windows];
}

@end

0 comments on commit 1de31d8

Please sign in to comment.