mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2025-01-18 22:26:12 +01:00
Offset default pointer by hotspot
Fixes #252. Currently a temporary fix until I implement cursor shape
This commit is contained in:
parent
fc4dd9d62e
commit
39fd958fae
6 changed files with 22 additions and 24 deletions
|
@ -64,6 +64,9 @@ features = [
|
|||
"x11rb_event_source",
|
||||
]
|
||||
|
||||
[workspace.lints.clippy]
|
||||
too_many_arguments = "allow"
|
||||
|
||||
########################################################################yo😎###########
|
||||
|
||||
[package]
|
||||
|
@ -140,3 +143,6 @@ testing = [
|
|||
"smithay/renderer_test",
|
||||
]
|
||||
wlcs = ["testing"]
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
|
|
|
@ -65,8 +65,6 @@ impl window_service_server::WindowService for WindowService {
|
|||
) -> Result<Response<()>, Status> {
|
||||
let request = request.into_inner();
|
||||
|
||||
tracing::info!(request = ?request);
|
||||
|
||||
let window_id = WindowId(
|
||||
request
|
||||
.window_id
|
||||
|
|
|
@ -51,7 +51,7 @@ use smithay::{
|
|||
vulkan::{self, version::Version, PhysicalDevice},
|
||||
SwapBuffersError,
|
||||
},
|
||||
desktop::utils::{send_frames_surface_tree, OutputPresentationFeedback},
|
||||
desktop::utils::OutputPresentationFeedback,
|
||||
input::pointer::CursorImageStatus,
|
||||
output::{Output, PhysicalProperties, Subpixel},
|
||||
reexports::{
|
||||
|
@ -1414,17 +1414,15 @@ impl Udev {
|
|||
let _ = renderer.downscale_filter(self.downscale_filter);
|
||||
|
||||
let pointer_images = &mut self.pointer_images;
|
||||
let pointer_image = pointer_images
|
||||
let (pointer_image, hotspot) = pointer_images
|
||||
.iter()
|
||||
.find_map(
|
||||
|(image, texture)| {
|
||||
if image == &frame {
|
||||
Some(texture.clone())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
},
|
||||
)
|
||||
.find_map(|(image, texture)| {
|
||||
if image == &frame {
|
||||
Some((texture.clone(), (frame.xhot as i32, frame.yhot as i32)))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.unwrap_or_else(|| {
|
||||
let texture = TextureBuffer::from_memory(
|
||||
&mut renderer,
|
||||
|
@ -1437,8 +1435,9 @@ impl Udev {
|
|||
None,
|
||||
)
|
||||
.expect("Failed to import cursor bitmap");
|
||||
let hotspot = (frame.xhot as i32, frame.yhot as i32);
|
||||
pointer_images.push((frame, texture.clone()));
|
||||
texture
|
||||
(texture, hotspot)
|
||||
});
|
||||
|
||||
let pointer_location = pinnacle
|
||||
|
@ -1455,14 +1454,6 @@ impl Udev {
|
|||
if let CursorImageStatus::Surface(surface) = &pinnacle.cursor_status {
|
||||
if !surface.alive() {
|
||||
pinnacle.cursor_status = CursorImageStatus::default_named();
|
||||
} else {
|
||||
send_frames_surface_tree(
|
||||
surface,
|
||||
output,
|
||||
pinnacle.clock.now(),
|
||||
Some(Duration::ZERO),
|
||||
|_, _| None,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1499,6 +1490,7 @@ impl Udev {
|
|||
pointer_location,
|
||||
&mut pinnacle.cursor_status,
|
||||
pinnacle.dnd_icon.as_ref(),
|
||||
hotspot.into(),
|
||||
&self.pointer_element,
|
||||
);
|
||||
self.pointer_element.set_element_kind(element::Kind::Cursor);
|
||||
|
@ -1513,6 +1505,7 @@ impl Udev {
|
|||
pointer_location,
|
||||
&mut pinnacle.cursor_status,
|
||||
pinnacle.dnd_icon.as_ref(),
|
||||
hotspot.into(),
|
||||
&self.pointer_element,
|
||||
);
|
||||
output_render_elements.extend(pointer_render_elements);
|
||||
|
|
|
@ -21,7 +21,6 @@ impl Udev {
|
|||
}
|
||||
None => PendingGammaChange::Restore,
|
||||
};
|
||||
tracing::info!("SET PENDING GAMMA WOO");
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
|
|
|
@ -304,6 +304,7 @@ impl Winit {
|
|||
pointer_location,
|
||||
&mut pinnacle.cursor_status,
|
||||
pinnacle.dnd_icon.as_ref(),
|
||||
(0, 0).into(), // Nonsurface cursors are hidden
|
||||
&pointer_element,
|
||||
);
|
||||
output_render_elements.extend(pointer_render_elements);
|
||||
|
|
|
@ -275,6 +275,7 @@ pub fn pointer_render_elements<R: PRenderer>(
|
|||
pointer_location: Point<f64, Logical>,
|
||||
cursor_status: &mut CursorImageStatus,
|
||||
dnd_icon: Option<&WlSurface>,
|
||||
fallback_hotspot: Point<i32, Logical>,
|
||||
pointer_element: &PointerElement<<R as Renderer>::TextureId>,
|
||||
) -> Vec<OutputRenderElement<R>> {
|
||||
let mut output_render_elements = Vec::new();
|
||||
|
@ -296,7 +297,7 @@ pub fn pointer_render_elements<R: PRenderer>(
|
|||
.hotspot
|
||||
})
|
||||
} else {
|
||||
(0, 0).into()
|
||||
fallback_hotspot
|
||||
};
|
||||
|
||||
let cursor_pos = pointer_location - output_geometry.loc.to_f64() - cursor_hotspot.to_f64();
|
||||
|
|
Loading…
Reference in a new issue