Merge pull request #81 from mahkoh/jorth/cursor-fixes
Various cursor fixes
This commit is contained in:
commit
4f7d39dc34
6 changed files with 20 additions and 7 deletions
|
|
@ -392,6 +392,7 @@ fn create_dummy_output(state: &Rc<State>) {
|
|||
hardware_cursor: Default::default(),
|
||||
update_render_data_scheduled: Cell::new(false),
|
||||
screencasts: Default::default(),
|
||||
hardware_cursor_needs_render: Cell::new(false),
|
||||
});
|
||||
let dummy_workspace = Rc::new(WorkspaceNode {
|
||||
id: state.node_ids.next(),
|
||||
|
|
|
|||
|
|
@ -190,9 +190,6 @@ impl Framebuffer {
|
|||
if let Some(rect) = cursor_rect {
|
||||
let seats = state.globals.lock_seats();
|
||||
for seat in seats.values() {
|
||||
if !render_hardware_cursor && seat.hardware_cursor() {
|
||||
continue;
|
||||
}
|
||||
if let Some(cursor) = seat.get_cursor() {
|
||||
let (mut x, mut y) = seat.get_position();
|
||||
if let Some(dnd_icon) = seat.dnd_icon() {
|
||||
|
|
@ -205,10 +202,12 @@ impl Framebuffer {
|
|||
renderer.render_surface(&dnd_icon, x, y, i32::MAX, i32::MAX);
|
||||
}
|
||||
}
|
||||
cursor.tick();
|
||||
x -= Fixed::from_int(rect.x1());
|
||||
y -= Fixed::from_int(rect.y1());
|
||||
cursor.render(&mut renderer, x, y);
|
||||
if render_hardware_cursor || !seat.hardware_cursor() {
|
||||
cursor.tick();
|
||||
x -= Fixed::from_int(rect.x1());
|
||||
y -= Fixed::from_int(rect.y1());
|
||||
cursor.render(&mut renderer, x, y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -258,6 +258,7 @@ impl WlSeatGlobal {
|
|||
let (x, y) = self.get_position();
|
||||
for output in self.state.root.outputs.lock().values() {
|
||||
if let Some(hc) = output.hardware_cursor.get() {
|
||||
let render = render | output.hardware_cursor_needs_render.take();
|
||||
let scale = output.preferred_scale.get();
|
||||
let extents = cursor.extents_at_scale(scale);
|
||||
if render {
|
||||
|
|
@ -290,6 +291,9 @@ impl WlSeatGlobal {
|
|||
hc.set_enabled(true);
|
||||
hc.set_position(x_rel + extents.x1(), y_rel + extents.y1());
|
||||
} else {
|
||||
if render {
|
||||
output.hardware_cursor_needs_render.set(true);
|
||||
}
|
||||
hc.set_enabled(false);
|
||||
}
|
||||
hc.commit();
|
||||
|
|
|
|||
|
|
@ -192,13 +192,20 @@ impl WlPointer {
|
|||
Some(n) => n,
|
||||
_ => {
|
||||
// cannot happen
|
||||
log::warn!("ignoring wl_pointer.set_cursor (1)");
|
||||
return Ok(());
|
||||
}
|
||||
};
|
||||
if pointer_node.node_client_id() != Some(self.seat.client.id) {
|
||||
log::warn!("ignoring wl_pointer.set_cursor (2)");
|
||||
return Ok(());
|
||||
}
|
||||
if req.serial != self.seat.client.last_enter_serial.get() {
|
||||
log::warn!(
|
||||
"ignoring wl_pointer.set_cursor (3) ({} != {})",
|
||||
req.serial,
|
||||
self.seat.client.last_enter_serial.get(),
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
self.seat.global.set_app_cursor(cursor_opt);
|
||||
|
|
|
|||
|
|
@ -128,6 +128,7 @@ impl ConnectorHandler {
|
|||
jay_outputs: Default::default(),
|
||||
screencasts: Default::default(),
|
||||
update_render_data_scheduled: Cell::new(false),
|
||||
hardware_cursor_needs_render: Cell::new(false),
|
||||
});
|
||||
self.state.add_output_scale(on.preferred_scale.get());
|
||||
let mode = info.initial_mode;
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ pub struct OutputNode {
|
|||
pub lock_surface: CloneCell<Option<Rc<ExtSessionLockSurfaceV1>>>,
|
||||
pub preferred_scale: Cell<Scale>,
|
||||
pub hardware_cursor: CloneCell<Option<Rc<dyn HardwareCursor>>>,
|
||||
pub hardware_cursor_needs_render: Cell<bool>,
|
||||
pub update_render_data_scheduled: Cell<bool>,
|
||||
pub screencasts: CopyHashMap<(ClientId, JayScreencastId), Rc<JayScreencast>>,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue