diff options
author | Руслан Ижбулатов <lrn1986@gmail.com> | 2016-08-22 15:21:28 +0000 |
---|---|---|
committer | Jakub Steiner <jimmac@gmail.com> | 2016-08-22 20:36:42 +0200 |
commit | b8a84340bd97732804047e71e8227fe211d1810f (patch) | |
tree | 23b89bbba17b1408f4ee06aeaf7a33e2dfd83673 /src/cursors | |
parent | f020e184b3cc35c41c118f85f8df02c21a877e92 (diff) | |
download | adwaita-icon-theme-b8a84340bd97732804047e71e8227fe211d1810f.tar.gz |
anicursorgen: sort cursors (hires ones first)
This should not affect anything, but Windows cursors have
multi-resolution frames sorted in larger-frames-first order,
so we should probably do the same.
Diffstat (limited to 'src/cursors')
-rwxr-xr-x | src/cursors/anicursorgen.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/cursors/anicursorgen.py b/src/cursors/anicursorgen.py index 40a7b6fdc..425eb736c 100755 --- a/src/cursors/anicursorgen.py +++ b/src/cursors/anicursorgen.py @@ -132,6 +132,17 @@ def make_cur (frames, args): buf = io.BytesIO () buf.write (p ('<HHH', 0, 2, len (frames))) frame_offsets = [] + + def frame_size_cmp (f1, f2): + if f1[0] < f2[0]: + return -1 + elif f1[0] > f2[0]: + return 1 + else: + return 0 + + frames = sorted (frames, frame_size_cmp, reverse=True) + for frame in frames: width = frame[0] if width > 255: @@ -206,6 +217,16 @@ def make_framesets (frames): print ("Frameset {} has duration {} for framesize {}, but {} for framesize {}".format (i, frameset[i][4], frameset[i][0], frameset[i - 1][4], frameset[i - 1][0]), file=sys.stderr) return None + def frameset_size_cmp (f1, f2): + if f1[0][0] < f2[0][0]: + return -1 + elif f1[0][0] > f2[0][0]: + return 1 + else: + return 0 + + framesets = sorted (framesets, frameset_size_cmp, reverse=True) + return framesets def make_ani (frames, out, args): |