From dc3c0d9afec175f109771a252305cbb9b0719469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mon=20ou=C3=AFe?= Date: Fri, 1 Dec 2023 02:55:32 +0100 Subject: Update overlay name to match window title For now the window title is only updated on resize to avoid making too many requests. Maybe it would be nice to check every few seconds for windows that get renamed frequently. --- src/main.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/main.cpp b/src/main.cpp index e884be0..f3de811 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1187,7 +1187,7 @@ bool CMainApplication::BInitOverlay() vr::VROverlay()->CreateDashboardOverlay( overlay_key, - "vr-video-player", + mpv_file ? mpv_file : "vr-video-player", &overlay_handle, &thumbnail_handle ); @@ -1478,6 +1478,23 @@ bool CMainApplication::HandleInput() if (overlay_mode) { vr::HmdVector2_t scale = {(float)window_width, (float)window_height}; vr::VROverlay()->SetOverlayMouseScale(overlay_handle, &scale); + + unsigned char *name = nullptr; + int name_len = 0; + int name_type = 0; + xdo_get_window_name(overlay_xdo, src_window_id, + &name, &name_len, &name_type); + + if (name && name_len > 0) { + std::string name_str; + name_str.resize(name_len); + for (int i = 0; i < name_len; i++) + name_str[i] = name[i]; + + vr::VROverlay()->SetOverlayName(overlay_handle, name_str.c_str()); + } + + XFree(name); } if(focused_window_changed) { -- cgit v1.2.3