From bf6b8f60ff4b2cb03f4f47ad1a774678f5395fc5 Mon Sep 17 00:00:00 2001 From: Guido Falsi Date: Mon, 17 Sep 2018 13:43:38 +0000 Subject: Import two upstream patches, fixing UTF-8 normalization and resolving a crash. PR: 231395 Submitted by: rozhuk.im@gmail.com --- x11/xfce4-taskmanager/Makefile | 1 + x11/xfce4-taskmanager/files/patch-af078d4 | 74 +++++++++++++++++++++++++++ x11/xfce4-taskmanager/files/patch-b896848 | 84 +++++++++++++++++++++++++++++++ 3 files changed, 159 insertions(+) create mode 100644 x11/xfce4-taskmanager/files/patch-af078d4 create mode 100644 x11/xfce4-taskmanager/files/patch-b896848 (limited to 'x11/xfce4-taskmanager') 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 +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 +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 + #include + #include ++#include + + #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 + -- cgit v1.2.3