state: Also set primary_output/preferred_scale for lock/cursor-surfaces
This commit is contained in:
parent
10d45f7134
commit
3eb002c3f1
1 changed files with 47 additions and 99 deletions
146
src/state.rs
146
src/state.rs
|
|
@ -634,33 +634,57 @@ impl Common {
|
||||||
render_element_states: &RenderElementStates,
|
render_element_states: &RenderElementStates,
|
||||||
) {
|
) {
|
||||||
let shell = self.shell.read().unwrap();
|
let shell = self.shell.read().unwrap();
|
||||||
// TODO: also set preferred scale
|
let processor = |surface: &WlSurface, states: &SurfaceData| {
|
||||||
|
let primary_scanout_output = update_surface_primary_scanout_output(
|
||||||
|
surface,
|
||||||
|
output,
|
||||||
|
states,
|
||||||
|
render_element_states,
|
||||||
|
default_primary_scanout_output_compare,
|
||||||
|
);
|
||||||
|
if let Some(output) = primary_scanout_output {
|
||||||
|
with_fractional_scale(states, |fraction_scale| {
|
||||||
|
fraction_scale.set_preferred_scale(output.current_scale().fractional_scale());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// lock surface
|
||||||
|
if let Some(session_lock) = shell.session_lock.as_ref() {
|
||||||
|
if let Some(lock_surface) = session_lock.surfaces.get(output) {
|
||||||
|
with_surfaces_surface_tree(lock_surface.wl_surface(), processor)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// grabs
|
|
||||||
for seat in shell
|
for seat in shell
|
||||||
.seats
|
.seats
|
||||||
.iter()
|
.iter()
|
||||||
.filter(|seat| &seat.active_output() == output)
|
.filter(|seat| &seat.active_output() == output)
|
||||||
{
|
{
|
||||||
|
let cursor_status = seat
|
||||||
|
.user_data()
|
||||||
|
.get::<Mutex<CursorImageStatus>>()
|
||||||
|
.map(|lock| {
|
||||||
|
let mut cursor_status = lock.lock().unwrap();
|
||||||
|
if let CursorImageStatus::Surface(ref surface) = *cursor_status {
|
||||||
|
if !surface.alive() {
|
||||||
|
*cursor_status = CursorImageStatus::default_named();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cursor_status.clone()
|
||||||
|
})
|
||||||
|
.unwrap_or(CursorImageStatus::default_named());
|
||||||
|
|
||||||
|
// cursor ...
|
||||||
|
if let CursorImageStatus::Surface(wl_surface) = cursor_status {
|
||||||
|
with_surfaces_surface_tree(&wl_surface, processor);
|
||||||
|
}
|
||||||
|
|
||||||
|
// grabs
|
||||||
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>() {
|
if let Some(move_grab) = seat.user_data().get::<SeatMoveGrabState>() {
|
||||||
if let Some(grab_state) = move_grab.lock().unwrap().as_ref() {
|
if let Some(grab_state) = move_grab.lock().unwrap().as_ref() {
|
||||||
for (window, _) in grab_state.element().windows() {
|
for (window, _) in grab_state.element().windows() {
|
||||||
window.with_surfaces(|surface, states| {
|
window.with_surfaces(processor);
|
||||||
let primary_scanout_output = update_surface_primary_scanout_output(
|
|
||||||
surface,
|
|
||||||
output,
|
|
||||||
states,
|
|
||||||
render_element_states,
|
|
||||||
default_primary_scanout_output_compare,
|
|
||||||
);
|
|
||||||
if let Some(output) = primary_scanout_output {
|
|
||||||
with_fractional_scale(states, |fraction_scale| {
|
|
||||||
fraction_scale.set_preferred_scale(
|
|
||||||
output.current_scale().fractional_scale(),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -670,21 +694,7 @@ impl Common {
|
||||||
for set in shell.workspaces.sets.values() {
|
for set in shell.workspaces.sets.values() {
|
||||||
set.sticky_layer.mapped().for_each(|mapped| {
|
set.sticky_layer.mapped().for_each(|mapped| {
|
||||||
for (window, _) in mapped.windows() {
|
for (window, _) in mapped.windows() {
|
||||||
window.with_surfaces(|surface, states| {
|
window.with_surfaces(processor);
|
||||||
let primary_scanout_output = update_surface_primary_scanout_output(
|
|
||||||
surface,
|
|
||||||
output,
|
|
||||||
states,
|
|
||||||
render_element_states,
|
|
||||||
default_primary_scanout_output_compare,
|
|
||||||
);
|
|
||||||
if let Some(output) = primary_scanout_output {
|
|
||||||
with_fractional_scale(states, |fraction_scale| {
|
|
||||||
fraction_scale
|
|
||||||
.set_preferred_scale(output.current_scale().fractional_scale());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -693,40 +703,12 @@ impl Common {
|
||||||
for space in shell.workspaces.spaces() {
|
for space in shell.workspaces.spaces() {
|
||||||
space.mapped().for_each(|mapped| {
|
space.mapped().for_each(|mapped| {
|
||||||
for (window, _) in mapped.windows() {
|
for (window, _) in mapped.windows() {
|
||||||
window.with_surfaces(|surface, states| {
|
window.with_surfaces(processor);
|
||||||
let primary_scanout_output = update_surface_primary_scanout_output(
|
|
||||||
surface,
|
|
||||||
output,
|
|
||||||
states,
|
|
||||||
render_element_states,
|
|
||||||
default_primary_scanout_output_compare,
|
|
||||||
);
|
|
||||||
if let Some(output) = primary_scanout_output {
|
|
||||||
with_fractional_scale(states, |fraction_scale| {
|
|
||||||
fraction_scale
|
|
||||||
.set_preferred_scale(output.current_scale().fractional_scale());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
space.minimized_windows.iter().for_each(|m| {
|
space.minimized_windows.iter().for_each(|m| {
|
||||||
for (window, _) in m.window.windows() {
|
for (window, _) in m.window.windows() {
|
||||||
window.with_surfaces(|surface, states| {
|
window.with_surfaces(processor);
|
||||||
let primary_scanout_output = update_surface_primary_scanout_output(
|
|
||||||
surface,
|
|
||||||
output,
|
|
||||||
states,
|
|
||||||
render_element_states,
|
|
||||||
default_primary_scanout_output_compare,
|
|
||||||
);
|
|
||||||
if let Some(output) = primary_scanout_output {
|
|
||||||
with_fractional_scale(states, |fraction_scale| {
|
|
||||||
fraction_scale
|
|
||||||
.set_preferred_scale(output.current_scale().fractional_scale());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -734,21 +716,7 @@ impl Common {
|
||||||
// OR windows
|
// OR windows
|
||||||
shell.override_redirect_windows.iter().for_each(|or| {
|
shell.override_redirect_windows.iter().for_each(|or| {
|
||||||
if let Some(wl_surface) = or.wl_surface() {
|
if let Some(wl_surface) = or.wl_surface() {
|
||||||
with_surfaces_surface_tree(&wl_surface, |surface, states| {
|
with_surfaces_surface_tree(&wl_surface, processor);
|
||||||
let primary_scanout_output = update_surface_primary_scanout_output(
|
|
||||||
surface,
|
|
||||||
output,
|
|
||||||
states,
|
|
||||||
render_element_states,
|
|
||||||
default_primary_scanout_output_compare,
|
|
||||||
);
|
|
||||||
if let Some(output) = primary_scanout_output {
|
|
||||||
with_fractional_scale(states, |fraction_scale| {
|
|
||||||
fraction_scale
|
|
||||||
.set_preferred_scale(output.current_scale().fractional_scale());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -756,21 +724,7 @@ impl Common {
|
||||||
for o in shell.outputs() {
|
for o in shell.outputs() {
|
||||||
let map = smithay::desktop::layer_map_for_output(o);
|
let map = smithay::desktop::layer_map_for_output(o);
|
||||||
for layer_surface in map.layers() {
|
for layer_surface in map.layers() {
|
||||||
layer_surface.with_surfaces(|surface, states| {
|
layer_surface.with_surfaces(processor);
|
||||||
let primary_scanout_output = update_surface_primary_scanout_output(
|
|
||||||
surface,
|
|
||||||
output,
|
|
||||||
states,
|
|
||||||
render_element_states,
|
|
||||||
default_primary_scanout_output_compare,
|
|
||||||
);
|
|
||||||
if let Some(output) = primary_scanout_output {
|
|
||||||
with_fractional_scale(states, |fraction_scale| {
|
|
||||||
fraction_scale
|
|
||||||
.set_preferred_scale(output.current_scale().fractional_scale());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -967,12 +921,6 @@ impl Common {
|
||||||
|
|
||||||
if let Some(session_lock) = shell.session_lock.as_ref() {
|
if let Some(session_lock) = shell.session_lock.as_ref() {
|
||||||
if let Some(lock_surface) = session_lock.surfaces.get(output) {
|
if let Some(lock_surface) = session_lock.surfaces.get(output) {
|
||||||
with_surfaces_surface_tree(lock_surface.wl_surface(), |_surface, states| {
|
|
||||||
with_fractional_scale(states, |fraction_scale| {
|
|
||||||
fraction_scale
|
|
||||||
.set_preferred_scale(output.current_scale().fractional_scale());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
send_frames_surface_tree(
|
send_frames_surface_tree(
|
||||||
lock_surface.wl_surface(),
|
lock_surface.wl_surface(),
|
||||||
output,
|
output,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue