[libwnck] util: allow setting the same client type again



commit 16cda4ba7ffb1674c12f0b7d45444a43d917e779
Author: Sebastian Geiger <sbastig gmx net>
Date:   Sun Jan 7 18:45:58 2018 +0100

    util: allow setting the same client type again
    
    https://bugzilla.gnome.org/show_bug.cgi?id=792304

 libwnck/util.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/libwnck/util.c b/libwnck/util.c
index d90f585..c8e0e6e 100644
--- a/libwnck/util.c
+++ b/libwnck/util.c
@@ -636,6 +636,11 @@ static WnckClientType client_type = 0;
  * tasklists, it is important to set the role to %WNCK_CLIENT_TYPE_PAGER for
  * libwnck to properly work.
  *
+ * This function should only be called once per program. Additional calls
+ * with the same client type will be silently ignored. An attempt to change
+ * the client type to a differnet value after it has already been set will
+ * be ignored and a critical warning will be logged.
+ *
  * Since: 2.14
  */
 void
@@ -644,8 +649,8 @@ wnck_set_client_type (WnckClientType ewmh_sourceindication_client_type)
   /* Clients constantly switching types makes no sense; this should only be
    * set once.
    */
-  if (client_type != 0)
-    g_critical ("wnck_set_client_type got called multiple times.\n");
+  if (client_type != 0 && client_type != ewmh_sourceindication_client_type)
+    g_critical ("wnck_set_client_type: changing the client type is not supported.\n");
   else
     client_type = ewmh_sourceindication_client_type;
 }


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