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

fix: Update to objc2 0.3.0-beta.4; use new icrate bindings #200

Closed
wants to merge 1 commit into from

Conversation

mwcampbell
Copy link
Contributor

fixes #199

Switching from our own AppKit bindings to the new ones in icrate isn't strictly necessary to fix the bug, but I figured it was a good idea anyway.

@madsmtm Please review.

@@ -13,6 +13,13 @@ edition = "2021"
[dependencies]
accesskit = { version = "0.8.1", path = "../../common" }
accesskit_consumer = { version = "0.11.0", path = "../../consumer" }
objc2 = "0.3.0-beta.3"
objc2 = "0.3.0-beta.4"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm on holiday at the moment, will gladly review it later.

To fix it in the interim, you should use objc2 = "=0.3.0-beta.3" instead, at least until I've released a stable version.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though even with this, you should use "=" so that it doesn't break again in the future (this is just a quirk in how pre-release versions work)

Suggested change
objc2 = "0.3.0-beta.4"
objc2 = "=0.3.0-beta.4"

Copy link
Contributor

@madsmtm madsmtm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything looks good, except for the version thing.

Note that this will make accesskit quite slow to compile, though I'm working on resolving that in madsmtm/objc2#311

@@ -13,6 +13,13 @@ edition = "2021"
[dependencies]
accesskit = { version = "0.8.1", path = "../../common" }
accesskit_consumer = { version = "0.11.0", path = "../../consumer" }
objc2 = "0.3.0-beta.3"
objc2 = "0.3.0-beta.4"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Though even with this, you should use "=" so that it doesn't break again in the future (this is just a quirk in how pre-release versions work)

Suggested change
objc2 = "0.3.0-beta.4"
objc2 = "=0.3.0-beta.4"

foundation::MainThreadMarker,
rc::{Id, Shared, WeakId},
};
use icrate::{AppKit::*, Foundation::MainThreadMarker};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: AppKit::* is a lot of types, I'd probably recommend importing the specifics you need instead (when feasible)

use std::rc::Rc;

use crate::{
appkit::*,
context::Context,
node::{filter, filter_detached, NodeWrapper},
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit:

I'd recommend using NSAccessibilityNotificationName in QueuedEvent::Generic::notification below, since that is actually the correct type.

Likewise for QueuedEvent::Announcement::priority being NSAccessibilityPriorityLevel

Comment on lines +39 to 52
let window = unsafe { view.window() }.unwrap();
let point = unsafe { window.convertPointFromScreen(point) };
let point = unsafe { view.convertPoint_fromView(point, None) };
// AccessKit coordinates are in physical (DPI-dependent) pixels, but
// macOS provides logical (DPI-independent) coordinates here.
let factor = view.backing_scale_factor();
let factor = unsafe { window.backingScaleFactor() };
let point = Point::new(
point.x * factor,
if view.is_flipped() {
if unsafe { view.isFlipped() } {
point.y * factor
} else {
let view_bounds = view.bounds();
let view_bounds = unsafe { view.bounds() };
(view_bounds.size.height - point.y) * factor
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: These methods are always safe, and will be marked as such in icrate in the future ;)

@mwcampbell
Copy link
Contributor Author

I will probably reverse the description to pull the AppKit definitions from icrate, due to the substantial increase in compile time. I don't want developers that care about compile time to reject AccessKit. In any case, there's no longer any urgency to this PR, since the dependency on objc2 is now correctly pinned in main.

@waywardmonkeys
Copy link
Contributor

It looks like this should now update to objc2 version 0.4.x and the current icrate which uses features to control which things are included to keep acceptable compile times.

Is that correct?

@mwcampbell
Copy link
Contributor Author

Yes, I've known about objc2 0.4.0 for several days but have been putting off working on this.

@waywardmonkeys
Copy link
Contributor

I'm thinking about doing it this month or next, if you like.

@mwcampbell
Copy link
Contributor Author

OK, I'll abandon this PR and look forward to your contribution. Thanks!

@mwcampbell mwcampbell closed this Aug 8, 2023
@DataTriny DataTriny deleted the objc2-0.3.0-beta.4 branch December 28, 2023 16:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Recent objc2's commit breaks the build.
3 participants