Re: [g-a-devel] GUI Restrictions on an Accessibility App?



В Втр, 20/01/2009 в 15:16 -0800, Quiring, Sam пишет:
> Thank you for the response.
> 
> = Well, it's hard to quess. Since your app is small you could probably create a small sample to reproduce the problem,
> = it will be easier to track your mistake then. The thing I personally wonder of is - where is SPI_init?
> 
> Do you want to take a look?
> 
> ======================
> 
> SPI_Init() is called pretty early in the process.  Here's an outline:
> 
> main()
> {
>     ...
>     g_thread_init(0);
>     gdk_threads_init();
> 
>     initGUI();   -- This spawns the GUI thread.
> 
>     pthread_barrier_wait( &startingGateBarrier );
>     pthread_barrier_wait( &nextStepBarrier );
> 
>     SPI_init();
> 
>     ...    -- do some SPI exploration here (print list of apps)
> 
>     TimerThreadInit();  - creates a thread with an event loop
> 
>     createListeners();
>     registerListeners();
>     SPI_event_main();
>     SPI_deregisterGlobalEventListenerAll(genericListener);
>     ...
> }
> 
> The GUI thread looks like this:
> 
> guiProcessor()
> {
>     pthread_barrier_wait( &startingGateBarrier );
>     gtk_init();
>     gdk_threads_enter();
>     ... setup the GUI window
>     gtk_widget_show(window);
>     pthread_barrier_wait( &nextStepBarrier );
>     gtk_main();
> 
> It is interesting you would ask about SPI_init().  In main(),
>  if I have the two pthread_barrier_wait() calls before SPI_init(),
>  the GUI initializes and the buttons react to clicking.  If I move 
> those barrier_wait calls to after SPI_init, then the GUI initializes,
>  but the buttons will not react to clicking.
> 
> If I move the barrier_wait calls to after TimerThreadInit(), then 
> the GUI initializes and the buttons react to clicking.  Go figure.

I'd rewrite this altogether. GUI should be handled in main thread without any barriers.
The worker threads could signal the UI on idle or use something like queue to update 
the UI. This way you'll solve a lot of issues, not just an issue with SPI.

Try just the GUI without threads first, then add workers.

Attachment: signature.asc
Description: =?koi8-r?Q?=FC=D4=C1?= =?koi8-r?Q?_=DE=C1=D3=D4=D8?= =?koi8-r?Q?_=D3=CF=CF=C2=DD=C5=CE=C9=D1?= =?koi8-r?Q?_=D0=CF=C4=D0=C9=D3=C1=CE=C1?= =?koi8-r?Q?_=C3=C9=C6=D2=CF=D7=CF=CA?= =?koi8-r?Q?_=D0=CF=C4=D0=C9=D3=D8=C0?=



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]