summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYaakov Selkowitz <yselkowi@redhat.com>2022-01-05 22:21:19 -0500
committerYaakov Selkowitz <yselkowi@redhat.com>2022-01-05 22:21:21 -0500
commit56d7c2f8bd7b46a83c6fc4731011fc2b39b50b02 (patch)
treecfcfc1b2936340860e8ebc4d1bd6a19fc87c6679
parent5a33a8d0c95dedf32d054b7c5bbd847169779655 (diff)
downloadindicator-keylock-main.tar.gz
indicator-keylock-main.tar.xz
indicator-keylock-main.zip
Use GtkApplication, force X11 backendHEADmain
-rw-r--r--indicator-keylock-3.1.0-gtkapplication.patch88
-rw-r--r--indicator-keylock-3.1.0-x11.patch11
-rw-r--r--indicator-keylock.spec9
3 files changed, 106 insertions, 2 deletions
diff --git a/indicator-keylock-3.1.0-gtkapplication.patch b/indicator-keylock-3.1.0-gtkapplication.patch
new file mode 100644
index 0000000..c950daa
--- /dev/null
+++ b/indicator-keylock-3.1.0-gtkapplication.patch
@@ -0,0 +1,88 @@
+https://bazaar.launchpad.net/~tsbarnes/indicator-keylock/trunk/revision/113
+
+=== modified file 'configure.ac'
+--- a/configure.ac 2015-09-22 00:05:09 +0000
++++ b/configure.ac 2018-05-20 02:54:56 +0000
+@@ -24,12 +24,11 @@
+ PKG_CHECK_MODULES(glib, [glib-2.0 >= 2.24.0])
+ PKG_CHECK_MODULES(gtk, [gtk+-3.0 >= 3.2.0])
+ PKG_CHECK_MODULES(appindicator, [appindicator3-0.1 >= 0.4.1])
+-PKG_CHECK_MODULES(unique, [unique-3.0 >= 3.0.0])
+ PKG_CHECK_MODULES(libnotify, [libnotify >= 0.7.4])
+ PKG_CHECK_MODULES(x11, [x11 >= 1.0])
+
+-PACKAGE_CFLAGS="$glib_CFLAGS $gtk_CFLAGS $appindicator_CFLAGS $unique_CFLAGS $libnotify_CFLAGS $x11_CFLAGS"
+-PACKAGE_LIBS="$glib_LIBS $gtk_LIBS $appindicator_LIBS $unique_LIBS $libnotify_LIBS $x11_LIBS"
++PACKAGE_CFLAGS="$glib_CFLAGS $gtk_CFLAGS $appindicator_CFLAGS $libnotify_CFLAGS $x11_CFLAGS"
++PACKAGE_LIBS="$glib_LIBS $gtk_LIBS $appindicator_LIBS $libnotify_LIBS $x11_LIBS"
+ AC_SUBST(PACKAGE_CFLAGS)
+ AC_SUBST(PACKAGE_LIBS)
+
+
+=== modified file 'src/globals.h'
+--- a/src/globals.h 2011-11-09 20:31:37 +0000
++++ b/src/globals.h 2018-05-20 02:54:56 +0000
+@@ -6,13 +6,12 @@
+ #include <glib/gi18n.h>
+ #include <gio/gio.h>
+ #include <gtk/gtk.h>
+-#include <unique/unique.h>
+ #include <libappindicator/app-indicator.h>
+ #include <libnotify/notify.h>
+
+ extern GRand * self_random;
+
+-extern UniqueApp * self_unique_app;
++extern GtkApplication * self_gtk_app;
+
+ extern gboolean self_has_notify;
+ extern NotifyNotification * self_notification;
+
+=== modified file 'src/main.c'
+--- a/src/main.c 2012-04-04 15:20:54 +0000
++++ b/src/main.c 2018-05-20 02:54:56 +0000
+@@ -6,7 +6,7 @@
+
+ GRand * self_random = NULL;
+
+-UniqueApp * self_unique_app = NULL;
++GtkApplication * self_gtk_app = NULL;
+ gboolean self_has_notify = FALSE;
+ NotifyNotification * self_notification = NULL;
+
+@@ -173,18 +173,15 @@
+ gtk_main_quit();
+ }
+
+-UniqueResponse on_self_unique_app_message_received(UniqueApp *app, gint command, UniqueMessageData *message_data, guint time_, gpointer user_data) {
+- if(command == INDICATOR_KEYLOCK_OPEN_PREFS) {
+- show_pref_dialog();
+- }
+- return(UNIQUE_RESPONSE_OK);
++void on_self_gtk_app_activate_received(GtkApplication *app) {
++ show_pref_dialog();
+ }
+
+ int main(int argc, char *argv[]) {
+ gtk_init_with_args(&argc, &argv, _("Indicator/Status Icon for keyboard lock keys"), NULL, NULL, NULL);
+ self_random = g_rand_new();
+- self_unique_app = unique_app_new_with_commands("org.desktop.indicator-keylock", NULL, "open-prefs", INDICATOR_KEYLOCK_OPEN_PREFS, NULL);
+- g_signal_connect(self_unique_app, "message-received", G_CALLBACK(on_self_unique_app_message_received), NULL);
++ self_gtk_app = gtk_application_new("org.desktop.indicator-keylock", 0);
++ g_signal_connect(self_gtk_app, "activate", G_CALLBACK(on_self_gtk_app_activate_received), NULL);
+
+ if (!init_xkb_extension(G_CALLBACK(on_xkb_event))) {
+ GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Could not initialize X Keyboard Extension."));
+@@ -204,11 +201,6 @@
+
+ init_pref_dialog();
+
+- if (unique_app_is_running(self_unique_app) == TRUE) {
+- UniqueResponse response = unique_app_send_message(self_unique_app, INDICATOR_KEYLOCK_OPEN_PREFS, NULL);
+- return(response);
+- }
+-
+ self_menu_caps = gtk_image_menu_item_new_with_label(_("Caps Lock"));
+ self_menu_caps_image = gtk_image_new_from_icon_name("caps-lock-off", GTK_ICON_SIZE_MENU);
+ gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(self_menu_caps), self_menu_caps_image);
+
diff --git a/indicator-keylock-3.1.0-x11.patch b/indicator-keylock-3.1.0-x11.patch
new file mode 100644
index 0000000..381f4fb
--- /dev/null
+++ b/indicator-keylock-3.1.0-x11.patch
@@ -0,0 +1,11 @@
+diff -up indicator-keylock-3.1.0/src/main.c.orig indicator-keylock-3.1.0/src/main.c
+--- indicator-keylock-3.1.0/src/main.c.orig 2022-01-05 19:22:23.381405852 -0500
++++ indicator-keylock-3.1.0/src/main.c 2022-01-05 19:23:54.855658436 -0500
+@@ -181,6 +181,7 @@ UniqueResponse on_self_unique_app_messag
+ }
+
+ int main(int argc, char *argv[]) {
++ gdk_set_allowed_backends("x11");
+ gtk_init_with_args(&argc, &argv, _("Indicator/Status Icon for keyboard lock keys"), NULL, NULL, NULL);
+ self_random = g_rand_new();
+ self_gtk_app = gtk_application_new("org.desktop.indicator-keylock", 0);
diff --git a/indicator-keylock.spec b/indicator-keylock.spec
index 1f1bbf4..25482f4 100644
--- a/indicator-keylock.spec
+++ b/indicator-keylock.spec
@@ -1,6 +1,6 @@
Name: indicator-keylock
Version: 3.1.0
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Lock Keys indicator applet
License: GPLv3
@@ -9,6 +9,8 @@ Source0: http://archive.ubuntu.com/ubuntu/pool/universe/i/%{name}/%{name}
Patch0: indicator-keylock-3.1.0-icons.patch
Patch1: indicator-keylock-3.1.0-ldflags.patch
Patch2: indicator-keylock-3.1.0-gcc10.patch
+Patch3: indicator-keylock-3.1.0-gtkapplication.patch
+Patch4: indicator-keylock-3.1.0-x11.patch
BuildRequires: desktop-file-utils
BuildRequires: gcc
@@ -18,7 +20,6 @@ BuildRequires: make
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(gtk+-3.0)
BuildRequires: pkgconfig(appindicator3-0.1)
-BuildRequires: pkgconfig(unique-3.0)
BuildRequires: pkgconfig(libnotify)
BuildRequires: pkgconfig(x11)
@@ -53,6 +54,10 @@ desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop
%changelog
+* Thu Jan 06 2022 Yaakov Selkowitz <yselkowi@redhat.com> - 3.1.0-3
+- Use GtkApplication instead of libunique
+- Force X11 backend to avoid crash in Wayland sessions
+
* Tue Nov 30 2021 Yaakov Selkowitz <yselkowi@redhat.com> - 3.1.0-2
- rebuilt