Skip to content

Commit ff31390

Browse files
committed
Merge pull request rust-windowing#390 from glennw/upstream-wm-class
Set WM_CLASS based on initial window title.
2 parents d8cd748 + 4a83ab6 commit ff31390

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/x11/window/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,16 @@ impl Window {
510510
}
511511
}
512512

513+
// Set ICCCM WM_CLASS property based on initial window title
514+
unsafe {
515+
with_c_str(&*builder.title, |c_name| {
516+
let hint = ffi::XAllocClassHint();
517+
(*hint).res_name = c_name as *mut i8;
518+
(*hint).res_class = c_name as *mut i8;
519+
ffi::XSetClassHint(display, window, hint);
520+
ffi::XFree(hint as *mut libc::c_void);
521+
});
522+
}
513523

514524
// creating GL context
515525
let (context, extra_functions) = unsafe {

0 commit comments

Comments
 (0)