* [PATCH 1/2] Revert "connman-gnome: StatusIcon adapts to size changes"
2016-10-04 11:23 [PATCH 0/2] Fix network applet rendering issues Jussi Kukkonen
@ 2016-10-04 11:27 ` Jussi Kukkonen
2016-10-04 11:27 ` [PATCH 2/2] matchbox-panel-2: Fix small systray icon drawing Jussi Kukkonen
1 sibling, 0 replies; 3+ messages in thread
From: Jussi Kukkonen @ 2016-10-04 11:27 UTC (permalink / raw)
To: openembedded-core
The aim of the original commit was to make connman-gnome load the icons
at the exact size of the systray. There are two problems with this:
* There are not enough icon sizes provided to make the scaling
look good at most sizes (including current panel size)
* Both connman-gnome and mb-panel have bugs in the icon size update
code and using scaling to exact size makes these much more visible
(See bug 9995 for example).
The problems the original commit tried to fix can be worked around
with better packing in matchbox-panel-2.
Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
---
.../connman/connman-gnome/0001-Port-to-Gtk3.patch | 136 +++------------------
1 file changed, 15 insertions(+), 121 deletions(-)
diff --git a/meta/recipes-connectivity/connman/connman-gnome/0001-Port-to-Gtk3.patch b/meta/recipes-connectivity/connman/connman-gnome/0001-Port-to-Gtk3.patch
index 279ca05..c93e9b4 100644
--- a/meta/recipes-connectivity/connman/connman-gnome/0001-Port-to-Gtk3.patch
+++ b/meta/recipes-connectivity/connman/connman-gnome/0001-Port-to-Gtk3.patch
@@ -1,11 +1,10 @@
-From 092fe0793b39c6feb6464bfbd568b050960d62c0 Mon Sep 17 00:00:00 2001
+From a59b0fac02e74a971ac3f08bf28c17ce361a9526 Mon Sep 17 00:00:00 2001
From: Jussi Kukkonen <jussi.kukkonen@intel.com>
Date: Wed, 2 Mar 2016 15:47:49 +0200
Subject: [PATCH] Port to Gtk3
Some unused (or not useful) code was removed, functionality should stay
-the same, although applet now loads icons based on actual size available
-to it.
+the same.
Code still contains quite a few uses of deprecated API.
@@ -13,13 +12,13 @@ Upstream-Status: Submitted
Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
---
applet/agent.c | 3 +--
- applet/main.c | 43 ------------------------------
- applet/status.c | 74 +++++++++++++++++++++++++++++++++------------------
+ applet/main.c | 43 -------------------------------------------
+ applet/status.c | 8 --------
configure.ac | 3 +--
- properties/ethernet.c | 14 +++++-----
+ properties/ethernet.c | 14 +++++++-------
properties/main.c | 2 +-
- properties/wifi.c | 12 ++++-----
- 7 files changed, 64 insertions(+), 87 deletions(-)
+ properties/wifi.c | 12 ++++++------
+ 7 files changed, 16 insertions(+), 69 deletions(-)
diff --git a/applet/agent.c b/applet/agent.c
index 65bed08..04fe86a 100644
@@ -43,7 +42,7 @@ index 65bed08..04fe86a 100644
label = gtk_label_new(_("Please provide some network information:"));
gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0);
diff --git a/applet/main.c b/applet/main.c
-index c7b3c7f..f2ce46b 100644
+index f12d371..cd16285 100644
--- a/applet/main.c
+++ b/applet/main.c
@@ -157,46 +157,6 @@ static void name_owner_changed(DBusGProxy *proxy, const char *name,
@@ -104,26 +103,10 @@ index c7b3c7f..f2ce46b 100644
"copyright", "Copyright \xc2\xa9 2008 Intel Corporation",
"comments", _("A connection manager for the GNOME desktop"),
diff --git a/applet/status.c b/applet/status.c
-index aed6f1e..6ecbf3a 100644
+index aed6f1e..015ff29 100644
--- a/applet/status.c
+++ b/applet/status.c
-@@ -30,13 +30,14 @@
- static gboolean available = FALSE;
-
- static GtkStatusIcon *statusicon = NULL;
-+static gint icon_size = 0;
-
- static GdkPixbuf *pixbuf_load(GtkIconTheme *icontheme, const gchar *name)
- {
- GdkPixbuf *pixbuf;
- GError *error = NULL;
-
-- pixbuf = gtk_icon_theme_load_icon(icontheme, name, 22, 0, &error);
-+ pixbuf = gtk_icon_theme_load_icon(icontheme, name, icon_size, 0, &error);
-
- if (pixbuf == NULL) {
- g_warning("Missing icon %s: %s", name, error->message);
-@@ -102,8 +103,6 @@ static void icon_animation_start(IconAnimation *animation,
+@@ -102,8 +102,6 @@ static void icon_animation_start(IconAnimation *animation,
{
available = TRUE;
@@ -132,7 +115,7 @@ index aed6f1e..6ecbf3a 100644
animation->start = start;
animation->end = (end == 0) ? animation->count - 1 : end;
-@@ -120,8 +119,6 @@ static void icon_animation_stop(IconAnimation *animation)
+@@ -120,8 +118,6 @@ static void icon_animation_stop(IconAnimation *animation)
{
available = TRUE;
@@ -141,96 +124,7 @@ index aed6f1e..6ecbf3a 100644
if (animation->id > 0)
g_source_remove(animation->id);
-@@ -190,6 +187,42 @@ static GdkPixbuf *pixbuf_none;
- static GdkPixbuf *pixbuf_wired;
- static GdkPixbuf *pixbuf_signal[5];
-
-+static void
-+load_icons (gint size)
-+{
-+ // educated guess to preload correct size
-+ if (size == 0)
-+ size = 34;
-+
-+ if (icon_size == size)
-+ return;
-+
-+ icon_size = size;
-+
-+ if(pixbuf_none)
-+ status_cleanup();
-+
-+ g_debug ("Loading icons at size %d", icon_size);
-+ animation = icon_animation_load(icontheme, "connman-connecting", 33);
-+ pixbuf_signal[0] = pixbuf_load(icontheme, "connman-signal-01");
-+ pixbuf_signal[1] = pixbuf_load(icontheme, "connman-signal-02");
-+ pixbuf_signal[2] = pixbuf_load(icontheme, "connman-signal-03");
-+ pixbuf_signal[3] = pixbuf_load(icontheme, "connman-signal-04");
-+ pixbuf_signal[4] = pixbuf_load(icontheme, "connman-signal-05");
-+
-+ pixbuf_none = pixbuf_load(icontheme, "connman-type-none");
-+ pixbuf_wired = pixbuf_load(icontheme, "connman-type-wired");
-+ pixbuf_notifier = pixbuf_load(icontheme, "connman-notifier-unavailable");
-+}
-+
-+static gboolean
-+size_changed_cb (GtkStatusIcon *statusicon,
-+ gint size,
-+ gpointer user_data)
-+{
-+ load_icons (size);
-+}
-+
- int status_init(StatusCallback activate, GtkWidget *popup)
- {
- GdkScreen *screen;
-@@ -204,17 +237,9 @@ int status_init(StatusCallback activate, GtkWidget *popup)
-
- gtk_icon_theme_append_search_path(icontheme, ICONDIR);
-
-- animation = icon_animation_load(icontheme, "connman-connecting", 33);
--
-- pixbuf_signal[0] = pixbuf_load(icontheme, "connman-signal-01");
-- pixbuf_signal[1] = pixbuf_load(icontheme, "connman-signal-02");
-- pixbuf_signal[2] = pixbuf_load(icontheme, "connman-signal-03");
-- pixbuf_signal[3] = pixbuf_load(icontheme, "connman-signal-04");
-- pixbuf_signal[4] = pixbuf_load(icontheme, "connman-signal-05");
--
-- pixbuf_none = pixbuf_load(icontheme, "connman-type-none");
-- pixbuf_wired = pixbuf_load(icontheme, "connman-type-wired");
-- pixbuf_notifier = pixbuf_load(icontheme, "connman-notifier-unavailable");
-+ g_signal_connect (statusicon, "size-changed",
-+ G_CALLBACK(size_changed_cb), NULL);
-+ load_icons (gtk_status_icon_get_size (statusicon));
-
- if (activate != NULL)
- g_signal_connect(statusicon, "activate",
-@@ -231,17 +256,18 @@ void status_cleanup(void)
- int i;
-
- icon_animation_free(animation);
-+ animation = NULL;
-
- for (i = 0; i < 5; i++)
-- g_object_unref(pixbuf_signal[i]);
-+ g_clear_object(&pixbuf_signal[i]);
-
-- g_object_unref(pixbuf_none);
-- g_object_unref(pixbuf_wired);
-- g_object_unref(pixbuf_notifier);
-+ g_clear_object(&pixbuf_none);
-+ g_clear_object(&pixbuf_wired);
-+ g_clear_object(&pixbuf_notifier);
-
-- g_object_unref(icontheme);
-+ g_clear_object(&icontheme);
-
-- g_object_unref(statusicon);
-+ g_clear_object(&statusicon);
- }
-
- void status_unavailable(void)
-@@ -251,8 +277,6 @@ void status_unavailable(void)
+@@ -251,8 +247,6 @@ void status_unavailable(void)
available = FALSE;
gtk_status_icon_set_from_pixbuf(statusicon, pixbuf_notifier);
@@ -239,7 +133,7 @@ index aed6f1e..6ecbf3a 100644
gtk_status_icon_set_visible(statusicon, TRUE);
}
-@@ -299,7 +323,6 @@ static void set_ready(gint signal)
+@@ -299,7 +293,6 @@ static void set_ready(gint signal)
if (signal < 0) {
gtk_status_icon_set_from_pixbuf(statusicon, pixbuf_wired);
@@ -247,7 +141,7 @@ index aed6f1e..6ecbf3a 100644
return;
}
-@@ -311,7 +334,6 @@ static void set_ready(gint signal)
+@@ -311,7 +304,6 @@ static void set_ready(gint signal)
index = 4;
gtk_status_icon_set_from_pixbuf(statusicon, pixbuf_signal[index]);
@@ -379,5 +273,5 @@ index bd325ef..a5827e0 100644
}
break;
--
-2.1.4
+2.8.1
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* [PATCH 2/2] matchbox-panel-2: Fix small systray icon drawing
2016-10-04 11:23 [PATCH 0/2] Fix network applet rendering issues Jussi Kukkonen
2016-10-04 11:27 ` [PATCH 1/2] Revert "connman-gnome: StatusIcon adapts to size changes" Jussi Kukkonen
@ 2016-10-04 11:27 ` Jussi Kukkonen
1 sibling, 0 replies; 3+ messages in thread
From: Jussi Kukkonen @ 2016-10-04 11:27 UTC (permalink / raw)
To: openembedded-core
Add patch to pack systray icons so that their drawing area is the
size they expect (otherwise GtkStatusIcon based systray items can
end up drawing "tiled", looking like 1.5 icons instead of a single
icon).
Fixes [YOCTO #9995]
Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
---
...applets-systray-Allow-icons-to-be-smaller.patch | 34 ++++++++++++++++++++++
.../matchbox-panel-2/matchbox-panel-2_2.11.bb | 4 ++-
2 files changed, 37 insertions(+), 1 deletion(-)
create mode 100644 meta/recipes-sato/matchbox-panel-2/files/0001-applets-systray-Allow-icons-to-be-smaller.patch
diff --git a/meta/recipes-sato/matchbox-panel-2/files/0001-applets-systray-Allow-icons-to-be-smaller.patch b/meta/recipes-sato/matchbox-panel-2/files/0001-applets-systray-Allow-icons-to-be-smaller.patch
new file mode 100644
index 0000000..d13dd3d
--- /dev/null
+++ b/meta/recipes-sato/matchbox-panel-2/files/0001-applets-systray-Allow-icons-to-be-smaller.patch
@@ -0,0 +1,34 @@
+From f83a9179696b2d060ee4860733dafbf38bbd4b87 Mon Sep 17 00:00:00 2001
+From: Jussi Kukkonen <jussi.kukkonen@intel.com>
+Date: Wed, 28 Sep 2016 15:05:41 +0300
+Subject: [PATCH] applets/systray: Allow icons to be smaller
+
+Don't expand/fill the systray items, align them in the center of the
+systray panel. This makes sure the icons are drawn at the size they
+expect.
+
+Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
+Upstream-Status: Submitted
+---
+ applets/systray/systray.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/applets/systray/systray.c b/applets/systray/systray.c
+index 39698a8..94a5753 100644
+--- a/applets/systray/systray.c
++++ b/applets/systray/systray.c
+@@ -29,8 +29,9 @@ on_realize (GtkWidget *widget, gpointer user_data)
+ tray = (GtkWidget *)na_tray_new_for_screen (screen, orientation);
+
+ gtk_widget_show (tray);
+-
+- gtk_container_add (GTK_CONTAINER (widget), tray);
++ gtk_widget_set_valign (tray, GTK_ALIGN_CENTER);
++ gtk_widget_set_halign (tray, GTK_ALIGN_CENTER);
++ gtk_box_pack_start (GTK_BOX (widget), tray, FALSE, FALSE, 0);
+ }
+
+ G_MODULE_EXPORT GtkWidget *
+--
+2.1.4
+
diff --git a/meta/recipes-sato/matchbox-panel-2/matchbox-panel-2_2.11.bb b/meta/recipes-sato/matchbox-panel-2/matchbox-panel-2_2.11.bb
index a387073..d38e7f6 100644
--- a/meta/recipes-sato/matchbox-panel-2/matchbox-panel-2_2.11.bb
+++ b/meta/recipes-sato/matchbox-panel-2/matchbox-panel-2_2.11.bb
@@ -21,7 +21,9 @@ RPROVIDES_${PN} = "matchbox-panel"
RREPLACES_${PN} = "matchbox-panel"
RCONFLICTS_${PN} = "matchbox-panel"
-SRC_URI = "git://git.yoctoproject.org/${BPN}"
+SRC_URI = "git://git.yoctoproject.org/${BPN} \
+ file://0001-applets-systray-Allow-icons-to-be-smaller.patch \
+ "
EXTRA_OECONF = "--enable-startup-notification --enable-dbus"
EXTRA_OECONF += " ${@bb.utils.contains("MACHINE_FEATURES", "acpi", "--with-battery=acpi", "",d)}"
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread