diff options
author | David Robillard <d@drobilla.net> | 2022-05-20 19:44:23 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2022-05-21 17:05:51 -0400 |
commit | 82405e8c177de446d03c340b4b6876370d79883a (patch) | |
tree | 8b58d94ce03810d95558d725f9a3394d2e7d0fc7 /include/pugl | |
parent | a136586a339032126540ceb24f7c3f15eaba68c8 (diff) | |
download | pugl-82405e8c177de446d03c340b4b6876370d79883a.tar.gz pugl-82405e8c177de446d03c340b4b6876370d79883a.tar.bz2 pugl-82405e8c177de446d03c340b4b6876370d79883a.zip |
Add puglSetPosition() and puglSetSize()
These are redundant with puglSetFrame in a sense, but allow setting the size of
a view without the position, or vice-versa. This API also maps more nicely to
Wayland, where applications can not position themselves (but can resize).
Diffstat (limited to 'include/pugl')
-rw-r--r-- | include/pugl/pugl.h | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/include/pugl/pugl.h b/include/pugl/pugl.h index 3fc124e..a7dd7eb 100644 --- a/include/pugl/pugl.h +++ b/include/pugl/pugl.h @@ -1001,13 +1001,33 @@ PuglStatus puglSetFrame(PuglView* view, PuglRect frame); /** + Set the current position of the view. + + @return #PUGL_UNKNOWN_ERROR on failure, in which case the view frame is + unchanged. +*/ +PUGL_API +PuglStatus +puglSetPosition(PuglView* view, int x, int y); + +/** + Set the current size of the view. + + @return #PUGL_UNKNOWN_ERROR on failure, in which case the view frame is + unchanged. +*/ +PUGL_API +PuglStatus +puglSetSize(PuglView* view, unsigned width, unsigned height); + +/** Set a size hint for the view. - This can be used to set the default, minimum, and maximum size of a view, as - well as the supported range of aspect ratios. + This can be used to set the default, minimum, and maximum size of a view, + as well as the supported range of aspect ratios. - This should be called before puglResize() so the initial window for the view - can be configured correctly. + This should be called before puglResize() so the initial window for the + view can be configured correctly. @return #PUGL_UNKNOWN_ERROR on failure, but always succeeds if the view is not yet realized. |