simonwiles / cinnamon_applets

custom applets for the Cinnamon shell
10 stars 7 forks source link

World Clock causes CPU spikes and UI freezes #2

Closed mathrick closed 11 years ago

mathrick commented 11 years ago

I'm seeing periodic (~1s) short freezes of everything on screen when World Clock applet is enabled. It's not hugely noticeable when say browsing, but annoying when watching video, and a deal breaker for games. The same does not happen when using the stock calendar applet.

Since the freezes happen every second, it's fairly obvious that the applet is doing something to tie up Cinnamon's UI in the refresh function.

simonwiles commented 11 years ago

thanks for the report. i've not been able to replicate this issue yet, and to my knowledge no one else has experienced this, so I could use a little more information about your set-up. how many timezones are you displaying? what is the OS and kernel version, and what version of Cinnamon are you using? cheers!

mathrick commented 11 years ago

I'm debugging it now, it's straight out caused by the spawn_sync() call in get_world_time(). Commenting it out removes the problem. I have 4 zones set up, and running on Mint 15, Cinnamon 1.8.8 with vanilla 3.10 (ie. not distro) from mainline kernel PPA.

simonwiles commented 11 years ago

thanks -- i'm looking at it now too. shelling out at that point was never entirely satisfactory, but it seemed to be working nicely. i wonder if it has anything to do with the 3.10 kernel (since i haven't encountered problems elsewhere)? can you confirm if you had problems with earlier kernel revisions? (i'm currently running 3.9-11 from the liquorix repo, and there has to be a good chance you're the only user of this applet using 3.10).

i'm looking into using GLib to do the timezone manipulation now, since i've been meaning to do that for ages anyway...

mathrick commented 11 years ago

I have a patch for that now, will make a pull request in a second, just need to push that out to a repo.

simonwiles commented 11 years ago

that's great, thanks so much -- I'll put a new version up on spices later today.

mathrick commented 11 years ago

Great. Unrelated, but I was also thinking about rewriting the settings UI in JS, to avoid relying on external python. Do you know if it's possible to spawn a new GUI window from inside Cinnamon sanely?

simonwiles commented 11 years ago

I was thinking about that too, given the new Cinnamon 1.8 applet settings API. However, the settings dialogue is sufficiently complicated that I don't think the settings API will cut it, and I don't see an enormous amount of value in redoing it in JS otherwise. Cinnamon already has a dependency on python, doesn't it?

To address your question more directly, using Util.spawnCommandLine() as I do to launch the python settings dialogue would work just fine, I think (I wouldn't call it insane, anyway ;)), but something along the lines of

const Gtk = imports.gi.Gtk;
let win = new Gtk.Window({ type: Gtk.WindowType.TOPLEVEL });
win.show();

ought to be okay too, right?

mathrick commented 11 years ago

Yeah, I asked around, and there's no way to spawn toplevel UI short of Utils.spawn*(). But I have other ideas for improving the common settings UI, which I took to #linuxmint-dev.