SHA256
1
0
forked from pool/gtk3

Accepting request 666905 from GNOME:Next

Add upstream patch, I was waiting for upstream to do a brown paper bag release, but it seems it won't happen...


- Add gtk3-Add-fallbacks-GtkSwitch-labels.patch: Add fallbacks for
  GtkSwitch state labels.

OBS-URL: https://build.opensuse.org/request/show/666905
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gtk3?expand=0&rev=341
This commit is contained in:
2019-01-18 09:17:26 +00:00
committed by Git OBS Bridge
parent 889b6a0693
commit 9c734a4c1a
3 changed files with 81 additions and 0 deletions

View File

@@ -0,0 +1,72 @@
From ed39721aa7435860f46da69998cf6cac4ae7e735 Mon Sep 17 00:00:00 2001
From: Emmanuele Bassi <ebassi@gnome.org>
Date: Tue, 15 Jan 2019 15:22:09 +0000
Subject: [PATCH] Add fallbacks for GtkSwitch state labels
While the IEC power symbols have been part of Unicode since version 9.0,
released in 2016, not every font supports them.
We can use the old symbols as a fallback, as they seem to have the
better coverage, if not the best appearance.
---
gtk/gtkswitch.c | 41 +++++++++++++++++++++++++++++++++++++++--
1 file changed, 39 insertions(+), 2 deletions(-)
diff --git a/gtk/gtkswitch.c b/gtk/gtkswitch.c
index bf63f34fd2..1d42f572a9 100644
--- a/gtk/gtkswitch.c
+++ b/gtk/gtkswitch.c
@@ -298,11 +298,48 @@ gtk_switch_create_pango_layouts (GtkSwitch *self)
{
GtkSwitchPrivate *priv = self->priv;
+ /* Glyphs for the ON state, in descending order of preference */
+ const char *on_glyphs[] = {
+ "", /* U+23FD POWER ON SYMBOL */
+ "❙", /* U+2759 MEDIUM VERTICAL BAR */
+ };
+
+ /* Glyphs for the OFF state, in descending order of preference */
+ const char *off_glyphs[] = {
+ "⭘", /* U+2B58 HEAVY CIRCLE */
+ "○", /* U+25CB WHITE CIRCLE */
+ };
+ int i;
+
g_clear_object (&priv->on_layout);
- priv->on_layout = gtk_widget_create_pango_layout (GTK_WIDGET (self), "");
+
+ for (i = 0; i < G_N_ELEMENTS (on_glyphs); i++)
+ {
+ PangoLayout *layout = gtk_widget_create_pango_layout (GTK_WIDGET (self), on_glyphs[i]);
+
+ if (pango_layout_get_unknown_glyphs_count (layout) == 0)
+ {
+ priv->on_layout = layout;
+ break;
+ }
+
+ g_object_unref (layout);
+ }
g_clear_object (&priv->off_layout);
- priv->off_layout = gtk_widget_create_pango_layout (GTK_WIDGET (self), "⭘");
+
+ for (i = 0; i < G_N_ELEMENTS (off_glyphs); i++)
+ {
+ PangoLayout *layout = gtk_widget_create_pango_layout (GTK_WIDGET (self), off_glyphs[i]);
+
+ if (pango_layout_get_unknown_glyphs_count (layout) == 0)
+ {
+ priv->off_layout = layout;
+ break;
+ }
+
+ g_object_unref (layout);
+ }
}
static void
--
2.18.1

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Fri Jan 18 06:18:01 UTC 2019 - bjorn.lie@gmail.com
- Add gtk3-Add-fallbacks-GtkSwitch-labels.patch: Add fallbacks for
GtkSwitch state labels.
-------------------------------------------------------------------
Mon Jan 14 21:32:19 UTC 2019 - mgorse@suse.com

View File

@@ -40,6 +40,8 @@ Patch0: gtk3-GTK_PATH64.patch
Patch1: gtk3-revert-forced-xftdpi.patch
# PATCH-FIX-UPSTREAM gtk3-boo1121456-a11y-export.patch boo#1121456 mgorse@suse.com -- export gtk_cell_accessible_parent_get_(row|column)_header_cells functions.
Patch2: gtk3-boo1121456-a11y-export.patch
# PATCH-FIX-UPSTREAM gtk3-Add-fallbacks-GtkSwitch-labels.patch -- Add fallbacks for GtkSwitch state labels
Patch3: gtk3-Add-fallbacks-GtkSwitch-labels.patch
BuildRequires: cups-devel >= 1.2
BuildRequires: docbook-xsl-stylesheets
@@ -371,6 +373,7 @@ cp -a %{SOURCE1} .
%endif
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
%configure \