Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Drakulix committed Oct 10, 2023
1 parent 6a92030 commit cf7980f
Show file tree
Hide file tree
Showing 30 changed files with 2,332 additions and 2,682 deletions.
5 changes: 2 additions & 3 deletions src/backend/kms/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -965,8 +965,8 @@ fn render_node_for_output(
) -> DrmNode {
let workspace = shell.active_space(output);
let nodes = workspace
.get_fullscreen(output)
.map(|w| vec![w.surface()])
.get_fullscreen()
.map(|w| vec![w.clone()])
.unwrap_or_else(|| workspace.windows().collect::<Vec<_>>())
.into_iter()
.flat_map(|w| w.wl_surface().and_then(|s| source_node_for_surface(&s, dh)))
Expand Down Expand Up @@ -1379,7 +1379,6 @@ impl KmsState {
false
};

shell.refresh_outputs();
if recreated {
let sessions = output.pending_buffers().collect::<Vec<_>>();
if let Err(err) = self.schedule_render(
Expand Down
50 changes: 22 additions & 28 deletions src/backend/render/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::{
CosmicMapped, CosmicMappedRenderElement, OverviewMode, Trigger, WorkspaceRenderElement,
},
state::{Common, Fps},
utils::prelude::{OutputExt, SeatExt},
utils::prelude::*,
wayland::{
handlers::{
data_device::get_dnd_icon,
Expand Down Expand Up @@ -160,7 +160,7 @@ impl IndicatorShader {
pub fn focus_element<R: AsGlowRenderer>(
renderer: &R,
key: impl Into<Key>,
mut element_geo: Rectangle<i32, Logical>,
mut element_geo: Rectangle<i32, Local>,
thickness: u8,
scale: f64,
alpha: f32,
Expand All @@ -184,7 +184,7 @@ impl IndicatorShader {
pub fn element<R: AsGlowRenderer>(
renderer: &R,
key: impl Into<Key>,
geo: Rectangle<i32, Logical>,
geo: Rectangle<i32, Local>,
thickness: u8,
radius: u8,
alpha: f32,
Expand Down Expand Up @@ -223,7 +223,7 @@ impl IndicatorShader {

let elem = PixelShaderElement::new(
shader,
geo,
geo.as_logical(),
None, //TODO
alpha,
vec![
Expand All @@ -240,8 +240,8 @@ impl IndicatorShader {
}

let elem = &mut cache.get_mut(&key).unwrap().1;
if elem.geometry(1.0.into()).to_logical(1) != geo {
elem.resize(geo, None);
if elem.geometry(1.0.into()).to_logical(1) != geo.as_logical() {
elem.resize(geo.as_logical(), None);
}
elem.clone()
}
Expand Down Expand Up @@ -271,7 +271,7 @@ impl BackdropShader {
pub fn element<R: AsGlowRenderer>(
renderer: &R,
key: impl Into<Key>,
geo: Rectangle<i32, Logical>,
geo: Rectangle<i32, Local>,
radius: f32,
alpha: f32,
color: [f32; 3],
Expand Down Expand Up @@ -304,7 +304,7 @@ impl BackdropShader {

let elem = PixelShaderElement::new(
shader,
geo,
geo.as_logical(),
None, // TODO
alpha,
vec![
Expand All @@ -320,8 +320,8 @@ impl BackdropShader {
}

let elem = &mut cache.get_mut(&key).unwrap().1;
if elem.geometry(1.0.into()).to_logical(1) != geo {
elem.resize(geo, None);
if elem.geometry(1.0.into()).to_logical(1) != geo.as_logical() {
elem.resize(geo.as_logical(), None);
}
elem.clone()
}
Expand Down Expand Up @@ -492,15 +492,11 @@ where
let (resize_mode, resize_indicator) = state.shell.resize_mode();
let resize_indicator = resize_indicator.map(|indicator| (resize_mode, indicator));
let swap_tree = if let OverviewMode::Started(Trigger::KeyboardSwap(_, desc), _) = &overview.0 {
if let Some(desc_output) = desc.output.upgrade() {
if output != &desc_output || current.0 != desc.handle {
state
.shell
.space_for_handle(&desc.handle)
.and_then(|w| w.tiling_layer.tree_for_output(&desc_output))
} else {
None
}
if current.0 != desc.handle {
state
.shell
.space_for_handle(&desc.handle)
.map(|w| w.tiling_layer.tree())
} else {
None
}
Expand Down Expand Up @@ -530,17 +526,17 @@ where

let has_fullscreen = workspace
.fullscreen
.get(output)
.as_ref()
.filter(|f| !f.is_animating())
.map(|f| f.exclusive);
.is_some();
let (overlay_elements, overlay_popups) =
split_layer_elements(renderer, output, Layer::Overlay, exclude_workspace_overview);

// overlay is above everything
elements.extend(overlay_popups.into_iter().map(Into::into));
elements.extend(overlay_elements.into_iter().map(Into::into));

let mut window_elements = if !has_fullscreen.unwrap_or(false) {
let mut window_elements = if !has_fullscreen {
let (top_elements, top_popups) =
split_layer_elements(renderer, output, Layer::Top, exclude_workspace_overview);
elements.extend(top_popups.into_iter().map(Into::into));
Expand All @@ -557,7 +553,7 @@ where
.shell
.space_for_handle(&previous)
.ok_or(OutputNoMode)?;
let has_fullscreen = workspace.fullscreen.contains_key(output);
let has_fullscreen = workspace.fullscreen.is_some();
let is_active_space = workspace.outputs().any(|o| o == &active_output);

let percentage = {
Expand All @@ -581,9 +577,8 @@ where
});

let (w_elements, p_elements) = workspace
.render_output::<R>(
.render::<R>(
renderer,
output,
&state.shell.override_redirect_windows,
state.xwayland_state.as_mut(),
(!move_active && is_active_space).then_some(&last_active_seat),
Expand Down Expand Up @@ -639,9 +634,8 @@ where
let is_active_space = workspace.outputs().any(|o| o == &active_output);

let (w_elements, p_elements) = workspace
.render_output::<R>(
.render::<R>(
renderer,
output,
&state.shell.override_redirect_windows,
state.xwayland_state.as_mut(),
(!move_active && is_active_space).then_some(&last_active_seat),
Expand All @@ -665,7 +659,7 @@ where
))
}));

if has_fullscreen.is_none() {
if !has_fullscreen {
let (w_elements, p_elements) =
background_layer_elements(renderer, output, exclude_workspace_overview);

Expand Down
1 change: 0 additions & 1 deletion src/backend/winit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,6 @@ impl State {
output.change_current_state(Some(mode), None, None, None);
layer_map_for_output(output).arrange();
self.common.output_configuration_state.update();
self.common.shell.refresh_outputs();
render_ping.ping();
}
WinitEvent::Refresh => render_ping.ping(),
Expand Down
1 change: 0 additions & 1 deletion src/backend/x11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,6 @@ pub fn init_backend(
output.set_preferred(mode);
layer_map_for_output(output).arrange();
state.common.output_configuration_state.update();
state.common.shell.refresh_outputs();
surface.dirty = true;
if !surface.pending {
surface.render.ping();
Expand Down
Loading

0 comments on commit cf7980f

Please sign in to comment.