Re: libegg (egg-dock) and gtksocket/gtkplug



Hello,

(Please CC me since I'm not subscribed to this list)

First of all a disclaimer: I know nothing about plugs and sockets or the
XEmbed protocol, and what I'm about to write I deduced it by looking at
the GtkSocket/GtkPlug code.

On Mon, 2003-05-05 at 01:40, Biswapesh Chattopadhyay wrote:
Hi

The docking stuff was written by Gustavo, so I'm CC-ing him.

This is just a guess, but:

1) Have you tried ref()ing the widgets that are getting destroyed
explicitly ?
2) Are you using the latest code from libegg, which has seen some memory
management and other fixes in the past week or two ?

Rgds,
Biswa.

Hi,

I'm using the docking widget framework from libegg and most (if not all)
of the docked widgets need to be embedded from other processes.
Everything works fine with the libegg stuff when using both non-embedded
and embedded widgets until I actually interact with the docked items and
move them around.  Then the gtkplug attached to the embedded widgets
gets destroyed.  This happens both when the embedded widget is pulled
out and floated as well as when it's moved around the docking area.

From what I understand, there's some kind of re-parenting going on when
the gtksocket widget gets moved around, but that's the extent of my
understanding here !

That's correct.  But more than a reparenting (which AFAICS should be
handled by the socket/plug code) what's happening is that the dock item
is being removed and then added back to the dock.  The difference with
reparenting is that the later is more an "atomic" operation.

Again, from looking at the code, I think the only way for the plug not
to be destroyed is to handle the plug's "delete-event" signal and return
TRUE (gtkplug.c, lines 1093-1135 and the send_delete_event function).

I think you'll need to call gtk_socket_add_id() again when the dock item
containing the socket is realized again (after being re-docked) since
AFAICS the embedding procedure is not restarted automatically.  You can
easily do this by connecting to the socket's realize signal.

I'd be grateful if anyone who's used any of the docking libegg stuff
with embedded widgets could help me out or advise me of a better way of
doing this kind of thing (other docking frameworks which work better
with embedded widgets, maybe from bonobo ?)

Somebody else who knows better should be able to give you the right
answer, but in the mean time you can try my suggestions (and report back
if you were successful ;-)

Good luck,
Gustavo




Thanks,

Mac.


Some test code from plug process:

 plug = gtk_plug_new(0);
 ...
 (widgets added to plug)
 ...
 g_print("Plug ID = %d\n", gtk_plug_get_id(GTK_PLUG(plug)));

 (printed on command-line for now)


Test code from socket process:

 ...
 table = gtk_vbox_new(FALSE, 5);
 gtk_container_add(GTK_CONTAINER(win), table);
 gtk_container_set_border_width(GTK_CONTAINER(table), 10);

 dock = egg_dock_new();
 gtk_box_pack_start(GTK_BOX(table), dock, TRUE, TRUE, 0);

 ...
 (items added to dock)
 ...

 display_socket_item = egg_dock_item_new("display_socket_item",
  "Display Socket Item", EGG_DOCK_ITEM_BEH_NORMAL);
 display_socket = gtk_socket_new();
 gtk_container_add(GTK_CONTAINER(display_socket_item),
  display_socket);
 g_signal_connect(display_socket, "plug_added",
  G_CALLBACK(plug_added), display_socket);
 g_signal_connect(display_socket, "plug_removed",
  G_CALLBACK(plug_removed), display_socket);

 egg_dock_add_item(EGG_DOCK(dock),
EGG_DOCK_ITEM(display_socket_item),
EGG_DOCK_BOTTOM);
 gtk_widget_show_all(display_socket_item);
 ...

I put the XID from the plug on the command line and in the "realize"
callback for the main window, I do:

 gtk_socket_add_id(GTK_SOCKET(display_socket), xid);

I check the plug_window member of the gtksocket struct in the callbacks
(plug_added, plug_removed) so I know when the plug gets destroyed.


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








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