Skip to content

Commit e4848ac

Browse files
madsmtmkchibisov
authored andcommitted
Bump edition to 2024
The `_sys` crates edition was not bumped along the way due to heavy use of generators, which are still not updated to 2024 thus breaking build due to `unsafe` being required for `extern` now.
1 parent 0433af9 commit e4848ac

36 files changed

+175
-281
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
strategy:
4242
fail-fast: false
4343
matrix:
44-
rust_version: [1.71.0, stable, nightly]
44+
rust_version: [1.85.0, stable, nightly]
4545
platform:
4646
- { target: x86_64-pc-windows-msvc, os: windows-latest, }
4747
- { target: i686-pc-windows-msvc, os: windows-latest, }
@@ -59,10 +59,10 @@ jobs:
5959
- { target: x86_64-apple-darwin, os: macos-latest, }
6060
exclude:
6161
# Android is tested on stable-3
62-
- rust_version: '1.71.0'
62+
- rust_version: '1.85.0'
6363
platform: { target: aarch64-linux-android, os: ubuntu-latest, cmd: 'apk --' }
6464
include:
65-
- rust_version: '1.71.0'
65+
- rust_version: '1.85.0'
6666
platform: { target: aarch64-linux-android, os: ubuntu-latest, cmd: 'apk --' }
6767

6868

@@ -110,5 +110,5 @@ jobs:
110110

111111
- name: Lint with clippy
112112
shell: bash
113-
if: (matrix.rust_version == '1.71.0') && !contains(matrix.platform.options, '--no-default-features')
113+
if: (matrix.rust_version == '1.85.0') && !contains(matrix.platform.options, '--no-default-features')
114114
run: cargo clippy --workspace --all-targets --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES -- -Dwarnings

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
# Unreleased
22

33
- **Breaking:** Added `make_current_surfaceless(self)` for `{Possibly,Not}CurrentGlContext`.
4+
- Updated `objc2` frameworks dependency to `v0.3.2`.
5+
- Use `objc2-open-gl` instead of `cgl` dependency.
6+
- Bump MSRV from `1.71` to `1.85`.
47

58
# Version 0.32.3
69

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ members = [
1212

1313
[workspace.package]
1414
# MSRV. Also update in ci.yml
15-
rust-version = "1.71.0"
15+
rust-version = "1.85.0"
16+
edition = "2024"

glutin-winit/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ keywords = ["windowing", "opengl", "winit"]
77
license = "MIT"
88
readme = "README.md"
99
repository = "https://github.com/rust-windowing/glutin"
10-
edition = "2021"
1110
rust-version.workspace = true
11+
edition.workspace = true
1212

1313
[features]
1414
default = ["egl", "glx", "x11", "wayland", "wgl"]

glutin-winit/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ use raw_window_handle::RawWindowHandle;
2929
use winit::error::OsError;
3030
use winit::window::{Window, WindowAttributes};
3131

32-
#[cfg(glx_backend)]
33-
use winit::platform::x11::register_xlib_error_hook;
3432
#[cfg(x11_platform)]
3533
use winit::platform::x11::WindowAttributesExtX11;
34+
#[cfg(glx_backend)]
35+
use winit::platform::x11::register_xlib_error_hook;
3636

3737
#[cfg(all(not(egl_backend), not(glx_backend), not(wgl_backend), not(cgl_backend)))]
3838
compile_error!("Please select at least one api backend");

glutin/Cargo.toml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ readme = "README.md"
99
repository = "https://github.com/rust-windowing/glutin"
1010
documentation = "https://docs.rs/glutin"
1111
rust-version.workspace = true
12-
edition = "2021"
12+
edition.workspace = true
1313

1414
[features]
1515
default = ["egl", "glx", "x11", "wayland", "wgl"]
@@ -54,33 +54,37 @@ wayland-sys = { version = "0.31.1", default-features = false, features = [
5454
x11-dl = { version = "2.20.0", optional = true }
5555

5656
[target.'cfg(any(target_os = "macos"))'.dependencies]
57-
cgl = "0.3.2"
5857
dispatch2 = { version = "0.3.0", default-features = false, features = [
5958
"std",
6059
"objc2",
6160
] }
6261
objc2 = "0.6.1"
63-
objc2-core-foundation = { version = "0.3.1", default-features = false, features = [
62+
objc2-core-foundation = { version = "0.3.2", default-features = false, features = [
6463
"std",
6564
"CFBase",
6665
"CFString",
6766
"CFBundle",
6867
] }
69-
objc2-foundation = { version = "0.3.1", default-features = false, features = [
68+
objc2-foundation = { version = "0.3.2", default-features = false, features = [
7069
"std",
7170
"NSArray",
7271
"NSThread",
7372
] }
74-
objc2-app-kit = { version = "0.3.1", default-features = false, features = [
73+
objc2-app-kit = { version = "0.3.2", default-features = false, features = [
7574
"std",
7675
"objc2-core-foundation",
76+
"objc2-open-gl",
7777
"NSApplication",
7878
"NSResponder",
7979
"NSView",
8080
"NSWindow",
8181
"NSOpenGL",
8282
"NSOpenGLView",
8383
] }
84+
objc2-open-gl = { version = "0.3.2", default-features = false, features = [
85+
"std",
86+
"CGLTypes",
87+
] }
8488

8589
[build-dependencies]
8690
cfg_aliases = "0.2.1"

glutin/src/api/cgl/appkit.rs

Lines changed: 0 additions & 106 deletions
This file was deleted.

glutin/src/api/cgl/config.rs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
//! Everything related to `NSOpenGLPixelFormat`.
22
3+
use std::ptr::NonNull;
34
use std::sync::Arc;
45
use std::{fmt, iter};
56

7+
use objc2::AllocAnyThread;
68
use objc2::rc::Retained;
79
#[allow(deprecated)]
810
use objc2_app_kit::{
911
NSOpenGLPFAAccelerated, NSOpenGLPFAAllowOfflineRenderers, NSOpenGLPFAAlphaSize,
1012
NSOpenGLPFAColorFloat, NSOpenGLPFAColorSize, NSOpenGLPFADepthSize, NSOpenGLPFADoubleBuffer,
1113
NSOpenGLPFAMinimumPolicy, NSOpenGLPFAMultisample, NSOpenGLPFAOpenGLProfile,
1214
NSOpenGLPFASampleBuffers, NSOpenGLPFASamples, NSOpenGLPFAStencilSize, NSOpenGLPFAStereo,
13-
NSOpenGLPFATripleBuffer, NSOpenGLPixelFormatAttribute, NSOpenGLProfileVersion3_2Core,
14-
NSOpenGLProfileVersion4_1Core, NSOpenGLProfileVersionLegacy,
15+
NSOpenGLPFATripleBuffer, NSOpenGLPixelFormat, NSOpenGLPixelFormatAttribute,
16+
NSOpenGLProfileVersion3_2Core, NSOpenGLProfileVersion4_1Core, NSOpenGLProfileVersionLegacy,
1517
};
1618

1719
use crate::config::{
@@ -21,7 +23,6 @@ use crate::display::GetGlDisplay;
2123
use crate::error::{ErrorKind, Result};
2224
use crate::private::Sealed;
2325

24-
use super::appkit::NSOpenGLPixelFormat;
2526
use super::display::Display;
2627

2728
impl Display {
@@ -47,9 +48,10 @@ impl Display {
4748
attrs.push((r_size + g_size + b_size + template.alpha_size) as u32);
4849
},
4950
_ => {
50-
return Err(
51-
ErrorKind::NotSupported("luminance buffers are not supported with CGL").into()
51+
return Err(ErrorKind::NotSupported(
52+
"luminance buffers are not supported with CGL",
5253
)
54+
.into());
5355
},
5456
}
5557

@@ -113,7 +115,12 @@ impl Display {
113115
.find_map(|profile| {
114116
attrs[profile_attr_pos] = profile;
115117
// initWithAttributes returns None if the attributes were invalid
116-
unsafe { NSOpenGLPixelFormat::newWithAttributes(&attrs) }
118+
unsafe {
119+
NSOpenGLPixelFormat::initWithAttributes(
120+
<NSOpenGLPixelFormat as AllocAnyThread>::alloc(),
121+
NonNull::new(attrs.as_ptr().cast_mut()).unwrap(),
122+
)
123+
}
117124
})
118125
.ok_or(ErrorKind::BadConfig)?;
119126

@@ -135,11 +142,13 @@ pub struct Config {
135142
}
136143

137144
impl Config {
145+
#[allow(deprecated)]
138146
fn raw_attribute(&self, attrib: NSOpenGLPixelFormatAttribute) -> i32 {
139147
unsafe {
140148
let mut value = 0;
141149
self.inner.raw.getValues_forAttribute_forVirtualScreen(
142-
&mut value, attrib,
150+
NonNull::from(&mut value),
151+
attrib,
143152
// They do differ per monitor and require context. Which is kind of insane, but
144153
// whatever. Zero is a primary monitor.
145154
0,
@@ -228,9 +237,13 @@ impl Sealed for Config {}
228237
pub(crate) struct ConfigInner {
229238
display: Display,
230239
pub(crate) transparency: bool,
240+
#[allow(deprecated)]
231241
pub(crate) raw: Retained<NSOpenGLPixelFormat>,
232242
}
233243

244+
unsafe impl Send for ConfigInner {}
245+
unsafe impl Sync for ConfigInner {}
246+
234247
impl PartialEq for ConfigInner {
235248
fn eq(&self, other: &Self) -> bool {
236249
self.raw == other.raw

0 commit comments

Comments
 (0)