Commit e3f4cc36 authored by Nalin Dahyabhai's avatar Nalin Dahyabhai

require automake 1.6, 1.5 chokes on AM_LDFLAGS, which 1.7 wants instead of

* autogen.sh: require automake 1.6, 1.5 chokes on AM_LDFLAGS, which 1.7 wants
	instead of LDFLAGS(!).  Require autoconf 2.52 or newer, because older
	versions bail on configure.in.
* configure.in: Check if ft_render_mode_mono, FT_RENDER_MODE_NORMAL,
	FT_PIXEL_MODE_MONO, ft_pixel_mode_mono, FT_PIXEL_MODE_GRAY2,
	FT_PIXEL_MODE_GRAY4, FT_PIXEL_MODE_GRAY, ft_pixel_mode_grays,
	FT_PIXEL_MODE_LCD are declared.
* src/vte.c, src/vteapp.c, src/vtefc.c, src/vtepango.c: handle being built with
	GTK+ 2.0 or 2.2.
* src/vtegl.c: disable for GTK+ < 2.2.0.
* src/vtepangox.c: use a PangoX context instead of a Pango context when
	determining font metrics.
* src/vteglyph.c: handle the twisty maze of load and render options and pixel
	modes which various versions of freetype support.
parent 0e259e34
2003-04-14 nalin
* autogen.sh: require automake 1.6, 1.5 chokes on AM_LDFLAGS, which 1.7
wants instead of LDFLAGS(!). Require autoconf 2.52 or newer, because
older versions bail on configure.in.
* configure.in: Check if ft_render_mode_mono, FT_RENDER_MODE_NORMAL,
FT_PIXEL_MODE_MONO, ft_pixel_mode_mono, FT_PIXEL_MODE_GRAY2,
FT_PIXEL_MODE_GRAY4, FT_PIXEL_MODE_GRAY, ft_pixel_mode_grays,
FT_PIXEL_MODE_LCD are declared.
* src/vte.c, src/vteapp.c, src/vtefc.c, src/vtepango.c: handle being
built with GTK+ 2.0 or 2.2.
* src/vtegl.c: disable for GTK+ < 2.2.0.
* src/vtepangox.c: use a PangoX context instead of a Pango context
when determining font metrics.
* src/vteglyph.c: handle the twisty maze of load and render options and
pixel modes various versions of freetype support.
2003-04-14 nalin
* configure.in: disable pangox, xft, glx drawing if run invoked with
the --without-x flag.
......
......@@ -29,13 +29,29 @@ if $have_libtool ; then : ; else
DIE=1
fi
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
for autoconf in autoconf autoconf-2.57 autoconf-2.56 autoconf-2.55 autoconf-2.54 autoconf-2.53 autoconf-2.52 ; do
if "$autoconf" --version < /dev/null > /dev/null 2>&1 ; then
version=`"$autoconf" --version | head -1 | awk '{print $NF}'`
acmajor=`echo "$version" | cut -f1 -d.`
acminor=`echo "$version" | cut -f2 -d.`
if test "$acmajor" -gt 3 ; then
break
fi
if test "$acmajor" -ge 2 ; then
if test "$acminor" -ge 50 ; then
break
fi
fi
fi
done
if ! "$autoconf" --version < /dev/null > /dev/null 2>&1 ; then
echo
echo "You must have autoconf installed to compile $PROJECT."
echo "You must have autoconf 2.52 installed to compile $PROJECT."
echo "Install the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
fi
autoheader=`echo "$autoconf" | sed s,autoconf,autoheader,g`
(freetype-config --version) < /dev/null > /dev/null 2>&1 || {
echo
......@@ -46,7 +62,7 @@ fi
}
have_automake=false
for automakev in 1.7 1.6 1.5 ; do
for automakev in 1.7 1.6 ; do
if automake-$automakev --version < /dev/null > /dev/null 2>&1 ; then
have_automake=true
break;
......@@ -54,8 +70,8 @@ for automakev in 1.7 1.6 1.5 ; do
done
if $have_automake ; then : ; else
echo
echo "You must have automake 1.5 installed to compile $PROJECT."
echo "Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.5.tar.gz"
echo "You must have automake 1.6 installed to compile $PROJECT."
echo "Get ftp://ftp.gnu.org/pub/gnu/automake/automake-1.6.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
fi
......@@ -81,16 +97,16 @@ touch config.h.in
aclocal-$automakev $ACLOCAL_FLAGS
# optionally feature autoheader
(autoheader --version) < /dev/null > /dev/null 2>&1 && autoheader
$autoheader
automake-$automakev -a -c $am_opt
autoconf
$autoconf
cd gnome-pty-helper
touch config.h.in
aclocal-$automakev $ACLOCAL_FLAGS
(autoheader --version) < /dev/null > /dev/null 2>&1 && autoheader
$autoheader
automake-$automakev -a -c $am_opt
autoconf
$autoconf
cd $ORIGDIR
......
......@@ -35,8 +35,7 @@ PKG_CHECK_MODULES(GLIB,glib-2.0)
PKG_CHECK_MODULES(GOBJECT,[glib-2.0 gobject-2.0])
PKG_CHECK_MODULES(GTK,[glib-2.0 gobject-2.0 gtk+-2.0])
# Require GTK+ 2.2 (we use some of the GdkScreen APIs) and fontconfig.
wantedmodules="glib-2.0 gobject-2.0 gtk+-2.0 >= 2.2.0 fontconfig"
wantedmodules="glib-2.0 gobject-2.0 gtk+-2.0 fontconfig"
# Use Xft2 if Pango has Xft2 support and it isn't disabled.
if test "$have_x" = yes ; then
......@@ -105,35 +104,81 @@ if test -d "$ac_x_includes" ; then
fi
AC_CHECK_HEADERS(ft2build.h)
AC_CHECK_DECLS(ft_render_mode_mono,,,[
AC_CHECK_DECL(ft_render_mode_mono,[AC_DEFINE(HAVE_DECL_ft_render_mode_mono,1,Define if your freetype2 installation defines ft_render_mode_mono.)],,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
])
AC_CHECK_DECLS(FT_RENDER_MODE_MONO,,,[
AC_CHECK_DECL(FT_RENDER_MODE_MONO,[AC_DEFINE(HAVE_DECL_FT_RENDER_MODE_MONO,1,Define if your freetype2 installation defines FT_RENDER_MODE_MONO.)],,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
])
AC_CHECK_DECLS(FT_LOAD_NO_HINTING,,,[
AC_CHECK_DECL(FT_LOAD_NO_HINTING,,,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
])
AC_CHECK_DECLS(FT_RENDER_MODE_LIGHT,,,[
AC_CHECK_DECL(FT_RENDER_MODE_LIGHT,,,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
])
AC_CHECK_DECLS(FT_RENDER_MODE_NORMAL,,,[
AC_CHECK_DECL(FT_RENDER_MODE_NORMAL,,,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
])
AC_CHECK_DECL(FT_PIXEL_MODE_MONO,[AC_DEFINE(HAVE_DECL_FT_PIXEL_MODE_MONO,1,Define if your freetype2 build declares FT_PIXEL_MODE_MONO.)],,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
])
AC_CHECK_DECL(ft_pixel_mode_mono,[AC_DEFINE(HAVE_DECL_ft_pixel_mode_mono,1,Define if your freetype2 build declares ft_pixel_mode_mono.)],,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
])
AC_CHECK_DECL(FT_PIXEL_MODE_GRAY2,,,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
])
AC_CHECK_DECL(FT_PIXEL_MODE_GRAY4,,,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
])
AC_CHECK_DECL(FT_PIXEL_MODE_GRAY,[AC_DEFINE(HAVE_DECL_FT_PIXEL_MODE_GRAY,1,Define if your freetype2 build declares FT_PIXEL_MODE_GRAY.)],,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
])
AC_CHECK_DECL(ft_pixel_mode_grays,[AC_DEFINE(HAVE_DECL_ft_pixel_mode_grays,1,Define if your freetype2 build declares ft_pixel_mode_grays.)],,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
#endif
])
AC_CHECK_DECL(FT_PIXEL_MODE_LCD,,,[
#ifdef HAVE_FT2BUILD_H
#include <ft2build.h>
#include FT_FREETYPE_H
......
......@@ -18,6 +18,7 @@
#ident "$Id$"
#include "../config.h"
#include <sys/types.h>
#include <sys/wait.h>
#include <signal.h>
#include <stdlib.h>
......
......@@ -5153,7 +5153,9 @@ vte_sequence_handler_window_manipulation(VteTerminal *terminal,
GQuark match_quark,
GValueArray *params)
{
#if GTK_CHECK_VERSION(2,2,0)
GdkScreen *gscreen;
#endif
VteScreen *screen;
GValue *value;
GtkWidget *widget;
......@@ -5358,17 +5360,22 @@ vte_sequence_handler_window_manipulation(VteTerminal *terminal,
fprintf(stderr, "Reporting screen size.\n");
}
#endif
#if GTK_CHECK_VERSION(2,2,0)
if (gtk_widget_has_screen(widget)) {
gscreen = gtk_widget_get_screen(widget);
} else {
gscreen = gdk_screen_get_default();
}
height = gdk_screen_get_height(gscreen);
width = gdk_screen_get_width(gscreen);
#else
height = gdk_screen_height();
width = gdk_screen_width();
#endif
snprintf(buf, sizeof(buf),
"%s%ld;%ldt", _VTE_CAP_CSI,
gdk_screen_get_height(gscreen) /
terminal->char_height,
gdk_screen_get_width(gscreen) /
terminal->char_width);
height / terminal->char_height,
width / terminal->char_width);
vte_terminal_feed_child(terminal, buf, strlen(buf));
break;
case 20:
......
......@@ -30,7 +30,6 @@
#endif
#include "debug.h"
#include "vte.h"
#include <gdk/gdkx.h>
#ifdef ENABLE_NLS
#include <libintl.h>
......@@ -341,8 +340,6 @@ static void
take_xconsole_ownership(GtkWidget *widget, gpointer data)
{
char *name, hostname[255];
GdkDisplay *display;
Atom xatom;
GdkAtom atom;
GtkClipboard *clipboard;
GtkTargetEntry targets[] = {
......@@ -354,11 +351,9 @@ take_xconsole_ownership(GtkWidget *widget, gpointer data)
memset(hostname, '\0', sizeof(hostname));
gethostname(hostname, sizeof(hostname) - 1);
display = gdk_display_get_default();
name = g_strdup_printf("MIT_CONSOLE_%s", hostname);
xatom = gdk_x11_get_xatom_by_name_for_display(display, name);
atom = gdk_x11_xatom_to_atom_for_display(display, xatom);
atom = gdk_atom_intern(name, FALSE);
clipboard = gtk_clipboard_get(atom);
g_free(name);
......
......@@ -37,11 +37,13 @@
struct _vte_draw_impl
*_vte_draw_impls[] = {
&_vte_draw_skel,
#if GTK_CHECK_VERSION(2,2,0)
#ifndef X_DISPLAY_MISSING
#ifdef HAVE_GL
/* &_vte_draw_gl, */
#endif
#endif
#endif
#ifndef X_DISPLAY_MISSING
#ifdef HAVE_XFT2
&_vte_draw_xft,
......
......@@ -89,7 +89,11 @@ _vte_fc_transcribe_from_pango_font_description(FcPattern *pattern,
FcPatternAddDouble(pattern, FC_SIZE, size);
/* Set the language for the pattern. */
#if GTK_CHECK_VERSION(2,2,0)
context = gdk_pango_context_get_for_screen(gdk_screen_get_default());
#else
context = gdk_pango_context_get();
#endif
language = pango_context_get_language(context);
if (pango_language_to_string(language) != NULL) {
FcPatternAddString(pattern, FC_LANG,
......@@ -115,7 +119,9 @@ static void
_vte_fc_defaults_from_gtk(FcPattern *pattern)
{
GtkSettings *settings;
#if GTK_CHECK_VERSION(2,2,0)
GdkScreen *screen;
#endif
GObjectClass *klass;
int i, antialias = -1, hinting = -1, dpi = -1;
double d;
......@@ -123,8 +129,12 @@ _vte_fc_defaults_from_gtk(FcPattern *pattern)
FcResult result;
/* Add any defaults configured for GTK+. */
#if GTK_CHECK_VERSION(2,2,0)
screen = gdk_screen_get_default();
settings = gtk_settings_get_for_screen(screen);
#else
settings = gtk_settings_get_default();
#endif
if (settings == NULL) {
return;
}
......
......@@ -17,7 +17,9 @@
*/
#include "../config.h"
#include <gtk/gtk.h>
#if GTK_CHECK_VERSION(2,2,0)
#ifndef X_DISPLAY_MISSING
#ifdef HAVE_GL
......@@ -421,3 +423,4 @@ struct _vte_draw_impl _vte_draw_gl = {
#endif
#endif
#endif
......@@ -512,25 +512,34 @@ _vte_glyph_get(struct _vte_glyph_cache *cache, gunichar c)
ioffset *= (-face->glyph->bitmap.pitch);
}
switch (face->glyph->bitmap.pixel_mode) {
#ifdef HAVE_DECL_FT_PIXEL_MODE_MONO
case FT_PIXEL_MODE_MONO:
#else
#ifdef HAVE_DECL_ft_pixel_mode_mono
case ft_pixel_mode_mono:
#else
#error Neither ft_pixel_mode_mono nor FT_PIXEL_MODE_MONO is defined!
#endif
#endif
ioffset += (x / 8);
t = (face->glyph->bitmap.buffer[ioffset] << (x % 8));
r = g = b = (t >> 7) ? 0xff : 0;
break;
#ifdef HAVE_DECL_FT_PIXEL_MODE_GRAY2
case FT_PIXEL_MODE_GRAY2:
ioffset += (x / 4);
t = (face->glyph->bitmap.buffer[ioffset] << ((x % 4) * 2));
r = g = b = CLAMP((t >> 6) * 0x55, 0, 0xff);
break;
#endif
#ifdef HAVE_DECL_FT_PIXEL_MODE_GRAY4
case FT_PIXEL_MODE_GRAY4:
ioffset += (x / 2);
t = (face->glyph->bitmap.buffer[ioffset] << ((x % 2) * 4)) & 7;
r = g = b = CLAMP((t >> 4) * 0x25, 0, 0xff);
break;
case FT_PIXEL_MODE_GRAY:
ioffset += x;
r = g = b = face->glyph->bitmap.buffer[ioffset];
break;
#endif
#ifdef HAVE_DECL_FT_PIXEL_MODE_LCD
case FT_PIXEL_MODE_LCD:
case FT_PIXEL_MODE_LCD_V:
ioffset += (x * 3);
......@@ -538,8 +547,17 @@ _vte_glyph_get(struct _vte_glyph_cache *cache, gunichar c)
g = face->glyph->bitmap.buffer[ioffset++];
b = face->glyph->bitmap.buffer[ioffset++];
break;
#endif
#ifdef HAVE_DECL_FT_PIXEL_MODE_GRAY
case FT_PIXEL_MODE_GRAY:
#else
#ifdef HAVE_DECL_ft_pixel_mode_grays
case ft_pixel_mode_grays:
#endif
ioffset += x;
r = g = b = face->glyph->bitmap.buffer[ioffset];
#endif
default:
r = g = b = 0;
g_assert_not_reached();
break;
}
......
......@@ -110,13 +110,19 @@ _vte_pango_get_colormap(struct _vte_draw *draw)
static void
_vte_pango_start(struct _vte_draw *draw)
{
#if GTK_CHECK_VERSION(2,2,0)
GdkScreen *screen;
#endif
PangoContext *ctx;
struct _vte_pango_data *data;
data = (struct _vte_pango_data*) draw->impl_data;
#if GTK_CHECK_VERSION(2,2,0)
screen = gdk_drawable_get_screen(draw->widget->window);
ctx = gdk_pango_context_get_for_screen(screen);
#else
ctx = gdk_pango_context_get();
#endif
if (PANGO_IS_LAYOUT(data->layout)) {
g_object_unref(G_OBJECT(data->layout));
......@@ -249,7 +255,9 @@ static void
_vte_pango_set_text_font(struct _vte_draw *draw,
const PangoFontDescription *fontdesc)
{
#if GTK_CHECK_VERSION(2,2,0)
GdkScreen *screen;
#endif
PangoContext *ctx;
PangoLayout *layout;
PangoLayoutIter *iter;
......@@ -262,8 +270,16 @@ _vte_pango_set_text_font(struct _vte_draw *draw,
data = (struct _vte_pango_data*) draw->impl_data;
screen = gdk_screen_get_default();
#if GTK_CHECK_VERSION(2,2,0)
if (gtk_widget_has_screen(draw->widget)) {
screen = gtk_widget_get_screen(draw->widget);
} else {
screen = gdk_screen_get_default();
}
ctx = gdk_pango_context_get_for_screen(screen);
#else
ctx = gdk_pango_context_get();
#endif
layout = pango_layout_new(ctx);
if (data->font != NULL) {
pango_font_description_free(data->font);
......
......@@ -284,8 +284,8 @@ static void
_vte_pango_x_set_text_font(struct _vte_draw *draw,
const PangoFontDescription *fontdesc)
{
GdkScreen *screen;
PangoContext *ctx;
Display *display;
PangoLayout *layout;
PangoLayoutIter *iter;
PangoRectangle ink, logical;
......@@ -297,8 +297,16 @@ _vte_pango_x_set_text_font(struct _vte_draw *draw,
data = (struct _vte_pango_x_data*) draw->impl_data;
screen = gdk_screen_get_default();
ctx = gdk_pango_context_get_for_screen(screen);
#if GTK_CHECK_VERSION(2,2,0)
display = gdk_x11_display_get_xdisplay(gtk_widget_get_display(draw->widget));
#else
display = gdk_display;
#endif
if (PANGO_IS_CONTEXT(data->ctx)) {
g_object_unref(G_OBJECT(data->ctx));
}
ctx = pango_x_get_context(display);
layout = pango_layout_new(ctx);
if (data->font != NULL) {
pango_font_description_free(data->font);
......@@ -351,6 +359,7 @@ _vte_pango_x_set_text_font(struct _vte_draw *draw,
}
#endif
g_object_unref(G_OBJECT(layout));
g_object_unref(G_OBJECT(ctx));
}
static int
......
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