diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2009-12-23 10:26:59 -0500 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2009-12-23 10:26:59 -0500 |
commit | 77ea73bf2ae87c35fe24b49af61d9e6b58e2c551 (patch) | |
tree | c9f2c721cc717dc4f65c4e7365965bc2cc84544d | |
parent | 58689c06e1d15d645c1181f0f8288fefa52f967e (diff) |
Drop struct _vte_draw_impl
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/vtedraw.c | 14 | ||||
-rw-r--r-- | src/vtedraw.h | 44 | ||||
-rw-r--r-- | src/vtepangocairo.c | 41 | ||||
-rw-r--r-- | src/vtepangocairo.h | 33 | ||||
-rw-r--r-- | src/vteskel.c | 86 | ||||
-rw-r--r-- | src/vteskel.h | 33 |
7 files changed, 8 insertions, 246 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 453f8d9..f76bd27 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -66,15 +66,12 @@ libvte_la_SOURCES = \ vtedraw.h \ vteint.h \ vtepangocairo.c \ - vtepangocairo.h \ vteregex.c \ vteregex.h \ vterowdata.c \ vterowdata.h \ vteseq.c \ vteseq-list.h \ - vteskel.c \ - vteskel.h \ vtestream.c \ vtestream.h \ vtestream-base.h \ diff --git a/src/vtedraw.c b/src/vtedraw.c index 50b075c..c3dc176 100644 --- a/src/vtedraw.c +++ b/src/vtedraw.c @@ -28,20 +28,13 @@ #include <gtk/gtk.h> #include "debug.h" #include "vtedraw.h" -#include "vtepangocairo.h" -#include "vteskel.h" GdkVisual * _vte_draw_get_visual (struct _vte_draw *draw) { - GdkVisual *visual = NULL; - _vte_debug_print (VTE_DEBUG_DRAW, "draw_get_visual\n"); - if (draw->impl->get_visual) - visual = draw->impl->get_visual (draw); - - return visual ? visual : gtk_widget_get_visual (draw->widget); + return gtk_widget_get_visual (draw->widget); } GdkColormap * @@ -51,10 +44,7 @@ _vte_draw_get_colormap (struct _vte_draw *draw, gboolean maybe_use_default) _vte_debug_print (VTE_DEBUG_DRAW, "draw_get_colormap\n"); - if (draw->impl->get_colormap) - colormap = draw->impl->get_colormap (draw); - else - colormap = gtk_widget_get_colormap (draw->widget); + colormap = gtk_widget_get_colormap (draw->widget); if (colormap == NULL && maybe_use_default) { colormap = gdk_screen_get_default_colormap (gtk_widget_get_screen (draw->widget)); diff --git a/src/vtedraw.h b/src/vtedraw.h index cfdbdef..f709413 100644 --- a/src/vtedraw.h +++ b/src/vtedraw.h @@ -59,48 +59,6 @@ struct _vte_draw_text_request { gshort x, y, columns; }; -struct _vte_draw_impl { - const char *name; - gboolean (*check)(struct _vte_draw *draw, GtkWidget *widget); - void (*create)(struct _vte_draw *draw, GtkWidget *widget); - void (*destroy)(struct _vte_draw *draw); - GdkVisual* (*get_visual)(struct _vte_draw *draw); - GdkColormap* (*get_colormap)(struct _vte_draw *draw); - void (*start)(struct _vte_draw *draw); - void (*end)(struct _vte_draw *draw); - void (*set_background_solid)(struct _vte_draw *, - GdkColor *color, - guint16 opacity); - void (*set_background_image)(struct _vte_draw *, - enum VteBgSourceType type, - GdkPixbuf *pixbuf, - const char *file, - const GdkColor *color, - double saturation); - void (*set_background_scroll)(struct _vte_draw *, - gint, gint); - void (*clip)(struct _vte_draw *, GdkRegion *); - gboolean always_requires_clear; - void (*clear)(struct _vte_draw *, gint, gint, gint, gint); - void (*set_text_font)(struct _vte_draw *, - const PangoFontDescription *, - VteTerminalAntiAlias); - void (*get_text_metrics)(struct _vte_draw *, gint *, gint *, gint *); - int (*get_char_width)(struct _vte_draw *, vteunistr c, int columns, - gboolean); - gboolean (*has_bold)(struct _vte_draw *); - void (*draw_text)(struct _vte_draw *, - struct _vte_draw_text_request *, gsize, - GdkColor *, guchar, gboolean); - gboolean (*has_char)(struct _vte_draw *, vteunistr, gboolean); - void (*draw_rectangle)(struct _vte_draw *, - gint, gint, gint, gint, - GdkColor *, guchar); - void (*fill_rectangle)(struct _vte_draw *, - gint, gint, gint, gint, - GdkColor *, guchar); -}; - struct _vte_draw { GtkWidget *widget; @@ -108,8 +66,6 @@ struct _vte_draw { gboolean requires_clear; - const struct _vte_draw_impl *impl; - /* for use by impl */ gpointer impl_data; }; diff --git a/src/vtepangocairo.c b/src/vtepangocairo.c index 09e2dfb..3bb1610 100644 --- a/src/vtepangocairo.c +++ b/src/vtepangocairo.c @@ -26,7 +26,6 @@ #include "debug.h" #include "vtebg.h" #include "vtedraw.h" -#include "vtepangocairo.h" #include "vte-private.h" #include <pango/pangocairo.h> @@ -791,6 +790,8 @@ struct _vte_pangocairo_data { cairo_t *cr; }; +const char impl_name[] = "pangocairo"; + struct _vte_draw * _vte_draw_new (GtkWidget *widget) { @@ -800,15 +801,11 @@ _vte_draw_new (GtkWidget *widget) /* Create the structure. */ draw = g_slice_new0 (struct _vte_draw); draw->widget = g_object_ref (widget); - draw->impl = &_vte_draw_pangocairo; - draw->requires_clear = draw->impl->always_requires_clear; + draw->requires_clear = FALSE; _vte_debug_print (VTE_DEBUG_DRAW, - "draw_new (%s)\n", draw->impl->name); - _vte_debug_print (VTE_DEBUG_MISC, "Using %s.\n", draw->impl->name); - - if (draw->impl->create) - draw->impl->create (draw, draw->widget); + "draw_new (%s)\n", impl_name); + _vte_debug_print (VTE_DEBUG_MISC, "Using %s.\n", impl_name); data = g_slice_new0 (struct _vte_pangocairo_data); draw->impl_data = data; @@ -884,8 +881,7 @@ _vte_draw_set_background_solid(struct _vte_draw *draw, { struct _vte_pangocairo_data *data = draw->impl_data; - draw->requires_clear = - draw->impl->always_requires_clear || opacity != 0xFFFF; + draw->requires_clear = opacity != 0xFFFF; if (data->bg_pattern) cairo_pattern_destroy (data->bg_pattern); @@ -1234,28 +1230,3 @@ _vte_draw_fill_rectangle (struct _vte_draw *draw, set_source_color_alpha (data->cr, color, alpha); cairo_fill (data->cr); } - -const struct _vte_draw_impl _vte_draw_pangocairo = { - "pangocairo", - NULL, /* check */ - NULL, /* create */ - NULL, /* destroy */ - NULL, /* get_visual */ - NULL, /* get_colormap */ - NULL, /* start */ - NULL, /* end */ - NULL, /* set_background_solid */ - NULL, /* set_background_image */ - NULL, /* set_background_scroll */ - NULL, /* clip */ - FALSE, /* always_requires_clear */ - NULL, /* clear */ - NULL, /* text_font */ - NULL, /* text_metrics */ - NULL, /* char_width */ - NULL, /* has_bold */ - NULL, /* draw_text */ - NULL, /* draw_has_char */ - NULL, /* draw_rectangle */ - NULL, /* fill_rectangle */ -}; diff --git a/src/vtepangocairo.h b/src/vtepangocairo.h deleted file mode 100644 index d1abfc7..0000000 --- a/src/vtepangocairo.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2003 Red Hat, Inc. - * - * This is free software; you can redistribute it and/or modify it under - * the terms of the GNU Library General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef vte_vtepangocairo_h_included -#define vte_vtepangocairo_h_included - -/* The interfaces in this file are subject to change at any time. */ - - -#include "vtedraw.h" - -G_BEGIN_DECLS - -extern const struct _vte_draw_impl _vte_draw_pangocairo; - -G_END_DECLS - -#endif diff --git a/src/vteskel.c b/src/vteskel.c deleted file mode 100644 index 274b6de..0000000 --- a/src/vteskel.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (C) 2003 Red Hat, Inc. - * - * This is free software; you can redistribute it and/or modify it under - * the terms of the GNU Library General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -#include <config.h> - -#include <sys/param.h> -#include <stdio.h> -#include <string.h> -#include <gtk/gtk.h> -#include "debug.h" -#include "vtebg.h" -#include "vtedraw.h" - -static void -_vte_skel_clear(struct _vte_draw *draw, - gint x, gint y, gint width, gint height) -{ - g_message ("_vte_skel_clear: %d,%d+%d,%d", - x, y, width, height); -} - -static void -_vte_skel_get_text_metrics(struct _vte_draw *draw, - gint *width, gint *height, gint *ascent) -{ - g_message ("_vte_skel_get_text_metrics"); -} - -static void -_vte_skel_draw_text(struct _vte_draw *draw, - struct _vte_draw_text_request *requests, gsize n_requests, - GdkColor *color, guchar alpha, gboolean bold) -{ - g_message ("_vte_skel_draw_text: %d chars", - n_requests); -} - -static void -_vte_skel_fill_rectangle(struct _vte_draw *draw, - gint x, gint y, gint width, gint height, - GdkColor *color, guchar alpha) -{ - g_message ("_vte_skel_fill_rectangle: %d,%d+%d,%d", - x, y, width, height); -} - -const struct _vte_draw_impl _vte_draw_skel = { - "null", - NULL, /* check */ - NULL, /* create */ - NULL, /* destroy */ - NULL, /* get_visual */ - NULL, /* get_colormap */ - NULL, /* start */ - NULL, /* end */ - NULL, /* set_background_solid */ - NULL, /* set_background_image */ - NULL, /* set_background_scroll */ - NULL, /* clip */ - TRUE, /* always_requires_clear */ - _vte_skel_clear, - NULL, /* set_text_font */ - _vte_skel_get_text_metrics, - NULL, /* get_char_width */ - NULL, /* has_bold */ - _vte_skel_draw_text, - NULL, /* draw_has_char */ - NULL, /* draw_rectangle */ - _vte_skel_fill_rectangle -}; diff --git a/src/vteskel.h b/src/vteskel.h deleted file mode 100644 index e202632..0000000 --- a/src/vteskel.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright (C) 2003 Red Hat, Inc. - * - * This is free software; you can redistribute it and/or modify it under - * the terms of the GNU Library General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef vte_vteskel_h_included -#define vte_vteskel_h_included - -/* The interfaces in this file are subject to change at any time. */ - - -#include "vtedraw.h" - -G_BEGIN_DECLS - -extern const struct _vte_draw_impl _vte_draw_skel; - -G_END_DECLS - -#endif |