From 498a653cd70f9de52b634350af54decbd1c1fe60 Mon Sep 17 00:00:00 2001 From: ellson <devnull@localhost> Date: Tue, 18 Jan 2005 20:01:04 +0000 Subject: [PATCH] framework for supporting multiple display types (xlib, xcb, sdl, glitz, ...) via plugin --- lib/common/types.h | 1 + lib/gvc/gvcint.h | 2 ++ lib/gvc/gvemit.c | 1 - lib/gvc/gvplugin.h | 6 +++++- lib/gvc/gvplugin_display.h | 36 ++++++++++++++++++++++++++++++++++++ lib/gvc/gvplugin_layout.h | 2 -- lib/gvc/gvplugin_render.h | 2 -- 7 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 lib/gvc/gvplugin_display.h diff --git a/lib/common/types.h b/lib/common/types.h index a03a8f578..7e84029af 100644 --- a/lib/common/types.h +++ b/lib/common/types.h @@ -36,6 +36,7 @@ extern "C" { typedef struct GVC_s GVC_t; typedef struct gvrender_engine_s gvrender_engine_t; typedef struct gvlayout_engine_s gvlayout_engine_t; + typedef struct gvdisplay_engine_s gvdisplay_engine_t; typedef struct htmllabel_t htmllabel_t; diff --git a/lib/gvc/gvcint.h b/lib/gvc/gvcint.h index 69c1d1896..1bc403020 100644 --- a/lib/gvc/gvcint.h +++ b/lib/gvc/gvcint.h @@ -153,6 +153,8 @@ extern "C" { gv_plugin_t *apis[NUM_APIS]; /* array of linked lists of plugins for each api */ gv_plugin_t *api[NUM_APIS]; /* array of current plugins for each api */ + void *display; /* window display data for gvdisplay plugin */ + /* gvrender_begin_job() */ char *layout_type; /* string name of layout type */ gvlayout_engine_t *layout_engine; /* current layout engine */ diff --git a/lib/gvc/gvemit.c b/lib/gvc/gvemit.c index 7ef363229..a3b67d9aa 100644 --- a/lib/gvc/gvemit.c +++ b/lib/gvc/gvemit.c @@ -533,7 +533,6 @@ void gvemit_graph(GVC_t * gvc, graph_t * g, int flags) win_deinit(job); XCloseDisplay(job->dpy); - free(job->win); #else fprintf(stderr,"No X11 support available\n"); #endif diff --git a/lib/gvc/gvplugin.h b/lib/gvc/gvplugin.h index d2e6add0a..62579ba81 100644 --- a/lib/gvc/gvplugin.h +++ b/lib/gvc/gvplugin.h @@ -23,6 +23,10 @@ extern "C" { #endif +#ifndef NULL +#define NULL (void *)0 +#endif + /* * Define an apis array of name strings using an enumerated api_t as index. * The enumerated type is defined here. The apis array is @@ -31,7 +35,7 @@ extern "C" { * The last enum is NUM_APIS which is the size of the array. */ // #define APIS ELEM(render) ELEM(layout) ELEM(parser) ELEM(scripter) ... -#define APIS ELEM(render) ELEM(layout) +#define APIS ELEM(render) ELEM(layout) ELEM(display) #define ELEM(x) API_##x, typedef enum { APIS NUM_APIS } api_t; /* API_render, API_layout, ... */ diff --git a/lib/gvc/gvplugin_display.h b/lib/gvc/gvplugin_display.h new file mode 100644 index 000000000..c7f9c49b9 --- /dev/null +++ b/lib/gvc/gvplugin_display.h @@ -0,0 +1,36 @@ +/* $Id$ $Revision$ */ +/* vim:set shiftwidth=4 ts=8: */ + +/********************************************************** +* This software is part of the graphviz package * +* http://www.graphviz.org/ * +* * +* Copyright (c) 1994-2004 AT&T Corp. * +* and is licensed under the * +* Common Public License, Version 1.0 * +* by AT&T Corp. * +* * +* Information and Software Systems Research * +* AT&T Research, Florham Park NJ * +**********************************************************/ + +#ifndef GVDISPLAY_PLUGIN_H +#define GVDISPLAY_PLUGIN_H + +#include "gvplugin.h" +#include "gvcint.h" + +#ifdef __cplusplus +extern "C" { +#endif + + struct gvdisplay_engine_s { + void (*init) (GVC_t * gvc); + void (*process) (GVC_t * gvc); + void (*deinit) (GVC_t * gvc); + }; + +#ifdef __cplusplus +} +#endif +#endif /* GVDISPLAY_PLUGIN_H */ diff --git a/lib/gvc/gvplugin_layout.h b/lib/gvc/gvplugin_layout.h index 3508b62a2..e47cbfd78 100644 --- a/lib/gvc/gvplugin_layout.h +++ b/lib/gvc/gvplugin_layout.h @@ -14,8 +14,6 @@ * AT&T Research, Florham Park NJ * **********************************************************/ -/* This is the public header for the libgvre_* plugins */ - #ifndef GVLAYOUT_PLUGIN_H #define GVLAYOUT_PLUGIN_H diff --git a/lib/gvc/gvplugin_render.h b/lib/gvc/gvplugin_render.h index 7155d498a..f92dd3e1a 100644 --- a/lib/gvc/gvplugin_render.h +++ b/lib/gvc/gvplugin_render.h @@ -14,8 +14,6 @@ * AT&T Research, Florham Park NJ * **********************************************************/ -/* This is the public header for the libgvre_* plugins */ - #ifndef GVRENDER_PLUGIN_H #define GVRENDER_PLUGIN_H -- 2.40.0