head-management: add tearing-state-v1 extension
This commit is contained in:
parent
aaef75f9f3
commit
4482c3168b
10 changed files with 140 additions and 4 deletions
|
|
@ -400,4 +400,5 @@ declare_extensions! {
|
|||
physical_display_info_v1: PhysicalDisplayInfoV1,
|
||||
non_desktop_info_v1: NonDesktopInfoV1,
|
||||
vrr_state_v1: VrrStateV1,
|
||||
tearing_state_v1: TearingStateV1,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,4 +9,5 @@ pub(super) mod jay_head_ext_mode_info_v1;
|
|||
pub(super) mod jay_head_ext_mode_setter_v1;
|
||||
pub(super) mod jay_head_ext_non_desktop_info_v1;
|
||||
pub(super) mod jay_head_ext_physical_display_info_v1;
|
||||
pub(super) mod jay_head_ext_tearing_state_v1;
|
||||
pub(super) mod jay_head_ext_vrr_state_v1;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
use {
|
||||
crate::{
|
||||
ifs::head_management::HeadState,
|
||||
wire::{
|
||||
jay_head_ext_tearing_state_v1::{
|
||||
Active, Disabled, Enabled, Inactive, JayHeadExtTearingStateV1RequestHandler,
|
||||
},
|
||||
jay_head_manager_ext_tearing_state_v1::JayHeadManagerExtTearingStateV1RequestHandler,
|
||||
},
|
||||
},
|
||||
std::rc::Rc,
|
||||
};
|
||||
|
||||
impl_tearing_state_v1! {
|
||||
version = 1,
|
||||
after_announce = after_announce,
|
||||
after_transaction = after_transaction,
|
||||
}
|
||||
|
||||
impl HeadName {
|
||||
fn after_announce(&self, shared: &HeadState) {
|
||||
self.send_enabled(shared);
|
||||
self.send_active(shared);
|
||||
}
|
||||
|
||||
fn after_transaction(&self, shared: &HeadState, tran: &HeadState) {
|
||||
if shared.tearing_enabled != tran.tearing_enabled {
|
||||
self.send_enabled(shared);
|
||||
}
|
||||
if shared.tearing_active != tran.tearing_active {
|
||||
self.send_active(shared);
|
||||
}
|
||||
}
|
||||
|
||||
pub(in super::super) fn send_enabled(&self, state: &HeadState) {
|
||||
if state.tearing_enabled {
|
||||
self.client.event(Enabled { self_id: self.id });
|
||||
} else {
|
||||
self.client.event(Disabled { self_id: self.id });
|
||||
}
|
||||
}
|
||||
|
||||
pub(in super::super) fn send_active(&self, state: &HeadState) {
|
||||
if state.tearing_active {
|
||||
self.client.event(Active { self_id: self.id });
|
||||
} else {
|
||||
self.client.event(Inactive { self_id: self.id });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl JayHeadManagerExtTearingStateV1RequestHandler for MgrName {
|
||||
type Error = ErrorName;
|
||||
|
||||
mgr_common_req!();
|
||||
}
|
||||
|
||||
impl JayHeadExtTearingStateV1RequestHandler for HeadName {
|
||||
type Error = ErrorName;
|
||||
|
||||
head_common_req!();
|
||||
}
|
||||
|
||||
error!();
|
||||
Loading…
Add table
Add a link
Reference in a new issue