Skip to content

Commit 1475d4d

Browse files
committed
Improved flexibility of SDL_MUSTLOCK
1 parent 7c44df6 commit 1475d4d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

doc/news.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ Fixed Bugs:
5252
and fixed unit tests accordingly (issue #228).
5353
* Fixed various unit tests on big-endian platforms (PR #232).
5454
* Fixed 32-bit wraparound behaviour for ``SDL_TICKS_PASSED`` (PR #235).
55+
* Fixed ``SDL_MUSTLOCK`` to allow checking surface pointers in addition to
56+
surfaces.
5557

5658

5759
0.9.11

sdl2/surface.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@
4343

4444
# Macros & inline functions
4545

46-
SDL_MUSTLOCK = lambda s: ((s.flags & SDL_RLEACCEL) != 0)
46+
def SDL_MUSTLOCK(surf):
47+
if hasattr(surf, "contents"):
48+
surf = surf.contents
49+
return surf.flags & SDL_RLEACCEL != 0
4750

4851

4952
# Structs & opaque typedefs

0 commit comments

Comments
 (0)