Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Make sure set_mode always returns a cleared window#3317

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
illume merged 2 commits intomainfromankith26-set-mode-black
Sep 12, 2022

Conversation

@ankith26
Copy link
Contributor

fixes#3265

From the code, it seemed like retaining older window surface on subsequentset_mode calls is intentional, but no pygame version from 1.9.6 to 2.1.2 actually does it (in my testing, on windows)

This PR enforces the display clear on our end unconditionally whenset_mode is called

@Starbuck5
Copy link
Contributor

I have a relevant piece of information from my experience with set_mode.

Whether a window sticks around through set_mode or not is consistent and platform dependent. IIRC on MacOS a new window is created on a resize, for example, but not on Windows.

Copy link
Contributor

@MyreMylarMyreMylar left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Should at least be consistent now.

@Starbuck5
Copy link
Contributor

Starbuck5 commentedJul 24, 2022
edited
Loading

Ok, I haven't really fleshed out this idea yet, but

set_mode is also the window resizing API. It shouldn't lose the contents of the original window surface.

I see this was kind of discussed. I think the fact that you are both testing on windows could be impacting this as well, because of different SDL_Window behavior across OSes.

@ankith26
Copy link
ContributorAuthor

The idea behind this PR is to add consistency. It should be a documented API detail thatset_mode clears a window and users are supposed to redraw.

As mentioned above, the behaviour from pygame 1.9.6 to pygame 2.1.2 on windows has been clearing the window. This is only breaking now as an affect of the SDL 2.0.22/2.0.20 update (on windows only)

I also just tested on Ubuntu 22.04 (WSL) and the behaviour is the same as windows on pygame 2.1.2 (SDL 2.0.16), and I also had a SDL 2.0.22 wheel lying around from my manylinux PR (the one that is slow) and this too works the same the rest.

I don't know the status of this on macs.

@MyreMylar
Copy link
Contributor

I can't imagine many situations where pygame could successfully manage a window resizing eventwithout the user redrawing.

Where do we put the pixels? Do we run a smoothscale on the display surface? Fill the new space with black pixels in the case of an enlargement? Cut off the surface when shrinking?

I think always clearing to black is the easiest behaviour at pygame's level - because we can't know exactly what the application developer wants to happen when their window is resized.

@ankith26
Copy link
ContributorAuthor

I just noticed this change is missing some docs, will add that rq

@illume
Copy link
Member

It doesn't seem there is consensus yet on this one.

set_mode is also the window resizing API. It shouldn't lose the contents of the original window surface.

Does resizing the window leave the old surface just on windows? (or other platforms too?)
Seems like that might be useful behaviour?

To me, it's 99% clear that set_mode should definitely clear the surface the first time set_mode is called.

@illume
Copy link
Member

Yeah, I also agree with clearing the background on every set_mode() call (so that users can redraw their stuff). I also tested 1.9.6 behaviour and it is inline with 2.1.2 and the screen is always black after a set_mode call (so this issue is definitely a 2.1.3 break)

Ok, since this is old behaviour; I agree that this patch should be merged. The new behaviour could be useful though, but perhaps that can be added with a flag.

If there's no objections from@Starbuck5 I'd like to merge this for 2.1.3.

@illumeillume added Compatability (Pygame 2)Something that works in Pygame 1 but is broken in Pygame 2 bug labelsSep 12, 2022
@illumeillume merged commitdfa86d9 intomainSep 12, 2022
@illumeillume deleted the ankith26-set-mode-black branchSeptember 12, 2022 18:46
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@MyreMylarMyreMylarMyreMylar approved these changes

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

bugCompatability (Pygame 2)Something that works in Pygame 1 but is broken in Pygame 2displaypygame.display

Projects

None yet

Milestone

2.1.3

Development

Successfully merging this pull request may close these issues.

Differentset_mode behavior between versions

5 participants

@ankith26@Starbuck5@MyreMylar@illume

[8]ページ先頭

©2009-2025 Movatter.jp