Commit dacc45e6 authored by Nalin Dahyabhai's avatar Nalin Dahyabhai

let the caller control whether or not we return the default colormap.

* src/vtedraw.c, src/vtedraw.h (_vte_draw_get_colormap): let the caller control
	whether or not we return the default colormap.
* src/vtegl.c: enable blending.  Don't specify any buffer depths.  Set the
	current drawable before we do any drawing.  Call gluOrtho2D with the
	right args to set up the right projection.
* src/vteskel.c: quiet compiler warning by removing a "const".
* src/vtedraw.c: juggle the preferred render order again.
parent c858e8dc
2003-05-08 nalin
* src/vtedraw.c, src/vtedraw.h (_vte_draw_get_colormap): let the caller
control whether or not we return the default colormap.
* src/vtegl.c: enable blending. Don't specify any buffer depths. Set
the current drawable before we do any drawing. Call gluOrtho2D with
the right args to set up the right projection.
* src/vteskel.c: quiet compiler warning by removing a "const".
* src/vtedraw.c: juggle the preferred render order again.
2003-05-08 Abel Cheung <maddog@linux.org.hk>
* configure.in: Added "mk" to ALL_LINGUAS.
......
......@@ -11155,7 +11155,8 @@ vte_terminal_realize(GtkWidget *widget)
attributes.height = widget->allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = _vte_draw_get_visual(terminal->pvt->draw);
attributes.colormap = _vte_draw_get_colormap(terminal->pvt->draw);
attributes.colormap = _vte_draw_get_colormap(terminal->pvt->draw,
FALSE);
attributes.event_mask = gtk_widget_get_events(widget) |
GDK_EXPOSURE_MASK |
GDK_VISIBILITY_NOTIFY_MASK |
......@@ -13487,11 +13488,8 @@ vte_terminal_background_update(gpointer data)
bgcolor.green = terminal->pvt->palette[VTE_DEF_BG].green;
bgcolor.blue = terminal->pvt->palette[VTE_DEF_BG].blue;
bgcolor.pixel = 0;
colormap = _vte_draw_get_colormap(terminal->pvt->draw);
if (colormap == NULL) {
gtk_widget_ensure_style(widget);
colormap = gdk_gc_get_colormap(widget->style->fg_gc[GTK_WIDGET_STATE(widget)]);
}
gtk_widget_ensure_style(widget);
colormap = gdk_gc_get_colormap(widget->style->fg_gc[GTK_WIDGET_STATE(widget)]);
if (colormap) {
gdk_rgb_find_color(colormap, &bgcolor);
}
......
......@@ -44,18 +44,18 @@ struct _vte_draw_impl
#endif
#endif
&_vte_draw_ft2,
&_vte_draw_pango,
#ifndef X_DISPLAY_MISSING
#ifdef HAVE_PANGOX
&_vte_draw_pango_x,
#endif
#endif
#if GTK_CHECK_VERSION(2,2,0)
#ifndef X_DISPLAY_MISSING
#ifdef HAVE_GL
&_vte_draw_gl,
#endif
#endif
#endif
&_vte_draw_pango,
#ifndef X_DISPLAY_MISSING
#ifdef HAVE_PANGOX
&_vte_draw_pango_x,
#endif
#endif
};
......@@ -126,7 +126,7 @@ _vte_draw_get_visual(struct _vte_draw *draw)
}
GdkColormap *
_vte_draw_get_colormap(struct _vte_draw *draw)
_vte_draw_get_colormap(struct _vte_draw *draw, gboolean maybe_use_default)
{
GdkColormap *colormap;
g_return_val_if_fail(draw->impl != NULL, NULL);
......@@ -135,6 +135,9 @@ _vte_draw_get_colormap(struct _vte_draw *draw)
if (colormap) {
return colormap;
}
if (!maybe_use_default) {
return NULL;
}
#if GTK_CHECK_VERSION(2,2,0)
colormap = gdk_screen_get_default_colormap(gdk_screen_get_default());
#else
......
......@@ -98,7 +98,8 @@ void _vte_draw_free(struct _vte_draw *draw);
implementations may require that this visual/colormap pair be used when
creating a window, and may fail otherwise. */
GdkVisual *_vte_draw_get_visual(struct _vte_draw *draw);
GdkColormap *_vte_draw_get_colormap(struct _vte_draw *draw);
GdkColormap *_vte_draw_get_colormap(struct _vte_draw *draw,
gboolean maybe_use_default);
/* Begin and end a drawing operation. If anything is buffered locally, it is
flushed to the window system when _end() is called. */
......
......@@ -52,13 +52,7 @@ struct _vte_gl_data
struct _vte_glyph_cache *cache;
};
#define _vte_gl_pixmap_attributes \
GLX_RGBA, \
GLX_RED_SIZE, 8, \
GLX_BLUE_SIZE, 8, \
GLX_GREEN_SIZE, 8, \
GLX_ALPHA_SIZE, 8, \
None,
#define _vte_gl_pixmap_attributes GLX_RGBA, None,
static gboolean
_vte_gl_check(struct _vte_draw *draw, GtkWidget *widget)
......@@ -239,8 +233,10 @@ _vte_gl_start(struct _vte_draw *draw)
glXMakeCurrent(display, data->glpixmap, data->context);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluOrtho2D(0, width, 0, height);
glViewport(0, 0, width, height);
gluOrtho2D(0, width - 1, 0, height - 1);
glViewport(0, 0, width, height);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
static void
......@@ -255,6 +251,8 @@ _vte_gl_end(struct _vte_draw *draw)
gdisplay = gdk_display_get_default();
display = gdk_x11_display_get_xdisplay(gdisplay);
glXMakeCurrent(display, data->glpixmap, data->context);
glFlush();
glXWaitX();
glXWaitGL();
......@@ -301,7 +299,7 @@ _vte_gl_set_background_image(struct _vte_draw *draw,
data = (struct _vte_gl_data*) draw->impl_data;
bgpixmap = vte_bg_get_pixmap(vte_bg_get(), type, pixbuf, file,
tint, saturation,
_vte_draw_get_colormap(draw));
gdk_drawable_get_colormap(draw->widget->window));
if (GDK_IS_PIXMAP(data->bgpixmap)) {
g_object_unref(G_OBJECT(data->bgpixmap));
}
......@@ -312,11 +310,18 @@ static void
_vte_gl_clear(struct _vte_draw *draw,
gint x, gint y, gint width, gint height)
{
GdkDisplay *gdisplay;
Display *display;
struct _vte_gl_data *data;
data = (struct _vte_gl_data*) draw->impl_data;
long xstop, ystop, i, j;
int pixmapw, pixmaph, w, h;
gdisplay = gdk_display_get_default();
display = gdk_x11_display_get_xdisplay(gdisplay);
glXMakeCurrent(display, data->glpixmap, data->context);
if (GDK_IS_PIXMAP(data->bgpixmap)) {
gdk_drawable_get_size(data->bgpixmap, &pixmapw, &pixmaph);
} else {
......@@ -427,14 +432,20 @@ _vte_gl_draw_text(struct _vte_draw *draw,
struct _vte_draw_text_request *requests, gsize n_requests,
GdkColor *color, guchar alpha)
{
GdkDisplay *gdisplay;
Display *display;
struct _vte_gl_data *data;
const struct _vte_glyph *glyph;
guint16 a, r, g, b;
int width, height;
int i, j, x, y, w, pad;
gdisplay = gdk_display_get_default();
display = gdk_x11_display_get_xdisplay(gdisplay);
data = (struct _vte_gl_data*) draw->impl_data;
glXMakeCurrent(display, data->glpixmap, data->context);
glXWaitX();
r = color->red;
......@@ -458,9 +469,6 @@ _vte_gl_draw_text(struct _vte_draw *draw,
j = (y * glyph->width + x) *
glyph->bytes_per_pixel;
a = glyph->bytes[j] * alpha;
if (a == 0) {
continue;
}
glColor4us(r, g, b, a);
glVertex2i(requests[i].x + pad + x,
height - (requests[i].y + glyph->skip + y));
......@@ -475,11 +483,17 @@ _vte_gl_draw_rectangle(struct _vte_draw *draw,
gint x, gint y, gint width, gint height,
GdkColor *color, guchar alpha)
{
GdkDisplay *gdisplay;
Display *display;
struct _vte_gl_data *data;
int w, h;
gdisplay = gdk_display_get_default();
display = gdk_x11_display_get_xdisplay(gdisplay);
data = (struct _vte_gl_data*) draw->impl_data;
glXMakeCurrent(display, data->glpixmap, data->context);
glXWaitX();
gdk_drawable_get_size(data->pixmap, &w, &h);
......@@ -499,11 +513,17 @@ _vte_gl_fill_rectangle(struct _vte_draw *draw,
gint x, gint y, gint width, gint height,
GdkColor *color, guchar alpha)
{
GdkDisplay *gdisplay;
Display *display;
struct _vte_gl_data *data;
int w, h;
gdisplay = gdk_display_get_default();
display = gdk_x11_display_get_xdisplay(gdisplay);
data = (struct _vte_gl_data*) draw->impl_data;
glXMakeCurrent(display, data->glpixmap, data->context);
glXWaitX();
gdk_drawable_get_size(data->pixmap, &w, &h);
......
......@@ -184,7 +184,7 @@ _vte_pango_set_background_image(struct _vte_draw *draw,
data = (struct _vte_pango_data*) draw->impl_data;
pixmap = vte_bg_get_pixmap(vte_bg_get(), type, pixbuf, file,
color, saturation,
_vte_draw_get_colormap(draw));
_vte_draw_get_colormap(draw, TRUE));
if (GDK_IS_PIXMAP(data->pixmap)) {
g_object_unref(G_OBJECT(data->pixmap));
}
......
......@@ -211,7 +211,7 @@ _vte_pango_x_set_background_image(struct _vte_draw *draw,
data = (struct _vte_pango_x_data*) draw->impl_data;
pixmap = vte_bg_get_pixmap(vte_bg_get(), type, pixbuf, file,
color, saturation,
_vte_draw_get_colormap(draw));
_vte_draw_get_colormap(draw, TRUE));
if (data->pixmap) {
g_object_unref(G_OBJECT(data->pixmap));
}
......
......@@ -117,7 +117,7 @@ _vte_skel_set_background_color(struct _vte_draw *draw, GdkColor *color)
static void
_vte_skel_set_background_image(struct _vte_draw *draw,
enum VteBgSourceType type,
const GdkPixbuf *pixbuf,
GdkPixbuf *pixbuf,
const char *filename,
const GdkColor *tint,
double saturation)
......
......@@ -425,7 +425,7 @@ _vte_xft_set_background_image(struct _vte_draw *draw,
data->pixmapw = data->pixmaph = 0;
pixmap = vte_bg_get_pixmap(vte_bg_get(), type,
pixbuf, file, color, saturation,
_vte_draw_get_colormap(draw));
_vte_draw_get_colormap(draw, TRUE));
if (GDK_IS_PIXMAP(data->pixmap)) {
g_object_unref(G_OBJECT(data->pixmap));
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment