Skip to content

Commit

Permalink
Merge branch 'master' into x11-libxcb
Browse files Browse the repository at this point in the history
  • Loading branch information
notgull committed Jan 5, 2023
2 parents a6d9f45 + 66ca445 commit 2520d57
Show file tree
Hide file tree
Showing 18 changed files with 1,476 additions and 85 deletions.
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,7 @@
# Windows
/src/platform/windows.rs @msiglreith
/src/platform_impl/windows @msiglreith

# Orbital (Redox OS)
/src/platform/orbital.rs @jackpot51
/src/platform_impl/orbital @jackpot51
11 changes: 9 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, options: --no-default-features, features: x11 }
- { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, options: --no-default-features, features: "wayland,wayland-dlopen" }
- { target: aarch64-linux-android, os: ubuntu-latest, options: -p winit, cmd: 'apk --', features: "android-native-activity" }
- { target: x86_64-unknown-redox, os: ubuntu-latest, }
- { target: x86_64-apple-darwin, os: macos-latest, }
- { target: x86_64-apple-ios, os: macos-latest, }
- { target: aarch64-apple-ios, os: macos-latest, }
Expand Down Expand Up @@ -83,7 +84,9 @@ jobs:

- name: Build tests
shell: bash
if: matrix.rust_version != '1.60.0'
if: >
!contains(matrix.platform.target, 'redox') &&
matrix.rust_version != '1.60.0'
run: cargo $CMD test --no-run --verbose --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES

- name: Run tests
Expand All @@ -92,6 +95,7 @@ jobs:
!contains(matrix.platform.target, 'android') &&
!contains(matrix.platform.target, 'ios') &&
!contains(matrix.platform.target, 'wasm32') &&
!contains(matrix.platform.target, 'redox') &&
matrix.rust_version != '1.60.0'
run: cargo $CMD test --verbose --target ${{ matrix.platform.target }} $OPTIONS --features $FEATURES

Expand All @@ -102,13 +106,16 @@ jobs:

- name: Build tests with serde enabled
shell: bash
if: matrix.rust_version != '1.60.0'
if: >
!contains(matrix.platform.target, 'redox') &&
matrix.rust_version != '1.60.0'
run: cargo $CMD test --no-run --verbose --target ${{ matrix.platform.target }} $OPTIONS --features serde,$FEATURES
- name: Run tests with serde enabled
shell: bash
if: >
!contains(matrix.platform.target, 'android') &&
!contains(matrix.platform.target, 'ios') &&
!contains(matrix.platform.target, 'wasm32') &&
!contains(matrix.platform.target, 'redox') &&
matrix.rust_version != '1.60.0'
run: cargo $CMD test --verbose --target ${{ matrix.platform.target }} $OPTIONS --features serde,$FEATURES
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ And please only add new entries to the top of this list, right below the `# Unre
- **Breaking:** Removed support for `raw-window-handle` version `0.4`
- On Wayland, `RedrawRequested` not emitted during resize.
- On X11, migrate from Xlib to libxcb.
- Added Orbital support for Redox OS

# 0.27.5

Expand Down
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ libc = "0.2.64"
bytemuck = { version = "1.12.3", default-features = false, optional = true, features = ["extern_crate_alloc", "derive"] }
x11rb = { version = "0.11.0", features = ["allow-unsafe-code", "dl-libxcb", "randr", "resource_manager", "xinput", "xkb"], optional = true }

[target.'cfg(target_os = "redox")'.dependencies]
orbclient = { version = "0.3.42", default-features = false }
redox_syscall = "0.3"

[target.'cfg(target_arch = "wasm32")'.dependencies.web_sys]
package = "web-sys"
version = "0.3.22"
Expand Down
93 changes: 47 additions & 46 deletions FEATURES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ be used to create both games and applications. It supports the main graphical pl
- Unix
- via X11
- via Wayland
- Redox OS, via Orbital
- Mobile
- iOS
- Android
Expand Down Expand Up @@ -171,62 +172,62 @@ Legend:
- ❓: Unknown status

### Windowing
|Feature |Windows|MacOS |Linux x11 |Linux Wayland |Android|iOS |WASM |
|-------------------------------- | ----- | ---- | ------- | ----------- | ----- | ----- | -------- |
|Window initialization |✔️ |✔️ |[#5] |✔️ |[#33]|[#33] |✔️ |
|Providing pointer to init OpenGL |✔️ |✔️ |✔️ |✔️ |✔️ |✔️ |**N/A**|
|Providing pointer to init Vulkan |✔️ |✔️ |✔️ |✔️ |✔️ ||**N/A**|
|Window decorations |✔️ |✔️ |✔️ |✔️ |**N/A**|**N/A**|**N/A**|
|Window decorations toggle |✔️ |✔️ |✔️ |✔️ |**N/A**|**N/A**|**N/A**|
|Window resizing |✔️ |[#219]|✔️ |[#306] |**N/A**|**N/A**|✔️ |
|Window resize increments ||✔️ |✔️ ||**N/A**|**N/A**|**N/A**|
|Window transparency |✔️ |✔️ |✔️ |✔️ |**N/A**|**N/A**|N/A |
|Window maximization |✔️ |✔️ |✔️ |✔️ |**N/A**|**N/A**|**N/A**|
|Window maximization toggle |✔️ |✔️ |✔️ |✔️ |**N/A**|**N/A**|**N/A**|
|Window minimization |✔️ |✔️ |✔️ |✔️ |**N/A**|**N/A**|**N/A**|
|Fullscreen |✔️ |✔️ |✔️ |✔️ |**N/A**|✔️ |✔️ |
|Fullscreen toggle |✔️ |✔️ |✔️ |✔️ |**N/A**|✔️ |✔️ |
|Exclusive fullscreen |✔️ |✔️ |✔️ |**N/A** ||✔️ |**N/A**|
|HiDPI support |✔️ |✔️ |✔️ |✔️ |✔️ |✔️ |✔️ |
|Popup windows |||||||**N/A**|
|Feature |Windows|MacOS |Linux x11 |Linux Wayland |Android|iOS |WASM |Redox OS|
|-------------------------------- | ----- | ---- | ------- | ----------- | ----- | ----- | -------- | ------ |
|Window initialization |✔️ |✔️ |[#5] |✔️ |[#33]|[#33] |✔️ |✔️ |
|Providing pointer to init OpenGL |✔️ |✔️ |✔️ |✔️ |✔️ |✔️ |**N/A**|✔️ |
|Providing pointer to init Vulkan |✔️ |✔️ |✔️ |✔️ |✔️ ||**N/A**|**N/A** |
|Window decorations |✔️ |✔️ |✔️ |✔️ |**N/A**|**N/A**|**N/A**|✔️ |
|Window decorations toggle |✔️ |✔️ |✔️ |✔️ |**N/A**|**N/A**|**N/A**|**N/A** |
|Window resizing |✔️ |[#219]|✔️ |[#306] |**N/A**|**N/A**|✔️ |✔️ |
|Window resize increments ||✔️ |✔️ ||**N/A**|**N/A**|**N/A**|**N/A** |
|Window transparency |✔️ |✔️ |✔️ |✔️ |**N/A**|**N/A**|N/A |✔️ |
|Window maximization |✔️ |✔️ |✔️ |✔️ |**N/A**|**N/A**|**N/A**|**N/A** |
|Window maximization toggle |✔️ |✔️ |✔️ |✔️ |**N/A**|**N/A**|**N/A**|**N/A** |
|Window minimization |✔️ |✔️ |✔️ |✔️ |**N/A**|**N/A**|**N/A**|**N/A** |
|Fullscreen |✔️ |✔️ |✔️ |✔️ |**N/A**|✔️ |✔️ |**N/A** |
|Fullscreen toggle |✔️ |✔️ |✔️ |✔️ |**N/A**|✔️ |✔️ |**N/A** |
|Exclusive fullscreen |✔️ |✔️ |✔️ |**N/A** ||✔️ |**N/A**|**N/A** |
|HiDPI support |✔️ |✔️ |✔️ |✔️ |✔️ |✔️ |✔️ ||
|Popup windows |||||||**N/A**|**N/A** |

### System information
|Feature |Windows|MacOS |Linux x11|Linux Wayland|Android|iOS |WASM |
|---------------- | ----- | ---- | ------- | ----------- | ----- | ------- | -------- |
|Monitor list |✔️ |✔️ |✔️ |✔️ |✔️ |✔️ |**N/A**|
|Video mode query |✔️ |✔️ |✔️ |✔️ |✔️ |✔️ |**N/A**|
|Feature |Windows|MacOS |Linux x11|Linux Wayland|Android|iOS |WASM |Redox OS|
|---------------- | ----- | ---- | ------- | ----------- | ----- | ------- | -------- | ------ |
|Monitor list |✔️ |✔️ |✔️ |✔️ |✔️ |✔️ |**N/A**||
|Video mode query |✔️ |✔️ |✔️ |✔️ |✔️ |✔️ |**N/A**||

### Input handling
|Feature |Windows |MacOS |Linux x11|Linux Wayland|Android|iOS |WASM |
|----------------------- | ----- | ---- | ------- | ----------- | ----- | ----- | -------- |
|Mouse events |✔️ |[#63] |✔️ |✔️ |**N/A**|**N/A**|✔️ |
|Mouse set location |✔️ |✔️ |✔️ |✔️(when locked) |**N/A**|**N/A**|**N/A**|
|Cursor locking ||✔️ ||✔️ |**N/A**|**N/A**|✔️ |
|Cursor confining |✔️ ||✔️ |✔️ |**N/A**|**N/A**||
|Cursor icon |✔️ |✔️ |✔️ |✔️ |**N/A**|**N/A**|✔️ |
|Cursor hittest |✔️ |✔️ ||✔️ |**N/A**|**N/A**||
|Touch events |✔️ ||✔️ |✔️ |✔️ |✔️ |✔️ |
|Touch pressure |✔️ |||||✔️ |✔️ |
|Multitouch |✔️ ||✔️ |✔️ |✔️ |✔️ ||
|Keyboard events |✔️ |✔️ |✔️ |✔️ |✔️ ||✔️ |
|Drag & Drop |[#720] |[#720] |[#720] |[#306] |**N/A**|**N/A**||
|Raw Device Events |[#750] |[#750] |[#750] |||||
|Gamepad/Joystick events |[#804] |||||||
|Device movement events ||||||||
|Drag window with cursor |✔️ |✔️ |✔️ |✔️ |**N/A**|**N/A**|**N/A** |
|Feature |Windows |MacOS |Linux x11|Linux Wayland|Android|iOS |WASM |Redox OS|
|----------------------- | ----- | ---- | ------- | ----------- | ----- | ----- | -------- | ------ |
|Mouse events |✔️ |[#63] |✔️ |✔️ |**N/A**|**N/A**|✔️ |✔️ |
|Mouse set location |✔️ |✔️ |✔️ |✔️(when locked) |**N/A**|**N/A**|**N/A**|**N/A** |
|Cursor locking ||✔️ ||✔️ |**N/A**|**N/A**|✔️ ||
|Cursor confining |✔️ ||✔️ |✔️ |**N/A**|**N/A**|||
|Cursor icon |✔️ |✔️ |✔️ |✔️ |**N/A**|**N/A**|✔️ |**N/A** |
|Cursor hittest |✔️ |✔️ ||✔️ |**N/A**|**N/A**|||
|Touch events |✔️ ||✔️ |✔️ |✔️ |✔️ |✔️ |**N/A** |
|Touch pressure |✔️ |||||✔️ |✔️ |**N/A** |
|Multitouch |✔️ ||✔️ |✔️ |✔️ |✔️ ||**N/A** |
|Keyboard events |✔️ |✔️ |✔️ |✔️ |✔️ ||✔️ |✔️ |
|Drag & Drop |[#720] |[#720] |[#720] |[#306] |**N/A**|**N/A**||**N/A** |
|Raw Device Events |[#750] |[#750] |[#750] |||||**N/A** |
|Gamepad/Joystick events |[#804] |||||||**N/A** |
|Device movement events ||||||||**N/A** |
|Drag window with cursor |✔️ |✔️ |✔️ |✔️ |**N/A**|**N/A**|**N/A** |**N/A** |

### Pending API Reworks
Changes in the API that have been agreed upon but aren't implemented across all platforms.

|Feature |Windows|MacOS |Linux x11|Linux Wayland|Android|iOS |WASM |
|------------------------------ | ----- | ---- | ------- | ----------- | ----- | ----- | -------- |
|New API for HiDPI ([#315] [#319]) |✔️ |✔️ |✔️ |✔️ |✔️ |✔️ ||
|Event Loop 2.0 ([#459]) |✔️ |✔️ ||✔️ |✔️ |✔️ ||
|Keyboard Input ([#812]) ||||||||
|Feature |Windows|MacOS |Linux x11|Linux Wayland|Android|iOS |WASM |Redox OS|
|------------------------------ | ----- | ---- | ------- | ----------- | ----- | ----- | -------- | ------ |
|New API for HiDPI ([#315] [#319]) |✔️ |✔️ |✔️ |✔️ |✔️ |✔️ |||
|Event Loop 2.0 ([#459]) |✔️ |✔️ ||✔️ |✔️ |✔️ |||
|Keyboard Input ([#812]) |||||||||

### Completed API Reworks
|Feature |Windows|MacOS |Linux x11|Linux Wayland|Android|iOS |WASM |
|------------------------------ | ----- | ---- | ------- | ----------- | ----- | ----- | -------- |
|Feature |Windows|MacOS |Linux x11|Linux Wayland|Android|iOS |WASM |Redox OS|
|------------------------------ | ----- | ---- | ------- | ----------- | ----- | ----- | -------- | ------ |

[#165]: https://github.com/rust-windowing/winit/issues/165
[#219]: https://github.com/rust-windowing/winit/issues/219
Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -209,3 +209,8 @@ inside `Event::NewEvents(StartCause::Init)`.
[#2051]: https://github.com/rust-windowing/winit/issues/2051
[#2087]: https://github.com/rust-windowing/winit/issues/2087
[#1705]: https://github.com/rust-windowing/winit/issues/1705

#### Redox OS

Redox OS has some functionality not present yet, that will be implemented when
its orbital display server provides it.
6 changes: 4 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ fn main() {
windows_platform: { target_os = "windows" },
apple: { any(target_os = "ios", target_os = "macos") },
free_unix: { all(unix, not(apple), not(android_platform)) },
redox: { target_os = "redox" },

// Native displays.
x11_platform: { all(feature = "x11", free_unix, not(wasm)) },
wayland_platform: { all(feature = "wayland", free_unix, not(wasm)) },
x11_platform: { all(feature = "x11", free_unix, not(wasm), not(redox)) },
wayland_platform: { all(feature = "wayland", free_unix, not(wasm), not(redox)) },
orbital_platform: { redox },
}
}
3 changes: 2 additions & 1 deletion examples/window_run_return.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
macos_platform,
x11_platform,
wayland_platform,
android_platform
android_platform,
orbital_platform,
))]
fn main() {
use std::{thread::sleep, time::Duration};
Expand Down
6 changes: 3 additions & 3 deletions src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ pub enum WindowEvent<'a> {
///
/// ## Platform-specific
///
/// - **iOS / Android / Web:** Unsupported.
/// - **iOS / Android / Web / Orbital:** Unsupported.
Ime(Ime),

/// The cursor has moved on the window.
Expand Down Expand Up @@ -508,7 +508,7 @@ pub enum WindowEvent<'a> {
///
/// ## Platform-specific
///
/// - **iOS / Android / X11 / Wayland:** Unsupported.
/// - **iOS / Android / X11 / Wayland / Orbital:** Unsupported.
ThemeChanged(Theme),

/// The window has been occluded (completely hidden from view).
Expand All @@ -517,7 +517,7 @@ pub enum WindowEvent<'a> {
/// minimised, set invisible, or fully occluded by another window.
///
/// Platform-specific behavior:
/// - **iOS / Android / Web / Wayland / Windows:** Unsupported.
/// - **iOS / Android / Web / Wayland / Windows / Orbital:** Unsupported.
Occluded(bool),
}

Expand Down
2 changes: 1 addition & 1 deletion src/event_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ impl<T> EventLoopWindowTarget<T> {
///
/// ## Platform-specific
///
/// - **Wayland / macOS / iOS / Android / Web:** Unsupported.
/// - **Wayland / macOS / iOS / Android / Web / Orbital:** Unsupported.
///
/// [`DeviceEvent`]: crate::event::DeviceEvent
pub fn set_device_event_filter(&self, _filter: DeviceEventFilter) {
Expand Down
2 changes: 1 addition & 1 deletion src/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl VideoMode {
///
/// ## Platform-specific
///
/// - **Wayland:** Always returns 32.
/// - **Wayland / Orbital:** Always returns 32.
/// - **iOS:** Always returns 32.
#[inline]
pub fn bit_depth(&self) -> u16 {
Expand Down
5 changes: 4 additions & 1 deletion src/platform/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ pub mod android;
pub mod ios;
#[cfg(macos_platform)]
pub mod macos;
#[cfg(orbital_platform)]
pub mod orbital;
#[cfg(wayland_platform)]
pub mod wayland;
#[cfg(wasm_platform)]
Expand All @@ -35,6 +37,7 @@ pub mod x11;
macos_platform,
android_platform,
x11_platform,
wayland_platform
wayland_platform,
orbital_platform
))]
pub mod run_return;
1 change: 1 addition & 0 deletions src/platform/orbital.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// There are no Orbital specific traits yet.
4 changes: 4 additions & 0 deletions src/platform_impl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ mod platform;
#[cfg(wasm_platform)]
#[path = "web/mod.rs"]
mod platform;
#[cfg(orbital_platform)]
#[path = "orbital/mod.rs"]
mod platform;

pub use self::platform::*;

Expand Down Expand Up @@ -59,5 +62,6 @@ impl From<Fullscreen> for RootFullscreen {
not(x11_platform),
not(wayland_platform),
not(wasm_platform),
not(orbital_platform),
))]
compile_error!("The platform you're compiling for is not supported by winit");
Loading

0 comments on commit 2520d57

Please sign in to comment.