Weston stuff: fractional HiDPI, FreeBSD, Rust

Greg V greg at unrelenting.technology
Thu Dec 14 00:05:59 UTC 2017


Hi everyone!

I've been hacking around, trying to make Weston more usable for myself…

So far I've done:

- FreeBSD support: https://github.com/myfreeweb/weston/commit/5827840c8
2b9d0a302d5c54c514ca6f4238e12de
- memfd/anonymous shm in os_create_anonymous_file: https://github.com/m
yfreeweb/weston/commit/24bbf0d9265478c406a23d8f1642a37daf43425f
- static linking of backends and gl-renderer: https://github.com/myfree
web/weston/commit/c9ed3f9683bd7fb99aa0e811348fbcec37674140 for language
bindings (e.g. there's no good way to ship additional shared libraries
when you're a Rust library, I don't think cargo supports that)
- the Rust libweston bindings themselves https://github.com/myfreeweb/w
eston-rs — incomplete/WIP, but a simple example compositor works! (see
weston-rs/examples folder)
- fractional DPI scaling! https://github.com/myfreeweb/weston/commit/d2
16493ae33659a98b9a9cbe77d4068b9462eea8 (additional downscaling after
integer scaling)

Please tell me if there's any interest in merging some of these changes
into upstream weston!

//

The fractional scaling was surprisingly easy to implement, works
perfectly with native Wayland apps and looks excellent on my 28" 4K
monitor (140% scale).

However… Xwayland.

I saw a lot of discussion of multiple monitors with different DPIs and
stuff. I only have one single monitor and I just want Firefox and
Thunderbird to not be blurry.

So, Weston assumes that X11 clients are not DPI aware. (Personally, I
haven't seen any clients that don't respect Xft.dpi in Xresources…)

I tried to change that, to make Weston assume they are DPI aware:

libweston-desktop/xwayland.c
@@ -256,6 +257,10 @@ create_surface(struct weston_desktop_xwayland 
+       wsurface->pending.buffer_viewport.buffer.scale = 2;
+       wsurface->pending.buffer_viewport.changed = 1;

well… the resolution is correct, but everything becomes unusable :(
Only rendering is properly scaled, mouse input is not! Mouse position
appears to X11 clients as if they were not downscaled. So clicks go to
wrong places and wrong areas get re-rendered in the compositor. And
yeah, no more shadows in gtk3 apps, instead there's a black rectangle
behind the window.

https://unrelentingtech.s3.dualstack.eu-west-1.amazonaws.com/xwayland-d
ebug.png — the gl renderer's debug view shows the damage area on the
button is not where it should be.

Apparently GNOME handles this correctly. I've tried looking at mutter
source, haven't found anything useful.

How do I fix this?? Please help…


More information about the wayland-devel mailing list