RE: trying to launch a dialog from outside the main gui thread by emiting a signal to the thread.



I ended up modifying my class such that the information for the dialog gets
added to a vector and I added a timer which looks at the vector and if there
is something new to be displayed it pops it off and launches the appropriate
dialog, thus keeping everything happening within the GUI thread (or at least
that is what I am assuming is happening now that the code works).

Kevin

-----Original Message-----
From: Chris Vine [mailto:chris cvine freeserve co uk] 
Sent: Tuesday, March 06, 2007 6:16 PM
To: gtk-app-devel-list gnome org
Cc: Kevin Lambert
Subject: Re: trying to launch a dialog from outside the main gui thread by
emiting a signal to the thread.


On Tuesday 06 March 2007 17:45, Kevin Lambert wrote:
I am currently working on a multithreaded application which has a 
primary GUI that is always running and I need to be able to get that 
GUI to show a popup to put images in.  The problem I am having is how 
do I tell the GUI to show the popup from outside of its own code?

As a test I connected the "keys-changed" signal for the GUI's window 
so that if that signal gets emitted it launches my dialog.  I then 
added an external function which emits that signal which, when called, 
crashes the application with:

Xlib: unexpected async reply (sequence 0x995)!
Xlib: sequence lost (0x108c7 > 0xfd) in reply type 0x8!
Xlib: sequence lost (0x10000 > 0xfd) in reply type 0x0!

I do know that only the primary GUI thread is allowed to handle X 
calls which is why I had the signal handler launching my dialog.  I 
have tried googling for information but Im not finding much.

The callback is executed in the thread which emits the signal.  For your use

(to cross thread boundaries), see g_idle_add().

Chris





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