[mutter] x11-display: Get _NET_WM_NAME from context



commit 7d0aaa14d1e1c80457d28912ac291ddc7af7e88f
Author: Jonas Ã…dahl <jadahl gmail com>
Date:   Wed Mar 3 22:12:01 2021 +0100

    x11-display: Get _NET_WM_NAME from context
    
    It's equivalent to the name that was passed when the context was
    created.
    
    Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1861>

 src/core/meta-context-private.h |  2 ++
 src/core/meta-context.c         |  8 ++++++++
 src/meta/main.h                 |  3 ---
 src/x11/meta-x11-display.c      | 19 ++-----------------
 4 files changed, 12 insertions(+), 20 deletions(-)
---
diff --git a/src/core/meta-context-private.h b/src/core/meta-context-private.h
index 70a5245ec6..73ae1a86f0 100644
--- a/src/core/meta-context-private.h
+++ b/src/core/meta-context-private.h
@@ -45,6 +45,8 @@ struct _MetaContextClass
   void (* notify_ready) (MetaContext *context);
 };
 
+const char * meta_context_get_name (MetaContext *context);
+
 MetaWaylandCompositor * meta_context_get_wayland_compositor (MetaContext *context);
 
 #endif /* META_CONTEXT_PRIVATE_H */
diff --git a/src/core/meta-context.c b/src/core/meta-context.c
index 79a1c14f7f..4a3c3fabe2 100644
--- a/src/core/meta-context.c
+++ b/src/core/meta-context.c
@@ -117,6 +117,14 @@ meta_context_notify_ready (MetaContext *context)
   META_CONTEXT_GET_CLASS (context)->notify_ready (context);
 }
 
+const char *
+meta_context_get_name (MetaContext *context)
+{
+  MetaContextPrivate *priv = meta_context_get_instance_private (context);
+
+  return priv->name;
+}
+
 /**
  * meta_context_get_backend:
  * @context: The #MetaContext
diff --git a/src/meta/main.h b/src/meta/main.h
index 02304e8837..2533c7f22d 100644
--- a/src/meta/main.h
+++ b/src/meta/main.h
@@ -29,9 +29,6 @@
 META_EXPORT
 gboolean        meta_get_replace_current_wm (void);  /* Actually defined in util.c */
 
-META_EXPORT
-void            meta_set_wm_name              (const char *wm_name);
-
 META_EXPORT
 void            meta_set_gnome_wm_keybindings (const char *wm_keybindings);
 
diff --git a/src/x11/meta-x11-display.c b/src/x11/meta-x11-display.c
index 88c8f49311..40abd32da8 100644
--- a/src/x11/meta-x11-display.c
+++ b/src/x11/meta-x11-display.c
@@ -83,7 +83,6 @@ typedef struct _MetaX11DisplayLogicalMonitorData
 static GdkDisplay *prepared_gdk_display = NULL;
 
 static const char *gnome_wm_keybindings = "Mutter";
-static const char *net_wm_name = "Mutter";
 
 static char *get_screen_name (Display *xdisplay,
                               int      number);
@@ -730,6 +729,7 @@ static void
 init_leader_window (MetaX11Display *x11_display,
                     guint32        *timestamp)
 {
+  MetaContext *context = meta_display_get_context (x11_display->display);
   gulong data[1];
   XEvent event;
 
@@ -746,7 +746,7 @@ init_leader_window (MetaX11Display *x11_display,
   meta_prop_set_utf8_string_hint (x11_display,
                                   x11_display->leader_window,
                                   x11_display->atom__NET_WM_NAME,
-                                  net_wm_name);
+                                  meta_context_get_name (context));
 
   meta_prop_set_utf8_string_hint (x11_display,
                                   x11_display->leader_window,
@@ -1004,21 +1004,6 @@ set_work_area_hint (MetaDisplay    *display,
   g_free (data);
 }
 
-/**
- * meta_set_wm_name: (skip)
- * @wm_name: value for _NET_WM_NAME
- *
- * Set the value to use for the _NET_WM_NAME property. To take effect,
- * it is necessary to call this function before meta_init().
- */
-void
-meta_set_wm_name (const char *wm_name)
-{
-  g_return_if_fail (meta_get_display () == NULL);
-
-  net_wm_name = wm_name;
-}
-
 /**
  * meta_set_gnome_wm_keybindings: (skip)
  * @wm_keybindings: value for _GNOME_WM_KEYBINDINGS


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