Re: [Java-gnome-developer] CustomEvnets
Brought to you by:
afcowie
From: Andrew C. <an...@op...> - 2005-06-22 03:40:33
|
On Tue, 2005-21-06 at 15:17 -0400, Sami Wagiaalla wrote: > CustomEvents that i add are not getting handled until I move the mouse > over my widgets. I used to think that Thread.yield() did the trick, and it did in one working example I had. But then I used the exact same code in a piece of production code, and it *didn't* work - mouse movement (ie, a Gtk event) required. Grr. I recalled a comment someone made on IRC, and in a flash of inspiration, speculated that if a GtkTimer was running, maybe it awakening would cause an event which would get the main loop to fire. This seems to work. Code snippet: Timer _ticker = null int INTERVAL = 50; ... _ticker = new Timer(INTERVAL, new Fireable() { private long last; public boolean fire() { long now = System.currentTimeMillis(); System.err.println("Timer fired. Elapsed " + (now - last) + ", compared to interval "+INTERVAL); last = now; return true; } }); _ticker.start(); I know others have discussed the fundamental bug lurking down in the way that CustomEvents is hooked into the main loop, but I don't off hand know what that diagnosis is. AfC Sydney -- We treat all communications to be in confidence and to the personal attention of the intended recipient. Messages are conveyed with the expectation that commercial best effort measures will be taken by both parties to maintain confidentiality and to prevent disclosure to unauthorized persons. Unless stated otherwise and digitally signed, this email is not to be construed as a contract. Attention is drawn to our standard terms and conditions, http://www.operationaldynamics.com/about/faq/terms/ which serve as a guideline to help shape expectations. Actual terms will be presented in a formal proposal and are as individually agreed between us and each client. Corporate details, our privacy policy, and related information can be obtained on by contacting us electronically or in writing at GPO Box 4339, Sydney, NSW, 2001, Australia. ABN 94 103 213 136 If this message was received in error or you are not the intended recipient please notify us immediately, destroy this original, and delete it from any electronic or archive systems it may have been stored on. |