On Thu, Apr 10, 2008 at 09:12:21AM +0100, John M Collins wrote:
> I have spent most of a day looking at the various documents about
> emitting signals and articles here without finding the answers to the
> questions - sorry if they seem stupid as I'm a comparative newcomer to
> GTK.
> 
> I am converting an application to use GTK+ which receives messages from
> a daemon process using signals - i.e. OS signals not the signals in GTK.
> 
> The signals are sent by the daemon process to tell the receiving clients
> "you might want to refresh your display". It is for the receiving
> clients to worry about whether they do need to refresh their displays
> (the actual data is in shared memory).
> 
> My first question is: Is it safe to emit a signal (i.e. the GTK idea of
> a signal) within the OS-signal handling routine?

No. You should get rid of the OS-signal handling mechanism. Use a
file descriptor, a socket (UDP) or something, register a callback to
this and update in the ordinary mannor. Signals is a nucience. You
should keep syctronication on file descriptor.

The daemon process then send a UDP (Multicast) message to the clients.

If you want I can give you an example.

> If not, it looks as if the only standard way is to have the OS
> signal-catching routine just turn on "had_a_signal" and use
> g_timeout_add to call a function which looks at "had_a_signal". Or is
> there a better way?
> 
> If it is OK to emit a signal please could someone confirm my
> understanding of "events" in GTK. (I'd appreciate it if someone could
> confirm my understanding in any case).
> 
> Am I right in thinking that if I want to emit a client event (which
> seems to be an appropriate thing to emit) I can either put:
> 
>         g_signal_emit_by_name(G_OBJECT(window), "client_event");
> 
> Or I set up a GdkEvent and put
> 
>         g_signal_emit_by_name(G_OBJECT(window), "event", &event,
>         &retval);
> 
> Unfortunately the documentation such as there is talks about using
> gtk_signal_emit_by_name but the documentation of that says it's
> deprecated and I should use g_signal_emit_by_name.
> 
> Or is there is some altogether better way of doing all this that I
> haven't thought of? Please note rewriting the daemon process is not
> currently an option.

You should! It is a small difference.

And WERY worthwhile.
 
> 
> John Collins <[EMAIL PROTECTED]> Skype: toadwarbler
> Xi Software Ltd www.xisl.com 
> 
> Tel: +44 (0)1707 886110 (Direct)
>      +44 (0)7799 113162 (Mobile)
> 
> Registered in England & Wales Company Number 1977148 VAT: GB 403 9239 64
> 
> Trading Address: 3 Mandeville Rise, Welwyn Garden City, Herts, AL8 7JT, UK
> Reg Office: 2 Mill Road, Haverhill, Suffolk, CB9 8BD, UK
> 
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

-- 
Göran Hasse

----------------------------------------------------------------
Göran Hasse           email: [EMAIL PROTECTED]  Tel: 08-6949270
Raditex AB             http://www.raditex.se    
Planiavägen 15, 1tr                             Mob: 070-5530148
131 34  NACKA, SWEDEN                         OrgNr: 556240-0589
VAT: SE556240058901
------------------------------------------------------------------

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to