Skip to content

Commit b014d72

Browse files
author
dessant
committed
add pause_on_minimize config option
1 parent 98a37ae commit b014d72

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

kivy/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,9 @@ def kivy_usage():
277277
level = LOG_LEVELS.get(Config.get('kivy', 'log_level'))
278278
Logger.setLevel(level=level)
279279

280+
if Config.getboolean('kivy', 'desktop'):
281+
Config.set('kivy', 'pause_on_minimize', '0')
282+
280283
# Can be overrided in command line
281284
if 'KIVY_UNITTEST' not in environ and 'KIVY_PACKAGING' not in environ:
282285
# save sys argv, otherwize, gstreamer use it and display help..

kivy/config.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
5252
`exit_on_escape`: int, 0 or 1
5353
Enables exiting kivy when escape is pressed.
5454
0 is disabled, 1 is enabled.
55+
`pause_on_minimize`: int, 0 or 1
56+
If set to `1`, the main loop is paused and the `on_pause` event
57+
is dispatched when the window is minimized. Defaults to `0`
58+
on desktop and `1` on mobile.
5559
`keyboard_layout`: string
5660
Identifier of the layout to use.
5761
`keyboard_mode`: string
@@ -229,6 +233,7 @@
229233
`borderless` has been added to the graphics section.
230234
The `fake` option of `fullscreen` in the graphics section has been
231235
deprecated, use the `borderless` option instead.
236+
`pause_on_minimize` has been added to the kivy section.
232237
233238
.. versionchanged:: 1.8.0
234239
`systemanddock` and `systemandmulti` has been added as possible values for
@@ -269,7 +274,7 @@
269274
_is_rpi = exists('/opt/vc/include/bcm_host.h')
270275

271276
# Version number of current configuration format
272-
KIVY_CONFIG_VERSION = 11
277+
KIVY_CONFIG_VERSION = 12
273278

274279
Config = None
275280
'''Kivy configuration object. Its :attr:`~kivy.config.ConfigParser.name` is
@@ -731,11 +736,14 @@ def name(self, value):
731736

732737
elif version == 9:
733738
Config.setdefault('kivy', 'exit_on_escape', '1')
734-
739+
735740
elif version == 10:
736741
Config.set('graphics', 'fullscreen', '0')
737742
Config.setdefault('graphics', 'borderless', '0')
738743

744+
elif version == 11:
745+
Config.setdefault('kivy', 'pause_on_minimize', '1')
746+
739747
#elif version == 1:
740748
# # add here the command for upgrading from configuration 0 to 1
741749
#

kivy/core/window/window_sdl2.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,8 @@ def _mainloop(self):
314314
self.canvas.ask_update()
315315

316316
elif action == 'windowminimized':
317-
self.do_pause()
317+
if Config.getboolean('kivy', 'pause_on_minimize'):
318+
self.do_pause()
318319

319320
elif action == 'joyaxismotion':
320321
stickid, axisid, value = args

0 commit comments

Comments
 (0)