Bug 201587

Summary: Causes ~1 wakeup per second when idle
Product: [Applications] klipper Reporter: Jonathan Thomas <echidnaman>
Component: generalAssignee: Esben Mose Hansen <kde>
Status: RESOLVED FIXED    
Severity: normal CC: dimsuz
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Disable timer when it is not necessary

Description Jonathan Thomas 2009-07-26 22:12:11 UTC
Version:            (using KDE 4.2.98)
OS:                Linux
Installed from:    Ubuntu Packages

Originally reported by a user at https://launchpad.net/bugs/301338

Klipper compiled against XFixes still causes 0.8 - 1.0 wakeups per second, even though it is not supposed to do any polling.

ldd /usr/bin/klipper shows that it is indeed linked against libXFixes.
Comment 1 Jakub Stachowski 2009-09-03 21:29:08 UTC
Created attachment 36670 [details]
Disable timer when it is not necessary

Cause of the problem being fixed: klipper sets up a timer to check if there were too many clipboard changes in last second (overflow timer). It is enabled all the time, no matter if someone actually uses the clipboard or not.

Fix: enable timer only after a clipboard change (if it is not yet enabled). 
When the timer fires, do all checks as usual and disable it. Timer handler 
resets overflow count to 0 so it is not possible that an overflow will be 
missed because of this patch.
Comment 2 Esben Mose Hansen 2009-09-04 08:21:47 UTC
Patch looks good to me. Will test it today, and apply.
Comment 3 Esben Mose Hansen 2009-09-04 11:05:46 UTC
SVN commit 1019658 by esben:

Disable overflow timer when it is not needed, elimating a wakeup per second in klipper.
Patch by Jakub Stachowski
BUG: 201587


 M  +4 -1      klipper.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1019658
Comment 4 Esben Mose Hansen 2009-09-04 11:06:37 UTC
Sincere thanks to the reporter and patch submitted :)