pub struct Window {
pub window_type: WindowType,
pub state: WindowState,
pub top_left: Point,
pub size: Size,
pub depth_layer: DepthLayer,
pub name: String,
pub transform: Mat4,
pub alpha: f32,
/* private fields */
}Expand description
A window’s state, exposed to plugin callbacks and to crate::plugin::managed_windows.
Read-only fields describe the window at the time of the callback. Setter
methods (set_state, set_rectangle, etc.) are available for windows
returned by crate::plugin::managed_windows.
Fields§
§window_type: WindowTypeThe type of this window.
state: WindowStateThe state of the window.
top_left: PointThe position of the window.
size: SizeThe size of the window.
depth_layer: DepthLayerThe depth layer of the window.
name: StringThe name of the window.
transform: Mat4The 4x4 transform matrix of the window (column-major).
alpha: f32The alpha (opacity) of the window.
Implementations§
Source§impl Window
impl Window
Sourcepub fn id(&self) -> u64
pub fn id(&self) -> u64
Retrieve the ID of this window.
Plugins may elect to keep a reference to this ID so that they can
match it with Window later.
Sourcepub fn application(&self) -> Option<ApplicationInfo>
pub fn application(&self) -> Option<ApplicationInfo>
Get the application that owns this window.
Sourcepub fn set_workspace(&self, workspace: &Workspace) -> Result<(), ()>
pub fn set_workspace(&self, workspace: &Workspace) -> Result<(), ()>
Move this window to a different workspace.
Sourcepub fn set_rectangle(&self, rect: Rectangle, animate: bool) -> Result<(), ()>
pub fn set_rectangle(&self, rect: Rectangle, animate: bool) -> Result<(), ()>
Set the position and size of this window.
Sourcepub fn set_transform(&self, transform: Mat4) -> Result<(), ()>
pub fn set_transform(&self, transform: Mat4) -> Result<(), ()>
Set the 4x4 column-major transform matrix of this window.
Sourcepub fn request_focus(&self) -> Result<(), ()>
pub fn request_focus(&self) -> Result<(), ()>
Request keyboard focus on this window.
Sourcepub fn set_shader(&self, shader_id: Option<u8>) -> Result<(), ()>
pub fn set_shader(&self, shader_id: Option<u8>) -> Result<(), ()>
Set the custom shader applied to this window.
Pass Some(id) with the ID returned by register_window_sample_to_rgba to activate
the shader, or None to clear any custom shader and revert to default rendering.
Sourcepub fn set_geometry_shader(
&self,
geometry_shader_id: Option<u8>,
) -> Result<(), ()>
pub fn set_geometry_shader( &self, geometry_shader_id: Option<u8>, ) -> Result<(), ()>
Set the geometry shader applied to this window.
Pass Some(id) with the ID returned by
crate::plugin::register_window_geometry_shader to activate the shader, or
None to clear it and revert to the window’s plain geometry.
Sourcepub fn set_shader_uniform(
&self,
name: &str,
value: ShaderUniform,
) -> Result<(), ()>
pub fn set_shader_uniform( &self, name: &str, value: ShaderUniform, ) -> Result<(), ()>
Set the uniform called name on every shader that draws this window, replacing any
previous value of the same name. Setting it redraws the window.
Shaders that do not declare name, or that declare it with another type, ignore it.
A window may have at most 16 uniforms, and names may be at most 64 bytes long. Names
that the compositor sets itself (e.g. u_world_to_clip, alpha) and those starting
with gl_ are rejected.