From 1e48f8bbfdb0f1ce2f9132d604405fb72d160d9d Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 12 Jan 2023 15:30:44 -0500 Subject: Windows: Add PUGL_DARK_FRAME hint This allows dark applications to visually integrate more nicely in Windows 10. A little thing, but it really goes a long way to make programs not look out of place and half-baked. --- examples/pugl_management_demo.c | 11 +++++++---- examples/pugl_shader_demo.c | 1 + examples/pugl_vulkan_cpp_demo.cpp | 1 + 3 files changed, 9 insertions(+), 4 deletions(-) (limited to 'examples') diff --git a/examples/pugl_management_demo.c b/examples/pugl_management_demo.c index 30a026e..766bee1 100644 --- a/examples/pugl_management_demo.c +++ b/examples/pugl_management_demo.c @@ -50,20 +50,20 @@ onExpose(PuglView* const view, const PuglExposeEvent* const event) cairo_clip_preserve(cr); // Draw background - cairo_set_source_rgb(cr, 0.2, 0.2, 0.2); + cairo_set_source_rgb(cr, 0.1, 0.1, 0.1); cairo_set_line_width(cr, 4.0); cairo_fill(cr); // Set up text renering char buf[128] = {0}; cairo_text_extents_t extents = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}; - cairo_set_font_size(cr, 32.0); + cairo_set_font_size(cr, 30.0); // Draw time label snprintf(buf, sizeof(buf), "Draw time: %g", puglGetTime(world)); cairo_text_extents(cr, buf, &extents); cairo_move_to(cr, cx - extents.width / 2.0, cy + extents.height / 2.0 - 48.0); - cairo_set_source_rgb(cr, 1.0, 1.0, 1.0); + cairo_set_source_rgb(cr, 0.9, 0.9, 0.9); cairo_show_text(cr, buf); // Draw style label @@ -112,13 +112,15 @@ toggleDialog(DemoApp* const app) puglSetHandle(app->dialogView.view, &app->dialogView); puglSetTransientParent(app->dialogView.view, puglGetNativeView(app->mainView.view)); + + puglSetViewString(app->dialogView.view, PUGL_WINDOW_TITLE, "Dialog"); + puglSetViewHint(app->dialogView.view, PUGL_DARK_FRAME, PUGL_TRUE); puglSetSizeHint(app->dialogView.view, PUGL_DEFAULT_SIZE, 320, 240); puglSetSizeHint(app->dialogView.view, PUGL_MIN_SIZE, 160, 120); puglSetViewHint(app->dialogView.view, PUGL_IGNORE_KEY_REPEAT, true); puglSetViewHint(app->dialogView.view, PUGL_RESIZABLE, true); puglSetViewHint( app->dialogView.view, PUGL_VIEW_TYPE, PUGL_VIEW_TYPE_DIALOG); - puglSetViewString(app->dialogView.view, PUGL_WINDOW_TITLE, "Dialog"); } return puglShow(app->dialogView.view, PUGL_SHOW_RAISE); @@ -240,6 +242,7 @@ main(int argc, char** argv) puglSetHandle(app.mainView.view, &app.mainView); puglSetSizeHint(app.mainView.view, PUGL_DEFAULT_SIZE, 640, 480); puglSetSizeHint(app.mainView.view, PUGL_MIN_SIZE, 320, 240); + puglSetViewHint(app.mainView.view, PUGL_DARK_FRAME, PUGL_TRUE); puglSetViewHint(app.mainView.view, PUGL_IGNORE_KEY_REPEAT, true); puglSetViewHint(app.mainView.view, PUGL_RESIZABLE, true); puglSetViewHint(app.mainView.view, PUGL_VIEW_TYPE, PUGL_VIEW_TYPE_NORMAL); diff --git a/examples/pugl_shader_demo.c b/examples/pugl_shader_demo.c index 5773a9d..5cd9c7c 100644 --- a/examples/pugl_shader_demo.c +++ b/examples/pugl_shader_demo.c @@ -265,6 +265,7 @@ setupPugl(PuglTestApp* app) puglSetViewHint(app->view, PUGL_DOUBLE_BUFFER, app->opts.doubleBuffer); puglSetViewHint(app->view, PUGL_SWAP_INTERVAL, app->opts.sync); puglSetViewHint(app->view, PUGL_IGNORE_KEY_REPEAT, PUGL_TRUE); + puglSetViewHint(app->view, PUGL_DARK_FRAME, PUGL_TRUE); puglSetHandle(app->view, app); puglSetEventFunc(app->view, onEvent); } diff --git a/examples/pugl_vulkan_cpp_demo.cpp b/examples/pugl_vulkan_cpp_demo.cpp index 7e652a5..2cfb1e8 100644 --- a/examples/pugl_vulkan_cpp_demo.cpp +++ b/examples/pugl_vulkan_cpp_demo.cpp @@ -1719,6 +1719,7 @@ run(const char* const programPath, app.view.setSizeHint(pugl::SizeHint::minSize, width / 4U, height / 4U); app.view.setBackend(pugl::vulkanBackend()); app.view.setHint(pugl::ViewHint::resizable, opts.resizable); + app.view.setHint(pugl::ViewHint::darkFrame, true); const pugl::Status st = app.view.realize(); if (st != pugl::Status::success) { return logError("Failed to create window (%s)\n", pugl::strerror(st)); -- cgit v1.2.1