#!/bin/sh
#
#    Copyright (C) 2008-2010  Rubén Rodríguez <ruben@trisquel.info>
#
#    This program is free software; you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation; either version 2 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program; if not, write to the Free Software
#    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
#

VERSION=3
COMPONENT=main

. ./config

# Fixes https://bugs.launchpad.net/indicator-applet/+bug/965953

cat << EOF | patch -p0
--- src/indicator-applet.c      2020-04-09 06:09:47.000000000 -0500
+++ src.mod/indicator-applet.c  2021-08-11 19:21:12.914141219 -0500
@@ -305,6 +305,24 @@
   return 0.0;
 }

+static void
+do_menu_reposition(gpointer menu)
+{
+  gtk_widget_set_size_request(menu, 0,0);
+  while (gtk_events_pending ())
+    gtk_main_iteration ();
+  gtk_menu_reposition(menu);
+  while (gtk_events_pending ())
+    gtk_main_iteration ();
+}
+
+static void
+on_menuitem_show (GtkMenuItem *menuitem, gpointer menu)
+{
+  gtk_widget_get_preferred_size (GTK_WIDGET (menu), NULL,NULL);
+  g_idle_add((GSourceFunc) do_menu_reposition, (gpointer) menu);
+}
+
 static GtkWidget*
 create_menuitem (IndicatorObject      *io,
                  IndicatorObjectEntry *entry,
EOF

# Show datetime in standard applet
#sed '/datetime/,/}/d' -i src/indicator-applet.c

changelog "Fixes LP:965953"

compile

