1
0
Fork 0
forked from wry/wry

head-management: add jay-tearing-mode-info-v1 extension

This commit is contained in:
Julian Orth 2025-07-14 15:00:56 +02:00
parent 3e2707174e
commit a7f8a26df7
11 changed files with 107 additions and 11 deletions

View file

@ -405,4 +405,5 @@ declare_extensions! {
drm_color_space_info_v1: DrmColorSpaceInfoV1,
non_desktop_override_v1: NonDesktopOverrideV1,
jay_vrr_mode_info_v1: JayVrrModeInfoV1,
jay_tearing_mode_info_v1: JayTearingModeInfoV1,
}

View file

@ -7,6 +7,7 @@ pub(super) mod jay_head_ext_connector_info_v1;
pub(super) mod jay_head_ext_core_info_v1;
pub(super) mod jay_head_ext_drm_color_space_info_v1;
pub(super) mod jay_head_ext_format_info_v1;
pub(super) mod jay_head_ext_jay_tearing_mode_info_v1;
pub(super) mod jay_head_ext_jay_vrr_mode_info_v1;
pub(super) mod jay_head_ext_mode_info_v1;
pub(super) mod jay_head_ext_mode_setter_v1;

View file

@ -0,0 +1,51 @@
use {
crate::{
ifs::head_management::HeadState,
wire::{
jay_head_ext_jay_tearing_mode_info_v1::{
JayHeadExtJayTearingModeInfoV1RequestHandler, Mode,
},
jay_head_manager_ext_jay_tearing_mode_info_v1::JayHeadManagerExtJayTearingModeInfoV1RequestHandler,
},
},
std::rc::Rc,
};
impl_jay_tearing_mode_info_v1! {
version = 1,
after_announce = after_announce,
after_transaction = after_transaction,
}
impl HeadName {
fn after_announce(&self, shared: &HeadState) {
self.send_mode(shared);
}
fn after_transaction(&self, shared: &HeadState, tran: &HeadState) {
if shared.tearing_mode != tran.tearing_mode {
self.send_mode(shared);
}
}
pub(in super::super) fn send_mode(&self, state: &HeadState) {
self.client.event(Mode {
self_id: self.id,
mode: state.tearing_mode.0,
});
}
}
impl JayHeadManagerExtJayTearingModeInfoV1RequestHandler for MgrName {
type Error = ErrorName;
mgr_common_req!();
}
impl JayHeadExtJayTearingModeInfoV1RequestHandler for HeadName {
type Error = ErrorName;
head_common_req!();
}
error!();