JNIEXPORT jlongArray JNICALL Java_org_gnome_gdk_GdkWindow_gdk_1window_1peek_1children ( JNIEnv* env, jclass cls, jlong _self ) { GList* result; jlongArray _result; GdkWindow* self; // convert parameter self self = (GdkWindow*) _self; // call function result = gdk_window_peek_children(self); // cleanup parameter self // translate return value to JNI type _result = (jlongArray) bindings_java_convert_glist_to_jarray(env, result); // and finally return _result; }
static VALUE gdkwin_get_children(VALUE self) { /* Don't use gdk_window_get_children() here */ GList* list = gdk_window_peek_children(_SELF(self)); VALUE ary = rb_ary_new(); while (list) { rb_ary_push(ary, GOBJ2RVAL(list->data)); list = list->next; } return ary; }
static void destroy_children (GdkWindow *window) { GList *l; GdkWindow *child; for (l = gdk_window_peek_children (window); l != NULL; l = l->next) { child = l->data; destroy_children (child); gdk_window_destroy (child); } }
static void save_children (GString *s, GdkWindow *window) { GList *l; GdkWindow *child; for (l = g_list_reverse (gdk_window_peek_children (window)); l != NULL; l = l->next) { child = l->data; save_window (s, child); } }
static void add_children (GtkTreeStore *store, GdkWindow *window, GtkTreeIter *window_iter) { GList *l; GtkTreeIter child_iter; for (l = gdk_window_peek_children (window); l != NULL; l = l->next) { gtk_tree_store_append (store, &child_iter, window_iter); gtk_tree_store_set (store, &child_iter, 0, l->data, -1); add_children (store, l->data, &child_iter); } }
static void save_window (GString *s, GdkWindow *window) { gint x, y; GdkColor *color; gdk_window_get_position (window, &x, &y); color = g_object_get_data (G_OBJECT (window), "color"); g_string_append_printf (s, "%d,%d %dx%d (%d,%d,%d) %d %d\n", x, y, gdk_window_get_width (window), gdk_window_get_height (window), color->red, color->green, color->blue, gdk_window_has_native (window), g_list_length (gdk_window_peek_children (window))); save_children (s, window); }