summaryrefslogtreecommitdiffstats
path: root/mgaapplet
diff options
context:
space:
mode:
Diffstat (limited to 'mgaapplet')
-rwxr-xr-xmgaapplet15
1 files changed, 15 insertions, 0 deletions
diff --git a/mgaapplet b/mgaapplet
index a0ac9048..2f996598 100755
--- a/mgaapplet
+++ b/mgaapplet
@@ -185,6 +185,11 @@ if ($ENV{DESKTOP_SESSION} =~ /plasma$/i) {
$icon->set_title('mgaapplet');
$icon->set_status('STATUS_NOTIFIER_STATUS_ACTIVE');
$icon->register;
+ # We keep this only as a fallback if the DBusMenu service does not work.
+ # This way, we are sure that right-clicks will always work. (mga#20540)
+ $icon->signal_connect(context_menu => sub {
+ $menu->popup(undef, undef, undef, undef, 0, Gtk3::get_current_event_time()) if $menu;
+ });
}
else {
$icon = Gtk3::StatusIcon->new;
@@ -227,6 +232,16 @@ shouldStart() or die "$localfile should be set to TRUE: please use --force or -f
go2State('delayed');
+# NOTE: Must be called after go2State() above to make sure that
+# the menu has already been created, else set_context_menu() will complain.
+# When mgaapplet is launched automatically when opening a new session, there
+# seems to be some latency with DBus and/or DBusMenu, and when this method
+# is called too early, it seems to be blocked. So we add a timer here to call
+# it again to make sure that right-click events will be correctly handled by
+# DBusMenu. If the registration fails again, then the 'context_menu' signal
+# will be emitted and caught above (mga#20540).
+Glib::Timeout->add(100, sub { $icon->set_context_menu($menu); 0 }) if $is_plasma;
+
Glib::Timeout->add_seconds($config{FIRST_CHECK_DELAY}/1000, sub {
POSIX::sigprocmask(SIG_UNBLOCK, POSIX::SigSet->new(SIGCHLD));
$SIG{CHLD} = \&harvester;