diff options
author | David Robillard <d@drobilla.net> | 2025-01-22 18:42:11 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2025-01-22 18:42:11 -0500 |
commit | 1dce4defe62b5e0ed70460b52c444dc51a701e18 (patch) | |
tree | e5e7d7b7a1a32f766f68e393a8a8e1e362a97f3e /include | |
parent | 90b9b63b2001c4595c08f7da5aa4403611327678 (diff) | |
download | pugl-1dce4defe62b5e0ed70460b52c444dc51a701e18.tar.gz pugl-1dce4defe62b5e0ed70460b52c444dc51a701e18.tar.bz2 pugl-1dce4defe62b5e0ed70460b52c444dc51a701e18.zip |
Make puglSetSizeHint() consistent with puglSetSize()
In general, it's more convenient to have full-width integers as parameters,
since C will promote any arithmetic on smaller types to them anyway. Using
narrow types here, then, doesn't really make anything stricter, just forces an
annoying cast when lots of warnings are enabled, which is likely unchecked.
Better to handle it here, since it's more convenient, and the integer range
checks the compiler can do aren't correct anyway (the max width/height is
intentionally smaller than the max PuglSpan, so it can fit in a signed 16-bit
integer).
Diffstat (limited to 'include')
-rw-r--r-- | include/pugl/pugl.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/include/pugl/pugl.h b/include/pugl/pugl.h index e3ab504..b70b91d 100644 --- a/include/pugl/pugl.h +++ b/include/pugl/pugl.h @@ -1234,8 +1234,8 @@ PUGL_API PuglStatus puglSetSizeHint(PuglView* view, PuglSizeHint hint, - PuglSpan width, - PuglSpan height); + unsigned width, + unsigned height); /** @} @@ -1820,7 +1820,7 @@ static inline PUGL_DEPRECATED_BY("puglSetSizeHint") void puglInitWindowMinSize(PuglView* view, int width, int height) { - puglSetSizeHint(view, PUGL_MIN_SIZE, (PuglSpan)width, (PuglSpan)height); + puglSetSizeHint(view, PUGL_MIN_SIZE, (unsigned)width, (unsigned)height); } /** @@ -1841,8 +1841,8 @@ puglInitWindowAspectRatio(PuglView* view, int maxX, int maxY) { - puglSetSizeHint(view, PUGL_MIN_ASPECT, (PuglSpan)minX, (PuglSpan)minY); - puglSetSizeHint(view, PUGL_MAX_ASPECT, (PuglSpan)maxX, (PuglSpan)maxY); + puglSetSizeHint(view, PUGL_MIN_ASPECT, (unsigned)minX, (unsigned)minY); + puglSetSizeHint(view, PUGL_MAX_ASPECT, (unsigned)maxX, (unsigned)maxY); } /** @@ -2081,7 +2081,7 @@ PuglStatus puglSetDefaultSize(PuglView* view, int width, int height) { return puglSetSizeHint( - view, PUGL_DEFAULT_SIZE, (PuglSpan)width, (PuglSpan)height); + view, PUGL_DEFAULT_SIZE, (unsigned)width, (unsigned)height); } /** @@ -2098,7 +2098,7 @@ PuglStatus puglSetMinSize(PuglView* view, int width, int height) { return puglSetSizeHint( - view, PUGL_MIN_SIZE, (PuglSpan)width, (PuglSpan)height); + view, PUGL_MIN_SIZE, (unsigned)width, (unsigned)height); } /** @@ -2115,7 +2115,7 @@ PuglStatus puglSetMaxSize(PuglView* view, int width, int height) { return puglSetSizeHint( - view, PUGL_MAX_SIZE, (PuglSpan)width, (PuglSpan)height); + view, PUGL_MAX_SIZE, (unsigned)width, (unsigned)height); } /** @@ -2139,10 +2139,10 @@ PuglStatus puglSetAspectRatio(PuglView* view, int minX, int minY, int maxX, int maxY) { const PuglStatus st0 = - puglSetSizeHint(view, PUGL_MIN_ASPECT, (PuglSpan)minX, (PuglSpan)minY); + puglSetSizeHint(view, PUGL_MIN_ASPECT, (unsigned)minX, (unsigned)minY); const PuglStatus st1 = - puglSetSizeHint(view, PUGL_MAX_ASPECT, (PuglSpan)maxX, (PuglSpan)maxY); + puglSetSizeHint(view, PUGL_MAX_ASPECT, (unsigned)maxX, (unsigned)maxY); return st0 ? st0 : st1; } |