Skip the pointer hit test outside Overview presenting
visual_scale_for_window returns 1.0 whenever Overview is not presenting, so gate the window_under_visual walk behind is_presenting() and read the scale straight from the constant. Use hash_map::Entry for the window geometry insert so client_size is only computed on the vacant path, and reuse the elapsed time already sampled for the frame in expire_wait and presentation_size_request instead of calling start_time.elapsed() a second time.
This commit is contained in:
1 parent
2eb5fe7b73
commit
e7ee2f14db
2 files changed
+16
-12
No files matched your search
@@ -239,10 +239,13 @@ impl Ferese {
|
|||||||
let pointer = self.seat.get_pointer().expect("seat has a pointer");
|
let pointer = self.seat.get_pointer().expect("seat has a pointer");
|
||||||
let position = pointer.current_location();
|
let position = pointer.current_location();
|
||||||
let focus = self.surface_under(position);
|
let focus = self.surface_under(position);
|
||||||
let (scale_x, scale_y) = self
|
let (scale_x, scale_y) = if self.overview.is_presenting() {
|
||||||
.window_under_visual(position)
|
self.window_under_visual(position)
|
||||||
.and_then(|window| self.visual_scale_for_window(&window))
|
.and_then(|window| self.visual_scale_for_window(&window))
|
||||||
.unwrap_or((1.0, 1.0));
|
.unwrap_or((1.0, 1.0))
|
||||||
|
} else {
|
||||||
|
(1.0, 1.0)
|
||||||
|
};
|
||||||
let delta = event.delta();
|
let delta = event.delta();
|
||||||
let delta_unaccel = event.delta_unaccel();
|
let delta_unaccel = event.delta_unaccel();
|
||||||
|
|
||||||
|
|||||||
+10
-9
@@ -1,5 +1,5 @@
|
|||||||
use std::{
|
use std::{
|
||||||
collections::{HashMap, HashSet},
|
collections::{HashMap, HashSet, hash_map::Entry},
|
||||||
error::Error,
|
error::Error,
|
||||||
ffi::OsString,
|
ffi::OsString,
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
@@ -1468,12 +1468,13 @@ impl Ferese {
|
|||||||
if scrolling.is_none() {
|
if scrolling.is_none() {
|
||||||
self.viewport_coupled_widths.remove(&id);
|
self.viewport_coupled_widths.remove(&id);
|
||||||
}
|
}
|
||||||
let committed_size = client_size(&window);
|
let (geometry, had_geometry) = match self.window_geometry.entry(id) {
|
||||||
let had_geometry = self.window_geometry.contains_key(&id);
|
Entry::Occupied(entry) => (entry.into_mut(), true),
|
||||||
let geometry = self
|
Entry::Vacant(entry) => (
|
||||||
.window_geometry
|
entry.insert(WindowGeometry::new(rect, client_size(&window))),
|
||||||
.entry(id)
|
false,
|
||||||
.or_insert_with(|| WindowGeometry::new(rect, committed_size));
|
),
|
||||||
|
};
|
||||||
let mode = if is_fullscreen {
|
let mode = if is_fullscreen {
|
||||||
PresentationMode::Fullscreen
|
PresentationMode::Fullscreen
|
||||||
} else if is_maximized {
|
} else if is_maximized {
|
||||||
@@ -1852,7 +1853,7 @@ impl Ferese {
|
|||||||
settled_coupled_widths.push(id);
|
settled_coupled_widths.push(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if let Some(size) = geometry.client.expire_wait(self.start_time.elapsed()) {
|
if let Some(size) = geometry.client.expire_wait(now) {
|
||||||
tracing::warn!(
|
tracing::warn!(
|
||||||
?id,
|
?id,
|
||||||
configured_width = size.width,
|
configured_width = size.width,
|
||||||
@@ -1861,7 +1862,7 @@ impl Ferese {
|
|||||||
"client did not commit the final configured size within 500 ms"
|
"client did not commit the final configured size within 500 ms"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if let Some(size) = geometry.presentation_size_request(self.start_time.elapsed())
|
if let Some(size) = geometry.presentation_size_request(now)
|
||||||
&& !self.natural_floating_pending.contains(&id)
|
&& !self.natural_floating_pending.contains(&id)
|
||||||
&& let Some(toplevel) = window.toplevel()
|
&& let Some(toplevel) = window.toplevel()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user