layer surface fixes. also always offload pending configures to surfaces
This commit is contained in:
parent
eea1406bd4
commit
fd695ef232
5 changed files with 57 additions and 14 deletions
|
|
@ -24,7 +24,21 @@ impl WlrLayerShellHandler for State {
|
|||
.and_then(Output::from_resource)
|
||||
.unwrap_or_else(|| self.space.outputs().next().unwrap().clone());
|
||||
let mut map = layer_map_for_output(&output);
|
||||
map.map_layer(&LayerSurface::new(surface, namespace))
|
||||
map.map_layer(&LayerSurface::new(surface.clone(), namespace))
|
||||
.unwrap();
|
||||
surface.send_configure();
|
||||
}
|
||||
|
||||
fn layer_destroyed(&mut self, surface: smithay::wayland::shell::wlr_layer::LayerSurface) {
|
||||
if let Some((mut map, layer)) = self.space.outputs().find_map(|o| {
|
||||
let map = layer_map_for_output(o);
|
||||
let layer = map
|
||||
.layers()
|
||||
.find(|&layer| layer.layer_surface() == &surface)
|
||||
.cloned();
|
||||
layer.map(|layer| (map, layer))
|
||||
}) {
|
||||
map.unmap_layer(&layer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
12
src/input.rs
12
src/input.rs
|
|
@ -3,6 +3,7 @@ use smithay::{
|
|||
AbsolutePositionEvent, Axis, AxisSource, ButtonState, Event, InputBackend, InputEvent,
|
||||
KeyboardKeyEvent, PointerAxisEvent, PointerButtonEvent,
|
||||
},
|
||||
desktop::layer_map_for_output,
|
||||
input::{
|
||||
keyboard::FilterResult,
|
||||
pointer::{AxisFrame, ButtonEvent, MotionEvent},
|
||||
|
|
@ -91,6 +92,17 @@ impl State {
|
|||
toplevel.send_pending_configure();
|
||||
}
|
||||
});
|
||||
self.space.elements().for_each(|window| {
|
||||
window.window.set_activated(false);
|
||||
if let Some(actv_window) = actv_window.as_ref() {
|
||||
if actv_window.window == window.window {
|
||||
window.window.set_activated(true);
|
||||
}
|
||||
}
|
||||
if let Some(toplevel) = window.window.toplevel() {
|
||||
toplevel.send_pending_configure();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
pointer.button(
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
#![allow(dead_code)]
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::State;
|
||||
use cairo::{Context, Format, ImageSurface};
|
||||
use parking_lot::Mutex;
|
||||
|
|
@ -419,6 +421,29 @@ impl State {
|
|||
framebuffer: &mut GlesTarget,
|
||||
damage_tracker: &mut OutputDamageTracker,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
self.space.elements().for_each(|window| {
|
||||
if let Some(toplevel) = window.window.toplevel() {
|
||||
toplevel.send_pending_configure();
|
||||
}
|
||||
window.window.send_frame(
|
||||
&output,
|
||||
self.start_time.elapsed(),
|
||||
Some(Duration::ZERO),
|
||||
|_, _| Some(output.clone()),
|
||||
)
|
||||
});
|
||||
self.space.outputs().for_each(|output| {
|
||||
layer_map_for_output(output).layers().for_each(|layer| {
|
||||
layer.layer_surface().send_pending_configure();
|
||||
layer.send_frame(
|
||||
&output,
|
||||
self.start_time.elapsed(),
|
||||
Some(Duration::ZERO),
|
||||
|_, _| Some(output.clone()),
|
||||
)
|
||||
})
|
||||
});
|
||||
|
||||
smithay::desktop::space::render_output::<_, OutputElement<GlesRenderer>, _, _>(
|
||||
output,
|
||||
renderer,
|
||||
|
|
|
|||
14
src/winit.rs
14
src/winit.rs
|
|
@ -14,15 +14,16 @@ use crate::State;
|
|||
pub fn init_winit(state: &mut State) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let (mut backend, winit) = winit::init()?;
|
||||
|
||||
let size = backend.window_size();
|
||||
let mode = Mode {
|
||||
size: backend.window_size(),
|
||||
size,
|
||||
refresh: 60_000,
|
||||
};
|
||||
|
||||
let output = Output::new(
|
||||
"winit".to_string(),
|
||||
PhysicalProperties {
|
||||
size: (0, 0).into(),
|
||||
size: (size.w, size.h).into(),
|
||||
subpixel: Subpixel::Unknown,
|
||||
make: "Milkyway".into(),
|
||||
model: "Winit".into(),
|
||||
|
|
@ -68,15 +69,6 @@ pub fn init_winit(state: &mut State) -> Result<(), Box<dyn std::error::Error>> {
|
|||
}
|
||||
backend.submit(Some(&[damage])).unwrap();
|
||||
|
||||
state.space.elements().for_each(|window| {
|
||||
window.window.send_frame(
|
||||
&output,
|
||||
state.start_time.elapsed(),
|
||||
Some(Duration::ZERO),
|
||||
|_, _| Some(output.clone()),
|
||||
)
|
||||
});
|
||||
|
||||
state.space.refresh();
|
||||
state.popups.cleanup();
|
||||
let _ = state.display_handle.flush_clients();
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ use std::process::Stdio;
|
|||
|
||||
use smithay::{
|
||||
desktop::Window,
|
||||
reexports::calloop::{EventLoop, LoopHandle},
|
||||
reexports::calloop::LoopHandle,
|
||||
utils::{Logical, Rectangle},
|
||||
wayland::xwayland_shell::{XWaylandShellHandler, XWaylandShellState},
|
||||
xwayland::{
|
||||
|
|
@ -10,7 +10,7 @@ use smithay::{
|
|||
X11Surface, X11Wm, XWayland, XWaylandEvent, XwmHandler,
|
||||
},
|
||||
};
|
||||
use wayland_server::{Display, DisplayHandle};
|
||||
use wayland_server::DisplayHandle;
|
||||
|
||||
use crate::{render::DecoratedWindow, state::State};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue