A quick glance at the code also reveals an almost complete lack of comments and copious use of unexplained `unsafe`.
A quick glance at the code also reveals an almost complete lack of comments and copious use of unexplained `unsafe`.
This tool was clearly written by someone with a "make it work for the general public" mindset. And, to be honest, I'm not 100% opposed to this approach, although there should definitely be a giant warning system configuration is changed. When a piece of software says "You are using Wayland and this software requires X11, please change your desktop session type" then you're not helping most people. A simple button to fix the problem can be a lot better than an error message with a link to a complicated step-by-step guide.
As is often the case, this client seems to have been made for people running Ubuntu/Fedora, and a relatively recent version at that.
The copious amount of unsafe seems to revolve around operating system APIs being called. Interacting with X11 requires tons of unsafe operations, you can't really work around that. The best you can do is make your own wrappers to hide the fact you're calling unsafe code behind the scenes, but I can't see too much unnecessary unsafe code in there to be honest.
The user now has one app that works, potentially dozens that don't, doesn't know why it broke, and doesn't know how to fix it. Which is why destructive fix it's for a single app is not a great idea. If it was non-destructive, I would totally agree with you.
I'm sure there are some applications out there that rely on Wayland support, but Wayland is unusable for proper remote tech support without some extensions to the API that Wayland developers don't want to add (notably, the ability to send input to running applications).
There are workarounds (hooking directly into the input system, for example) but those work despite Wayland, not because of it.
I'm willing to go as far as to say that by clicking the "fix me" button, the end user will probably end up fixing more applications than it breaks.
Depends on what what you mean by "Wayland developers". Wlroots, and thus sway, support such extensions and I think KDE is open to standardizing such extensions. Gnome supports remote desktop through an xdg portal. The problem is that, as with several other things, all of the compositors haven't agreed on a single standard.
Which apps work on wayland but not x11 ?
Though people who want to avoid using toolkits would probably do that, as Wayland's API is much more sane for apps.
However for example Waydroid only supports running on Wayland, and somehow nobody has created a reverse XWayland yet (People that ask for this get constantly redirected to nested compositors which is absolutely the wrong thing, a proper reverse XWayland would seemlessly integrate the apps like Xwayland does, and you could drag them, transparency would work, and https://wayland.app/protocols/xdg-shell#xdg_surface:request:... would be converted to _GTK_FRAME_EXTENTS, etc)
I've used sway, as an example to Wayland only, and if you have specific things configured around Wayland as a compositor, they break too..
But that shouldn't really be the focus point of the discussion, what really is the point, you don't just yank a whole system wide config out from under an unsuspecting user, there's so many variables you just don't know or can account for. Creating a stable application, is also respecting other apps and the system it runs on, not just going in blazin' fixing things for yourself and then not caring about what side effect/consequences it can have. And worse, not informing about it properly.
This app probably should use libinput to emulate keyboard/mouse instead of tapping into X11. No need for crazy hacks as libinput supports Wayland. Applications that provide remote desktop-like functionality like Sunshine used it and runs well on Wayland.
Notably, the lack of a mouse cursor is kind of a big deal for remote support situations. You want the user to be able to indicate stuff with the mouse.
What is Gamestream ? What is Moonlight ?
Nvidia gamestream is the proprietary server from nvidia, sunshine is an opensource server compatible with gamestream protocol, and moonlight is an opensource gamestream client.
Hum I don't understand this, I've been injecting key strokes for a decade on any Linux-running system using uinput (which creates a new virtual /dev/input). Is this somehow broken by wayland? (I haven't ever really used wayland, nor do i understand how it works)
This is not well-written Rust; code like the below actually defeats the purpose of using Rust, and without any specific reason for doing so.
I personally discourage people from using this software.
static mut KEYBOARD_HOOKED: bool = false;
fn start_keyboard_hook(&self) {
if unsafe { KEYBOARD_HOOKED } {
return;
}
}
The build even requires an assembler (NASM), which is odd, in this context.Edit: Further, there's no such thing as "the purpose of using Rust". Different users can use the same tool for different purposes, and Rust is no different.
To keep in mind, on a pragmatic level, that this type of global can be trivially implemented, at a minimum, via atomics, so the cost to avoid the unsafe is near-zero.
Atomics are not supported by all the platforms, but based on my understanding of their targets (x86-64), they're supported.
AFAIK on any typical platform there's no way you'd have "tearing" for a single byte ie: this will never store an invalid boolean representation.
(Since I use sway on Ubuntu, rather than gdm, I’d argue it’s a capital offense, but YMMV.)
> "Warning" > "Current Wayland display server is not supported" > `Fix it` => a button triggers system gdm config change > A 'Help' link to github, showing how to change the config manaully.
I wouldn't count it as malware. But I don't think it's OK to change the system configuration by pressing a button of a remote desktop software. It should simply provide a link to user instead.
[1] https://github.com/rustdesk/rustdesk/blob/45375517b960add901...