notify-osd wakes up for every key/focus event after showing the first bubble

Bug #915389 reported by Martin Pitt on 2012-01-12
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
The Ubuntu Power Consumption Project
Medium
Martin Pitt
libwnck
Fix Released
Medium
libwnck3 (Ubuntu)
Medium
Martin Pitt
notify-osd (Ubuntu)
Medium
Martin Pitt

Bug Description

notify-osd needlessly keeps waking up for each X event (mouse, keyboard, screen, etc.) as soon as the first ever bubble is shown.

It is not from any g_timeout_add, gdk/x11 integration, or otherwise; it might be from ATK integration?

Martin Pitt (pitti) on 2012-01-12
Changed in notify-osd (Ubuntu):
importance: Undecided → Medium
affects: notify-osd (Ubuntu) → notify-osd
Martin Pitt (pitti) on 2012-01-12
Changed in ubuntu-power-consumption:
status: New → Triaged
Martin Pitt (pitti) wrote :

For the record (I need to stop for today): This starts to happen when calling dnd_dont_disturb_user(). When I replace the function body with "return FALSE", notify-osd works fine and the wakeups do not happen.

Changed in notify-osd:
assignee: nobody → Martin Pitt (pitti)
Changed in ubuntu-power-consumption:
assignee: nobody → Martin Pitt (pitti)
Martin Pitt (pitti) wrote :

gboolean
dnd_has_one_fullscreen_window (void)
{
        WnckScreen *screen = wnck_screen_get_default ();

^ This last line triggers the bug.

Martin Pitt (pitti) wrote :

This reproduces the bug:

  strace python -c 'from gi.repository import GLib, Gdk, Wnck; s = Wnck.Screen.get_default(); GLib.MainLoop().run()'

After that, any keypress in any window, and any window focus change event causes a wakeup. This might be inherent to what wnck does, but it needs a way to say "I am not interested in events any more". You can't unref() the screen object.

I'll check if that's intended and there is a cleanup function, or whether that's a real bug in wnck.

Martin Pitt (pitti) wrote :

I confirmed that this is ab API shortcoming of libwnck. When you use it, it lazily initializes an X event filter, but there is no API to clean it up again. I'll discuss that with upstream.

Changed in notify-osd:
status: New → Confirmed
Changed in libwnck:
importance: Unknown → Medium
status: Unknown → Confirmed
Martin Pitt (pitti) wrote :

I sent a possible patch to libwnck upstream, now waiting for comments.

I guess this means that bamf suffers from the same issue. It'll be quite a lot harder to fix for bamf, I suspect, though.

Martin Pitt (pitti) wrote :

I sent a patch for a wnck_shutdown() method to the upstream bug, waiting for review.

Changed in ubuntu-power-consumption:
importance: Undecided → Medium
Changed in libwnck (Ubuntu):
assignee: nobody → Martin Pitt (pitti)
importance: Undecided → Medium
status: New → In Progress
Martin Pitt (pitti) wrote :

@Mikkel: I figure bamf might actually want to track focus changes all the time, though? notify-osd doesn't, it just uses it as an one-time call to find out whether there is any fullscreen window.

Martin Pitt (pitti) wrote :

Note to self: I see little reason why wnck should wake up for all key events.

summary: - notify-osd wakes up for every key/mouse event after showing the first
+ notify-osd wakes up for every key/focus event after showing the first
bubble
Martin Pitt (pitti) wrote :

For the record, wnck does not explicitly subscribe to key events, but to PropertyChangeMask for both the root window and all app windows. This is necessary for getting notified about window geometry changes, but unfortunately also produces wakeups for keyboard events. I don't see what we can do about this unfortunately.

Martin Pitt (pitti) on 2012-01-24
affects: libwnck (Ubuntu) → libwnck3 (Ubuntu)
Martin Pitt (pitti) on 2012-01-24
Changed in notify-osd (Ubuntu):
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → Martin Pitt (pitti)
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package libwnck3 - 3.2.1-1ubuntu1

---------------
libwnck3 (3.2.1-1ubuntu1) precise; urgency=low

  * Add 03_add_wnck_shutdown.patch: Add wnck_shutdown() method that stops
    listening to events and tear down all resources from libwnck. This should
    be done if you are not going to need the state change notifications for an
    extended period of time, to avoid wakeups with every key and focus event.
    (LP: #915389)
  * debian/libwnck-3-0.symbols: Add new symbol.
 -- Martin Pitt <email address hidden> Tue, 24 Jan 2012 08:39:22 +0100

Changed in libwnck3 (Ubuntu):
status: In Progress → Fix Released
Martin Pitt (pitti) wrote :

I updated notify-osd to use the new wnck_shutdown() function if available, upstream notify-osd merge proposal sent.

I'll now cherry-pick this into Ubuntu.

Launchpad Janitor (janitor) wrote :

This bug was fixed in the package notify-osd - 0.9.32-0ubuntu5

---------------
notify-osd (0.9.32-0ubuntu5) precise; urgency=low

  * Fix unnecessary wakeups on every keyboard/focus event:
    - configure.in: Check if wnck_shutdown() is available.
    - src/dnd.c: Call wnck_shutdown() (if available) when we are done with
      fullscreen window checking.
    - https://code.launchpad.net/~pitti/notify-osd/wnck_shutdown/+merge/89836
    - LP: #915389
 -- Martin Pitt <email address hidden> Tue, 24 Jan 2012 09:23:55 +0100

Changed in notify-osd (Ubuntu):
status: In Progress → Fix Released
Martin Pitt (pitti) on 2012-01-24
Changed in ubuntu-power-consumption:
status: Triaged → Fix Released
Martin Pitt (pitti) on 2012-01-24
Changed in notify-osd:
assignee: Martin Pitt (pitti) → nobody
Changed in libwnck:
status: Confirmed → Fix Released
Changed in notify-osd:
status: Confirmed → Fix Released
no longer affects: notify-osd
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.