win32 compatibility

This commit is contained in:
multiSnow 2022-12-06 15:10:30 +08:00
parent 6cf1ebcb26
commit bd3cf90791
Signed by: multiSnow
GPG Key ID: 18EDAC29CAA2DBCE
3 changed files with 12 additions and 5 deletions

View File

@ -16,7 +16,8 @@ Optional:
Supported platform:
- linux
- (others need to test: such as win32, cygwin, darwin, bsd, ...)
- win32
- (others need to test: such as cygwin, darwin, bsd, ...)
Feature:
- | configurable full keyboard control

View File

@ -25,7 +25,7 @@ version_info=(0,0,0)
required_pyver=(3,11,0)
# TODO: test on different platform
supported_platform=('linux',)
supported_platform=('linux','win32')
# for SDL 2.26.0
required_pysdl2ver=(0,9,15)

View File

@ -15,7 +15,12 @@
from _thread import allocate_lock
from functools import partial
from signal import SIG_IGN,SIGINT,SIGTERM,SIGUSR1,SIGUSR2,signal,strsignal
from signal import SIG_IGN,SIGINT,SIGTERM,signal,strsignal
try:
from signal import SIG_IGN,SIGINT,SIGTERM,SIGUSR1,SIGUSR2,signal,strsignal
except ImportError:
SIGUSR1=SIGUSR2=None
from .co import AttrDict
from .config import *
@ -89,8 +94,9 @@ def mainloop(*,images=(),containers=()):
handler=partial(signal_close,ui=ui)
signal(SIGINT,handler)
signal(SIGTERM,handler)
signal(SIGUSR1,handler)
signal(SIGUSR2,handler)
if SIGUSR1 is not None:
signal(SIGUSR1,handler)
signal(SIGUSR2,handler)
if images:
command_listed(images,ui)