diff options
author | David Robillard <d@drobilla.net> | 2023-01-07 19:27:14 -0500 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2023-01-07 20:27:35 -0500 |
commit | 4ad8621ac1d94c8e9cf88f83c46a3a70cd91212b (patch) | |
tree | 63307cb14d43c7391b34f94ca0e532d8e9e01a09 /test | |
parent | 677e13dcbb5b64ce85093b9ea5c14025964e35b9 (diff) | |
download | pugl-4ad8621ac1d94c8e9cf88f83c46a3a70cd91212b.tar.gz pugl-4ad8621ac1d94c8e9cf88f83c46a3a70cd91212b.tar.bz2 pugl-4ad8621ac1d94c8e9cf88f83c46a3a70cd91212b.zip |
Add support for special view types and styles
Diffstat (limited to 'test')
-rw-r--r-- | test/test_utils.h | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/test/test_utils.h b/test/test_utils.h index fd2c15b..5655e53 100644 --- a/test/test_utils.h +++ b/test/test_utils.h @@ -89,6 +89,33 @@ scrollDirectionString(const PuglScrollDirection direction) return "unknown"; } +static inline const char* +viewStyleFlagString(const PuglViewStyleFlag state) +{ + switch (state) { + case PUGL_VIEW_STYLE_MODAL: + return "modal"; + case PUGL_VIEW_STYLE_TALL: + return "tall"; + case PUGL_VIEW_STYLE_WIDE: + return "wide"; + case PUGL_VIEW_STYLE_HIDDEN: + return "hidden"; + case PUGL_VIEW_STYLE_FULLSCREEN: + return "fullscreen"; + case PUGL_VIEW_STYLE_ABOVE: + return "above"; + case PUGL_VIEW_STYLE_BELOW: + return "below"; + case PUGL_VIEW_STYLE_DEMANDING: + return "demanding"; + case PUGL_VIEW_STYLE_RESIZING: + return "resizing"; + } + + return "unknown"; +} + static inline int printEvent(const PuglEvent* event, const char* prefix, const bool verbose) { @@ -183,12 +210,20 @@ printEvent(const PuglEvent* event, const char* prefix, const bool verbose) case PUGL_UPDATE: return fprintf(stderr, "%sUpdate\n", prefix); case PUGL_CONFIGURE: - return PRINT("%sConfigure " PIFMT " " PUFMT "\n", - prefix, - event->configure.x, - event->configure.y, - event->configure.width, - event->configure.height); + PRINT("%sConfigure " PIFMT " " PUFMT " (", + prefix, + event->configure.x, + event->configure.y, + event->configure.width, + event->configure.height); + for (PuglViewStyleFlags mask = 1U; mask <= PUGL_MAX_VIEW_STYLE_FLAG; + mask <<= 1U) { + if (event->configure.style & mask) { + PRINT(" %s", viewStyleFlagString((PuglViewStyleFlag)mask)); + } + } + PRINT("%s\n", " )"); + return 0; case PUGL_EXPOSE: return PRINT("%sExpose " PIFMT " " PUFMT "\n", prefix, @@ -254,6 +289,8 @@ puglViewHintString(const PuglViewHint hint) return "Ignore key repeat"; case PUGL_REFRESH_RATE: return "Refresh rate"; + case PUGL_VIEW_TYPE: + return "View type"; } return "Unknown"; |