fepitre / rpms / gtk3

Forked from rpms/gtk3 4 years ago
Clone

Blame SOURCES/0001-a11y-Include-window-management-buttons-in-headerbar.patch

5eb3ce
From bc1c0584b76e19d5d65bfa2ae809f95113e53c83 Mon Sep 17 00:00:00 2001
5eb3ce
From: Benjamin Otte <otte@redhat.com>
5eb3ce
Date: Sun, 21 Jul 2019 23:15:00 +0200
5eb3ce
Subject: [PATCH] a11y: Include window management buttons in headerbar
5eb3ce
5eb3ce
---
5eb3ce
 gtk/a11y/Makefile.inc             |  2 +
5eb3ce
 gtk/a11y/gtkheaderbaraccessible.c | 87 +++++++++++++++++++++++++++++++
5eb3ce
 gtk/a11y/gtkheaderbaraccessible.h | 55 +++++++++++++++++++
5eb3ce
 gtk/gtkcontainerprivate.h         |  1 +
5eb3ce
 gtk/gtkheaderbar.c                |  3 +-
5eb3ce
 6 files changed, 149 insertions(+), 1 deletion(-)
5eb3ce
 create mode 100644 gtk/a11y/gtkheaderbaraccessible.c
5eb3ce
 create mode 100644 gtk/a11y/gtkheaderbaraccessible.h
5eb3ce
5eb3ce
diff --git a/gtk/a11y/Makefile.inc b/gtk/a11y/Makefile.inc
5eb3ce
index 8529c7ae57..3ed6c5decd 100644
5eb3ce
--- a/gtk/a11y/Makefile.inc
5eb3ce
+++ b/gtk/a11y/Makefile.inc
5eb3ce
@@ -14,6 +14,7 @@ a11y_h_sources =				\
5eb3ce
 	a11y/gtkflowboxaccessible.h		\
5eb3ce
 	a11y/gtkflowboxchildaccessible.h	\
5eb3ce
 	a11y/gtkframeaccessible.h		\
5eb3ce
+	a11y/gtkheaderbaraccessible.h	        \
5eb3ce
 	a11y/gtkiconviewaccessible.h		\
5eb3ce
 	a11y/gtkimageaccessible.h		\
5eb3ce
 	a11y/gtkimagecellaccessible.h		\
5eb3ce
@@ -88,6 +89,7 @@ a11y_c_sources =				\
5eb3ce
 	a11y/gtkflowboxaccessible.c		\
5eb3ce
 	a11y/gtkflowboxchildaccessible.c	\
5eb3ce
 	a11y/gtkframeaccessible.c		\
5eb3ce
+	a11y/gtkheaderbaraccessible.c	        \
5eb3ce
 	a11y/gtkiconviewaccessible.c		\
5eb3ce
 	a11y/gtkimageaccessible.c		\
5eb3ce
 	a11y/gtkimagecellaccessible.c		\
5eb3ce
--- a/gtk/Makefile.in
5eb3ce
+++ b/gtk/Makefile.in
5eb3ce
@@ -281,6 +281,7 @@
5eb3ce
 	a11y/gtkcontainercellaccessible.c a11y/gtkentryaccessible.c \
5eb3ce
 	a11y/gtkexpanderaccessible.c a11y/gtkflowboxaccessible.c \
5eb3ce
 	a11y/gtkflowboxchildaccessible.c a11y/gtkframeaccessible.c \
5eb3ce
+	a11y/gtkheaderbaraccessible.c \
5eb3ce
 	a11y/gtkiconviewaccessible.c a11y/gtkimageaccessible.c \
5eb3ce
 	a11y/gtkimagecellaccessible.c a11y/gtklabelaccessible.c \
5eb3ce
 	a11y/gtklevelbaraccessible.c a11y/gtklinkbuttonaccessible.c \
5eb3ce
@@ -487,6 +488,7 @@
5eb3ce
 	a11y/libgtk_3_la-gtkflowboxaccessible.lo \
5eb3ce
 	a11y/libgtk_3_la-gtkflowboxchildaccessible.lo \
5eb3ce
 	a11y/libgtk_3_la-gtkframeaccessible.lo \
5eb3ce
+	a11y/libgtk_3_la-gtkheaderbaraccessible.lo \
5eb3ce
 	a11y/libgtk_3_la-gtkiconviewaccessible.lo \
5eb3ce
 	a11y/libgtk_3_la-gtkimageaccessible.lo \
5eb3ce
 	a11y/libgtk_3_la-gtkimagecellaccessible.lo \
5eb3ce
@@ -1389,6 +1391,7 @@
5eb3ce
 	a11y/gtkflowboxaccessible.h		\
5eb3ce
 	a11y/gtkflowboxchildaccessible.h	\
5eb3ce
 	a11y/gtkframeaccessible.h		\
5eb3ce
+	a11y/gtkheaderbaraccessible.h		\
5eb3ce
 	a11y/gtkiconviewaccessible.h		\
5eb3ce
 	a11y/gtkimageaccessible.h		\
5eb3ce
 	a11y/gtkimagecellaccessible.h		\
5eb3ce
@@ -1463,6 +1466,7 @@
5eb3ce
 	a11y/gtkflowboxaccessible.c		\
5eb3ce
 	a11y/gtkflowboxchildaccessible.c	\
5eb3ce
 	a11y/gtkframeaccessible.c		\
5eb3ce
+	a11y/gtkheaderbaraccessible.c		\
5eb3ce
 	a11y/gtkiconviewaccessible.c		\
5eb3ce
 	a11y/gtkimageaccessible.c		\
5eb3ce
 	a11y/gtkimagecellaccessible.c		\
5eb3ce
@@ -2702,6 +2706,8 @@
5eb3ce
 	a11y/$(DEPDIR)/$(am__dirstamp)
5eb3ce
 a11y/libgtk_3_la-gtkframeaccessible.lo: a11y/$(am__dirstamp) \
5eb3ce
 	a11y/$(DEPDIR)/$(am__dirstamp)
5eb3ce
+a11y/libgtk_3_la-gtkheaderbaraccessible.lo: a11y/$(am__dirstamp) \
5eb3ce
+	a11y/$(DEPDIR)/$(am__dirstamp)
5eb3ce
 a11y/libgtk_3_la-gtkiconviewaccessible.lo: a11y/$(am__dirstamp) \
5eb3ce
 	a11y/$(DEPDIR)/$(am__dirstamp)
5eb3ce
 a11y/libgtk_3_la-gtkimageaccessible.lo: a11y/$(am__dirstamp) \
5eb3ce
@@ -3447,6 +3453,7 @@
5eb3ce
 @AMDEP_TRUE@@am__include@ @am__quote@a11y/$(DEPDIR)/libgtk_3_la-gtkflowboxaccessible.Plo@am__quote@
5eb3ce
 @AMDEP_TRUE@@am__include@ @am__quote@a11y/$(DEPDIR)/libgtk_3_la-gtkflowboxchildaccessible.Plo@am__quote@
5eb3ce
 @AMDEP_TRUE@@am__include@ @am__quote@a11y/$(DEPDIR)/libgtk_3_la-gtkframeaccessible.Plo@am__quote@
5eb3ce
+@AMDEP_TRUE@@am__include@ @am__quote@a11y/$(DEPDIR)/libgtk_3_la-gtkheaderbaraccessible.Plo@am__quote@
5eb3ce
 @AMDEP_TRUE@@am__include@ @am__quote@a11y/$(DEPDIR)/libgtk_3_la-gtkiconviewaccessible.Plo@am__quote@
5eb3ce
 @AMDEP_TRUE@@am__include@ @am__quote@a11y/$(DEPDIR)/libgtk_3_la-gtkimageaccessible.Plo@am__quote@
5eb3ce
 @AMDEP_TRUE@@am__include@ @am__quote@a11y/$(DEPDIR)/libgtk_3_la-gtkimagecellaccessible.Plo@am__quote@
5eb3ce
@@ -3705,6 +3712,13 @@
5eb3ce
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
5eb3ce
 @am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgtk_3_la_CFLAGS) $(CFLAGS) -c -o a11y/libgtk_3_la-gtkframeaccessible.lo `test -f 'a11y/gtkframeaccessible.c' || echo '$(srcdir)/'`a11y/gtkframeaccessible.c
5eb3ce
 
5eb3ce
+a11y/libgtk_3_la-gtkheaderbaraccessible.lo: a11y/gtkheaderbaraccessible.c
5eb3ce
+@am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgtk_3_la_CFLAGS) $(CFLAGS) -MT a11y/libgtk_3_la-gtkheaderbaraccessible.lo -MD -MP -MF a11y/$(DEPDIR)/libgtk_3_la-gtkheaderbaraccessible.Tpo -c -o a11y/libgtk_3_la-gtkheaderbaraccessible.lo `test -f 'a11y/gtkheaderbaraccessible.c' || echo '$(srcdir)/'`a11y/gtkheaderbaraccessible.c
5eb3ce
+@am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) a11y/$(DEPDIR)/libgtk_3_la-gtkheaderbaraccessible.Tpo a11y/$(DEPDIR)/libgtk_3_la-gtkheaderbaraccessible.Plo
5eb3ce
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	$(AM_V_CC)source='a11y/gtkheaderbaraccessible.c' object='a11y/libgtk_3_la-gtkheaderbaraccessible.lo' libtool=yes @AMDEPBACKSLASH@
5eb3ce
+@AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
5eb3ce
+@am__fastdepCC_FALSE@	$(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgtk_3_la_CFLAGS) $(CFLAGS) -c -o a11y/libgtk_3_la-gtkheaderbaraccessible.lo `test -f 'a11y/gtkheaderbaraccessible.c' || echo '$(srcdir)/'`a11y/gtkheaderbaraccessible.c
5eb3ce
+
5eb3ce
 a11y/libgtk_3_la-gtkiconviewaccessible.lo: a11y/gtkiconviewaccessible.c
5eb3ce
 @am__fastdepCC_TRUE@	$(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libgtk_3_la_CFLAGS) $(CFLAGS) -MT a11y/libgtk_3_la-gtkiconviewaccessible.lo -MD -MP -MF a11y/$(DEPDIR)/libgtk_3_la-gtkiconviewaccessible.Tpo -c -o a11y/libgtk_3_la-gtkiconviewaccessible.lo `test -f 'a11y/gtkiconviewaccessible.c' || echo '$(srcdir)/'`a11y/gtkiconviewaccessible.c
5eb3ce
 @am__fastdepCC_TRUE@	$(AM_V_at)$(am__mv) a11y/$(DEPDIR)/libgtk_3_la-gtkiconviewaccessible.Tpo a11y/$(DEPDIR)/libgtk_3_la-gtkiconviewaccessible.Plo
5eb3ce
diff --git a/gtk/a11y/gtkheaderbaraccessible.c b/gtk/a11y/gtkheaderbaraccessible.c
5eb3ce
new file mode 100644
5eb3ce
index 0000000000..3610ac0d1f
5eb3ce
--- /dev/null
5eb3ce
+++ b/gtk/a11y/gtkheaderbaraccessible.c
5eb3ce
@@ -0,0 +1,87 @@
5eb3ce
+/* GTK+ - accessibility implementations
5eb3ce
+ * Copyright 2001, 2002, 2003 Sun Microsystems Inc.
5eb3ce
+ *
5eb3ce
+ * This library is free software; you can redistribute it and/or
5eb3ce
+ * modify it under the terms of the GNU Lesser General Public
5eb3ce
+ * License as published by the Free Software Foundation; either
5eb3ce
+ * version 2 of the License, or (at your option) any later version.
5eb3ce
+ *
5eb3ce
+ * This library is distributed in the hope that it will be useful,
5eb3ce
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
5eb3ce
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5eb3ce
+ * Lesser General Public License for more details.
5eb3ce
+ *
5eb3ce
+ * You should have received a copy of the GNU Lesser General Public
5eb3ce
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
5eb3ce
+ */
5eb3ce
+
5eb3ce
+#include "config.h"
5eb3ce
+
5eb3ce
+#include "gtkheaderbaraccessible.h"
5eb3ce
+
5eb3ce
+#include "gtkcontainerprivate.h"
5eb3ce
+
5eb3ce
+G_DEFINE_TYPE (GtkHeaderBarAccessible, gtk_header_bar_accessible, GTK_TYPE_CONTAINER_ACCESSIBLE)
5eb3ce
+
5eb3ce
+static void
5eb3ce
+count_widget (GtkWidget *widget,
5eb3ce
+              gint      *count)
5eb3ce
+{
5eb3ce
+  (*count)++;
5eb3ce
+}
5eb3ce
+
5eb3ce
+static gint
5eb3ce
+gtk_header_bar_accessible_get_n_children (AtkObject* obj)
5eb3ce
+{
5eb3ce
+  GtkWidget *widget;
5eb3ce
+  gint count = 0;
5eb3ce
+
5eb3ce
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
5eb3ce
+  if (widget == NULL)
5eb3ce
+    return 0;
5eb3ce
+
5eb3ce
+  gtk_container_forall (GTK_CONTAINER (widget), (GtkCallback) count_widget, &count);
5eb3ce
+  return count;
5eb3ce
+}
5eb3ce
+
5eb3ce
+static AtkObject *
5eb3ce
+gtk_header_bar_accessible_ref_child (AtkObject *obj,
5eb3ce
+                                     gint       i)
5eb3ce
+{
5eb3ce
+  GList *children, *tmp_list;
5eb3ce
+  AtkObject  *accessible;
5eb3ce
+  GtkWidget *widget;
5eb3ce
+
5eb3ce
+  widget = gtk_accessible_get_widget (GTK_ACCESSIBLE (obj));
5eb3ce
+  if (widget == NULL)
5eb3ce
+    return NULL;
5eb3ce
+
5eb3ce
+  children = gtk_container_get_all_children (GTK_CONTAINER (widget));
5eb3ce
+  tmp_list = g_list_nth (children, i);
5eb3ce
+  if (!tmp_list)
5eb3ce
+    {
5eb3ce
+      g_list_free (children);
5eb3ce
+      return NULL;
5eb3ce
+    }
5eb3ce
+  accessible = gtk_widget_get_accessible (GTK_WIDGET (tmp_list->data));
5eb3ce
+
5eb3ce
+  g_list_free (children);
5eb3ce
+  g_object_ref (accessible);
5eb3ce
+
5eb3ce
+  return accessible;
5eb3ce
+}
5eb3ce
+
5eb3ce
+static void
5eb3ce
+gtk_header_bar_accessible_class_init (GtkHeaderBarAccessibleClass *klass)
5eb3ce
+{
5eb3ce
+  AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
5eb3ce
+
5eb3ce
+  class->get_n_children = gtk_header_bar_accessible_get_n_children;
5eb3ce
+  class->ref_child = gtk_header_bar_accessible_ref_child;
5eb3ce
+}
5eb3ce
+
5eb3ce
+static void
5eb3ce
+gtk_header_bar_accessible_init (GtkHeaderBarAccessible *header_bar)
5eb3ce
+{
5eb3ce
+}
5eb3ce
+
5eb3ce
diff --git a/gtk/a11y/gtkheaderbaraccessible.h b/gtk/a11y/gtkheaderbaraccessible.h
5eb3ce
new file mode 100644
5eb3ce
index 0000000000..fca9428a94
5eb3ce
--- /dev/null
5eb3ce
+++ b/gtk/a11y/gtkheaderbaraccessible.h
5eb3ce
@@ -0,0 +1,55 @@
5eb3ce
+/* GTK+ - accessibility implementations
5eb3ce
+ * Copyright 2001, 2002, 2003 Sun Microsystems Inc.
5eb3ce
+ *
5eb3ce
+ * This library is free software; you can redistribute it and/or
5eb3ce
+ * modify it under the terms of the GNU Library General Public
5eb3ce
+ * License as published by the Free Software Foundation; either
5eb3ce
+ * version 2 of the License, or (at your option) any later version.
5eb3ce
+ *
5eb3ce
+ * This library is distributed in the hope that it will be useful,
5eb3ce
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
5eb3ce
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
5eb3ce
+ * Library General Public License for more details.
5eb3ce
+ *
5eb3ce
+ * You should have received a copy of the GNU Library General Public
5eb3ce
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
5eb3ce
+ */
5eb3ce
+
5eb3ce
+#ifndef __GTK_HEADER_BAR_ACCESSIBLE_H__
5eb3ce
+#define __GTK_HEADER_BAR_ACCESSIBLE_H__
5eb3ce
+
5eb3ce
+#if !defined (__GTK_A11Y_H_INSIDE__) && !defined (GTK_COMPILATION)
5eb3ce
+#error "Only <gtk/gtk-a11y.h> can be included directly."
5eb3ce
+#endif
5eb3ce
+
5eb3ce
+#include <gtk/a11y/gtkcontaineraccessible.h>
5eb3ce
+
5eb3ce
+G_BEGIN_DECLS
5eb3ce
+
5eb3ce
+#define GTK_TYPE_HEADER_BAR_ACCESSIBLE                  (gtk_header_bar_accessible_get_type ())
5eb3ce
+#define GTK_HEADER_BAR_ACCESSIBLE(obj)                  (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTK_TYPE_HEADER_BAR_ACCESSIBLE, GtkHeaderBarAccessible))
5eb3ce
+#define GTK_HEADER_BAR_ACCESSIBLE_CLASS(klass)          (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_HEADER_BAR_ACCESSIBLE, GtkHeaderBarAccessibleClass))
5eb3ce
+#define GTK_IS_HEADER_BAR_ACCESSIBLE(obj)               (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTK_TYPE_HEADER_BAR_ACCESSIBLE))
5eb3ce
+#define GTK_IS_HEADER_BAR_ACCESSIBLE_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_HEADER_BAR_ACCESSIBLE))
5eb3ce
+#define GTK_HEADER_BAR_ACCESSIBLE_GET_CLASS(obj)        (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_HEADER_BAR_ACCESSIBLE, GtkHeaderBarAccessibleClass))
5eb3ce
+
5eb3ce
+typedef struct _GtkHeaderBarAccessible        GtkHeaderBarAccessible;
5eb3ce
+typedef struct _GtkHeaderBarAccessibleClass   GtkHeaderBarAccessibleClass;
5eb3ce
+typedef struct _GtkHeaderBarAccessiblePrivate GtkHeaderBarAccessiblePrivate;
5eb3ce
+
5eb3ce
+struct _GtkHeaderBarAccessible
5eb3ce
+{
5eb3ce
+  GtkContainerAccessible parent;
5eb3ce
+};
5eb3ce
+
5eb3ce
+struct _GtkHeaderBarAccessibleClass
5eb3ce
+{
5eb3ce
+  GtkContainerAccessibleClass parent_class;
5eb3ce
+};
5eb3ce
+
5eb3ce
+GDK_AVAILABLE_IN_ALL
5eb3ce
+GType gtk_header_bar_accessible_get_type (void);
5eb3ce
+
5eb3ce
+G_END_DECLS
5eb3ce
+
5eb3ce
+#endif /* __GTK_HEADER_BAR_ACCESSIBLE_H__ */
5eb3ce
diff --git a/gtk/gtkcontainerprivate.h b/gtk/gtkcontainerprivate.h
5eb3ce
index 7402a6676b..547e0295c3 100644
5eb3ce
--- a/gtk/gtkcontainerprivate.h
5eb3ce
+++ b/gtk/gtkcontainerprivate.h
5eb3ce
@@ -42,6 +42,7 @@ void      _gtk_container_maybe_start_idle_sizer (GtkContainer *container);
5eb3ce
 gboolean  _gtk_container_get_border_width_set   (GtkContainer *container);
5eb3ce
 void      _gtk_container_set_border_width_set   (GtkContainer *container,
5eb3ce
                                                  gboolean      border_width_set);
5eb3ce
+GList *   gtk_container_get_all_children        (GtkContainer  *container);
5eb3ce
 void      gtk_container_get_children_clip       (GtkContainer  *container,
5eb3ce
                                                  GtkAllocation *out_clip);
5eb3ce
 void      gtk_container_set_default_resize_mode (GtkContainer *container,
5eb3ce
diff --git a/gtk/gtkheaderbar.c b/gtk/gtkheaderbar.c
5eb3ce
index dd7d2093c9..0ef94e3c84 100644
5eb3ce
--- a/gtk/gtkheaderbar.c
5eb3ce
+++ b/gtk/gtkheaderbar.c
5eb3ce
@@ -30,7 +30,7 @@
5eb3ce
 #include "gtkwindowprivate.h"
5eb3ce
 #include "gtkwidgetprivate.h"
5eb3ce
 #include "gtkcontainerprivate.h"
5eb3ce
-#include "a11y/gtkcontaineraccessible.h"
5eb3ce
+#include "a11y/gtkheaderbaraccessible.h"
5eb3ce
 
5eb3ce
 #include <string.h>
5eb3ce
 
5eb3ce
@@ -2118,6 +2118,7 @@ gtk_header_bar_class_init (GtkHeaderBarClass *class)
5eb3ce
 
5eb3ce
   g_object_class_install_properties (object_class, LAST_PROP, header_bar_props);
5eb3ce
 
5eb3ce
+  gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_HEADER_BAR_ACCESSIBLE);
5eb3ce
   gtk_widget_class_set_accessible_role (widget_class, ATK_ROLE_PANEL);
5eb3ce
   gtk_widget_class_set_css_name (widget_class, "headerbar");
5eb3ce
 }
5eb3ce
-- 
5eb3ce
2.21.0
5eb3ce