Files
winit/src/changelog/unreleased.md
T
Matěj Laitl bbab3d8e35 x11: fix WindowAttributesExtX11::with_x11_screen()
Based on https://github.com/rust-windowing/winit/pull/3973, which should
be merged first.

There's an API to programmatically specify X11 screen id (override what
is determined from the `DISPLAY` env variable), but it doesn't work.

Seeting up X Server with 2 screens and calling `DISPLAY=:0
X11_SCREEN_ID=1 cargo run --example window` should be equivalent to
calling `DISPLAY=:0.1 cargo run --example window`

The latter works (and places the window on the correct screen), but the
former yields

`failed to create initial window: Os(OsError { line: 620, file:
"src/platform_impl/linux/x11/window.rs", error: X11Error(X11Error {
error_kind: Match, error_code: 8, sequence: 219, bad_value: 1319,
minor_opcode: 0, major_opcode: 1, extension_name: None, request_name:
Some("CreateWindow") }) })`

_Here `1319` is the root window id for screen 0, which doesn't match the
screen 1 that we request._

The problem is that we need to factor in the screen id when determining
the parent (root) window when not explicitly set. This patch does that.

---

Also: Extend the window example with X11_{SCREEN,VISUAL}_ID env variables
2024-12-21 09:05:36 +03:00

2.2 KiB

The format is based on Keep a Changelog.

The sections should follow the order Added, Changed, Deprecated, Removed, and Fixed.

Platform specific changed should be added to the end of the section and grouped by platform name. Common API additions should have , implemented at the end for platforms where the API was initially implemented. See the following example on how to add them:

### Added

- Add `Window::turbo()`, implemented on X11, Wayland, and Web.
- On X11, add `Window::some_rare_api`.
- On X11, add `Window::even_more_rare_api`.
- On Wayland, add `Window::common_api`.
- On Windows, add `Window::some_rare_api`.

When the change requires non-trivial amount of work for users to comply with it, the migration guide should be added below the entry, like:

- Deprecate `Window` creation outside of `EventLoop::run`

  This was done to simply migration in the future. Consider the
  following code:

  // Code snippet.

  To migrate it we should do X, Y, and then Z, for example:

  // Code snippet.

The migration guide could reference other migration examples in the current changelog entry.

Unreleased

Added

  • On macOS, add WindowExtMacOS::set_borderless_game and WindowAttributesExtMacOS::with_borderless_game to fully disable the menu bar and dock in Borderless Fullscreen as commonly done in games.
  • On X11, the window example now understands the X11_VISUAL_ID and X11_SCREEN_ID env variables to test the respective modifiers of window creation.

Fixed

  • On macOS, fix WindowEvent::Moved sometimes being triggered unnecessarily on resize.
  • On macOS, package manifest definitions of LSUIElement will no longer be overridden with the default activation policy, unless explicitly provided during initialization.
  • On macOS, fix crash when calling drag_window() without a left click present.
  • On X11, key events forward to IME anyway, even when it's disabled.
  • On Windows, make ControlFlow::WaitUntil work more precisely using CREATE_WAITABLE_TIMER_HIGH_RESOLUTION.
  • On X11, creating windows on screen that is not the first one (e.g. DISPLAY=:0.1) works again.
  • On X11, creating windows while passing with_x11_screen(non_default_screen) works again.