Description
Issue №2011 opened by aragubas at 2020-07-10 00:18:06
So, i installed the new dev10 version, and wharever i minimize the Game Window, the Screen and everthing just freezes out, simple...
MyOS: Linux Mint 19.3
Python: 3.7
DE: Gnome
Comments
# # MyreMylar commented at 2020-07-10 17:58:19
Some code that you are running would be useful to try and diagnose what is happening. This isn't a universal problem as far as I am aware so it may be specific to your setup or code.
# # aragubas commented at 2020-07-13 00:40:09
Some code that you are running would be useful to try and diagnose what is happening. This isn't a universal problem as far as I am aware so it may be specific to your setup or code.
You can check out the code in:
https://github.com/aragubas/taiyou-game-engine
# # MyreMylar commented at 2020-07-13 13:18:51
Not sure how I would run all that, but I expect it is probably this code:
elif ResiziableWindow and not tge.RunInFullScreen:
if event.type == pygame.VIDEORESIZE:
# Resize the Window
DISPLAY = pygame.display.set_mode((event.w, event.h), pygame.DOUBLEBUF | pygame.RESIZABLE | pygame.HWACCEL)
The way resizing the window works has changed in SDL2 and pygame was updated a few times to just let SDL2 do the work now, so I expect you don't now need to call set_mode()
over and over. I would just comment out these lines, rebuild your engine library and see if it just works.
# # aragubas commented at 2020-07-13 13:28:17
Not sure how I would run all that, but I expect it is probably this code:
elif ResiziableWindow and not tge.RunInFullScreen: if event.type == pygame.VIDEORESIZE: # Resize the Window DISPLAY = pygame.display.set_mode((event.w, event.h), pygame.DOUBLEBUF | pygame.RESIZABLE | pygame.HWACCEL)
The way resizing the window works has changed in SDL2 and pygame was updated a few times to just let SDL2 do the work now, so I expect you don't now need to call
set_mode()
over and over. I would just comment out these lines, rebuild your engine library and see if it just works.
Still not working, and that piece of code was just laying around there, since i removed the Resizeable Captability of my Game Engine...
# # aragubas commented at 2020-07-13 13:29:11
and this only happens when i click the Minimize button of Pygame's Window
# # MyreMylar commented at 2020-07-13 13:34:24
Hmm, damn. No clue then.
Perhaps you can narrow it down with break points and find out where things are getting stuck? Or create a more minimal example that shows the same problem. It's hard to narrow things down further without more to go on.
# # aragubas commented at 2020-07-13 15:23:08
Hmm, damn. No clue then.
Perhaps you can narrow it down with break points and find out where things are getting stuck? Or create a more minimal example that shows the same problem. It's hard to narrow things down further without more to go on.
the strange thing is, it only freezes the Game Draw, Events, Sounds and the code IS running, i will record a video and upload to you see how strange this is
# # aragubas commented at 2020-07-13 15:28:05
here is the footage video
# # MyreMylar commented at 2020-07-14 06:58:07
Hmm, that looks like the display surface is not getting updated. I guess you could try tinkering with things like switching:
pygame.display.flip()
to:
pygame.display.update()
But I don't hold out much hope for that. I think a cut down example demonstrating the same issue is probably the way to go, the video behaviour (with the display updating but the code still running) reminds me of this old problem with calling set_mode()
a lot on linux:
Are you mixing pygame with other libraries? Perhaps one of them is fighting with SDL for control of the window and changes in pygame have meant that the other library is now winning the fight?
Another strategy you could try if you don't want to debug it in pygame is to work around it by detecting if the window goes inactive and becomes active again which should happen when the window is minimized and then un-minimized (checking pygame.display.get_active()
in a loop should allow you to set a flag for this) and when that happens, call set_mode()
again to try and get back a new display surface that will update as normal again.
# # aragubas commented at 2020-07-23 14:58:34
Hmm, that looks like the display surface is not getting updated. I guess you could try tinkering with things like switching:
pygame.display.flip()
to:
pygame.display.update()
But I don't hold out much hope for that. I think a cut down example demonstrating the same issue is probably the way to go, the video behaviour (with the display updating but the code still running) reminds me of this old problem with calling
set_mode()
a lot on linux:212
Are you mixing pygame with other libraries? Perhaps one of them is fighting with SDL for control of the window and changes in pygame have meant that the other library is now winning the fight?
Another strategy you could try if you don't want to debug it in pygame is to work around it by detecting if the window goes inactive and becomes active again which should happen when the window is minimized and then un-minimized (checking
pygame.display.get_active()
in a loop should allow you to set a flag for this) and when that happens, callset_mode()
again to try and get back a new display surface that will update as normal again.
Yes, when the screen is freezed, pygame.display.get_active()
returns False, i can make a little condition to set_mode()
the display again... But how do i check if the Main Window is not Minimized?
# # id-hkj commented at 2021-05-23 15:22:02
Hmm, that looks like the display surface is not getting updated. I guess you could try tinkering with things like switching:
pygame.display.flip()
to:
pygame.display.update()
https://github.com/aragubas/taiyou-game-engine/blob/0dc16632abe81b0173a0f5c323c337ab044d54a8/ENGINE/TaiyouMain/__init__.py# L431
But I don't hold out much hope for that. I think a cut down example demonstrating the same issue is probably the way to go, the video behaviour (with the display updating but the code still running) reminds me of this old problem with callingset_mode()
a lot on linux:212
Are you mixing pygame with other libraries? Perhaps one of them is fighting with SDL for control of the window and changes in pygame have meant that the other library is now winning the fight?
Another strategy you could try if you don't want to debug it in pygame is to work around it by detecting if the window goes inactive and becomes active again which should happen when the window is minimized and then un-minimized (checkingpygame.display.get_active()
in a loop should allow you to set a flag for this) and when that happens, callset_mode()
again to try and get back a new display surface that will update as normal again.Yes, when the screen is freezed,
pygame.display.get_active()
returns False, i can make a little condition toset_mode()
the display again... But how do i check if the Main Window is not Minimized?
If the main window is not minimized, pygame.display.getactive()
will return True.
Here is some code I wrote quickly just to test this:
import pygame
pygame.init()
win = pygame.display.set_mode((500, 200))
run = True
while run:
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
print(pygame.display.get_active())
pygame.time.delay(250)
pygame.quit()