From bd4f79646f623e929e6aa22bea028952b515aeef Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 12 Jan 2023 10:30:10 -0500 Subject: Add general string hint interface This replaces the window title and class name APIs with a more general one that can be easily extended to other things, like icon names, more detailed application hints, and so on. --- test/test_cairo.c | 4 ++-- test/test_clipboard.c | 4 ++-- test/test_cursor.c | 4 ++-- test/test_gl.c | 4 ++-- test/test_gl_free_unrealized.c | 4 ++-- test/test_gl_hints.c | 4 ++-- test/test_local_copy_paste.c | 4 ++-- test/test_realize.c | 4 ++-- test/test_redisplay.c | 4 ++-- test/test_remote_copy_paste.c | 8 ++++---- test/test_show_hide.c | 4 ++-- test/test_size.c | 4 ++-- test/test_stub.c | 4 ++-- test/test_stub_hints.c | 4 ++-- test/test_timer.c | 4 ++-- test/test_update.c | 4 ++-- test/test_view.c | 9 +++++---- test/test_vulkan.c | 4 ++-- 18 files changed, 41 insertions(+), 40 deletions(-) (limited to 'test') diff --git a/test/test_cairo.c b/test/test_cairo.c index c64a9eb..11d6cce 100644 --- a/test/test_cairo.c +++ b/test/test_cairo.c @@ -60,8 +60,8 @@ main(int argc, char** argv) PuglTest test = {world, view, opts, false}; // Set up and show view - puglSetClassName(test.world, "PuglTest"); - puglSetWindowTitle(test.view, "Pugl Cairo Test"); + puglSetWorldString(test.world, PUGL_CLASS_NAME, "PuglTest"); + puglSetViewString(test.view, PUGL_WINDOW_TITLE, "Pugl Cairo Test"); puglSetHandle(test.view, &test); puglSetBackend(test.view, puglCairoBackend()); puglSetEventFunc(test.view, onEvent); diff --git a/test/test_clipboard.c b/test/test_clipboard.c index a99d150..debe8e3 100644 --- a/test/test_clipboard.c +++ b/test/test_clipboard.c @@ -48,12 +48,12 @@ main(int argc, char** argv) puglParseTestOptions(&argc, &argv), false}; - puglSetClassName(test.world, "PuglTest"); + puglSetWorldString(test.world, PUGL_CLASS_NAME, "PuglTest"); // Set up views for (unsigned i = 0U; i < 2; ++i) { test.views[i] = puglNewView(test.world); - puglSetWindowTitle(test.world, "Pugl Clipboard Test"); + puglSetViewString(test.world, PUGL_WINDOW_TITLE, "Pugl Clipboard Test"); puglSetBackend(test.views[i], puglStubBackend()); puglSetHandle(test.views[i], &test); puglSetEventFunc(test.views[i], onEvent); diff --git a/test/test_cursor.c b/test/test_cursor.c index 89e81aa..11a52d7 100644 --- a/test/test_cursor.c +++ b/test/test_cursor.c @@ -46,8 +46,8 @@ main(int argc, char** argv) PuglTest test = {world, view, opts, false}; // Set up and show view - puglSetClassName(test.world, "PuglTest"); - puglSetWindowTitle(test.view, "Pugl Cursor Test"); + puglSetWorldString(test.world, PUGL_CLASS_NAME, "PuglTest"); + puglSetViewString(test.view, PUGL_WINDOW_TITLE, "Pugl Cursor Test"); puglSetHandle(test.view, &test); puglSetBackend(test.view, puglStubBackend()); puglSetEventFunc(test.view, onEvent); diff --git a/test/test_gl.c b/test/test_gl.c index a53854a..8854cad 100644 --- a/test/test_gl.c +++ b/test/test_gl.c @@ -79,8 +79,8 @@ main(int argc, char** argv) PuglTest test = {world, view, opts, false}; // Set up and show view - puglSetClassName(test.world, "PuglTest"); - puglSetWindowTitle(test.view, "Pugl OpenGL Test"); + puglSetWorldString(test.world, PUGL_CLASS_NAME, "PuglTest"); + puglSetViewString(test.view, PUGL_WINDOW_TITLE, "Pugl OpenGL Test"); puglSetHandle(test.view, &test); puglSetBackend(test.view, puglGlBackend()); puglSetEventFunc(test.view, onEvent); diff --git a/test/test_gl_free_unrealized.c b/test/test_gl_free_unrealized.c index 0ad3dda..82fc18b 100644 --- a/test/test_gl_free_unrealized.c +++ b/test/test_gl_free_unrealized.c @@ -31,8 +31,8 @@ main(int argc, char** argv) // Set up view test.view = puglNewView(test.world); - puglSetClassName(test.world, "PuglTest"); - puglSetWindowTitle(test.view, "Pugl OpenGL Free Test"); + puglSetWorldString(test.world, PUGL_CLASS_NAME, "PuglTest"); + puglSetViewString(test.view, PUGL_WINDOW_TITLE, "Pugl OpenGL Free Test"); puglSetBackend(test.view, puglGlBackend()); puglSetHandle(test.view, &test); puglSetSizeHint(test.view, PUGL_DEFAULT_SIZE, 256, 256); diff --git a/test/test_gl_hints.c b/test/test_gl_hints.c index e0114ff..16b51c5 100644 --- a/test/test_gl_hints.c +++ b/test/test_gl_hints.c @@ -30,8 +30,8 @@ main(void) PuglView* const view = puglNewView(world); // Set up view - puglSetClassName(world, "PuglTest"); - puglSetWindowTitle(view, "Pugl OpenGL Hints Test"); + puglSetWorldString(world, PUGL_CLASS_NAME, "PuglTest"); + puglSetViewString(view, PUGL_WINDOW_TITLE, "Pugl OpenGL Hints Test"); puglSetBackend(view, puglGlBackend()); puglSetEventFunc(view, onEvent); puglSetSizeHint(view, PUGL_DEFAULT_SIZE, 256, 256); diff --git a/test/test_local_copy_paste.c b/test/test_local_copy_paste.c index 5918418..737f193 100644 --- a/test/test_local_copy_paste.c +++ b/test/test_local_copy_paste.c @@ -127,8 +127,8 @@ main(int argc, char** argv) // Set up view app.view = puglNewView(app.world); - puglSetClassName(app.world, "PuglTest"); - puglSetWindowTitle(app.view, "Pugl Copy/Paste Test"); + puglSetWorldString(app.world, PUGL_CLASS_NAME, "PuglTest"); + puglSetViewString(app.view, PUGL_WINDOW_TITLE, "Pugl Copy/Paste Test"); puglSetBackend(app.view, puglStubBackend()); puglSetHandle(app.view, &app); puglSetEventFunc(app.view, onEvent); diff --git a/test/test_realize.c b/test/test_realize.c index bf55e50..7e37319 100644 --- a/test/test_realize.c +++ b/test/test_realize.c @@ -63,8 +63,8 @@ main(int argc, char** argv) // Set up view test.view = puglNewView(test.world); - puglSetClassName(test.world, "PuglTest"); - puglSetWindowTitle(test.view, "Pugl Realize Test"); + puglSetWorldString(test.world, PUGL_CLASS_NAME, "PuglTest"); + puglSetViewString(test.view, PUGL_WINDOW_TITLE, "Pugl Realize Test"); puglSetHandle(test.view, &test); assert(puglRealize(test.view) == PUGL_BAD_BACKEND); diff --git a/test/test_redisplay.c b/test/test_redisplay.c index 60dd219..1276136 100644 --- a/test/test_redisplay.c +++ b/test/test_redisplay.c @@ -111,8 +111,8 @@ main(int argc, char** argv) // Set up view test.view = puglNewView(test.world); - puglSetClassName(test.world, "PuglTest"); - puglSetWindowTitle(test.view, "Pugl Redisplay Test"); + puglSetWorldString(test.world, PUGL_CLASS_NAME, "PuglTest"); + puglSetViewString(test.view, PUGL_WINDOW_TITLE, "Pugl Redisplay Test"); puglSetBackend(test.view, puglStubBackend()); puglSetHandle(test.view, &test); puglSetEventFunc(test.view, onEvent); diff --git a/test/test_remote_copy_paste.c b/test/test_remote_copy_paste.c index 2fe55fe..a9f079e 100644 --- a/test/test_remote_copy_paste.c +++ b/test/test_remote_copy_paste.c @@ -142,8 +142,8 @@ main(int argc, char** argv) // Set up copier view app.copierView = puglNewView(app.world); - puglSetClassName(app.world, "PuglTest"); - puglSetWindowTitle(app.copierView, "Pugl Copy Test"); + puglSetWorldString(app.world, PUGL_CLASS_NAME, "PuglTest"); + puglSetViewString(app.copierView, PUGL_WINDOW_TITLE, "Pugl Copy Test"); puglSetBackend(app.copierView, puglStubBackend()); puglSetHandle(app.copierView, &app); puglSetEventFunc(app.copierView, onCopierEvent); @@ -152,8 +152,8 @@ main(int argc, char** argv) // Set up paster view app.pasterView = puglNewView(app.world); - puglSetClassName(app.world, "PuglTest"); - puglSetWindowTitle(app.pasterView, "Pugl Paste Test"); + puglSetWorldString(app.world, PUGL_CLASS_NAME, "PuglTest"); + puglSetViewString(app.pasterView, PUGL_WINDOW_TITLE, "Pugl Paste Test"); puglSetBackend(app.pasterView, puglStubBackend()); puglSetHandle(app.pasterView, &app); puglSetEventFunc(app.pasterView, onPasterEvent); diff --git a/test/test_show_hide.c b/test/test_show_hide.c index 3b0acae..1517203 100644 --- a/test/test_show_hide.c +++ b/test/test_show_hide.c @@ -109,8 +109,8 @@ main(int argc, char** argv) // Set up view test.view = puglNewView(test.world); - puglSetClassName(test.world, "PuglTest"); - puglSetWindowTitle(test.view, "Pugl Show/Hide Test"); + puglSetWorldString(test.world, PUGL_CLASS_NAME, "PuglTest"); + puglSetViewString(test.view, PUGL_WINDOW_TITLE, "Pugl Show/Hide Test"); puglSetBackend(test.view, puglStubBackend()); puglSetHandle(test.view, &test); puglSetEventFunc(test.view, onEvent); diff --git a/test/test_size.c b/test/test_size.c index 88afa16..e3f738a 100644 --- a/test/test_size.c +++ b/test/test_size.c @@ -77,8 +77,8 @@ main(int argc, char** argv) // Set up view with size bounds and an aspect ratio test.view = puglNewView(test.world); - puglSetClassName(test.world, "PuglTest"); - puglSetWindowTitle(test.view, "Pugl Size Test"); + puglSetWorldString(test.world, PUGL_CLASS_NAME, "PuglTest"); + puglSetViewString(test.view, PUGL_WINDOW_TITLE, "Pugl Size Test"); puglSetBackend(test.view, puglStubBackend()); puglSetHandle(test.view, &test); puglSetEventFunc(test.view, onEvent); diff --git a/test/test_stub.c b/test/test_stub.c index 2badfb2..bd8a0eb 100644 --- a/test/test_stub.c +++ b/test/test_stub.c @@ -46,8 +46,8 @@ main(int argc, char** argv) PuglTest test = {world, view, opts, false}; // Set up and show view - puglSetClassName(test.world, "PuglTest"); - puglSetWindowTitle(test.view, "Pugl Stub Test"); + puglSetWorldString(test.world, PUGL_CLASS_NAME, "PuglTest"); + puglSetViewString(test.view, PUGL_WINDOW_TITLE, "Pugl Stub Test"); puglSetHandle(test.view, &test); puglSetBackend(test.view, puglStubBackend()); puglSetEventFunc(test.view, onEvent); diff --git a/test/test_stub_hints.c b/test/test_stub_hints.c index b59c590..4c9d0c4 100644 --- a/test/test_stub_hints.c +++ b/test/test_stub_hints.c @@ -30,8 +30,8 @@ main(void) PuglView* const view = puglNewView(world); // Set up view - puglSetClassName(world, "PuglTest"); - puglSetWindowTitle(view, "Pugl Stub Hints Test"); + puglSetWorldString(world, PUGL_CLASS_NAME, "PuglTest"); + puglSetViewString(view, PUGL_WINDOW_TITLE, "Pugl Stub Hints Test"); puglSetBackend(view, puglStubBackend()); puglSetEventFunc(view, onEvent); puglSetSizeHint(view, PUGL_DEFAULT_SIZE, 256, 256); diff --git a/test/test_timer.c b/test/test_timer.c index 42a4140..d8cc5c3 100644 --- a/test/test_timer.c +++ b/test/test_timer.c @@ -106,8 +106,8 @@ main(int argc, char** argv) // Set up view test.view = puglNewView(test.world); - puglSetClassName(test.world, "PuglTest"); - puglSetWindowTitle(test.view, "Pugl Timer Test"); + puglSetWorldString(test.world, PUGL_CLASS_NAME, "PuglTest"); + puglSetViewString(test.view, PUGL_WINDOW_TITLE, "Pugl Timer Test"); puglSetBackend(test.view, puglStubBackend()); puglSetHandle(test.view, &test); puglSetEventFunc(test.view, onEvent); diff --git a/test/test_update.c b/test/test_update.c index 1fc10d1..4710ca2 100644 --- a/test/test_update.c +++ b/test/test_update.c @@ -84,8 +84,8 @@ main(int argc, char** argv) // Set up view test.view = puglNewView(test.world); - puglSetClassName(test.world, "PuglTest"); - puglSetWindowTitle(test.view, "Pugl Update Test"); + puglSetWorldString(test.world, PUGL_CLASS_NAME, "PuglTest"); + puglSetViewString(test.view, PUGL_WINDOW_TITLE, "Pugl Update Test"); puglSetBackend(test.view, puglStubBackend()); puglSetHandle(test.view, &test); puglSetEventFunc(test.view, onEvent); diff --git a/test/test_view.c b/test/test_view.c index 7f1a112..a6af9f2 100644 --- a/test/test_view.c +++ b/test/test_view.c @@ -67,8 +67,8 @@ main(int argc, char** argv) // Set up view test.view = puglNewView(test.world); - puglSetClassName(test.world, "PuglTest"); - puglSetWindowTitle(test.view, "Pugl View Test"); + puglSetWorldString(test.world, PUGL_CLASS_NAME, "PuglTest"); + puglSetViewString(test.view, PUGL_WINDOW_TITLE, "Pugl View Test"); puglSetBackend(test.view, puglStubBackend()); puglSetHandle(test.view, &test); puglSetEventFunc(test.view, onEvent); @@ -76,9 +76,10 @@ main(int argc, char** argv) puglSetPosition(test.view, 384, 640); // Check basic accessors - assert(!strcmp(puglGetClassName(test.world), "PuglTest")); - assert(!strcmp(puglGetWindowTitle(test.view), "Pugl View Test")); assert(puglGetBackend(test.view) == puglStubBackend()); + assert(!strcmp(puglGetWorldString(test.world, PUGL_CLASS_NAME), "PuglTest")); + assert( + !strcmp(puglGetViewString(test.view, PUGL_WINDOW_TITLE), "Pugl View Test")); // Create and show window assert(!puglRealize(test.view)); diff --git a/test/test_vulkan.c b/test/test_vulkan.c index ec7732d..1376676 100644 --- a/test/test_vulkan.c +++ b/test/test_vulkan.c @@ -166,8 +166,8 @@ main(int argc, char** argv) assert(!createInstance(&test)); // Create window - puglSetClassName(test.world, "PuglTest"); - puglSetWindowTitle(test.view, "Pugl Vulkan Test"); + puglSetWorldString(test.world, PUGL_CLASS_NAME, "PuglTest"); + puglSetViewString(test.view, PUGL_WINDOW_TITLE, "Pugl Vulkan Test"); puglSetHandle(test.view, &test); puglSetBackend(test.view, puglVulkanBackend()); puglSetEventFunc(test.view, onEvent); -- cgit v1.2.1