void x11_window_set_title(hwrbitmap window, const struct pgstring *title) { struct x11bitmap *xb = XB(window)->frontbuffer ? XB(window)->frontbuffer : XB(window); struct pgstring *s; struct pgstr_iterator i; /* Make a null-terminated UTF-8 string */ if (!iserror(pgstring_convert(&s, PGSTR_ENCODE_UTF8, title))) { pgstring_seek(s, &i, 1, PGSEEK_END); if (!iserror(pgstring_insert_char(s, &i, 0, NULL))) XStoreName(x11_display, xb->d, s->buffer); pgstring_delete(s); } }
/* Free any object in a handlenode */ void object_free(struct handlenode *n) { #ifdef DEBUG_KEYS num_handles--; #endif #ifdef DEBUG_MEMORY printf("Enter object free of handle 0x%08X, type %d\n",n->id,n->type & PG_TYPEMASK); #endif if (!(n->type & HFLAG_NFREE)) { switch (n->type & PG_TYPEMASK) { case PG_TYPE_BITMAP: VID(bitmap_free) ((hwrbitmap)n->obj); break; case PG_TYPE_WIDGET: widget_remove((struct widget *)n->obj); break; case PG_TYPE_THEME: theme_remove((struct pgmemtheme *)n->obj); break; case PG_TYPE_DRIVER: unload_inlib((struct inlib *)n->obj); break; case PG_TYPE_WT: wt_free((struct pgmemwt *)n->obj); break; case PG_TYPE_INFILTER: infilter_delete((struct infilter *)n->obj); break; case PG_TYPE_CURSOR: cursor_delete((struct cursor *)n->obj); break; case PG_TYPE_PGSTRING: pgstring_delete((struct pgstring *)n->obj); break; case PG_TYPE_FONTDESC: font_descriptor_destroy((struct font_descriptor *)n->obj); break; /* Object types that are memory-managed independently of their handles */ case PG_TYPE_DIVTREE: case PG_TYPE_PARAGRAPH: break; default: g_free(n->obj); } } #ifdef DEBUG_MEMORY printf("Leave object free of handle 0x%08X, type %d\n",n->id,n->type & PG_TYPEMASK); #endif }