Skip to content

Commit

Permalink
fix(linux): include border and titlebars in Window::outer_position
Browse files Browse the repository at this point in the history
  • Loading branch information
amrbashir committed Oct 30, 2024
1 parent 0f7e95a commit 4bf2357
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changes/outer-position-linux.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tao": "patch"
---

On Linux, fix position returned in `Window::outer_position` to include border and titlebar.
8 changes: 6 additions & 2 deletions src/platform_impl/linux/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,12 @@ impl Window {
let size: Rc<(AtomicI32, AtomicI32)> = Rc::new((w_size.0.into(), w_size.1.into()));
let size_clone = size.clone();

window.connect_configure_event(move |_, event| {
let (x, y) = event.position();
window.connect_configure_event(move |window, event| {
let (x, y) = window
.window()
.map(|w| w.root_origin())
.unwrap_or_else(|| event.position());

position_clone.0.store(x, Ordering::Release);
position_clone.1.store(y, Ordering::Release);

Expand Down

0 comments on commit 4bf2357

Please sign in to comment.