Failed to embed another xwindow into GtkSocket in GNOME, but succeed in FVWM/blackbox
- From: Cloudor Pu <cloudor 126 com>
- To: desktop-devel-list gnome org
- Subject: Failed to embed another xwindow into GtkSocket in GNOME, but succeed in FVWM/blackbox
- Date: Tue, 12 Dec 2006 13:24:35 +0800
Hi, all
In my attached example.c, gtk_socket_add_id() is used to embed another
existed xwindow into a GtkSocket. It works in fvwm or blackbox but
failed in GNOME.
Can anybody tell me why this could happen? It's funny. Shouldn't gnome
support gtk better than other wm?
Or maybe I have mis-configured my gnome desktop. Then what should I do
to make it work?
==================
To test my example:
1. gcc `pkg-config --cflags --libs gtk+-2.0` example.c -o example
2. use xwininfo to get a pre-existing window id
3. ./example <that window id>
regards,
cloudor
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <gtk/gtk.h>
#include <gdk/gdk.h>
int main (int argc, char *argv[])
{
int exWID=0;
GtkWidget *win = NULL;
GtkWidget *vbox = NULL;
GtkWidget *label = NULL;
GtkWidget *socket = NULL;
if (argc>1) {
exWID = strtol(argv[1], NULL, 0);
}else
{
printf("You should specify a wid in cmd line.\n");
}
gtk_init(&argc, &argv);
win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(G_OBJECT(win), "delete_event",
G_CALLBACK(gtk_main_quit), NULL);
g_signal_connect(G_OBJECT(win), "destroy",
G_CALLBACK(gtk_main_quit), NULL);
gtk_container_set_border_width(GTK_CONTAINER(win), 2);
gtk_window_set_title(GTK_WINDOW(win), "HELLO RE-PARENT");
gtk_window_set_default_size(GTK_WINDOW(win), 640, 480);
gtk_widget_set_size_request(GTK_WIDGET(win), 100, 100);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add(GTK_CONTAINER (win), vbox);
label = gtk_label_new ("Xlib window");
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
socket = gtk_socket_new();
gtk_box_pack_start (GTK_BOX (vbox), socket, TRUE, TRUE, 0);
gtk_widget_show (socket);
if(exWID >0)
{
gtk_socket_add_id(GTK_SOCKET(socket), exWID);
}else
{
printf("My socket id: %d\n", gtk_socket_get_id(GTK_SOCKET(socket)));
}
gtk_widget_show (socket);
gtk_widget_show_all(win);
gtk_main();
exit(0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]