Re: Removing widgets in the main loop from another thread
- From: Robert Gründler <doobre gmail com>
- To: Chris Vine <chris cvine freeserve co uk>
- Cc: gtkmm-list gnome org
- Subject: Re: Removing widgets in the main loop from another thread
- Date: Thu, 26 Feb 2009 17:20:04 +0100
Because your arrangement doesn't on the face of it make sense, there
is probably more to it than at first appears. I therefore just make
three points which may or may not be relevant to your question:
1. You cannot (without great difficulty) have different Gtk::Window
objects created and/or destroyed in different threads. If it is
possible at all, you will need to use the GDK global thread lock, which
makes the use of Glib::Dispatcher redundant. You may also need to have
two main loop objects, one for each thread (from your description it is
impossible to say).
Well, i'll try to describe a little clearer what i'd like to accomplish:
I'm trying to write an user interface extension to an existing
application (pure data) . The application
itself is written in tcl/tk. It's native interface is very simple and
basically consists of objects on a canvas
which can be connected via wires to interact wich each other. I would
see it as an advantage to
be able to write UI widgets using a more modern framework like gtkmm for
the application.
My approach to this is the following:
1. The central object is a native tcl/tk object which can be placed on
the applications tcl/tk canvas. Upon it's creation,
it creates a singleton ProxyClass which holds the Gtk::Window and runs
it in a separate thread, so the 2 guis can run in paralell.
2. All widgets that can be placed into my Gtk::Window, will also be
created by a native tcl/tk object placed on the applications canvas.
When the object is created, it gets the singleton instance of the proxy
class to the Gtk:Window, creates the native Gtk::Widget and passes
it to the addWidget(Gtk::Widget *widget) method in the Gtk::Window using
the glib::dispatcher.
When the tcl/tk object - holding a pointer to the gtk::widget inside the
main window - is destroyed, it again calls the main window
using a glib dispatcher to remove the widget from the main window.
As i'm not that familiar with inter-thread communication, i'd be glad
for any feedback if the this approach seems usable, or
probably a terrible design choice over all...
I hope my description is understandable ;)
thanks for your help!
-robert
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]