aboutsummaryrefslogtreecommitdiff
path: root/x11/xfce4-taskmanager
diff options
context:
space:
mode:
authorGuido Falsi <madpilot@FreeBSD.org>2018-09-17 13:43:38 +0000
committerGuido Falsi <madpilot@FreeBSD.org>2018-09-17 13:43:38 +0000
commitbf6b8f60ff4b2cb03f4f47ad1a774678f5395fc5 (patch)
tree7e574f9eb8fc8014a6a36d7a12309c99ecc0df6c /x11/xfce4-taskmanager
parent5eb11c3ade0d172106192221c7e5937aa60b3125 (diff)
downloadports-bf6b8f60ff4b2cb03f4f47ad1a774678f5395fc5.tar.gz
ports-bf6b8f60ff4b2cb03f4f47ad1a774678f5395fc5.zip
Import two upstream patches, fixing UTF-8 normalization and resolving
a crash. PR: 231395 Submitted by: rozhuk.im@gmail.com
Notes
Notes: svn path=/head/; revision=479932
Diffstat (limited to 'x11/xfce4-taskmanager')
-rw-r--r--x11/xfce4-taskmanager/Makefile1
-rw-r--r--x11/xfce4-taskmanager/files/patch-af078d474
-rw-r--r--x11/xfce4-taskmanager/files/patch-b89684884
3 files changed, 159 insertions, 0 deletions
diff --git a/x11/xfce4-taskmanager/Makefile b/x11/xfce4-taskmanager/Makefile
index e108e7c0364e..4d2fff228837 100644
--- a/x11/xfce4-taskmanager/Makefile
+++ b/x11/xfce4-taskmanager/Makefile
@@ -3,6 +3,7 @@
PORTNAME= xfce4-taskmanager
PORTVERSION= 1.2.1
+PORTREVISION= 1
CATEGORIES= x11 xfce
MASTER_SITES= XFCE/src/apps/${PORTNAME}/${PORTVERSION:R}
DIST_SUBDIR= xfce4
diff --git a/x11/xfce4-taskmanager/files/patch-af078d4 b/x11/xfce4-taskmanager/files/patch-af078d4
new file mode 100644
index 000000000000..3fd2e3ebb348
--- /dev/null
+++ b/x11/xfce4-taskmanager/files/patch-af078d4
@@ -0,0 +1,74 @@
+From af078d406a43243388e0a61d647c3a6b7ada60ed Mon Sep 17 00:00:00 2001
+From: rim <rozhuk.im@gmail.com>
+Date: Thu, 21 Jun 2018 12:10:15 +0300
+Subject: Improve app search on close (bug 14466)
+
+---
+ src/app-manager.c | 25 ++++++++++++++++++++++++-
+ 1 file changed, 24 insertions(+), 1 deletion(-)
+
+diff --git a/src/app-manager.c b/src/app-manager.c
+index 5092e00..b2bdb0c 100644
+--- src/app-manager.c
++++ src/app-manager.c
+@@ -44,6 +44,7 @@ static gint app_pid_compare_fn (gconstpointer a, gconstpointer b);
+ static void apps_add_application (GArray *apps, WnckApplication *application, GPid pid);
+ static void apps_remove_application (GArray *apps, WnckApplication *application);
+ static App * apps_lookup_pid (GArray *apps, GPid pid);
++static App * apps_lookup_app (GArray *apps, WnckApplication *application);
+ static void application_opened (WnckScreen *screen, WnckApplication *application, XtmAppManager *manager);
+ static void application_closed (WnckScreen *screen, WnckApplication *application, XtmAppManager *manager);
+
+@@ -97,12 +98,17 @@ static GPid
+ app_get_pid(WnckApplication *application)
+ {
+ GPid pid;
++ GList *windows;
++
+ if (NULL == application)
+ return (0);
+ pid = wnck_application_get_pid (application);
+ if (pid != 0)
+ return (pid);
+- return (wnck_window_get_pid (WNCK_WINDOW (wnck_application_get_windows (application)->data)));
++ windows = wnck_application_get_windows (application);
++ if (NULL != windows && NULL != windows->data)
++ return (wnck_window_get_pid (WNCK_WINDOW (windows->data)));
++ return (0);
+ }
+
+ static gint
+@@ -134,6 +140,8 @@ apps_remove_application (GArray *apps, WnckApplication *application)
+ {
+ App *app = apps_lookup_pid(apps, app_get_pid (application));
+
++ if (app == NULL)
++ app = apps_lookup_app(apps, application);
+ if (app == NULL)
+ return;
+ g_object_unref (app->icon);
+@@ -150,6 +158,21 @@ apps_lookup_pid (GArray *apps, GPid pid)
+ return (bsearch(&tapp, apps->data, apps->len, sizeof(App), app_pid_compare_fn));
+ }
+
++static App *
++apps_lookup_app (GArray *apps, WnckApplication *application)
++{
++ App *tapp;
++ guint i;
++
++ for (i = 0; i < apps->len; i++) {
++ tapp = &g_array_index (apps, App, i);
++ if (tapp->application == application)
++ return (tapp);
++ }
++
++ return (NULL);
++}
++
+ static void
+ application_opened (WnckScreen *screen __unused, WnckApplication *application, XtmAppManager *manager)
+ {
+--
+cgit v1.2.1
+
diff --git a/x11/xfce4-taskmanager/files/patch-b896848 b/x11/xfce4-taskmanager/files/patch-b896848
new file mode 100644
index 000000000000..91b37302a75a
--- /dev/null
+++ b/x11/xfce4-taskmanager/files/patch-b896848
@@ -0,0 +1,84 @@
+From b89684865d88bbb8399f70387cae9e8ae17d64d9 Mon Sep 17 00:00:00 2001
+From: rim <rozhuk.im@gmail.com>
+Date: Sun, 29 Jul 2018 09:22:48 +0300
+Subject: Better utf-8 normalization (bug 14172)
+
+---
+ src/task-manager.c | 47 ++++++++++++++++++++++++++++++++++++++++-------
+ 1 file changed, 40 insertions(+), 7 deletions(-)
+
+diff --git a/src/task-manager.c b/src/task-manager.c
+index 93f9122..8188de6 100644
+--- src/task-manager.c
++++ src/task-manager.c
+@@ -22,6 +22,7 @@
+ #include <glib-object.h>
+ #include <glib/gi18n.h>
+ #include <gtk/gtk.h>
++#include <gmodule.h>
+
+ #include "task-manager.h"
+ #ifdef HAVE_WNCK
+@@ -125,12 +126,44 @@ setting_changed (GObject *object, GParamSpec *pspec __unused, XtmTaskManager *ma
+ static gchar *
+ pretty_cmdline (gchar *cmdline, gchar *comm)
+ {
+- /* Use the printable range of 0x20-0x7E */
+- const gchar *valid_chars = " !\"#$%&'()*+,-./0123456789:;<=>?@"
+- "ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`"
+- "abcdefghijklmnopqrstuvwxyz{|}~";
+- gchar *text = g_strstrip (g_strcanon (g_strdup (cmdline), valid_chars, ' '));
+- gsize text_size = (gsize)strlen (text);
++ gunichar c;
++ gchar *ch, *text_max, *text = g_strstrip (g_strdup (cmdline));
++ gsize csize, text_size = (gsize)strlen (text);
++
++ /* UTF-8 normalize. */
++ do {
++ for (ch = text, text_max = (text + text_size);
++ text_max > ch;
++ text_max = (text + text_size), ch = g_utf8_next_char(ch)) {
++ c = g_utf8_get_char_validated(ch, -1); /* If use (text_max - ch) - result is worse. */
++ if ((gunichar)-2 == c) {
++ text_size = (gsize)(ch - text);
++ (*ch) = 0;
++ break;
++ }
++ if ((gunichar)-1 == c) {
++ (*ch) = ' ';
++ continue;
++ }
++ csize = (gsize)g_unichar_to_utf8(c, NULL);
++
++ if (!g_unichar_isdefined(c) ||
++ !g_unichar_isprint(c) ||
++ (g_unichar_isspace(c) && (1 != csize || (' ' != (*ch) && ' ' != (*ch)))) ||
++ g_unichar_ismark(c) ||
++ g_unichar_istitle(c) ||
++ g_unichar_iswide(c) ||
++ g_unichar_iszerowidth(c) ||
++ g_unichar_iscntrl(c)) {
++ if (text_max < (ch + csize))
++ break;
++ memmove(ch, (ch + csize), (gsize)(text_max - (ch + csize)));
++ text_size -= csize;
++ }
++ }
++ text[text_size] = 0;
++ } while (!g_utf8_validate(text, (gssize)text_size, NULL));
++
+ if (!full_cmdline && text_size > 3)
+ {
+ /* Shorten full path to commands and wine applications */
+@@ -139,7 +172,7 @@ pretty_cmdline (gchar *cmdline, gchar *comm)
+ gchar *p = g_strstr_len (text, (gssize)text_size, comm);
+ if (p != NULL)
+ {
+- g_strlcpy (text, p, text_size);
++ memmove (text, p, text_size);
+ }
+ }
+ }
+--
+cgit v1.2.1
+