Skip to content

Commit

Permalink
Update objc2 and icrate versions
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Dec 5, 2023
1 parent 056a45b commit 79ff85e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
6 changes: 6 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,9 @@ members = [
"glutin_wgl_sys",
"glutin_gles2_sys",
]

[patch.crates-io]
objc2 = { path = "../objc2/crates/objc2" }
block-sys = { path = "../objc2/crates/block-sys" }
objc-sys = { path = "../objc2/crates/objc-sys" }
icrate = { path = "../objc2/crates/icrate" }
6 changes: 2 additions & 4 deletions glutin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,10 @@ x11-dl = { version = "2.20.0", optional = true }
[target.'cfg(any(target_os = "macos"))'.dependencies]
cgl = "0.3.2"
core-foundation = "0.9.3"
# Enable `relax-void-encoding` until https://github.com/madsmtm/objc2/pull/526 is resolved
objc2 = { version = "0.4.1", features = ["relax-void-encoding"] }
dispatch = "0.2.0"
objc2 = "0.5.0"

[target.'cfg(any(target_os = "macos"))'.dependencies.icrate]
version = "0.0.4"
version = "0.1.0"
features = [
"dispatch",
"Foundation",
Expand Down
6 changes: 3 additions & 3 deletions glutin/src/api/cgl/appkit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pub struct CGLContextObj {
}

unsafe impl RefEncode for CGLContextObj {
const ENCODING_REF: Encoding = Encoding::Pointer(&Encoding::Void);
const ENCODING_REF: Encoding = Encoding::Pointer(&Encoding::Struct("_CGLContextObject", &[]));
}

extern_class!(
Expand All @@ -42,7 +42,7 @@ extern_methods!(

#[method_id(initWithFormat:shareContext:)]
pub(crate) fn initWithFormat_shareContext(
this: Option<Allocated<Self>>,
this: Allocated<Self>,
format: &NSOpenGLPixelFormat,
share: Option<&NSOpenGLContext>,
) -> Option<Id<Self>>;
Expand Down Expand Up @@ -97,7 +97,7 @@ extern_methods!(
unsafe impl NSOpenGLPixelFormat {
#[method_id(initWithAttributes:)]
unsafe fn initWithAttributes(
this: Option<Allocated<Self>>,
this: Allocated<Self>,
attrs: *const NSOpenGLPixelFormatAttribute,
) -> Option<Id<Self>>;

Expand Down
4 changes: 2 additions & 2 deletions glutin/src/api/cgl/surface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl<T: SurfaceTypeTrait> GlSurface<T> for Surface<T> {
fn width(&self) -> Option<u32> {
let window = &self.ns_window;
let view = &self.ns_view;
MainThreadMarker::run_on_main(|mtm| unsafe {
MainThreadMarker::run_on_main(|mtm| {
let scale_factor = window.get(mtm).backingScaleFactor();
let frame = view.get(mtm).frame();
Some((frame.size.width * scale_factor) as u32)
Expand All @@ -119,7 +119,7 @@ impl<T: SurfaceTypeTrait> GlSurface<T> for Surface<T> {
fn height(&self) -> Option<u32> {
let window = &self.ns_window;
let view = &self.ns_view;
MainThreadMarker::run_on_main(|mtm| unsafe {
MainThreadMarker::run_on_main(|mtm| {
let scale_factor = window.get(mtm).backingScaleFactor();
let frame = view.get(mtm).frame();
Some((frame.size.height * scale_factor) as u32)
Expand Down

0 comments on commit 79ff85e

Please sign in to comment.