[gtk+] API: gdk: Remove title from gdk_window_new()



commit 9707f4d3b3f205f7d5e525ccf660d1d6ccd1ee0b
Author: Benjamin Otte <otte redhat com>
Date:   Fri Nov 4 04:08:50 2016 +0100

    API: gdk: Remove title from gdk_window_new()
    
    Use gdk_window_set_title() afterwards instead.

 gdk/gdkwindow.h                 |   14 +++++---------
 gdk/mir/gdkmirwindowimpl.c      |    5 +----
 gdk/quartz/gdkwindow-quartz.c   |    8 +-------
 gdk/wayland/gdkwindow-wayland.c |    8 +-------
 gdk/win32/gdkwindow-win32.c     |    9 +++------
 gdk/x11/gdkwindow-x11.c         |    8 +-------
 gtk/gtkwindow.c                 |    5 +++--
 7 files changed, 15 insertions(+), 42 deletions(-)
---
diff --git a/gdk/gdkwindow.h b/gdk/gdkwindow.h
index 3144aa1..8a62ba6 100644
--- a/gdk/gdkwindow.h
+++ b/gdk/gdkwindow.h
@@ -85,24 +85,22 @@ typedef enum
 
 /**
  * GdkWindowAttributesType:
- * @GDK_WA_TITLE: Honor the title field
  * @GDK_WA_X: Honor the X coordinate field
  * @GDK_WA_Y: Honor the Y coordinate field
  * @GDK_WA_TYPE_HINT: Honor the type_hint field
  *
  * Used to indicate which fields in the #GdkWindowAttr struct should be honored.
- * For example, if you filled in the “title” and “x” fields of #GdkWindowAttr,
- * pass “@GDK_WA_X | @GDK_WA_TITLE” to gdk_window_new(). Fields in
+ * For example, if you filled in the “x” and “y” fields of #GdkWindowAttr,
+ * pass “@GDK_WA_X | @GDK_WA_Y” to gdk_window_new(). Fields in
  * #GdkWindowAttr not covered by a bit in this enum are required; for example,
  * the @width/@height, @wclass, and @window_type fields are required, they have
  * no corresponding flag in #GdkWindowAttributesType.
  */
 typedef enum
 {
-  GDK_WA_TITLE    = 1 << 1,
-  GDK_WA_X        = 1 << 2,
-  GDK_WA_Y        = 1 << 3,
-  GDK_WA_TYPE_HINT = 1 << 4
+  GDK_WA_X        = 1 << 1,
+  GDK_WA_Y        = 1 << 2,
+  GDK_WA_TYPE_HINT = 1 << 3
 } GdkWindowAttributesType;
 
 /* Size restriction enumeration.
@@ -321,7 +319,6 @@ typedef enum
 
 /**
  * GdkWindowAttr:
- * @title: title of the window (for toplevel windows)
  * @event_mask: event mask (see gdk_window_set_events())
  * @x: X coordinate relative to parent window (see gdk_window_move())
  * @y: Y coordinate relative to parent window (see gdk_window_move())
@@ -337,7 +334,6 @@ typedef enum
  */
 struct _GdkWindowAttr
 {
-  gchar *title;
   gint event_mask;
   gint x, y;
   gint width;
diff --git a/gdk/mir/gdkmirwindowimpl.c b/gdk/mir/gdkmirwindowimpl.c
index 48ae34d..39f23d9 100644
--- a/gdk/mir/gdkmirwindowimpl.c
+++ b/gdk/mir/gdkmirwindowimpl.c
@@ -172,10 +172,7 @@ _gdk_mir_window_impl_new (GdkDisplay *display, GdkWindow *window, GdkWindowAttr
 
   impl->display = display;
 
-  if (attributes && attributes_mask & GDK_WA_TITLE)
-    impl->title = g_strdup (attributes->title);
-  else
-    impl->title = g_strdup (get_default_title ());
+  impl->title = g_strdup (get_default_title ());
 
   if (attributes && attributes_mask & GDK_WA_TYPE_HINT)
     impl->type_hint = attributes->type_hint;
diff --git a/gdk/quartz/gdkwindow-quartz.c b/gdk/quartz/gdkwindow-quartz.c
index c5f5367..3a86081 100644
--- a/gdk/quartz/gdkwindow-quartz.c
+++ b/gdk/quartz/gdkwindow-quartz.c
@@ -817,7 +817,6 @@ _gdk_quartz_display_create_window_impl (GdkDisplay    *display,
         NSRect content_rect;
         NSUInteger style_mask;
         int nx, ny;
-        const char *title;
 
         /* initWithContentRect will place on the mainScreen by default.
          * We want to select the screen to place on ourselves.  We need
@@ -855,12 +854,7 @@ _gdk_quartz_display_create_window_impl (GdkDisplay    *display,
                                                                  defer:NO
                                                                   screen:screen];
 
-       if (attributes_mask & GDK_WA_TITLE)
-         title = attributes->title;
-       else
-         title = get_default_title ();
-
-       gdk_window_set_title (window, title);
+       gdk_window_set_title (window, get_default_title ());
   
         [impl->toplevel setOpaque:NO];
         [impl->toplevel setBackgroundColor:[NSColor clearColor]];
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 08af04c..0b4ee60 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -663,7 +663,6 @@ _gdk_wayland_display_create_window_impl (GdkDisplay    *display,
   GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
   GdkWindowImplWayland *impl;
   GdkFrameClock *frame_clock;
-  const char *title;
 
   impl = g_object_new (GDK_TYPE_WINDOW_IMPL_WAYLAND, NULL);
   window->impl = GDK_WINDOW_IMPL (impl);
@@ -693,12 +692,7 @@ _gdk_wayland_display_create_window_impl (GdkDisplay    *display,
     {
     case GDK_WINDOW_TOPLEVEL:
     case GDK_WINDOW_TEMP:
-      if (attributes_mask & GDK_WA_TITLE)
-        title = attributes->title;
-      else
-        title = get_default_title ();
-
-      gdk_window_set_title (window, title);
+      gdk_window_set_title (window, get_default_title ());
       break;
 
     case GDK_WINDOW_CHILD:
diff --git a/gdk/win32/gdkwindow-win32.c b/gdk/win32/gdkwindow-win32.c
index d21ce02..8462d5e 100644
--- a/gdk/win32/gdkwindow-win32.c
+++ b/gdk/win32/gdkwindow-win32.c
@@ -732,9 +732,9 @@ _gdk_win32_display_create_window_impl (GdkDisplay    *display,
       remaining_mask &= ~GDK_WA_Y;
     }
 
-  if ((remaining_mask & ~(GDK_WA_TITLE|GDK_WA_TYPE_HINT)) != 0)
+  if ((remaining_mask & ~(GDK_WA_TYPE_HINT)) != 0)
     g_warning ("_gdk_window_impl_new: uexpected attribute 0x%X",
-               remaining_mask & ~(GDK_WA_TITLE|GDK_WA_TYPE_HINT));
+               remaining_mask & ~(GDK_WA_TYPE_HINT));
 
   hparent = GDK_WINDOW_HWND (real_parent);
 
@@ -845,10 +845,7 @@ _gdk_win32_display_create_window_impl (GdkDisplay    *display,
       y = (window->y + window->parent->abs_y - offset_y) * impl->window_scale;
     }
 
-  if (attributes_mask & GDK_WA_TITLE)
-    title = attributes->title;
-  else
-    title = get_default_title ();
+  title = get_default_title ();
   if (!title || !*title)
     title = "";
 
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 1f56bc9..279c233 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -915,7 +915,6 @@ _gdk_x11_display_create_window_impl (GdkDisplay    *display,
   XClassHint *class_hint;
 
   unsigned int class;
-  const char *title;
   int depth;
 
   display_x11 = GDK_X11_DISPLAY (display);
@@ -1009,12 +1008,7 @@ _gdk_x11_display_create_window_impl (GdkDisplay    *display,
     {
     case GDK_WINDOW_TOPLEVEL:
     case GDK_WINDOW_TEMP:
-      if (attributes_mask & GDK_WA_TITLE)
-        title = attributes->title;
-      else
-        title = get_default_title ();
-
-      gdk_window_set_title (window, title);
+      gdk_window_set_title (window, get_default_title ());
 
       class_hint = XAllocClassHint ();
       class_hint->res_name = (char *) g_get_prgname ();
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 46030d1..6242c0d 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -6963,7 +6963,6 @@ gtk_window_realize (GtkWidget *widget)
         attributes.window_type = GDK_WINDOW_SUBSURFACE;
 #endif
 
-      attributes.title = priv->title;
       attributes.wclass = GDK_INPUT_OUTPUT;
 
       attributes_mask = 0;
@@ -6990,7 +6989,6 @@ gtk_window_realize (GtkWidget *widget)
       attributes.type_hint = priv->type_hint;
 
       attributes_mask |= GDK_WA_TYPE_HINT;
-      attributes_mask |= (priv->title ? GDK_WA_TITLE : 0);
 
       gdk_window = gdk_window_new (parent_window, &attributes, attributes_mask);
     }
@@ -7029,6 +7027,9 @@ gtk_window_realize (GtkWidget *widget)
     gdk_window_set_transient_for (gdk_window,
                                   _gtk_widget_get_window (GTK_WIDGET (priv->transient_parent)));
 
+  if (priv->title)
+    gdk_window_set_title (gdk_window, priv->title);
+
   if (priv->wm_role)
     gdk_window_set_role (gdk_window, priv->wm_role);
 


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