diff options
author | Mon ouïe <mon.ouie@gmail.com> | 2023-12-01 02:55:32 +0100 |
---|---|---|
committer | Mon ouïe <mon.ouie@gmail.com> | 2023-12-01 02:55:32 +0100 |
commit | dc3c0d9afec175f109771a252305cbb9b0719469 (patch) | |
tree | 4b1552b52893c0f95f03883e836058dba8a309e6 /src | |
parent | bde503b6c48d5d70f0e44dea722402630a5a9ccf (diff) |
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.
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 19 |
1 files changed, 18 insertions, 1 deletions
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) { |