Merge pull request #331 from mahkoh/jorth/fix-subsurface-input-constraints
wl_surface: fix sub-surface extents filter
This commit is contained in:
commit
206a2ed4fc
22 changed files with 35 additions and 37 deletions
6
Cargo.lock
generated
6
Cargo.lock
generated
|
|
@ -1,6 +1,6 @@
|
|||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 3
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "addr2line"
|
||||
|
|
@ -715,9 +715,9 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9"
|
|||
|
||||
[[package]]
|
||||
name = "num-derive"
|
||||
version = "0.4.1"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cfb77679af88f8b125209d354a202862602672222e7f2313fdd6dc349bad4712"
|
||||
checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ ahash = "0.8.7"
|
|||
log = { version = "0.4.20", features = ["std"] }
|
||||
futures-util = "0.3.30"
|
||||
num-traits = "0.2.17"
|
||||
num-derive = "0.4.1"
|
||||
num-derive = "0.4.2"
|
||||
libloading = "0.8.1"
|
||||
bstr = { version = "1.9.0", default-features = false, features = ["std"] }
|
||||
isnt = "0.1.0"
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ fn write_egl_procs<W: Write>(f: &mut W) -> anyhow::Result<()> {
|
|||
for (name, _, _) in map.iter().copied() {
|
||||
writeln!(
|
||||
f,
|
||||
" {}: unsafe {{ (egl.eglGetProcAddress)(\"{}\\0\".as_ptr() as _) }},",
|
||||
" {}: unsafe {{ (egl.eglGetProcAddress)(c\"{}\".as_ptr() as _) }},",
|
||||
name, name
|
||||
)?;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ use {
|
|||
std::ptr,
|
||||
};
|
||||
|
||||
#[expect(clippy::manual_non_exhaustive)]
|
||||
pub struct ImgCopyWork {
|
||||
pub src: *mut u8,
|
||||
pub dst: *mut u8,
|
||||
|
|
|
|||
|
|
@ -742,8 +742,7 @@ impl WlSurface {
|
|||
if let Some(children) = self.children.borrow_mut().deref_mut() {
|
||||
for ss in children.subsurfaces.values() {
|
||||
let pos = ss.position.get();
|
||||
ss.surface
|
||||
.set_absolute_position(x1 + pos.x1(), y1 + pos.y1());
|
||||
ss.surface.set_absolute_position(x1 + pos.0, y1 + pos.1);
|
||||
}
|
||||
}
|
||||
for (_, con) in &self.text_input_connections {
|
||||
|
|
@ -878,7 +877,7 @@ impl WlSurface {
|
|||
let ce = ss.surface.extents.get();
|
||||
if !ce.is_empty() {
|
||||
let cp = ss.position.get();
|
||||
let ce = ce.move_(cp.x1(), cp.y1());
|
||||
let ce = ce.move_(cp.0, cp.1);
|
||||
extents = if extents.is_empty() {
|
||||
ce
|
||||
} else {
|
||||
|
|
@ -1516,8 +1515,10 @@ impl WlSurface {
|
|||
continue;
|
||||
}
|
||||
let pos = child.sub_surface.position.get();
|
||||
if pos.contains(x, y) {
|
||||
let (x, y) = pos.translate(x, y);
|
||||
let ext = child.sub_surface.surface.extents.get();
|
||||
let ext = ext.move_(pos.0, pos.1);
|
||||
if ext.contains(x, y) {
|
||||
let (x, y) = ext.translate(x, y);
|
||||
if let Some(res) = child.sub_surface.surface.find_surface_at(x, y) {
|
||||
return Some(res);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ use {
|
|||
},
|
||||
leaks::Tracker,
|
||||
object::{Object, Version},
|
||||
rect::Rect,
|
||||
utils::{
|
||||
clonecell::CloneCell,
|
||||
linkedlist::{LinkedNode, NodeRef},
|
||||
|
|
@ -36,7 +35,7 @@ pub struct WlSubsurface {
|
|||
unique_id: SubsurfaceId,
|
||||
pub surface: Rc<WlSurface>,
|
||||
pub(super) parent: Rc<WlSurface>,
|
||||
pub position: Cell<Rect>,
|
||||
pub position: Cell<(i32, i32)>,
|
||||
sync_requested: Cell<bool>,
|
||||
sync_ancestor: Cell<bool>,
|
||||
node: RefCell<Option<LinkedNode<StackElement>>>,
|
||||
|
|
@ -137,8 +136,7 @@ impl WlSubsurface {
|
|||
}
|
||||
if let Some((mut x, mut y)) = pending.position.take() {
|
||||
client_wire_scale_to_logical!(self.surface.client, x, y);
|
||||
self.position
|
||||
.set(self.surface.buffer_abs_pos.get().at_point(x, y));
|
||||
self.position.set((x, y));
|
||||
let (parent_x, parent_y) = self.parent.buffer_abs_pos.get().position();
|
||||
self.surface
|
||||
.set_absolute_position(parent_x + x, parent_y + y);
|
||||
|
|
|
|||
|
|
@ -389,12 +389,12 @@ impl Renderer<'_> {
|
|||
continue;
|
||||
}
|
||||
let pos = child.sub_surface.position.get();
|
||||
let (x1, y1) = self.base.scale_point(pos.x1(), pos.y1());
|
||||
let (x1, y1) = self.base.scale_point(pos.0, pos.1);
|
||||
self.render_surface_scaled(
|
||||
&child.sub_surface.surface,
|
||||
x + x1,
|
||||
y + y1,
|
||||
Some((pos.x1(), pos.y1())),
|
||||
Some(pos),
|
||||
bounds,
|
||||
true,
|
||||
);
|
||||
|
|
|
|||
|
|
@ -138,7 +138,7 @@ impl Udev {
|
|||
}
|
||||
|
||||
pub fn create_monitor(self: &Rc<Self>) -> Result<UdevMonitor, UdevError> {
|
||||
let res = unsafe { udev_monitor_new_from_netlink(self.udev, "udev\0".as_ptr() as _) };
|
||||
let res = unsafe { udev_monitor_new_from_netlink(self.udev, c"udev".as_ptr() as _) };
|
||||
if res.is_null() {
|
||||
return Err(UdevError::NewMonitor(Errno::default().into()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ impl<'a> Context<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> ErrorHandler for Context<'a> {
|
||||
impl ErrorHandler for Context<'_> {
|
||||
fn handle(&self, err: Spanned<ParserError>) {
|
||||
log::warn!("{}", Report::new(self.error(err)));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ pub struct SpannedError<'a, E> {
|
|||
pub cause: Option<E>,
|
||||
}
|
||||
|
||||
impl<'a, E: Error> Display for SpannedError<'a, E> {
|
||||
impl<E: Error> Display for SpannedError<'_, E> {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
||||
let original = self.input.deref();
|
||||
let span = self.span;
|
||||
|
|
@ -57,7 +57,7 @@ impl<'a, E: Error> Display for SpannedError<'a, E> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a, E: Error> Error for SpannedError<'a, E> {}
|
||||
impl<E: Error> Error for SpannedError<'_, E> {}
|
||||
|
||||
fn translate_position(input: &[u8], index: usize) -> (usize, usize) {
|
||||
if input.is_empty() {
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ impl<'v> Extractor<'v> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'v> Drop for Extractor<'v> {
|
||||
impl Drop for Extractor<'_> {
|
||||
fn drop(&mut self) {
|
||||
if !self.log_unused {
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ impl ActionParser<'_> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<'a> Parser for ActionParser<'a> {
|
||||
impl Parser for ActionParser<'_> {
|
||||
type Value = Action;
|
||||
type Error = ActionParserError;
|
||||
const EXPECTED: &'static [DataType] = &[DataType::String, DataType::Array, DataType::Table];
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ pub enum ConnectorParserError {
|
|||
|
||||
pub struct ConnectorParser<'a>(pub &'a Context<'a>);
|
||||
|
||||
impl<'a> Parser for ConnectorParser<'a> {
|
||||
impl Parser for ConnectorParser<'_> {
|
||||
type Value = ConfigConnector;
|
||||
type Error = ConnectorParserError;
|
||||
const EXPECTED: &'static [DataType] = &[DataType::Table];
|
||||
|
|
@ -49,7 +49,7 @@ impl<'a> Parser for ConnectorParser<'a> {
|
|||
|
||||
pub struct ConnectorsParser<'a>(pub &'a Context<'a>);
|
||||
|
||||
impl<'a> Parser for ConnectorsParser<'a> {
|
||||
impl Parser for ConnectorsParser<'_> {
|
||||
type Value = Vec<ConfigConnector>;
|
||||
type Error = ConnectorParserError;
|
||||
const EXPECTED: &'static [DataType] = &[DataType::Table, DataType::Array];
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ pub enum ConnectorMatchParserError {
|
|||
|
||||
pub struct ConnectorMatchParser<'a>(pub &'a Context<'a>);
|
||||
|
||||
impl<'a> Parser for ConnectorMatchParser<'a> {
|
||||
impl Parser for ConnectorMatchParser<'_> {
|
||||
type Value = ConnectorMatch;
|
||||
type Error = ConnectorMatchParserError;
|
||||
const EXPECTED: &'static [DataType] = &[DataType::Table, DataType::Array];
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ pub struct DrmDeviceParser<'a> {
|
|||
pub name_ok: bool,
|
||||
}
|
||||
|
||||
impl<'a> Parser for DrmDeviceParser<'a> {
|
||||
impl Parser for DrmDeviceParser<'_> {
|
||||
type Value = ConfigDrmDevice;
|
||||
type Error = DrmDeviceParserError;
|
||||
const EXPECTED: &'static [DataType] = &[DataType::Table];
|
||||
|
|
@ -89,7 +89,7 @@ impl<'a> Parser for DrmDeviceParser<'a> {
|
|||
|
||||
pub struct DrmDevicesParser<'a>(pub &'a Context<'a>);
|
||||
|
||||
impl<'a> Parser for DrmDevicesParser<'a> {
|
||||
impl Parser for DrmDevicesParser<'_> {
|
||||
type Value = Vec<ConfigDrmDevice>;
|
||||
type Error = DrmDeviceParserError;
|
||||
const EXPECTED: &'static [DataType] = &[DataType::Table, DataType::Array];
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ pub struct InputParser<'a> {
|
|||
pub is_inputs_array: bool,
|
||||
}
|
||||
|
||||
impl<'a> Parser for InputParser<'a> {
|
||||
impl Parser for InputParser<'_> {
|
||||
type Value = Input;
|
||||
type Error = InputParserError;
|
||||
const EXPECTED: &'static [DataType] = &[DataType::Table];
|
||||
|
|
@ -254,7 +254,7 @@ impl<'a> Parser for InputParser<'a> {
|
|||
|
||||
pub struct InputsParser<'a>(pub &'a Context<'a>);
|
||||
|
||||
impl<'a> Parser for InputsParser<'a> {
|
||||
impl Parser for InputsParser<'_> {
|
||||
type Value = Vec<Input>;
|
||||
type Error = InputParserError;
|
||||
const EXPECTED: &'static [DataType] = &[DataType::Table, DataType::Array];
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ pub enum InputMatchParserError {
|
|||
|
||||
pub struct InputMatchParser<'a>(pub &'a Context<'a>);
|
||||
|
||||
impl<'a> Parser for InputMatchParser<'a> {
|
||||
impl Parser for InputMatchParser<'_> {
|
||||
type Value = InputMatch;
|
||||
type Error = InputMatchParserError;
|
||||
const EXPECTED: &'static [DataType] = &[DataType::Table, DataType::Array];
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ pub enum ModeParserError {
|
|||
|
||||
pub struct ModeParser<'a>(pub &'a Context<'a>);
|
||||
|
||||
impl<'a> Parser for ModeParser<'a> {
|
||||
impl Parser for ModeParser<'_> {
|
||||
type Value = Mode;
|
||||
type Error = ModeParserError;
|
||||
const EXPECTED: &'static [DataType] = &[DataType::Table];
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ pub struct OutputParser<'a> {
|
|||
pub name_ok: bool,
|
||||
}
|
||||
|
||||
impl<'a> Parser for OutputParser<'a> {
|
||||
impl Parser for OutputParser<'_> {
|
||||
type Value = Output;
|
||||
type Error = OutputParserError;
|
||||
const EXPECTED: &'static [DataType] = &[DataType::Table];
|
||||
|
|
@ -150,7 +150,7 @@ impl<'a> Parser for OutputParser<'a> {
|
|||
|
||||
pub struct OutputsParser<'a>(pub &'a Context<'a>);
|
||||
|
||||
impl<'a> Parser for OutputsParser<'a> {
|
||||
impl Parser for OutputsParser<'_> {
|
||||
type Value = Vec<Output>;
|
||||
type Error = OutputParserError;
|
||||
const EXPECTED: &'static [DataType] = &[DataType::Table, DataType::Array];
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ pub enum OutputMatchParserError {
|
|||
|
||||
pub struct OutputMatchParser<'a>(pub &'a Context<'a>);
|
||||
|
||||
impl<'a> Parser for OutputMatchParser<'a> {
|
||||
impl Parser for OutputMatchParser<'_> {
|
||||
type Value = OutputMatch;
|
||||
type Error = OutputMatchParserError;
|
||||
const EXPECTED: &'static [DataType] = &[DataType::Table, DataType::Table];
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ pub enum Token<'a> {
|
|||
Literal(&'a [u8]),
|
||||
}
|
||||
|
||||
impl<'a> Token<'a> {
|
||||
impl Token<'_> {
|
||||
pub fn name(self, value_context: bool) -> &'static str {
|
||||
match self {
|
||||
Token::Dot => "`.`",
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ struct Parser<'a, 'b> {
|
|||
|
||||
type Key = VecDeque<Spanned<String>>;
|
||||
|
||||
impl<'a, 'b> Parser<'a, 'b> {
|
||||
impl<'a> Parser<'a, '_> {
|
||||
fn parse(mut self) -> Result<Spanned<Value>, Spanned<ParserError>> {
|
||||
self.parse_document()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue