Skip to content

Commit

Permalink
refactor: allow passing an activation token when creating a window
Browse files Browse the repository at this point in the history
  • Loading branch information
wash2 committed Nov 13, 2023
1 parent 37ec2a2 commit f20c85d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
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

0 comments on commit f20c85d

Please sign in to comment.