mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2024-12-27 21:58:18 +01:00
Add idle notify
This commit is contained in:
parent
8bc0f40f18
commit
bfce194c0b
3 changed files with 34 additions and 3 deletions
|
@ -10,8 +10,8 @@ use std::{mem, os::fd::OwnedFd, sync::Arc};
|
||||||
use smithay::{
|
use smithay::{
|
||||||
backend::renderer::utils::{self, with_renderer_surface_state},
|
backend::renderer::utils::{self, with_renderer_surface_state},
|
||||||
delegate_compositor, delegate_data_control, delegate_data_device, delegate_fractional_scale,
|
delegate_compositor, delegate_data_control, delegate_data_device, delegate_fractional_scale,
|
||||||
delegate_layer_shell, delegate_output, delegate_pointer_constraints, delegate_presentation,
|
delegate_idle_notify, delegate_layer_shell, delegate_output, delegate_pointer_constraints,
|
||||||
delegate_primary_selection, delegate_relative_pointer, delegate_seat,
|
delegate_presentation, delegate_primary_selection, delegate_relative_pointer, delegate_seat,
|
||||||
delegate_security_context, delegate_shm, delegate_viewporter, delegate_xwayland_shell,
|
delegate_security_context, delegate_shm, delegate_viewporter, delegate_xwayland_shell,
|
||||||
desktop::{
|
desktop::{
|
||||||
self, find_popup_root_surface, get_popup_toplevel_coords, layer_map_for_output, PopupKind,
|
self, find_popup_root_surface, get_popup_toplevel_coords, layer_map_for_output, PopupKind,
|
||||||
|
@ -42,6 +42,7 @@ use smithay::{
|
||||||
},
|
},
|
||||||
dmabuf,
|
dmabuf,
|
||||||
fractional_scale::{self, FractionalScaleHandler},
|
fractional_scale::{self, FractionalScaleHandler},
|
||||||
|
idle_notify::{IdleNotifierHandler, IdleNotifierState},
|
||||||
output::OutputHandler,
|
output::OutputHandler,
|
||||||
pointer_constraints::{with_pointer_constraint, PointerConstraintsHandler},
|
pointer_constraints::{with_pointer_constraint, PointerConstraintsHandler},
|
||||||
seat::WaylandFocus,
|
seat::WaylandFocus,
|
||||||
|
@ -917,6 +918,13 @@ impl XWaylandShellHandler for State {
|
||||||
}
|
}
|
||||||
delegate_xwayland_shell!(State);
|
delegate_xwayland_shell!(State);
|
||||||
|
|
||||||
|
impl IdleNotifierHandler for State {
|
||||||
|
fn idle_notifier_state(&mut self) -> &mut IdleNotifierState<Self> {
|
||||||
|
&mut self.pinnacle.idle_notifier_state
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delegate_idle_notify!(State);
|
||||||
|
|
||||||
impl Pinnacle {
|
impl Pinnacle {
|
||||||
fn position_popup(&self, popup: &PopupSurface) {
|
fn position_popup(&self, popup: &PopupSurface) {
|
||||||
trace!("State::position_popup");
|
trace!("State::position_popup");
|
||||||
|
|
20
src/input.rs
20
src/input.rs
|
@ -400,6 +400,10 @@ impl State {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn keyboard<I: InputBackend>(&mut self, event: I::KeyboardKeyEvent) {
|
fn keyboard<I: InputBackend>(&mut self, event: I::KeyboardKeyEvent) {
|
||||||
|
self.pinnacle
|
||||||
|
.idle_notifier_state
|
||||||
|
.notify_activity(&self.pinnacle.seat);
|
||||||
|
|
||||||
let serial = SERIAL_COUNTER.next_serial();
|
let serial = SERIAL_COUNTER.next_serial();
|
||||||
let time = event.time_msec();
|
let time = event.time_msec();
|
||||||
let press_state = event.state();
|
let press_state = event.state();
|
||||||
|
@ -616,6 +620,10 @@ impl State {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pointer_button<I: InputBackend>(&mut self, event: I::PointerButtonEvent) {
|
fn pointer_button<I: InputBackend>(&mut self, event: I::PointerButtonEvent) {
|
||||||
|
self.pinnacle
|
||||||
|
.idle_notifier_state
|
||||||
|
.notify_activity(&self.pinnacle.seat);
|
||||||
|
|
||||||
let Some(pointer) = self.pinnacle.seat.get_pointer() else {
|
let Some(pointer) = self.pinnacle.seat.get_pointer() else {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
@ -699,6 +707,10 @@ impl State {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pointer_axis<I: InputBackend>(&mut self, event: I::PointerAxisEvent) {
|
fn pointer_axis<I: InputBackend>(&mut self, event: I::PointerAxisEvent) {
|
||||||
|
self.pinnacle
|
||||||
|
.idle_notifier_state
|
||||||
|
.notify_activity(&self.pinnacle.seat);
|
||||||
|
|
||||||
let source = event.source();
|
let source = event.source();
|
||||||
|
|
||||||
let horizontal_amount = event
|
let horizontal_amount = event
|
||||||
|
@ -747,6 +759,10 @@ impl State {
|
||||||
/// This *should* only be generated on the winit backend.
|
/// This *should* only be generated on the winit backend.
|
||||||
/// Unless there's a case where it's generated on udev that I'm unaware of.
|
/// Unless there's a case where it's generated on udev that I'm unaware of.
|
||||||
fn pointer_motion_absolute<I: InputBackend>(&mut self, event: I::PointerMotionAbsoluteEvent) {
|
fn pointer_motion_absolute<I: InputBackend>(&mut self, event: I::PointerMotionAbsoluteEvent) {
|
||||||
|
self.pinnacle
|
||||||
|
.idle_notifier_state
|
||||||
|
.notify_activity(&self.pinnacle.seat);
|
||||||
|
|
||||||
let Some(pointer) = self.pinnacle.seat.get_pointer() else {
|
let Some(pointer) = self.pinnacle.seat.get_pointer() else {
|
||||||
error!("Pointer motion absolute received with no pointer on seat");
|
error!("Pointer motion absolute received with no pointer on seat");
|
||||||
return;
|
return;
|
||||||
|
@ -795,6 +811,10 @@ impl State {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pointer_motion<I: InputBackend>(&mut self, event: I::PointerMotionEvent) {
|
fn pointer_motion<I: InputBackend>(&mut self, event: I::PointerMotionEvent) {
|
||||||
|
self.pinnacle
|
||||||
|
.idle_notifier_state
|
||||||
|
.notify_activity(&self.pinnacle.seat);
|
||||||
|
|
||||||
let Some(pointer) = self.pinnacle.seat.get_pointer() else {
|
let Some(pointer) = self.pinnacle.seat.get_pointer() else {
|
||||||
error!("Pointer motion received with no pointer on seat");
|
error!("Pointer motion received with no pointer on seat");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -34,6 +34,7 @@ use smithay::{
|
||||||
compositor::{self, CompositorClientState, CompositorState},
|
compositor::{self, CompositorClientState, CompositorState},
|
||||||
dmabuf::DmabufFeedback,
|
dmabuf::DmabufFeedback,
|
||||||
fractional_scale::FractionalScaleManagerState,
|
fractional_scale::FractionalScaleManagerState,
|
||||||
|
idle_notify::IdleNotifierState,
|
||||||
output::OutputManagerState,
|
output::OutputManagerState,
|
||||||
pointer_constraints::PointerConstraintsState,
|
pointer_constraints::PointerConstraintsState,
|
||||||
relative_pointer::RelativePointerManagerState,
|
relative_pointer::RelativePointerManagerState,
|
||||||
|
@ -99,6 +100,7 @@ pub struct Pinnacle {
|
||||||
pub foreign_toplevel_manager_state: ForeignToplevelManagerState,
|
pub foreign_toplevel_manager_state: ForeignToplevelManagerState,
|
||||||
pub session_lock_manager_state: SessionLockManagerState,
|
pub session_lock_manager_state: SessionLockManagerState,
|
||||||
pub xwayland_shell_state: XWaylandShellState,
|
pub xwayland_shell_state: XWaylandShellState,
|
||||||
|
pub idle_notifier_state: IdleNotifierState<State>,
|
||||||
|
|
||||||
pub lock_state: LockState,
|
pub lock_state: LockState,
|
||||||
|
|
||||||
|
@ -241,7 +243,7 @@ impl Pinnacle {
|
||||||
|
|
||||||
let pinnacle = Pinnacle {
|
let pinnacle = Pinnacle {
|
||||||
loop_signal,
|
loop_signal,
|
||||||
loop_handle,
|
loop_handle: loop_handle.clone(),
|
||||||
display_handle: display_handle.clone(),
|
display_handle: display_handle.clone(),
|
||||||
clock: Clock::<Monotonic>::new(),
|
clock: Clock::<Monotonic>::new(),
|
||||||
compositor_state: CompositorState::new::<State>(&display_handle),
|
compositor_state: CompositorState::new::<State>(&display_handle),
|
||||||
|
@ -287,6 +289,7 @@ impl Pinnacle {
|
||||||
filter_restricted_client,
|
filter_restricted_client,
|
||||||
),
|
),
|
||||||
xwayland_shell_state: XWaylandShellState::new::<State>(&display_handle),
|
xwayland_shell_state: XWaylandShellState::new::<State>(&display_handle),
|
||||||
|
idle_notifier_state: IdleNotifierState::new(&display_handle, loop_handle),
|
||||||
|
|
||||||
lock_state: LockState::default(),
|
lock_state: LockState::default(),
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue