aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart Ribbers <bribbers@disroot.org>2020-06-22 16:03:43 +0200
committerRasmus Thomsen <oss@cogitri.dev>2020-06-23 07:16:20 +0000
commitaf54364e76aaaa41648918cc9ca0918c48fc9882 (patch)
tree90c7d903b1750c69c63866bd463f7fefc8d2ef58
parent1bb47e3a21445c5f2faa983e5a2f9ac0d4861ca9 (diff)
downloadaports-af54364e76aaaa41648918cc9ca0918c48fc9882.tar.gz
aports-af54364e76aaaa41648918cc9ca0918c48fc9882.tar.bz2
aports-af54364e76aaaa41648918cc9ca0918c48fc9882.tar.xz
community/phosh: backport patch to fix a phantom launcher
-rw-r--r--community/phosh/0001-app-list-model-phantom-launcher.patch155
-rw-r--r--community/phosh/APKBUILD6
2 files changed, 159 insertions, 2 deletions
diff --git a/community/phosh/0001-app-list-model-phantom-launcher.patch b/community/phosh/0001-app-list-model-phantom-launcher.patch
new file mode 100644
index 0000000000..b2aa205d26
--- /dev/null
+++ b/community/phosh/0001-app-list-model-phantom-launcher.patch
@@ -0,0 +1,155 @@
+Taken from upstream, fixes an issue where an application launcher would
+in some cases disappear making it impossible to launch that application
+via the GUI.
+
+From 1b642cd8ba63fd10ad40030e1e9c16e04c090e6e Mon Sep 17 00:00:00 2001
+From: Zander Brown <zbrown@gnome.org>
+Date: Fri, 19 Jun 2020 19:49:14 +0100
+Subject: [PATCH] app-list-model: phantom launcher
+
+At last a fix for the missing item problem
+
+tl;dr: we skipped the first entry
+
+The reason it was weirdly deterministic is that we _always_ skipped
+the first item and as long as the entries didn't change the item would
+_always_ be the same
+
+Why was the item seemingly random? Because the list doesn't have any
+sorting at the point we lost an item
+
+So why didn't this effect more people? A system has many, many entries -
+a lot of which aren't actually app launchers. For example my laptop
+currently has 301 entries of which 172 should actually be shown. By pure
+fluke we got lucky most of the time and skipped an unintersting one.
+
+The fix is painfully simple: iterate the GList properly
+---
+ src/app-list-model.c | 18 +++++++++--------
+ tools/dump-app-list.c | 47 +++++++++++++++++++++++++++++++++++++++++++
+ tools/meson.build | 3 +++
+ 3 files changed, 60 insertions(+), 8 deletions(-)
+ create mode 100644 tools/dump-app-list.c
+
+diff --git a/src/app-list-model.c b/src/app-list-model.c
+index 648ee00..5281985 100644
+--- a/src/app-list-model.c
++++ b/src/app-list-model.c
+@@ -1,12 +1,14 @@
+ /*
+- * Copyright © 2019 Zander Brown <zbrown@gnome.org>
++ * Copyright © 2019-2020 Zander Brown <zbrown@gnome.org>
+ *
+ * Inspired by gliststore.c:
+ * Copyright 2015 Lars Uebernickel
+ * Copyright 2015 Ryan Lortie
+ * https://gitlab.gnome.org/GNOME/glib/blob/713fec9dcb1ee49c4f64bbb6f483a5cd1db9966a/gio/gliststore.c
+ *
+- * SPDX-License-Identifier: GPL-3.0+
++ * SPDX-License-Identifier: GPL-3-or-later
++ *
++ * Author: Zander Brown <zbrown@gnome.org>
+ */
+
+ #include "app-list-model.h"
+@@ -116,27 +118,27 @@ items_changed (gpointer data)
+ {
+ PhoshAppListModel *self = PHOSH_APP_LIST_MODEL (data);
+ PhoshAppListModelPrivate *priv = phosh_app_list_model_get_instance_private (self);
+- GList *new_apps;
++ g_autolist(GAppInfo) new_apps = NULL;
+ int removed;
+ int added = 0;
+
+ new_apps = g_app_info_get_all ();
+
++ g_return_val_if_fail (new_apps != NULL, G_SOURCE_REMOVE);
++
+ removed = g_sequence_get_length (priv->items);
+
+ g_sequence_remove_range (g_sequence_get_begin_iter (priv->items),
+ g_sequence_get_end_iter (priv->items));
+
+- while ((new_apps = g_list_next (new_apps))) {
+- if (!g_app_info_should_show (G_APP_INFO (new_apps->data))) {
++ for (GList *l = new_apps; l; l = g_list_next (l)) {
++ if (!g_app_info_should_show (G_APP_INFO (l->data))) {
+ continue;
+ }
+- g_sequence_append (priv->items, g_object_ref (new_apps->data));
++ g_sequence_append (priv->items, g_object_ref (l->data));
+ added++;
+ }
+
+- g_list_free_full (new_apps, g_object_unref);
+-
+ priv->last.is_valid = FALSE;
+ priv->last.iter = NULL;
+ priv->last.position = 0;
+diff --git a/tools/dump-app-list.c b/tools/dump-app-list.c
+new file mode 100644
+index 0000000..2f7919d
+--- /dev/null
++++ b/tools/dump-app-list.c
+@@ -0,0 +1,47 @@
++/*
++ * Copyright © 2020 Zander Brown <zbrown@gnome.org>
++ *
++ * SPDX-License-Identifier: GPL-3-or-later
++ *
++ * Author: Zander Brown <zbrown@gnome.org>
++ *
++ * Print the contents of PhoshAppListModel
++ */
++
++#include <app-list-model.h>
++
++int
++main (int argc, char **argv)
++{
++ PhoshAppListModel *list = phosh_app_list_model_get_default ();
++ int i = 0;
++ GAppInfo *info;
++ GMainLoop *loop;
++
++ g_print ("Populating...\n");
++
++ /* Let the main loop run a bit for the timeouts/idle callbacks to run */
++ loop = g_main_loop_new (NULL, FALSE);
++ g_timeout_add_seconds (2, G_SOURCE_FUNC (g_main_loop_quit), loop);
++ g_main_loop_run (loop);
++
++ while ((info = g_list_model_get_item (G_LIST_MODEL (list), i))) {
++ if (G_IS_DESKTOP_APP_INFO (info)) {
++ g_print ("%s\n - %s\n",
++ g_app_info_get_id (info),
++ g_desktop_app_info_get_filename (G_DESKTOP_APP_INFO (info)));
++ } else {
++ /* Unlikely but handle it just in case */
++ g_print ("%s\n - %s\n",
++ g_app_info_get_id (info),
++ G_OBJECT_TYPE_NAME (info));
++ }
++
++ i++;
++ g_clear_object (&info);
++ }
++
++ g_print ("=== %i items\n", i);
++
++ return 0;
++}
+diff --git a/tools/meson.build b/tools/meson.build
+index 65a6a6d..d3fdd13 100644
+--- a/tools/meson.build
++++ b/tools/meson.build
+@@ -34,3 +34,6 @@ executable('notify-blocks', ['notify-blocks.c'],
+
+ executable('notify-server-standalone', ['notify-server-standalone.c'] + stubs,
+ dependencies: phosh_dep)
++
++executable('dump-app-list', ['dump-app-list.c'],
++ dependencies: phosh_dep)
+--
+2.27.0
+
diff --git a/community/phosh/APKBUILD b/community/phosh/APKBUILD
index eff41e0318..85a437d335 100644
--- a/community/phosh/APKBUILD
+++ b/community/phosh/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=phosh
pkgver=0.3.0
-pkgrel=0
+pkgrel=1
pkgdesc="Shell PoC for the Librem5"
# Blocked on mips and s390x by gnome-session, gnome-settings-daemon, squeekboard and libhandy
# Blocked on ppc64le by gnome-session
@@ -18,6 +18,7 @@ subpackages="$pkgname-lang"
source="$pkgname-$pkgver.tar.xz::https://repo.pureos.net/pureos/pool/main/p/phosh/phosh_$pkgver.tar.xz
phosh.desktop
sm.puri.OSK0.desktop
+ 0001-app-list-model-phantom-launcher.patch
"
options="!check" # Needs a running Wayland compositor
@@ -55,4 +56,5 @@ package() {
}
sha512sums="13561a413ab56c678c0550e0fdb7d5cbf739c2b6bab5aec84037903e15a3352539d82fb2a9f5fd7b447378507530e5473e6f1add00c6e5c37f88c26f95caa602 phosh-0.3.0.tar.xz
6644870edbbbc6b88d6e19f7771d81dba1a11066c2b34e4c22736db73a2dfd0d4909b4967503059c35385c5139a834a5c06a3c56b148ba1275d7f089c0c5f33c phosh.desktop
-f97019598323276cf97ae62f04b6245983198e04b228ddc605835ee46845d9b88c6890fb86e97e4bb6f1ad73361437d9ed18c91e81fe1284a88cdcb92d3fdc69 sm.puri.OSK0.desktop"
+f97019598323276cf97ae62f04b6245983198e04b228ddc605835ee46845d9b88c6890fb86e97e4bb6f1ad73361437d9ed18c91e81fe1284a88cdcb92d3fdc69 sm.puri.OSK0.desktop
+028ae14f8991b66ee3d9384f3b69a57c7e6a32379d2101bc4c0798de7d247f96af20b7993b4854e717fa5e711ef6ca780b38a4bca06f2d5f465bf677bc57fbd4 0001-app-list-model-phantom-launcher.patch"