1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-24 07:02:30 +01:00

wrlib: Implemented functions to allow clean-up of Contexts

The function 'RDestroyContext' have been defined in the API for a long time
but did not have an implementation, this patch fixes it.
This commit is contained in:
David Maciejak
2014-05-08 23:57:01 +02:00
committed by Carlos R. Mafra
parent 64e4019614
commit 283286e0cd
2 changed files with 16 additions and 0 deletions

View File

@@ -688,6 +688,21 @@ RContext *RCreateContext(Display * dpy, int screen_number, const RContextAttribu
return context;
}
void RDestroyContext(RContext *context)
{
if (context) {
if (context->copy_gc)
XFreeGC(context->dpy, context->copy_gc);
if (context->attribs) {
if ((context->attribs->flags & RC_VisualID) &&
!(context->attribs->flags & RC_DefaultVisual))
XDestroyWindow(context->dpy, context->drawable);
free(context->attribs);
}
free(context);
}
}
static Bool bestContext(Display * dpy, int screen_number, RContext * context)
{
XVisualInfo *vinfo = NULL, rvinfo;