Unify with_app_id and with_class methods

Both APIs are used to set application name. This commit unifies the API
between Wayland and X11, so downstream applications can remove platform
specific code when using `WindowBuilderExtUnix`.

Fixes #1739.
This commit is contained in:
Kirill Chibisov 2022-04-20 01:56:56 +03:00 committed by GitHub
parent bf366cb99d
commit cbba00d360
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 42 additions and 36 deletions

View file

@ -310,11 +310,11 @@ impl UnownedWindow {
// WM_CLASS must be set *before* mapping the window, as per ICCCM!
{
let (class, instance) = if let Some((instance, class)) = pl_attribs.class {
let instance = CString::new(instance.as_str())
let (class, instance) = if let Some(name) = pl_attribs.name {
let instance = CString::new(name.instance.as_str())
.expect("`WM_CLASS` instance contained null byte");
let class =
CString::new(class.as_str()).expect("`WM_CLASS` class contained null byte");
let class = CString::new(name.general.as_str())
.expect("`WM_CLASS` class contained null byte");
(instance, class)
} else {
let class = env::args()