Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix window positioning issue on macOS #7839

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

mteit
Copy link

@mteit mteit commented Mar 17, 2024

PR addresses an issue related to window positioning on macOS. The problem arises when setting the window to visible after resizing, which leads to inconsistent window positioning behavior after resizing. Specifically, the configuration window's position becomes dependent on the window size, causing it to appear at the bottom left corner of the window instead of the expected top left corner.

To fix this issue, I adjusted the order of operations to set the window visible before resizing.

This PR is linked to the corresponding GitHub issue: Link to GitHub issue

alacritty/src/display/mod.rs Outdated Show resolved Hide resolved
@mteit mteit requested a review from chrisduerr March 17, 2024 11:09
@mteit mteit changed the title Fix window positioning issue on macOS Draft: Fix window positioning issue on macOS Mar 17, 2024
@mteit mteit marked this pull request as draft March 17, 2024 22:11
@chrisduerr
Copy link
Member

marked this pull request as draft

Why did you switch the PR to draft status? Did you encounter any issues?

@mteit
Copy link
Author

mteit commented Mar 24, 2024

Why did you switch the PR to draft status? Did you encounter any issues?

@chrisduerr I encountered several unexpected behaviors while testing the PR.
Initially, the fix addressed the issue with window position along the y axis when window.decorations = "None", ensuring that the position adhered to the configuration in other cases.
However, the commit unexpectedly resolved an issue where window.dimensions was restricted in width when window.decorations = "Full"|"Transparent"|"Buttonless".
Despite this fix, I discovered a new issue: when window.decorations = "Full"|"Transparent"|"Buttonless", the window position along the x axis starts at 346 pixels (on my display), deviating from the expected behavior. Importantly, this issue persists both on my branch and on the master branch.

So, I'm going to fix the x axis issue, and then I will switch the PR status.

@mteit mteit force-pushed the fix-window-position-y branch 2 times, most recently from 50d438d to fbd82ed Compare March 25, 2024 00:22
@mteit mteit changed the title Draft: Fix window positioning issue on macOS Fix window positioning issue on macOS Mar 25, 2024
@mteit mteit marked this pull request as ready for review March 25, 2024 01:00
Comment on lines +428 to +431
#[cfg(target_os = "macos")]
if let Some(position) = config.window.position {
window.set_outer_position(PhysicalPosition::new(position.x as u32, position.y as u32));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you just add this using trial and error? We're already setting the position on startup, why are you setting it again?

This does not seem like the proper solution, it just looks like we're moving it a bunch hoping that one of the operations will stick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants