Add WindowBuilder::with_cursor() (#3319)

This commit is contained in:
daxpedda 2023-12-26 19:50:58 +01:00 committed by GitHub
parent f5c691467b
commit ba654bb61e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 26 additions and 1 deletions

View file

@ -169,6 +169,11 @@ impl Window {
_ => (),
};
match attributes.cursor {
Cursor::Icon(icon) => window_state.set_cursor(icon),
Cursor::Custom(cursor) => window_state.set_custom_cursor(&cursor.inner.0),
}
// Activate the window when the token is passed.
if let (Some(xdg_activation), Some(token)) = (
xdg_activation.as_ref(),

View file

@ -575,6 +575,8 @@ impl UnownedWindow {
leap!(window.set_window_level_inner(window_attrs.window_level)).ignore_error();
}
window.set_cursor(window_attrs.cursor);
// Remove the startup notification if we have one.
if let Some(startup) = pl_attribs.activation_token.as_ref() {
leap!(xconn.remove_activation_token(xwindow, &startup._token));

View file

@ -518,6 +518,8 @@ impl WinitWindow {
}
}
this.set_cursor(attrs.cursor);
let delegate = WinitWindowDelegate::new(&this, attrs.fullscreen.0.is_some());
// XXX Send `Focused(false)` right after creating the window delegate, so we won't

View file

@ -64,6 +64,7 @@ impl Window {
inner.set_maximized(attr.maximized);
inner.set_visible(attr.visible);
inner.set_window_icon(attr.window_icon);
inner.set_cursor(attr.cursor);
let canvas = Rc::downgrade(&inner.canvas);
let (dispatcher, runner) = Dispatcher::new(target.runner.main_thread(), inner).unwrap();

View file

@ -1225,6 +1225,8 @@ impl<'a, T: 'static> InitData<'a, T> {
win.set_content_protected(true);
}
win.set_cursor(attributes.cursor);
// Set visible before setting the size to ensure the
// attribute is correctly applied.
win.set_visible(attributes.visible);