Submitted by evolver on Sun, 06/22/2008 - 22:11. General Questions
I have an old Motif application that is about 10 years old. Upon start, it performs data manipulations before it pops the first window and goes into XEvent processing loop, which effectively make application interactive. In 10 years, the data set grew substantially. It was taking 10-15 seconds to go through the initial "data preparation" process but now it may take up to 5 minutes. It gets very annoying if you have to wait for 5 minutes with no interactive feedback. I want to add a progress indicator of some sort that would be able to report some milestones of the initial "data preparation"; thus, making user experience more entertaining.
The problem I'm facing is that I cannot manipulate Motif GUI until XEvent processing loop kicks in. I cannot create a window, force it do draw itself with all the widgets, and then to update it periodically from my data processing logic.
So, I have two fundamental problems:
1. I don't know if it possible to update and visualize widgets outside of XEvent processing loop. I tried to play with XmUpdateDisplay() but it only shows the window with decorations, including title, but none of the child widgets. Is there a way to force it to redraw the child widgets?
2. Is it possible to spin off a new thread that would handle events specific to this window alone? I would just run XtAppMainLoop() in this thread. I tried that but threads of my test application get stuck in XtRealizeWidget() call. Does anybody have an example of how to write a Motif application where more than thread processes events for individual windows?