I also had the same problem on my ubuntu 11.04, although I noticed, on my other machine, which is running ubuntu 10.10, screenkey worked without problems (don't know why). I used revision 50 from bzr trunk.
I looked into the codes, and fixed, by adding or removing gtk.gdk.threads_{enter,leave}.
As already pointed out, there should not be gtk.gdk.threads_{enter,leave} in on_preference_dialog() and on_about_dialog() because gtk (not glib) signal handlers are called *inside* a critical section. I removed them.
I added gtk.gdk.threads_{enter,leave} pairs in functions which are executed in key listener thread or timer thread. threads_init() is not needed since it is already called in a executable 'screenkey'.
I think this will also fix other bugs: bug #830958 Doesn't work anymore in Ubuntu 11.10 -- lack of thread synchronization in key listener. bug #603755 screenkey crashes -- the same bug. bug #620047 Screenkey Not Responsive -- not so sure but I think this is also caused by a lack of syncs in key listener. bug #728677 Freezes after writing the first time. -- lack of syncs in timer thread.
I tested this patch on both ubuntu 11.04 / 10.10 and this worked correctly.
Hi,
I also had the same problem on my ubuntu 11.04, although I noticed, on my other machine, which is running ubuntu 10.10, screenkey worked without problems (don't know why). I used revision 50 from bzr trunk.
I looked into the codes, and fixed, by adding or removing gtk.gdk. threads_ {enter, leave}.
As already pointed out, there should not be gtk.gdk. threads_ {enter, leave} in on_preference_ dialog( ) and on_about_dialog() because gtk (not glib) signal handlers are called *inside* a critical section. I removed them.
I added gtk.gdk. threads_ {enter, leave} pairs in functions which are executed in key listener thread or timer thread. threads_init() is not needed since it is already called in a executable 'screenkey'.
I think this will also fix other bugs:
bug #830958 Doesn't work anymore in Ubuntu 11.10 -- lack of thread synchronization in key listener.
bug #603755 screenkey crashes -- the same bug.
bug #620047 Screenkey Not Responsive -- not so sure but I think this is also caused by a lack of syncs in key listener.
bug #728677 Freezes after writing the first time. -- lack of syncs in timer thread.
I tested this patch on both ubuntu 11.04 / 10.10 and this worked correctly.