Skip to content

Update SCTK to 0.11.0 - #1653

Merged
kchibisov merged 8 commits into
rust-windowing:masterfrom
kchibisov:wayland-rework
Sep 28, 2020
Merged

kchibisov merged 8 commits into
rust-windowing:masterfrom
kchibisov:wayland-rework

Conversation

@kchibisov

@kchibisov kchibisov commented Aug 18, 2020 •

Copy link
Copy Markdown
Member

Updates smithay-client-toolkit to 0.10.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:

  • Disabled repeat rate not being handled.
  • Decoration buttons not working after tty switch.
  • Scaling not being applied on output reenable.
  • Crash when XCURSOR_SIZE is 0.
  • Pointer getting created in some cases without pointer capability.
  • On kwin, fix space between window and decorations on startup.
  • Incorrect size event when entering fullscreen when using
    client side decorations.
  • Client side decorations not being hided properly in fullscreen.
  • Fullscreen state tracking.
  • Repeat rate triggering multiple times from slow callback handler.
  • Resizable attribute not being applied properly on startup.

Besides those fixes it also adds a bunch of missing virtual keycodes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, and fall back for cursor icon to similar ones,
if the requested is missing.

It also adds new methods to a Theme trait, such as:

  • title_font(&self) -> Option<(String, f32)> - The font for a title.
  • title_color(&self, window_active: bool) -> [u8; 4] - The color of
    the text in the title.

Fixes #1680.
Fixes #1678.
Fixes #1676.
Fixes #1646.
Fixes #1614.
Fixes #1601.
Fixes #1533.
Fixes #1509.
Fixes #947.

@JMS55

JMS55 commented Aug 23, 2020

Copy link
Copy Markdown

I tested this out, it seems window decorations won't show up at all, and while fullscreen now works the first time you press it, exiting it dosen't restore the window size/position correctly (2nd half of #1601).

Gnome 3.36.4/Wayland.

@kchibisov

kchibisov commented Aug 23, 2020 •

Copy link
Copy Markdown
Member Author

I tested this out, it seems window decorations won't show up at all, and while fullscreen now works the first time you press it, exiting it dosen't restore the window size/position correctly (2nd half of #1601).

I'm aware of all the issue on GNOME here, please wait a bit, since I've fixed them already. Just they haven't reached that branch. You can track them by the patches I've sent here https://github.com/smithay/client-toolkit/pulls

I'll ping once I'd say that everything is good to test as well as I've ping the issues I'm closing. For now it's hard to test without all the patches I've sent upstream being applied at the same time.

@kchibisov

Copy link
Copy Markdown
Member Author

The major part of patches that I've send upstream was merged. I've finished winit part and created a branch for testing this changes in alacritty/alacritty#4140.

If you'll find any issues with that branch let me know.

@chrisduerr chrisduerr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some minor bikeshedding about the changelog entries.

Comment thread CHANGELOG.md Resolved
Comment thread CHANGELOG.md Resolved
Comment thread CHANGELOG.md Resolved
Comment thread CHANGELOG.md Resolved
@JMS55

JMS55 commented Aug 28, 2020

Copy link
Copy Markdown

Amazing work!

Issues:

  1. with_inner_size() isn't working. I request (1440, 810) and get (800, 600). X11 works fine.
  2. VirtualKeyCode::Minus/Subtract is weird. The - button to the right of 0 on my keyboard seems to map to Minus on Wayland, and Subtract on X11. Not sure if Wayland or X11 is wrong, I don't have macOS/Windows to test what they give.
    • This is not a new problem, I've been doing Some(VirtualKeyCode::Minus) | Some(VirtualKeyCode::Subtract) to get around it for stable winit, but since you changed some VirtualKeyCodes I'll bring it up here.

@kchibisov

Copy link
Copy Markdown
Member Author

Could you check what the size is https://github.com/rust-windowing/winit/pull/1653/files#diff-65ea0109d004c94225653a3937f9c145R97-R100 here? It'll be strange if with_inner_size won't work, since I clearly apply it there.

@JMS55

JMS55 commented Aug 28, 2020 •

Copy link
Copy Markdown

Sorry, I'm not sure what your link is supposed to show.
I did WindowBuilder::with_inner_size(), and then right after building the window, dbg!(window.inner_size()).
I got different numbers.

@JMS55

JMS55 commented Aug 28, 2020 •

Copy link
Copy Markdown

Also, please document that winit::platform::unix::Theme uses ARGB values, and not RGBA like I would expect.

@kchibisov

kchibisov commented Aug 28, 2020 •

Copy link
Copy Markdown
Member Author

Also, please document that winit::platform::unix::Theme uses ARGB values, and not RGBA like I would expect.

Have you seen that https://github.com/kchibisov/winit/blob/7d05df985eb61f777d5806778f7bab1b838e96d6/src/platform/unix.rs#L474 ?

@JMS55

JMS55 commented Aug 28, 2020

Copy link
Copy Markdown

Ah that's good, I was looking at the stable docs for winit I think, my bad.

@JMS55

JMS55 commented Aug 28, 2020 •

Copy link
Copy Markdown

Another bug: When setting the Theme, the title doesn't show. I tried overriding title_color(), but it changes the button's icons color instead.

@chrisduerr

chrisduerr commented Aug 28, 2020 •

Copy link
Copy Markdown
Contributor

VirtualKeyCode::Minus/Subtract is weird. The - button to the right of 0 on my keyboard seems to map to Minus on Wayland, and Subtract on X11. Not sure if Wayland or X11 is wrong, I don't have macOS/Windows to test what they give.

This is not a new problem, I've been doing Some(VirtualKeyCode::Minus) | Some(VirtualKeyCode::Subtract) to get around it for stable winit, but since you changed some VirtualKeyCodes I'll bring it up here.

Minus is for the "normal" key while Subtract is for the keypad. Unfortunately I believe not all platforms are aware of this leading to an inconsistent mess. I believe X11 does this wrong for example, even though the keycode names sent by X11are called "minus" and "subtract".

@kchibisov

Copy link
Copy Markdown
Member Author

Another bug: When setting the Theme, the title doesn't show. I tried overriding title_color(), but it changes the button's icons color instead.

That's a very old bug, I'm not sure that it ever worked correctly.

@kchibisov

Copy link
Copy Markdown
Member Author

Sorry, I'm not sure what your link is supposed to show.
I did WindowBuilder::with_inner_size(), and then right after building the window, dbg!(window.inner_size()).
I got different numbers.

Could you recheck size again?

@JMS55

JMS55 commented Aug 30, 2020

Copy link
Copy Markdown

Size works! The only major bug I see left is that with a custom theme, the title text is a bit too small.
image

@kchibisov

Copy link
Copy Markdown
Member Author

@JMS55

JMS55 commented Aug 30, 2020

Copy link
Copy Markdown

Ah, it looks like the default theme uses ("sans", 17.0). Maybe the Theme trait should copy that.

@kchibisov kchibisov changed the title Update SCTK to 0.10.0 Update SCTK to 0.11.0 Aug 30, 2020
@kchibisov
kchibisov marked this pull request as ready for review August 30, 2020 16:28
@chrisduerr
chrisduerr self-requested a review September 23, 2020 22:00
@lberrymage

Copy link
Copy Markdown
Contributor

Well I made some custom scenarios with wgpu and used the bevy game engine examples which also use wgpu. But yeah, I was making sure to render things.

@kchibisov

Copy link
Copy Markdown
Member Author

Well I made some custom scenarios with wgpu and used the bevy game engine examples which also use wgpu. But yeah, I was making sure to render things.

Thanks.

@aentity

aentity commented Sep 24, 2020

Copy link
Copy Markdown

This is last item for 0.23 release, seems need rebase, but otherwise, nothing is left before merge?

@kchibisov

Copy link
Copy Markdown
Member Author

This is last item for 0.23 release, seems need rebase, but otherwise, nothing is left before merge?

It's missing a 'review'. At least source level review should be performed. I actually have a bit more Wayland patched pending, which I want to have in 0.23 as well...

Updates smithay-client-toolkit to 0.11.0. The major highlight
of that updated, is update of wayland-rs to 0.27.0. Switching
to wayland-cursor, instead of using libwayland-cursor. It
also fixes the following bugs:

  - Disabled repeat rate not being handled.
  - Decoration buttons not working after tty switch.
  - Scaling not being applied on output reenable.
  - Crash when `XCURSOR_SIZE` is `0`.
  - Pointer getting created in some cases without pointer capability.
  - On kwin, fix space between window and decorations on startup.
  - Incorrect size event when entering fullscreen when using
    client side decorations.
  - Client side decorations not being hided properly in fullscreen.
  - Size tracking between fullscreen/tiled state changes.
  - Repeat rate triggering multiple times from slow callback handler.
  - Resizable attribute not being applied properly on startup.

Besides those fixes it also adds a bunch of missing virtual key codes,
implements proper cursor grabbing, adds right click on decorations
to open application menu, disabled maximize button for non-resizeable
window, and fall back for cursor icon to similar ones, if the requested
is missing.

It also adds new methods to a `Theme` trait, such as:
  - `title_font(&self) -> Option<(String, f32)>` - The font for a title.
  - `title_color(&self, window_active: bool) -> [u8; 4]` - The color of
  the text in the title.

Fixes rust-windowing#1680.
Fixes rust-windowing#1678.
Fixes rust-windowing#1676.
Fixes rust-windowing#1646.
Fixes rust-windowing#1614.
Fixes rust-windowing#1601.
Fixes rust-windowing#1533.
Fixes rust-windowing#1509.
Fixes rust-windowing#947.
This commit implemenets IME handling via text-input-v3 protocol
and so winit's IME related interfaces are now implemented.

Fixes rust-windowing#952.
@kchibisov

Copy link
Copy Markdown
Member Author

I've also added IME handling via text input v3, if someone out side of the GNOME can test it, it'll be nice. On GNOME it's hard to test it, since GNOME bugs quite a lot with text-input from my testing, even though I handle every event correctly. GTK apps are working 'kind of fine', because they are not using text-input-v3, but some side channel, like XIM.

Comment thread Cargo.toml Resolved
Comment thread src/platform/unix.rs Resolved
Comment thread src/platform/unix.rs Resolved
Comment thread src/platform_impl/linux/wayland/env.rs Resolved
Comment thread src/platform_impl/linux/wayland/env.rs Resolved
Previously WinitState was carrying a lot of inner mutable
data, however we can put entire WinitState into 'Rc<RefCell<_>>'
to avoid extensive borrows in callback processing.
@JMS55

JMS55 commented Sep 26, 2020

Copy link
Copy Markdown

Theme::titlebar_element_color() Doesn't seem to ever get passed false for window_active. It's always called with true for some reason.

@kchibisov

Copy link
Copy Markdown
Member Author

Theme::titlebar_element_color() Doesn't seem to ever get passed false for window_active. It's always called with true for some reason.

I've noticed that already, will fix when will be addressing the pending review.

@kchibisov
kchibisov requested a review from elinorbgr September 26, 2020 18:27
Comment thread src/platform/unix.rs Resolved
Comment thread src/platform/unix.rs Resolved
Comment thread src/platform/unix.rs Resolved

@chrisduerr chrisduerr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the theme's foreground flag, since it's not entirely clear and thus makes things a bit difficult, but I don't have any concrete suggestions to improve it.

But since changing that would likely be breaking, it probably makes sense to think about that again.

@kchibisov
kchibisov merged commit 3d85af0 into rust-windowing:master Sep 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment