Re: Getting native X Window from GtkWidget



A big thanks to both of you for the quick answer.
Unfortunately, I'm still out of luck. This is the code I use:

static PyObject *
kdetray_set_tray(PyObject *self, PyObject *args) {
       GtkWidget *gtkWidget;
fprintf(stderr, "Entering\n");

       if(!PyArg_ParseTuple(args, "i", &gtkWidget))
               return NULL;

       fprintf(stderr, "Handle: %p\n", gtkWidget);
/* Window w = GDK_WINDOW_XWINDOW( GTK_WIDGET(gtkWidget)->window ); */ Window w = GDK_WINDOW_XID( gtk_widget_get_parent_window(gtkWidget) );
       fprintf(stderr, "window: %p\n", w);
Display *d = GDK_WINDOW_XDISPLAY(gtkWidget);
       fprintf(stderr, "display: %p\n", d);
Atom statom = XInternAtom( d, "_KDE_NET_WM_SYSTEM_TRAY_WINDOW_FOR", False);
       XChangeProperty( d, w, statom, XA_WINDOW, 32,
                   PropModeReplace, NULL, 1);
Py_INCREF(Py_None);
       return Py_None;
}

As you can see, I tried both suggested routes. However, both of them lead to the same problem:

Entering
Handle: 0x34000c1

(process:11392): GLib-GObject-CRITICAL **: gtype.c:1871: initialization assertion failed, use g_type_init() prior to this function (process:11392): GLib-GObject-CRITICAL **: gtype.c:1871: initialization assertion failed, use g_type_init() prior to this function (process:11392): GLib-GObject-CRITICAL **: gtype.c:1871: initialization assertion failed, use g_type_init() prior to this function (process:11392): GLib-GObject-CRITICAL **: file gtype.c: line 1937 (g_type_add_interface_static): assertion `G_TYPE_IS_INSTANTIATABLE (instance_type)' failed
Segmentation fault

This error seems to indicate that the passed reference is not a reference to a GtkWidget. This is, however, what the wxPython documentation says.
This is the code on the Python side:
print "handle", hex(self.frame.GetHandle()) kdetray.set_tray(self.frame.GetHandle())

Any ideas? Should I move over to the wxPython mailing list with this question?

Thanks
Joerg Henne




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