[xdg-desktop-portal-gnome] screencast: Don't restore windows with too different titles



commit 4251d584b010c130f278ba22869d4c9a9d19ebdb
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Fri Mar 18 13:32:11 2022 -0300

    screencast: Don't restore windows with too different titles
    
    If the title is too different, don't restore it. The "too
    different" part is arbitrarily chosen to be half of the
    title's length. If this is too strict, we can review it
    later.

 src/screencast.c | 6 ++++++
 1 file changed, 6 insertions(+)
---
diff --git a/src/screencast.c b/src/screencast.c
index 46e1dfd..f256082 100644
--- a/src/screencast.c
+++ b/src/screencast.c
@@ -464,6 +464,12 @@ find_best_window_by_app_id_and_title (const char *app_id,
         }
     }
 
+  /* If even the best match's window title is too different, don't
+   * restore it.
+   */
+  if (best_match_distance > strlen (title) / 2)
+    return NULL;
+
   return best_match;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]