After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 691976 - PointerWatcher: keep a reference to the idle monitor
PointerWatcher: keep a reference to the idle monitor
Status: RESOLVED FIXED
Product: gnome-shell
Classification: Core
Component: message-tray
unspecified
Other All
: Normal normal
: ---
Assigned To: gnome-shell-maint
gnome-shell-maint
Depends on:
Blocks:
 
 
Reported: 2013-01-17 21:22 UTC by Giovanni Campagna
Modified: 2013-01-18 20:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
PointerWatcher: keep a reference to the idle monitor (1.85 KB, patch)
2013-01-17 21:22 UTC, Giovanni Campagna
committed Details | Review

Description Giovanni Campagna 2013-01-17 21:22:39 UTC
As the description says, has the important side effect of fixing
"stuck" notifications (due to idle monitor not firing)
Comment 1 Giovanni Campagna 2013-01-17 21:22:42 UTC
Created attachment 233696 [details] [review]
PointerWatcher: keep a reference to the idle monitor

If nothing references the idle monitor, it can be finalized at GC,
causing it to have no effect. Worse, if the finalization happens at
wrong time, the pointer watcher can be permanently off, disabling the
message tray.
Also, the pointer watcher has the useful side effect of creating
a PositiveTransition XSync alarm for 1 second of idleness, which is
necessary for the idle monitor in message tray to work correctly
(XSync NegativeTransition events are only emitted after a positive
transition for some other alarm)
Comment 2 Jasper St. Pierre (not reading bugmail) 2013-01-17 21:27:51 UTC
(In reply to comment #1)
> Also, the pointer watcher has the useful side effect of creating
> a PositiveTransition XSync alarm for 1 second of idleness, which is
> necessary for the idle monitor in message tray to work correctly
> (XSync NegativeTransition events are only emitted after a positive
> transition for some other alarm)

Wait, so you're saying that having two idle monitors could potentially gobble each other's events up?
Comment 3 Giovanni Campagna 2013-01-17 21:34:52 UTC
(In reply to comment #2)
> 
> Wait, so you're saying that having two idle monitors could potentially gobble
> each other's events up?

No, I'm saying that you need to fire a PositiveTransition before NegativeTransition XSync alarms are even considered.
MessageTray's IdleMonitor doesn't install watches, so it relies on someone else to create a PositiveTransition alarm that fires "often enough" to unblock its NegativeTransition. Normally, that one is the PointerWatcher's IdleMonitor, but if that's finalized GnomeIdleMonitor::became-active won't fire until some other alarm is triggered (usually, gnome-settings-daemon's idle-dim timeout)
Comment 4 Giovanni Campagna 2013-01-17 21:35:59 UTC
To clarify, two idle monitors can't gobble each other, but they can make each other fire more events than they would alone.
Comment 5 Jasper St. Pierre (not reading bugmail) 2013-01-18 04:35:37 UTC
If anybody else is curious, this is the same bug as #688227.
Comment 6 Jasper St. Pierre (not reading bugmail) 2013-01-18 05:10:48 UTC
Review of attachment 233696 [details] [review]:

With the commit message modified, this could work.
Comment 7 Giovanni Campagna 2013-01-18 20:14:50 UTC
Attachment 233696 [details] pushed as 56d7679 - PointerWatcher: keep a reference to the idle monitor