JNIEXPORT jlongArray JNICALL Java_org_gnome_gdk_GdkWindow_gdk_1window_1get_1children ( JNIEnv* env, jclass cls, jlong _self ) { GList* result; jlongArray _result; GdkWindow* self; // convert parameter self self = (GdkWindow*) _self; // call function result = gdk_window_get_children(self); // cleanup parameter self // translate return value to JNI type _result = (jlongArray) bindings_java_convert_glist_to_jarray(env, result); // cleanup return value if (result != NULL) { g_list_free(result); } // and finally return _result; }
static void test_widget_windows (gpointer data) { GType type = GPOINTER_TO_SIZE (data); GtkWidget* window = gtk_test_create_widget (GTK_TYPE_WINDOW, NULL); GtkWidget* widget = gtk_test_create_widget (type, NULL); GList * windows; gtk_container_add (GTK_CONTAINER (window), widget); gtk_widget_show_all (window); windows = g_list_prepend (NULL, gtk_widget_get_window (window)); while (windows) { gpointer user_data = NULL; GList * children = gdk_window_get_children (windows->data); if (!gdk_window_is_visible (windows->data)) { g_error ("the GdkWindow %p wasn't shown in map()", windows->data); } gdk_window_get_user_data (windows->data, &user_data); if (!user_data) { /* at some point provide a better message (e.g. with the window tree and the data) */ g_error ("the GdkWindow %p doesn't have user data set", windows->data); } windows = g_list_delete_link (windows, windows); windows = g_list_concat (windows, children); } }
static GSList* test_find_widget_input_windows (GtkWidget *widget, gboolean input_only) { GList *node, *children; GSList *matches = NULL; gpointer udata; gdk_window_get_user_data (widget->window, &udata); if (udata == widget && (!input_only || (GDK_IS_WINDOW (widget->window) && GDK_WINDOW_OBJECT (widget->window)->input_only))) matches = g_slist_prepend (matches, widget->window); children = gdk_window_get_children (gtk_widget_get_parent_window (widget)); for (node = children; node; node = node->next) { gdk_window_get_user_data (node->data, &udata); if (udata == widget && (!input_only || (GDK_IS_WINDOW (node->data) && GDK_WINDOW_OBJECT (node->data)->input_only))) matches = g_slist_prepend (matches, node->data); } return g_slist_reverse (matches); }
static PyObject * PyGdkWindow_GetAttr(PyGdkWindow_Object *self, char *key) { GdkWindow *win = PyGdkWindow_Get(self); gint x, y; GdkModifierType p_mask; if (!strcmp(key, "__members__")) return Py_BuildValue("[sssssssssssss]", "children", "colormap", "depth", "height", "parent", "pointer", "pointer_state", "toplevel", "type", "width", "x", "xid", "y"); if (!strcmp(key, "width")) { gdk_drawable_get_size(win, &x, NULL); return PyInt_FromLong(x); } if (!strcmp(key, "height")) { gdk_drawable_get_size(win, NULL, &y); return PyInt_FromLong(y); } if (!strcmp(key, "x")) { gdk_window_get_position(win, &x, NULL); return PyInt_FromLong(x); } if (!strcmp(key, "y")) { gdk_window_get_position(win, NULL, &y); return PyInt_FromLong(y); } if (!strcmp(key, "colormap")) return PyGdkColormap_New(gdk_drawable_get_colormap(win)); if (!strcmp(key, "pointer")) { gdk_window_get_pointer(win, &x, &y, NULL); return Py_BuildValue("(ii)", x, y); } if (!strcmp(key, "pointer_state")) { gdk_window_get_pointer(win, NULL, NULL, &p_mask); return PyInt_FromLong(p_mask); } if (!strcmp(key, "parent")) { GdkWindow *par = gdk_window_get_parent(win); if (par) return PyGdkWindow_New(par); Py_INCREF(Py_None); return Py_None; } if (!strcmp(key, "toplevel")) return PyGdkWindow_New(gdk_window_get_toplevel(win)); if (!strcmp(key, "children")) { GList *children, *tmp; PyObject *ret; children = gdk_window_get_children(win); if ((ret = PyList_New(0)) == NULL) return NULL; for (tmp = children; tmp != NULL; tmp = tmp->next) { PyObject *win = PyGdkWindow_New(tmp->data); if (win == NULL) { Py_DECREF(ret); return NULL; } PyList_Append(ret, win); Py_DECREF(win); } g_list_free(children); return ret; } if (!strcmp(key, "type")) return PyInt_FromLong(gdk_drawable_get_type(win)); if (!strcmp(key, "depth")) { gdk_window_get_geometry(win, NULL, NULL, NULL, NULL, &x); return PyInt_FromLong(x); } #ifdef WITH_XSTUFF if (!strcmp(key, "xid")) return PyInt_FromLong(GDK_WINDOW_XWINDOW(win)); #endif return Py_FindMethod(PyGdkWindow_methods, (PyObject *)self, key); }