[gtk+/wip/otte/gtk4: 27/127] API: window: Remove suppport for changing wmclass_name/group



commit 054463a13c3d5e2b1ab18cd1269c4c53ebbca8d0
Author: Benjamin Otte <otte redhat com>
Date:   Thu Sep 29 22:23:51 2016 +0200

    API: window: Remove suppport for changing wmclass_name/group
    
    X11 was the only backend to support it and people can just override it
    using XSetClassHint() directly.
    The docs already advertised the function as "Do not use".
    
    Keep the existing call to XSetClassHint() in place, so that we keep
    setting the same values as in GTK3.

 gdk/gdkwindow.h             |   10 +------
 gdk/win32/gdkwindow-win32.c |    8 +----
 gdk/x11/gdkwindow-x11.c     |   13 ++++------
 gtk/gtkplug.c               |    5 ----
 gtk/gtkwin32embedwidget.c   |    2 -
 gtk/gtkwindow.c             |   57 -------------------------------------------
 gtk/gtkwindow.h             |    4 ---
 gtk/gtkwindowprivate.h      |    4 ---
 8 files changed, 9 insertions(+), 94 deletions(-)
---
diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h
index 8692499..c3f13b4 100644
--- a/gdk/gdkwindow.h
+++ b/gdk/gdkwindow.h
@@ -93,7 +93,6 @@ typedef enum
  * @GDK_WA_Y: Honor the Y coordinate field
  * @GDK_WA_CURSOR: Honor the cursor field
  * @GDK_WA_VISUAL: Honor the visual field
- * @GDK_WA_WMCLASS: Honor the wmclass_class and wmclass_name fields
  * @GDK_WA_NOREDIR: Honor the override_redirect field
  * @GDK_WA_TYPE_HINT: Honor the type_hint field
  *
@@ -111,9 +110,8 @@ typedef enum
   GDK_WA_Y        = 1 << 3,
   GDK_WA_CURSOR           = 1 << 4,
   GDK_WA_VISUAL           = 1 << 5,
-  GDK_WA_WMCLASS   = 1 << 6,
-  GDK_WA_NOREDIR   = 1 << 7,
-  GDK_WA_TYPE_HINT = 1 << 8
+  GDK_WA_NOREDIR   = 1 << 6,
+  GDK_WA_TYPE_HINT = 1 << 7
 } GdkWindowAttributesType;
 
 /* Size restriction enumeration.
@@ -343,8 +341,6 @@ typedef enum
  * @visual: #GdkVisual for window
  * @window_type: type of window
  * @cursor: cursor for the window (see gdk_window_set_cursor())
- * @wmclass_name: don’t use (see gtk_window_set_wmclass())
- * @wmclass_class: don’t use (see gtk_window_set_wmclass())
  * @override_redirect: %TRUE to bypass the window manager
  * @type_hint: a hint of the function of the window
  *
@@ -361,8 +357,6 @@ struct _GdkWindowAttr
   GdkVisual *visual;
   GdkWindowType window_type;
   GdkCursor *cursor;
-  gchar *wmclass_name;
-  gchar *wmclass_class;
   gboolean override_redirect;
   GdkWindowTypeHint type_hint;
 };
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index 20ca3c3..6d25baa 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -734,9 +734,9 @@ _gdk_win32_display_create_window_impl (GdkDisplay    *display,
       remaining_mask &= ~GDK_WA_NOREDIR;
     }
 
-  if ((remaining_mask & ~(GDK_WA_WMCLASS|GDK_WA_VISUAL|GDK_WA_CURSOR|GDK_WA_TITLE|GDK_WA_TYPE_HINT)) != 0)
+  if ((remaining_mask & ~(GDK_WA_VISUAL|GDK_WA_CURSOR|GDK_WA_TITLE|GDK_WA_TYPE_HINT)) != 0)
     g_warning ("_gdk_window_impl_new: uexpected attribute 0x%X",
-               remaining_mask & ~(GDK_WA_WMCLASS|GDK_WA_VISUAL|GDK_WA_CURSOR|GDK_WA_TITLE|GDK_WA_TYPE_HINT));
+               remaining_mask & ~(GDK_WA_VISUAL|GDK_WA_CURSOR|GDK_WA_TITLE|GDK_WA_TYPE_HINT));
 
   hparent = GDK_WINDOW_HWND (real_parent);
 
@@ -752,10 +752,6 @@ _gdk_win32_display_create_window_impl (GdkDisplay    *display,
   impl->layered = FALSE;
   impl->layered_opacity = 1.0;
 
-  /* wclass is not any longer set always, but if is ... */
-  if ((attributes_mask & GDK_WA_WMCLASS) == GDK_WA_WMCLASS)
-    g_assert ((attributes->wclass == GDK_INPUT_OUTPUT) == !window->input_only);
-
   if (!window->input_only)
     {
       dwExStyle = 0;
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 14dfdd9..a954c46 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -1127,14 +1127,11 @@ _gdk_x11_display_create_window_impl (GdkDisplay    *display,
 
       gdk_window_set_title (window, title);
 
-      if (attributes_mask & GDK_WA_WMCLASS)
-        {
-          class_hint = XAllocClassHint ();
-          class_hint->res_name = attributes->wmclass_name;
-          class_hint->res_class = attributes->wmclass_class;
-          XSetClassHint (xdisplay, impl->xid, class_hint);
-          XFree (class_hint);
-        }
+      class_hint = XAllocClassHint ();
+      class_hint->res_name = (char *) g_get_prgname ();
+      class_hint->res_class = (char *) gdk_get_program_class ();
+      XSetClassHint (xdisplay, impl->xid, class_hint);
+      XFree (class_hint);
 
       setup_toplevel_window (window, window->parent);
       break;
diff --git a/gtk/gtkplug.c b/gtk/gtkplug.c
index 4e72543..de56b42 100644
--- a/gtk/gtkplug.c
+++ b/gtk/gtkplug.c
@@ -1009,7 +1009,6 @@ gtk_plug_realize (GtkWidget *widget)
   GdkWindow *gdk_window;
   GdkWindowAttr attributes;
   const gchar *title;
-  gchar *wmclass_name, *wmclass_class;
   gint attributes_mask;
   GdkScreen *screen;
 
@@ -1020,13 +1019,10 @@ gtk_plug_realize (GtkWidget *widget)
     g_warning ("GtkPlug only works under X11");
 
   title = gtk_window_get_title (window);
-  _gtk_window_get_wmclass (window, &wmclass_name, &wmclass_class);
   gtk_widget_get_allocation (widget, &allocation);
 
   attributes.window_type = GDK_WINDOW_CHILD;   /* XXX GDK_WINDOW_PLUG ? */
   attributes.title = (gchar *) title;
-  attributes.wmclass_name = wmclass_name;
-  attributes.wmclass_class = wmclass_class;
   attributes.width = allocation.width;
   attributes.height = allocation.height;
   attributes.wclass = GDK_INPUT_OUTPUT;
@@ -1044,7 +1040,6 @@ gtk_plug_realize (GtkWidget *widget)
 
   attributes_mask = GDK_WA_VISUAL;
   attributes_mask |= (title ? GDK_WA_TITLE : 0);
-  attributes_mask |= (wmclass_name ? GDK_WA_WMCLASS : 0);
 
   if (gtk_widget_is_toplevel (widget))
     {
diff --git a/gtk/gtkwin32embedwidget.c b/gtk/gtkwin32embedwidget.c
index c4e6aff..f6ddfa1 100644
--- a/gtk/gtkwin32embedwidget.c
+++ b/gtk/gtkwin32embedwidget.c
@@ -203,7 +203,6 @@ gtk_win32_embed_widget_realize (GtkWidget *widget)
 
   attributes.window_type = GDK_WINDOW_CHILD;
   attributes.title = (gchar *) gtk_window_get_title (window);
-  _gtk_window_get_wmclass (window, &attributes.wmclass_name, &attributes.wmclass_class);
   attributes.width = allocation.width;
   attributes.height = allocation.height;
   attributes.wclass = GDK_INPUT_OUTPUT;
@@ -222,7 +221,6 @@ gtk_win32_embed_widget_realize (GtkWidget *widget)
 
   attributes_mask = GDK_WA_VISUAL;
   attributes_mask |= (attributes.title ? GDK_WA_TITLE : 0);
-  attributes_mask |= (attributes.wmclass_name ? GDK_WA_WMCLASS : 0);
 
   gdk_window = gdk_window_new (embed_widget->parent_window,
                                &attributes, attributes_mask);
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 937d42b..205f471 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -192,8 +192,6 @@ struct _GtkWindowPrivate
 
   gchar   *startup_id;
   gchar   *title;
-  gchar   *wmclass_class;
-  gchar   *wmclass_name;
   gchar   *wm_role;
 
   guint    keys_changed_handler;
@@ -1649,8 +1647,6 @@ gtk_window_init (GtkWindow *window)
   gtk_container_set_default_resize_mode (GTK_CONTAINER (window), GTK_RESIZE_QUEUE);
 
   priv->title = NULL;
-  priv->wmclass_name = g_strdup (g_get_prgname ());
-  priv->wmclass_class = g_strdup (gdk_get_program_class ());
   priv->wm_role = NULL;
   priv->geometry_info = NULL;
   priv->type = GTK_WINDOW_TOPLEVEL;
@@ -2382,43 +2378,6 @@ gtk_window_get_title (GtkWindow *window)
 }
 
 /**
- * gtk_window_set_wmclass:
- * @window: a #GtkWindow
- * @wmclass_name: window name hint
- * @wmclass_class: window class hint
- *
- * Don’t use this function. It sets the X Window System “class” and
- * “name” hints for a window.  According to the ICCCM, you should
- * always set these to the same value for all windows in an
- * application, and GTK+ sets them to that value by default, so calling
- * this function is sort of pointless. However, you may want to call
- * gtk_window_set_role() on each window in your application, for the
- * benefit of the session manager. Setting the role allows the window
- * manager to restore window positions when loading a saved session.
- * 
- **/
-void
-gtk_window_set_wmclass (GtkWindow *window,
-                       const gchar *wmclass_name,
-                       const gchar *wmclass_class)
-{
-  GtkWindowPrivate *priv;
-
-  g_return_if_fail (GTK_IS_WINDOW (window));
-
-  priv = window->priv;
-
-  g_free (priv->wmclass_name);
-  priv->wmclass_name = g_strdup (wmclass_name);
-
-  g_free (priv->wmclass_class);
-  priv->wmclass_class = g_strdup (wmclass_class);
-
-  if (_gtk_widget_get_realized (GTK_WIDGET (window)))
-    g_warning ("gtk_window_set_wmclass: shouldn't set wmclass after window is realized!");
-}
-
-/**
  * gtk_window_set_role:
  * @window: a #GtkWindow
  * @role: unique identifier for the window to be used when restoring a session
@@ -5820,8 +5779,6 @@ gtk_window_finalize (GObject *object)
   GtkMnemonicHash *mnemonic_hash;
 
   g_free (priv->title);
-  g_free (priv->wmclass_name);
-  g_free (priv->wmclass_class);
   g_free (priv->wm_role);
   gtk_window_release_application (window);
 
@@ -7139,8 +7096,6 @@ gtk_window_realize (GtkWidget *widget)
 #endif
 
       attributes.title = priv->title;
-      attributes.wmclass_name = priv->wmclass_name;
-      attributes.wmclass_class = priv->wmclass_class;
       attributes.wclass = GDK_INPUT_OUTPUT;
       attributes.visual = gtk_widget_get_visual (widget);
 
@@ -7169,7 +7124,6 @@ gtk_window_realize (GtkWidget *widget)
 
       attributes_mask |= GDK_WA_VISUAL | GDK_WA_TYPE_HINT;
       attributes_mask |= (priv->title ? GDK_WA_TITLE : 0);
-      attributes_mask |= (priv->wmclass_name ? GDK_WA_WMCLASS : 0);
 
       gdk_window = gdk_window_new (parent_window, &attributes, attributes_mask);
     }
@@ -11553,17 +11507,6 @@ gtk_window_set_focus_visible (GtkWindow *window,
     }
 }
 
-void
-_gtk_window_get_wmclass (GtkWindow  *window,
-                         gchar     **wmclass_name,
-                         gchar     **wmclass_class)
-{
-  GtkWindowPrivate *priv = window->priv;
-
-  *wmclass_name = priv->wmclass_name;
-  *wmclass_class = priv->wmclass_class;
-}
-
 /**
  * gtk_window_set_has_user_ref_count:
  * @window: a #GtkWindow
diff --git a/gtk/gtkwindow.h b/gtk/gtkwindow.h
index 34b7681..1f1197a 100644
--- a/gtk/gtkwindow.h
+++ b/gtk/gtkwindow.h
@@ -151,10 +151,6 @@ void       gtk_window_set_title                (GtkWindow           *window,
 GDK_AVAILABLE_IN_ALL
 const gchar * gtk_window_get_title             (GtkWindow           *window);
 GDK_AVAILABLE_IN_ALL
-void       gtk_window_set_wmclass              (GtkWindow           *window,
-                                               const gchar         *wmclass_name,
-                                               const gchar         *wmclass_class);
-GDK_AVAILABLE_IN_ALL
 void       gtk_window_set_role                 (GtkWindow           *window,
                                                 const gchar         *role);
 GDK_AVAILABLE_IN_ALL
diff --git a/gtk/gtkwindowprivate.h b/gtk/gtkwindowprivate.h
index 5cb5a72..20dbbda 100644
--- a/gtk/gtkwindowprivate.h
+++ b/gtk/gtkwindowprivate.h
@@ -57,10 +57,6 @@ void            _gtk_window_set_is_active          (GtkWindow *window,
 void            _gtk_window_set_is_toplevel        (GtkWindow *window,
                                                     gboolean   is_toplevel);
 
-void            _gtk_window_get_wmclass            (GtkWindow  *window,
-                                                    gchar     **wmclass_name,
-                                                    gchar     **wmclass_class);
-
 void            _gtk_window_set_allocation         (GtkWindow           *window,
                                                     const GtkAllocation *allocation,
                                                     GtkAllocation       *allocation_out);


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