mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +07:00
+40
-28
@@ -2086,22 +2086,27 @@ impl State {
|
|||||||
|
|
||||||
let mut pointer_elements = Vec::new();
|
let mut pointer_elements = Vec::new();
|
||||||
let mut pointer_location = Point::default();
|
let mut pointer_location = Point::default();
|
||||||
if let Some((pointer_pos, win_pos)) = self.niri.pointer_pos_for_window_cast(mapped)
|
|
||||||
{
|
|
||||||
// Pointer location must be relative to the screencast buffer.
|
|
||||||
// - win_pos is the position of the main window surface in output-local
|
|
||||||
// coordinates
|
|
||||||
// - bbox.loc moves us relative to the screencast buffer
|
|
||||||
let buf_pos = win_pos + bbox.loc.to_f64().to_logical(scale);
|
|
||||||
let output_pos = self.niri.global_space.output_geometry(output).unwrap().loc;
|
|
||||||
pointer_location = pointer_pos - output_pos.to_f64() - buf_pos;
|
|
||||||
|
|
||||||
let pos = buf_pos.to_physical_precise_round(scale).upscale(-1);
|
if self.niri.pointer_visibility.is_visible() {
|
||||||
self.niri.render_pointer(renderer, output, &mut |elem| {
|
if let Some((pointer_pos, win_pos)) =
|
||||||
let elem =
|
self.niri.pointer_pos_for_window_cast(mapped)
|
||||||
RelocateRenderElement::from_element(elem, pos, Relocate::Relative);
|
{
|
||||||
pointer_elements.push(CastRenderElement::from(elem));
|
// Pointer location must be relative to the screencast buffer.
|
||||||
});
|
// - win_pos is the position of the main window surface in output-local
|
||||||
|
// coordinates
|
||||||
|
// - bbox.loc moves us relative to the screencast buffer
|
||||||
|
let buf_pos = win_pos + bbox.loc.to_f64().to_logical(scale);
|
||||||
|
let output_pos =
|
||||||
|
self.niri.global_space.output_geometry(output).unwrap().loc;
|
||||||
|
pointer_location = pointer_pos - output_pos.to_f64() - buf_pos;
|
||||||
|
|
||||||
|
let pos = buf_pos.to_physical_precise_round(scale).upscale(-1);
|
||||||
|
self.niri.render_pointer(renderer, output, &mut |elem| {
|
||||||
|
let elem =
|
||||||
|
RelocateRenderElement::from_element(elem, pos, Relocate::Relative);
|
||||||
|
pointer_elements.push(CastRenderElement::from(elem));
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let cursor_data = CursorData::compute(&pointer_elements, pointer_location, scale);
|
let cursor_data = CursorData::compute(&pointer_elements, pointer_location, scale);
|
||||||
|
|
||||||
@@ -5331,7 +5336,9 @@ impl Niri {
|
|||||||
&mut |elem| elements.push(elem.into()),
|
&mut |elem| elements.push(elem.into()),
|
||||||
);
|
);
|
||||||
|
|
||||||
self.render_pointer(renderer, output, &mut |elem| pointer.push(elem.into()));
|
if self.pointer_visibility.is_visible() {
|
||||||
|
self.render_pointer(renderer, output, &mut |elem| pointer.push(elem.into()));
|
||||||
|
}
|
||||||
|
|
||||||
let output_pos = self.global_space.output_geometry(output).unwrap().loc;
|
let output_pos = self.global_space.output_geometry(output).unwrap().loc;
|
||||||
let pointer_pos = self
|
let pointer_pos = self
|
||||||
@@ -5407,19 +5414,24 @@ impl Niri {
|
|||||||
|
|
||||||
let mut pointer_elements = Vec::new();
|
let mut pointer_elements = Vec::new();
|
||||||
let mut pointer_location = Point::default();
|
let mut pointer_location = Point::default();
|
||||||
if let Some((pointer_pos, win_pos)) = self.pointer_pos_for_window_cast(mapped) {
|
|
||||||
// Pointer location must be relative to the screencast buffer.
|
|
||||||
// - win_pos is the position of the main window surface in output-local coordinates
|
|
||||||
// - bbox.loc moves us relative to the screencast buffer
|
|
||||||
let buf_pos = win_pos + bbox.loc.to_f64().to_logical(scale);
|
|
||||||
let output_pos = self.global_space.output_geometry(output).unwrap().loc;
|
|
||||||
pointer_location = pointer_pos - output_pos.to_f64() - buf_pos;
|
|
||||||
|
|
||||||
let pos = buf_pos.to_physical_precise_round(scale).upscale(-1);
|
if self.pointer_visibility.is_visible() {
|
||||||
self.render_pointer(renderer, output, &mut |elem| {
|
if let Some((pointer_pos, win_pos)) = self.pointer_pos_for_window_cast(mapped) {
|
||||||
let elem = RelocateRenderElement::from_element(elem, pos, Relocate::Relative);
|
// Pointer location must be relative to the screencast buffer.
|
||||||
pointer_elements.push(CastRenderElement::from(elem));
|
// - win_pos is the position of the main window surface in output-local
|
||||||
});
|
// coordinates
|
||||||
|
// - bbox.loc moves us relative to the screencast buffer
|
||||||
|
let buf_pos = win_pos + bbox.loc.to_f64().to_logical(scale);
|
||||||
|
let output_pos = self.global_space.output_geometry(output).unwrap().loc;
|
||||||
|
pointer_location = pointer_pos - output_pos.to_f64() - buf_pos;
|
||||||
|
|
||||||
|
let pos = buf_pos.to_physical_precise_round(scale).upscale(-1);
|
||||||
|
self.render_pointer(renderer, output, &mut |elem| {
|
||||||
|
let elem =
|
||||||
|
RelocateRenderElement::from_element(elem, pos, Relocate::Relative);
|
||||||
|
pointer_elements.push(CastRenderElement::from(elem));
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
let cursor_data = CursorData::compute(&pointer_elements, pointer_location, scale);
|
let cursor_data = CursorData::compute(&pointer_elements, pointer_location, scale);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user