Rewrote drawing stuff

This commit is contained in:
Yevgen Muntyan 2005-07-06 23:41:14 +00:00
parent 9e94bc5a2a
commit f162e57f59
6 changed files with 1145 additions and 555 deletions

View File

@ -68,9 +68,6 @@ struct _MooTermPrivate {
gboolean scrolled;
guint _top_line;
// guint old_scrollback;
// guint old_width;
// guint old_height;
guint char_width;
guint char_height;
@ -79,11 +76,18 @@ struct _MooTermPrivate {
TermPangoLines *pango_lines;
TermFontInfo *font_info;
GdkPixmap *back_pixmap;
GdkRegion *changed_content; /* buffer coordinates, relative to top_line */
GdkGC *clip;
gboolean font_changed;
PangoLayout *layout;
GdkGC *fg[3];
GdkGC *bg[3];
/* thing[MOO_TERM_COLOR_MAX] == NULL */
GdkColor *color[MOO_TERM_COLOR_MAX + 1];
GdkGC *pair[MOO_TERM_COLOR_MAX + 1][MOO_TERM_COLOR_MAX + 1];
GdkGC *selected_pair[MOO_TERM_COLOR_MAX + 1][MOO_TERM_COLOR_MAX + 1];
TermCaretShape caret_shape;
guint caret_height;
@ -148,6 +152,13 @@ gboolean moo_term_key_press (GtkWidget *widget,
gboolean moo_term_key_release (GtkWidget *widget,
GdkEventKey *event);
void moo_term_init_back_pixmap (MooTerm *term);
void moo_term_resize_back_pixmap (MooTerm *term);
void moo_term_update_back_pixmap (MooTerm *term);
void moo_term_invalidate_content_all (MooTerm *term);
void moo_term_invalidate_content_rect(MooTerm *term,
GdkRectangle *rect);
void moo_term_force_update (MooTerm *term);
gboolean moo_term_expose_event (GtkWidget *widget,
GdkEventExpose *event);

View File

@ -207,12 +207,22 @@ static void moo_term_finalize (GObject *object)
if (term->priv->dirty)
gdk_region_destroy (term->priv->dirty);
if (term->priv->changed_content)
gdk_region_destroy (term->priv->changed_content);
if (term->priv->back_pixmap)
g_object_unref (term->priv->back_pixmap);
if (term->priv->clip)
g_object_unref (term->priv->clip);
if (term->priv->layout)
g_object_unref (term->priv->layout);
for (i = 0; i < MOO_TERM_COLOR_MAX; ++i)
g_free (term->priv->color[i]);
for (i = 0; i <= MOO_TERM_COLOR_MAX; ++i)
for (j = 0; j <= MOO_TERM_COLOR_MAX; ++j)
g_object_unref (term->priv->pair[i][j]);
if (i != MOO_TERM_COLOR_MAX || j != MOO_TERM_COLOR_MAX)
g_object_unref (term->priv->pair[i][j]);
g_free (term->priv);
G_OBJECT_CLASS (moo_term_parent_class)->finalize (object);
@ -297,6 +307,7 @@ static void moo_term_realize (GtkWidget *widget)
moo_term_setup_palette (term);
moo_term_init_font_stuff (term);
moo_term_init_back_pixmap (term);
moo_term_size_changed (term);
gdk_window_set_background (widget->window, &(widget->style->white));
@ -650,6 +661,9 @@ void moo_term_size_changed (MooTerm *term)
moo_term_buffer_set_screen_size (term->priv->buffer, width, height);
moo_term_vt_set_size (term->priv->vt, width, height);
if (GTK_WIDGET_REALIZED (term))
moo_term_resize_back_pixmap (term);
}

File diff suppressed because it is too large Load Diff

View File

@ -31,6 +31,16 @@ typedef struct _MooTermLine MooTermLine;
static MooTermTextAttr ZERO_ATTR;
/* FALSE if equal */
inline static gboolean attr_cmp (MooTermTextAttr *a1, MooTermTextAttr *a2)
{
return a1->mask != a2->mask ||
((a1->mask & MOO_TERM_TEXT_FOREGROUND) && (a1->foreground != a2->foreground)) ||
((a1->mask & MOO_TERM_TEXT_BACKGROUND) && (a1->background != a2->background));
}
#define TERM_LINE(ar) ((MooTermLine*) (ar))
#define TERM_LINE_ARRAY(line) ((GArray*) (line))

View File

@ -549,9 +549,9 @@ non_escape_char: printable_char
;
no_escape_string: non_escape_char { add_char ($1); }
| no_escape_string non_escape_char { add_char ($1); }
| no_escape_string non_escape_char { add_char ($2); }
;
printable_string: printable_char { add_char ($1); }
| printable_string printable_char { add_char ($1); }
| printable_string printable_char { add_char ($2); }
;

View File

@ -352,6 +352,7 @@ int _moo_term_yylex (MooTermParser *parser)
}
else
{
_moo_term_yylval = c;
return c;
}
}
@ -609,7 +610,7 @@ static void exec_decset (MooTermBuffer *buf,
break;
default:
g_warning ("%s: uknown mode %d", G_STRLOC, params[i]);
g_warning ("%s: unknown mode %d", G_STRLOC, params[i]);
}
}
}
@ -972,7 +973,7 @@ static void exec_restore_decset (MooTermBuffer *buf,
break;
default:
g_warning ("%s: uknown mode %d", G_STRLOC, params[i]);
g_warning ("%s: unknown mode %d", G_STRLOC, params[i]);
}
}
}