Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: allow passing an activation token when creating a window #80

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions runtime/src/command/platform_specific/wayland/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ pub struct SctkWindowSettings {

/// Whether the window should be transparent.
pub transparent: bool,

/// xdg-activation token
pub xdg_activation_token: Option<String>,
}

impl Default for SctkWindowSettings {
Expand All @@ -55,6 +58,7 @@ impl Default for SctkWindowSettings {
resizable: Some(8.0),
client_decorations: true,
transparent: false,
xdg_activation_token: Default::default(),
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions sctk/src/event_loop/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ where

size_limits,
resizable,
xdg_activation_token,
..
} = settings;
// TODO Ashley: set window as opaque if transparency is false
Expand Down Expand Up @@ -681,6 +682,12 @@ where

window.commit();

if let (Some(token), Some(activation_state)) =
(xdg_activation_token, self.activation_state.as_ref())
{
activation_state.activate::<()>(window.wl_surface(), token);
}

let wp_viewport = self.viewporter_state.as_ref().map(|state| {
state.get_viewport(window.wl_surface(), &self.queue_handle)
});
Expand Down
Loading