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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in WindowImplX11.cpp #1951

Closed
KrystianPotrykus opened this issue Dec 31, 2021 · 2 comments 路 Fixed by #1953
Closed

Error in WindowImplX11.cpp #1951

KrystianPotrykus opened this issue Dec 31, 2021 · 2 comments 路 Fixed by #1953

Comments

@KrystianPotrykus
Copy link

Thanks for raising your issue here! 馃檪

Before you submit the issue however, we'd like you to consider the follow points.

  • We like to use the issue tracker for confirmed issues.
  • If you're stuck with SFML, please use the forum to get help.

Subject of the issue

there is an error in the constructor:
WindowImplX11::WindowImplX11(VideoMode mode, const String& title, unsigned long style, const ContextSettings& settings)
when calculating the window position:
if(m_fullscreen)
{
windowPosition = getPrimaryMonitorPosition();
}
else
{
windowPosition.x = (DisplayWidth(m_display, m_screen) - mode.width) / 2;
windowPosition.y = (DisplayWidth(m_display, m_screen) - mode.height) / 2;
}

shouldn't there be:

if(m_fullscreen)
{
    windowPosition = getPrimaryMonitorPosition();
}
else
{
    windowPosition.x = (DisplayWidth(m_display, m_screen)  - mode.width) / 2;
    windowPosition.y = (DisplayHeight(m_display, m_screen)  - mode.height) / 2;
}
@Bromeon
Copy link
Member

Bromeon commented Jan 1, 2022

Thanks for the report, and looking into the code! I created a PR (see link above this comment), would you have the time to check if that fixes your problem?

You can check out the PR with these instructions:

# navigate to your SFML clone
git fetch origin pull/1953/head:x11-fix
git checkout x11-fix

And then rebuild SFML.

@eXpl0it3r eXpl0it3r added this to Discussion in SFML 2.6.0 via automation Jan 2, 2022
@eXpl0it3r eXpl0it3r added this to the 2.6 milestone Jan 2, 2022
@eXpl0it3r eXpl0it3r moved this from Discussion to Review & Testing in SFML 2.6.0 Jan 2, 2022
@eXpl0it3r eXpl0it3r linked a pull request Jan 2, 2022 that will close this issue
5 tasks
@eXpl0it3r
Copy link
Member

Unable to notice a difference while testing, but the fix seems "correct".
Wondering whether this piece of code is actually still needed.

Fixed with #1953

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
SFML 2.6.0
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants