Skip to content

Refactor macOS to use new objc2 features#2465

Merged
madsmtm merged 9 commits intomasterfrom
macos-refactor-unsafe
Sep 8, 2022
Merged

Refactor macOS to use new objc2 features#2465
madsmtm merged 9 commits intomasterfrom
macos-refactor-unsafe

Conversation

@madsmtm
Copy link
Member

@madsmtm madsmtm commented Sep 2, 2022

The final part of #2427, for now. I'll still work some more on things (namely main thread safety, see #2464), but this PR is a huge step up in safety and ease-of-maintenance.

Concretely:

  • Move bindings into appkit module that exposes a safe API around (almost) all message sending
  • Use objc2's ivar mechanism, which is just magnitudes better than the with_state functions we did before
  • Use objc2::foundation which contains safe interfaces to common stuff like NSString, NSArray, ...
  • Remove cocoa dependency

Checklist:

  • Tested on all platforms changed

@madsmtm madsmtm added DS - appkit Affects the AppKit/macOS backend S - maintenance Repaying technical debt labels Sep 2, 2022
@madsmtm madsmtm added this to the Version 0.28 milestone Sep 2, 2022
@madsmtm madsmtm requested a review from august64 as a code owner September 2, 2022 21:40
@madsmtm madsmtm mentioned this pull request Sep 2, 2022
8 tasks
@madsmtm madsmtm force-pushed the macos-refactor-unsafe branch 2 times, most recently from 5c72c34 to ec25dd7 Compare September 2, 2022 22:05
The compiler fence is safe to get rid of now since `interpretKeyEvents` takes `&mut self`
@madsmtm madsmtm force-pushed the macos-refactor-unsafe branch from ec25dd7 to 8db12b2 Compare September 2, 2022 22:23
@madsmtm madsmtm removed the request for review from august64 September 2, 2022 22:23
@madsmtm madsmtm force-pushed the macos-refactor-unsafe branch from 8db12b2 to 00a809e Compare September 2, 2022 22:29
@madsmtm madsmtm changed the title Refactor macOS Refactor macOS to use new objc2 features Sep 3, 2022
@madsmtm madsmtm merged commit 340f951 into master Sep 8, 2022
@madsmtm madsmtm deleted the macos-refactor-unsafe branch September 8, 2022 14:45
@madsmtm madsmtm mentioned this pull request Nov 30, 2022
1 task
@madsmtm madsmtm mentioned this pull request Aug 27, 2023
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DS - appkit Affects the AppKit/macOS backend S - maintenance Repaying technical debt

Development

Successfully merging this pull request may close these issues.

1 participant