From cd41b455e937d95fc8672c969bd393280cd43526 Mon Sep 17 00:00:00 2001 From: kallaballa Date: Mon, 28 Nov 2022 15:59:56 +0100 Subject: [PATCH] specify the window title --- src/beauty/beauty-demo.cpp | 2 +- src/common/subsystems.hpp | 5 +++-- src/font/font-demo.cpp | 2 +- src/nanovg/nanovg-demo.cpp | 2 +- src/optflow/optflow-demo.cpp | 2 +- src/pedestrian/pedestrian-demo.cpp | 2 +- src/tetra/tetra-demo.cpp | 2 +- src/video/video-demo.cpp | 2 +- 8 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/beauty/beauty-demo.cpp b/src/beauty/beauty-demo.cpp index 2862f9554..a77059138 100644 --- a/src/beauty/beauty-demo.cpp +++ b/src/beauty/beauty-demo.cpp @@ -200,7 +200,7 @@ int main(int argc, char **argv) { cv::VideoWriter writer(OUTPUT_FILENAME, cv::CAP_FFMPEG, cv::VideoWriter::fourcc('V', 'P', '9', '0'), fps, cv::Size(WIDTH, HEIGHT), { cv::VIDEOWRITER_PROP_HW_ACCELERATION, cv::VIDEO_ACCELERATION_VAAPI, cv::VIDEOWRITER_PROP_HW_ACCELERATION_USE_OPENCL, 1 }); if (!OFFSCREEN) - x11::init(); + x11::init("beauty-demo"); egl::init(); gl::init(); nvg::init(); diff --git a/src/common/subsystems.hpp b/src/common/subsystems.hpp index a90c657cc..88a31411a 100644 --- a/src/common/subsystems.hpp +++ b/src/common/subsystems.hpp @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -122,7 +123,7 @@ bool window_closed() { return false; } -void init() { +void init(const std::string& title) { xdisplay = XOpenDisplay(nullptr); if (xdisplay == nullptr) { cerr << "Unable to open X11 display" << endl; @@ -149,7 +150,7 @@ void init() { XSetWMHints(xdisplay, xwin, &hints); XMapWindow(xdisplay, xwin); - XStoreName(xdisplay, xwin, "nanovg-demo"); + XStoreName(xdisplay, xwin, title.c_str()); wmDeleteMessage = XInternAtom(xdisplay, "WM_DELETE_WINDOW", False); XSetWMProtocols(xdisplay, xwin, &wmDeleteMessage, 1); diff --git a/src/font/font-demo.cpp b/src/font/font-demo.cpp index 9e9afc83f..2707c7e97 100644 --- a/src/font/font-demo.cpp +++ b/src/font/font-demo.cpp @@ -40,7 +40,7 @@ int main(int argc, char **argv) { //If we render offscreen we don't need x11. if (!OFFSCREEN) - x11::init(); + x11::init("font-demo"); //Passing 'true' to egl::init() creates a debug OpenGL-context. egl::init(); //Initialize OpenGL. diff --git a/src/nanovg/nanovg-demo.cpp b/src/nanovg/nanovg-demo.cpp index 1c8bdf863..c11b4dd1b 100644 --- a/src/nanovg/nanovg-demo.cpp +++ b/src/nanovg/nanovg-demo.cpp @@ -149,7 +149,7 @@ int main(int argc, char **argv) { }); if (!OFFSCREEN) - x11::init(); + x11::init("nanovg-demo"); egl::init(); gl::init(); nvg::init(); diff --git a/src/optflow/optflow-demo.cpp b/src/optflow/optflow-demo.cpp index ab8b6ec44..ba407efb3 100644 --- a/src/optflow/optflow-demo.cpp +++ b/src/optflow/optflow-demo.cpp @@ -204,7 +204,7 @@ int main(int argc, char **argv) { }); if (!OFFSCREEN) - x11::init(); + x11::init("optflow-demo"); egl::init(); gl::init(); nvg::init(); diff --git a/src/pedestrian/pedestrian-demo.cpp b/src/pedestrian/pedestrian-demo.cpp index 0359ca61a..bb8f15e37 100644 --- a/src/pedestrian/pedestrian-demo.cpp +++ b/src/pedestrian/pedestrian-demo.cpp @@ -67,7 +67,7 @@ int main(int argc, char **argv) { // }); if (!OFFSCREEN) - x11::init(); + x11::init("pedestrian-demo"); egl::init(); gl::init(); nvg::init(); diff --git a/src/tetra/tetra-demo.cpp b/src/tetra/tetra-demo.cpp index 46b134d9f..079230386 100644 --- a/src/tetra/tetra-demo.cpp +++ b/src/tetra/tetra-demo.cpp @@ -95,7 +95,7 @@ int main(int argc, char **argv) { //If we are rendering offscreen we don't need x11 if(!OFFSCREEN) - x11::init(); + x11::init("tetra-demo"); //Passing true to init_egl will create a OpenGL debug context egl::init(); diff --git a/src/video/video-demo.cpp b/src/video/video-demo.cpp index 781864c16..76254b178 100644 --- a/src/video/video-demo.cpp +++ b/src/video/video-demo.cpp @@ -113,7 +113,7 @@ int main(int argc, char **argv) { //If we are rendering offscreen we don't need x11 if(!OFFSCREEN) - x11::init(); + x11::init("video-demo"); //Passing true to init_egl will create a OpenGL debug context egl::init();