Skip to content

Commit e89f4b6

Browse files
Merge #3050
3050: Upgrade to raw-window-handle v0.3 r=kvark a=antonok-edm Reopening #3037 against `master`, for merge whenever ready. Note that compiling examples currently doesn't work because `winit` still imports the old version of `raw-window-handle`; the two versions of the traits are incompatible. PR checklist: - [x] `make` succeeds (on *nix) - [x] `make reftests` succeeds - [x] tested examples with the following backends: `vulkan` - [x] `rustfmt` run on changed code Co-authored-by: Anton Lazarev <[email protected]>
2 parents 149c10b + e7b421f commit e89f4b6

File tree

8 files changed

+22
-11
lines changed

8 files changed

+22
-11
lines changed

examples/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ gfx-backend-empty = { path = "../src/backend/empty", version = "0.3" }
3737
env_logger = "0.6"
3838

3939
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
40-
winit = "0.20.0-alpha3"
40+
winit = "0.20.0-alpha4"
4141
glsl-to-spirv = "0.1.4"
4242

4343
[dependencies.gfx-backend-gl]

src/backend/dx11/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ spirv_cross = { version = "0.16", features = ["hlsl"] }
2828
parking_lot = "0.9"
2929
winapi = { version = "0.3", features = ["basetsd","d3d11", "d3d11sdklayers", "d3dcommon","d3dcompiler","dxgi1_2","dxgi1_3","dxgi1_4", "dxgi1_5", "dxgiformat","dxgitype","handleapi","minwindef","synchapi","unknwnbase","winbase","windef","winerror","winnt","winuser"] }
3030
wio = "0.2"
31-
raw-window-handle = "0.1"
31+
raw-window-handle = "0.3"
3232

3333
# This forces docs.rs to build the crate on windows, otherwise the build fails
3434
# and we get no docs at all.

src/backend/dx12/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ log = { version = "0.4" }
2727
smallvec = "0.6"
2828
spirv_cross = { version = "0.16", features = ["hlsl"] }
2929
winapi = { version = "0.3", features = ["basetsd","d3d12","d3d12sdklayers","d3d12shader","d3dcommon","d3dcompiler","dxgi1_2","dxgi1_3","dxgi1_4","dxgi1_6","dxgidebug","dxgiformat","dxgitype","handleapi","minwindef","synchapi","unknwnbase","winbase","windef","winerror","winnt","winuser"] }
30-
raw-window-handle = "0.1"
30+
raw-window-handle = "0.3"
3131

3232
# This forces docs.rs to build the crate on windows, otherwise the build fails
3333
# and we get no docs at all.

src/backend/empty/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ name = "gfx_backend_empty"
1313

1414
[dependencies]
1515
gfx-hal = { path = "../../hal", version = "0.3" }
16-
raw-window-handle = "0.1"
16+
raw-window-handle = "0.3"

src/backend/gl/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ glow = "0.3.0-alpha3"
3131
parking_lot = "0.9"
3232
spirv_cross = { version = "0.16", features = ["glsl"] }
3333
lazy_static = "1"
34-
raw-window-handle = { version = "0.1", optional = true }
34+
raw-window-handle = { version = "0.3", optional = true }
3535

3636
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
3737
glutin = { version = "0.22.0-alpha3", optional = true }
38+
raw-window-handle = "0.3"
3839

3940
[target.'cfg(target_arch = "wasm32")'.dependencies]
4041
js-sys = "0.3.6"

src/backend/metal/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ spirv_cross = { version = "0.16", features = ["msl"] }
4040
parking_lot = "0.9"
4141
storage-map = "0.2"
4242
lazy_static = "1"
43-
raw-window-handle = "0.1"
43+
raw-window-handle = "0.3"
4444

4545
# This forces docs.rs to build the crate on mac, otherwise the build fails
4646
# and we get no docs at all.

src/backend/vulkan/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ shared_library = { version = "0.1.9", optional = true }
2828
ash = "0.29.0"
2929
hal = { path = "../../hal", version = "0.3", package = "gfx-hal" }
3030
smallvec = "0.6"
31-
raw-window-handle = "0.1"
31+
raw-window-handle = "0.3"
3232

3333
[target.'cfg(windows)'.dependencies]
3434
winapi = { version = "0.3", features = ["libloaderapi", "windef", "winuser"] }

src/backend/vulkan/src/window.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,14 +274,14 @@ impl Instance {
274274

275275
if !use_current {
276276
let layer: *mut Object = msg_send![class, new];
277-
msg_send![view, setLayer: layer];
277+
let () = msg_send![view, setLayer: layer];
278278
let bounds: CGRect = msg_send![view, bounds];
279-
msg_send![layer, setBounds: bounds];
279+
let () = msg_send![layer, setBounds: bounds];
280280

281281
let window: *mut Object = msg_send![view, window];
282282
if !window.is_null() {
283283
let scale_factor: CGFloat = msg_send![window, backingScaleFactor];
284-
msg_send![layer, setContentsScale: scale_factor];
284+
let () = msg_send![layer, setContentsScale: scale_factor];
285285
}
286286
}
287287
}
@@ -336,11 +336,21 @@ impl Instance {
336336
not(target_os = "android"),
337337
not(target_os = "macos")
338338
))]
339-
RawWindowHandle::X11(handle)
339+
RawWindowHandle::Xlib(handle)
340340
if self.extensions.contains(&khr::XlibSurface::name()) =>
341341
{
342342
Ok(self.create_surface_from_xlib(handle.display as *mut _, handle.window))
343343
}
344+
#[cfg(all(
345+
feature = "xcb",
346+
unix,
347+
not(target_os = "android"),
348+
not(target_os = "macos"),
349+
not(target_os = "ios")
350+
))]
351+
RawWindowHandle::Xcb(handle) if self.extensions.contains(&khr::XcbSurface::name()) => {
352+
Ok(self.create_surface_from_xcb(handle.connection as *mut _, handle.window))
353+
}
344354
// #[cfg(target_os = "android")]
345355
// RawWindowHandle::ANativeWindowHandle(handle) => {
346356
// let native_window = unimplemented!();

0 commit comments

Comments
 (0)