+
Skip to content

Wayland metabug #306

Closed
Closed
@elinorbgr

Description

@elinorbgr

There are several issues with wayland. Most of them come from the fact that wayland does things differently than other platforms. I open this issue to list know issues and hopefully get discussion going about them.

Common problems

Resize/move do not work with Gnome

This is a bug in gnome that have been fixed now, you need at least gnome version 3.24.3, 3.25.3 or 3.26 (or newer) to have the fix.

The decorations are ugly / not native

Well, that's how wayland works. Clients are supposed to draw their own decorations. Winit uses wayland-window to draw them. I know they are ugly, and if you want to contribute to make them less ugly, please do! See the issue tracker of wayland-window for details.

The borders of my windows are not drawn the right size

This is perhaps the most regular issue, caused by several wayland particularities:

  • wayland clients are expected to draw their own borders
  • The dimensions of a wayland window is defined by the dimensions of its contents (with glutin, the EGL surface).

This means that winit know about the size of borders but not of the contents. Meaning the user needs to keep the two in sync by calling window.set_inner_size() appropriately. Hopefully at some point glutin will be able to handle it directly.

When your app receives a Resized event, winit has already changed the border size according to what you receive, so you don't need to manually resize the borders (unless you want an other size). Though you'll still need to resize your contents (your egl surface for example) to this new size.

My app crashes at startup with a message about a surface not being configured

See https://docs.rs/winit/0.8.2/winit/os/unix/trait.WindowExt.html#tymethod.is_ready

Note that depending on the wayland environment, this issue can manifest itself differently

#309 should help with that

Missing features to be implemented

These are known missing features with some hints about what needs to be done, if you want to help with some of it, please don't hesitate to ask on this issue for details or explanations.

Touch events

Currently touch event are completely ignored by winit, but it should be fairly straightforward to implement them in a similar way pointer events are.

The relevant implementation struct is here: https://docs.rs/wayland-client/0.11.3/wayland_client/protocol/wl_touch/struct.Implementation.html

Repeat keys

On wayland, key repeats are completely handled client-side. We need to figure out how to handle them, given the server sends us the delay before starting a delay and the repeat period. This might need some adapting of wayland-kbd.

Drag&drop / copy-paste

Both are handled by the same logic on wayland, from the wl_data_device_manager global. I'm in the process of figuring out how it should be used.

HiDPI handling (partly done)

Currently the backend correctly advertizes the dpi of each monitor as well as the expected drawn dpi for the windows, however it does not correctly translate it when sending the buffer to the server and does not generate HiDPIFactorChanged events.

Cursor image setting

Currently, Window::set_cursor is a stub. Should be implemented using wayland_client::cursor.

Window::set_cursor_state with CursorState::Hide will be handled the same way.

Cursor grabbing

Cursor grabbing is not supported by core wayland protcol, and will need to be implemented using the unstable pointer_constraints and relative_pointer protocol extensions.

Hide/Show the Window

Will likely require implementing it in wayland-window, by mapping/unmapping the shell_surface.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载