Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

Commit

Permalink
At last, merge the putty-gtk2 branch back into the trunk!
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.tartarus.org/sgt/putty@8037 cda61777-01e9-0310-a592-d414129be87e
  • Loading branch information
simon committed Jun 4, 2008
1 parent 881da16 commit f160b7b
Show file tree
Hide file tree
Showing 22 changed files with 1,387 additions and 551 deletions.
2 changes: 1 addition & 1 deletion LICENCE
Expand Up @@ -3,7 +3,7 @@ PuTTY is copyright 1997-2008 Simon Tatham.
Portions copyright Robert de Bath, Joris van Rantwijk, Delian
Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry,
Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, Markus
Kuhn, and CORE SDI S.A.
Kuhn, Colin Watson, and CORE SDI S.A.

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
Expand Down
2 changes: 1 addition & 1 deletion Recipe
Expand Up @@ -245,7 +245,7 @@ GUITERM = TERMINAL window windlg winctrls sizetip winucs winprint

# Same thing on Unix.
UXTERM = TERMINAL uxcfg sercfg uxucs uxprint timing
GTKTERM = UXTERM gtkwin gtkcfg gtkdlg gtkcols xkeysym
GTKTERM = UXTERM gtkwin gtkcfg gtkdlg gtkfont gtkcols xkeysym
OSXTERM = UXTERM osxwin osxdlg osxctrls

# Non-SSH back ends (putty, puttytel, plink).
Expand Down
2 changes: 1 addition & 1 deletion charset/macenc.c
@@ -1,4 +1,4 @@
/* $Id: macenc.c,v 1.2 2003/01/25 19:21:56 ben Exp $ */
/* $Id$ */
/*
* Copyright (c) 2003 Ben Harris
* All rights reserved.
Expand Down
9 changes: 9 additions & 0 deletions dialog.h
Expand Up @@ -209,6 +209,10 @@ union control {
* has a drop-down list built in. (Note that a _non_-
* editable drop-down list is done as a special case of a
* list box.)
*
* Don't try setting has_list and password on the same
* control; front ends are not required to support that
* combination.
*/
int has_list;
/*
Expand Down Expand Up @@ -333,6 +337,11 @@ union control {
* the respective widths of `ncols' columns, which together
* will exactly fit the width of the list box. Otherwise
* `percentages' must be NULL.
*
* There should never be more than one column in a
* drop-down list (one with height==0), because front ends
* may have to implement it as a special case of an
* editable combo box.
*/
int ncols; /* number of columns */
int *percentages; /* % width of each column */
Expand Down
4 changes: 2 additions & 2 deletions doc/licence.but
Expand Up @@ -6,8 +6,8 @@ PuTTY is \i{copyright} 1997-2008 Simon Tatham.

Portions copyright Robert de Bath, Joris van Rantwijk, Delian
Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry,
Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, Markus Kuhn,
and CORE SDI S.A.
Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, Markus
Kuhn, Colin Watson, and CORE SDI S.A.

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation files
Expand Down
2 changes: 1 addition & 1 deletion mac/mac_res.r
Expand Up @@ -1247,7 +1247,7 @@ resource 'TEXT' (wLicence, "licence", purgeable) {
"Portions copyright Robert de Bath, Joris van Rantwijk, Delian "
"Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry, "
"Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, Markus "
"Kuhn, and CORE SDI S.A.\n"
"Kuhn, Colin Watson, and CORE SDI S.A.\n"
"\n"
"Permission is hereby granted, free of charge, to any person "
"obtaining a copy of this software and associated documentation "
Expand Down
2 changes: 1 addition & 1 deletion mac/macabout.c
@@ -1,4 +1,4 @@
/* $Id: macabout.c,v 1.3 2003/03/29 23:07:55 ben Exp $ */
/* $Id$ */
/*
* Copyright (c) 1999, 2002, 2003 Ben Harris
* All rights reserved.
Expand Down
2 changes: 1 addition & 1 deletion mac/macpgen.c
@@ -1,4 +1,4 @@
/* $Id: macpgen.c,v 1.5 2003/02/23 13:31:12 ben Exp $ */
/* $Id$ */
/*
* Copyright (c) 1999, 2003 Ben Harris
* All rights reserved.
Expand Down
2 changes: 1 addition & 1 deletion mac/macpgen.r
Expand Up @@ -448,7 +448,7 @@ resource 'TEXT' (wLicence, "licence", purgeable) {
"Portions copyright Robert de Bath, Joris van Rantwijk, Delian "
"Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry, "
"Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, Markus "
"Kuhn, and CORE SDI S.A.\n"
"Kuhn, Colin Watson, and CORE SDI S.A.\n"
"\n"
"Permission is hereby granted, free of charge, to any person "
"obtaining a copy of this software and associated documentation "
Expand Down
2 changes: 1 addition & 1 deletion mac/macpgkey.c
@@ -1,4 +1,4 @@
/* $Id: macpgkey.c,v 1.5 2003/03/29 23:57:55 ben Exp $ */
/* $Id$ */
/*
* Copyright (c) 2003 Ben Harris
* Copyright (c) 1997-2003 Simon Tatham
Expand Down
2 changes: 1 addition & 1 deletion mac/macpgrid.h
@@ -1,4 +1,4 @@
/* $Id: macpgrid.h,v 1.4 2003/02/20 22:55:09 ben Exp $ */
/* $Id$ */

/*
* macpgrid.h -- Mac resource IDs for PuTTYgen
Expand Down
4 changes: 4 additions & 0 deletions mkauto.sh
Expand Up @@ -3,6 +3,10 @@
# It's separate from mkfiles.pl because it won't work (and isn't needed)
# on a non-Unix system.

# It's nice to be able to run this from inside the unix subdir as
# well as from outside.
test -f unix.h && cd ..

# Persuade automake to give us a copy of its install-sh. This is a
# pain because I don't actually want to have to _use_ automake.
# Instead, I construct a trivial unrelated automake project in a
Expand Down
10 changes: 8 additions & 2 deletions mkfiles.pl
Expand Up @@ -924,12 +924,18 @@ sub manpages {
"# You can define this path to point at your tools if you need to\n".
"# TOOLPATH = /opt/gcc/bin\n".
"CC = \$(TOOLPATH)cc\n".
"# You can manually set this to `gtk-config' or `pkg-config gtk+-1.2'\n".
"# (depending on what works on your system) if you want to enforce\n".
"# building with GTK 1.2, or you can set it to `pkg-config gtk+-2.0'\n".
"# if you want to enforce 2.0. The default is to try 2.0 and fall back\n".
"# to 1.2 if it isn't found.\n".
"GTK_CONFIG = sh -c 'pkg-config gtk+-2.0 \$\$0 2>/dev/null || gtk-config \$\$0'\n".
"\n".
&splitline("CFLAGS = -O2 -Wall -Werror -g " .
(join " ", map {"-I$dirpfx$_"} @srcdirs) .
" `gtk-config --cflags`").
" `\$(GTK_CONFIG) --cflags`").
" -D _FILE_OFFSET_BITS=64\n".
"XLDFLAGS = \$(LDFLAGS) `gtk-config --libs`\n".
"XLDFLAGS = \$(LDFLAGS) `\$(GTK_CONFIG) --libs`\n".
"ULDFLAGS = \$(LDFLAGS)\n".
"INSTALL=install\n",
"INSTALL_PROGRAM=\$(INSTALL)\n",
Expand Down
24 changes: 23 additions & 1 deletion unix/configure.ac
Expand Up @@ -18,7 +18,23 @@ AC_CHECK_HEADERS([utmpx.h sys/select.h],,,[
#include <sys/types.h>
#include <utmp.h>])

AM_PATH_GTK([1.2.0], [all_targets="all-cli all-gtk"], [all_targets="all-cli"])
# Look for both GTK 1 and GTK 2.
AM_PATH_GTK([1.2.0], [gtk=1], [gtk=none])
AM_PATH_GTK_2_0([2.0.0], [gtk=2], [])
if test "$gtk" = "none"; then
all_targets="all-cli"
else
all_targets="all-cli all-gtk"
fi
if test "$gtk" = "2"; then
ac_save_CFLAGS="$CFLAGS"
ac_save_LIBS="$LIBS"
CFLAGS="$CFLAGS $GTK_CFLAGS"
LIBS="$GTK_LIBS $LIBS"
AC_CHECK_FUNCS([pango_font_family_is_monospace pango_font_map_list_families])
CFLAGS="$ac_save_CFLAGS"
LIBS="$ac_save_LIBS"
fi
AC_SUBST([all_targets])

AC_SEARCH_LIBS([socket], [xnet])
Expand Down Expand Up @@ -48,4 +64,10 @@ AH_BOTTOM([
#ifndef HAVE_SYS_SELECT_H
# define HAVE_NO_SYS_SELECT_H
#endif
#ifndef HAVE_PANGO_FONT_FAMILY_IS_MONOSPACE
# define PANGO_PRE_1POINT4
#endif
#ifndef HAVE_PANGO_FONT_MAP_LIST_FAMILIES
# define PANGO_PRE_1POINT6
#endif
])
83 changes: 70 additions & 13 deletions unix/gtkcols.c
Expand Up @@ -3,24 +3,30 @@
*/

#include "gtkcols.h"
#include <gtk/gtk.h>

static void columns_init(Columns *cols);
static void columns_class_init(ColumnsClass *klass);
static void columns_map(GtkWidget *widget);
static void columns_unmap(GtkWidget *widget);
#if !GTK_CHECK_VERSION(2,0,0)
static void columns_draw(GtkWidget *widget, GdkRectangle *area);
static gint columns_expose(GtkWidget *widget, GdkEventExpose *event);
#endif
static void columns_base_add(GtkContainer *container, GtkWidget *widget);
static void columns_remove(GtkContainer *container, GtkWidget *widget);
static void columns_forall(GtkContainer *container, gboolean include_internals,
GtkCallback callback, gpointer callback_data);
#if !GTK_CHECK_VERSION(2,0,0)
static gint columns_focus(GtkContainer *container, GtkDirectionType dir);
#endif
static GtkType columns_child_type(GtkContainer *container);
static void columns_size_request(GtkWidget *widget, GtkRequisition *req);
static void columns_size_allocate(GtkWidget *widget, GtkAllocation *alloc);

static GtkContainerClass *parent_class = NULL;

#if !GTK_CHECK_VERSION(2,0,0)
GtkType columns_get_type(void)
{
static GtkType columns_type = 0;
Expand All @@ -42,42 +48,74 @@ GtkType columns_get_type(void)

return columns_type;
}
#else
GType columns_get_type(void)
{
static GType columns_type = 0;

if (!columns_type) {
static const GTypeInfo columns_info = {
sizeof(ColumnsClass),
NULL,
NULL,
(GClassInitFunc) columns_class_init,
NULL,
NULL,
sizeof(Columns),
0,
(GInstanceInitFunc)columns_init,
};

columns_type = g_type_register_static(GTK_TYPE_CONTAINER, "Columns",
&columns_info, 0);
}

return columns_type;
}
#endif

#if !GTK_CHECK_VERSION(2,0,0)
static gint (*columns_inherited_focus)(GtkContainer *container,
GtkDirectionType direction);
#endif

static void columns_class_init(ColumnsClass *klass)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;

object_class = (GtkObjectClass *)klass;
widget_class = (GtkWidgetClass *)klass;
container_class = (GtkContainerClass *)klass;

#if !GTK_CHECK_VERSION(2,0,0)
/* GtkObjectClass *object_class = (GtkObjectClass *)klass; */
GtkWidgetClass *widget_class = (GtkWidgetClass *)klass;
GtkContainerClass *container_class = (GtkContainerClass *)klass;
#else
/* GObjectClass *object_class = G_OBJECT_CLASS(klass); */
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
GtkContainerClass *container_class = GTK_CONTAINER_CLASS(klass);
#endif

#if !GTK_CHECK_VERSION(2,0,0)
parent_class = gtk_type_class(GTK_TYPE_CONTAINER);

/*
* FIXME: do we have to do all this faffing with set_arg,
* get_arg and child_arg_type? Ick.
*/
#else
parent_class = g_type_class_peek_parent(klass);
#endif

widget_class->map = columns_map;
widget_class->unmap = columns_unmap;
#if !GTK_CHECK_VERSION(2,0,0)
widget_class->draw = columns_draw;
widget_class->expose_event = columns_expose;
#endif
widget_class->size_request = columns_size_request;
widget_class->size_allocate = columns_size_allocate;

container_class->add = columns_base_add;
container_class->remove = columns_remove;
container_class->forall = columns_forall;
container_class->child_type = columns_child_type;
#if !GTK_CHECK_VERSION(2,0,0)
/* Save the previous value of this method. */
if (!columns_inherited_focus)
columns_inherited_focus = container_class->focus;
container_class->focus = columns_focus;
#endif
}

static void columns_init(Columns *cols)
Expand Down Expand Up @@ -135,6 +173,7 @@ static void columns_unmap(GtkWidget *widget)
gtk_widget_unmap(child->widget);
}
}
#if !GTK_CHECK_VERSION(2,0,0)
static void columns_draw(GtkWidget *widget, GdkRectangle *area)
{
Columns *cols;
Expand Down Expand Up @@ -186,6 +225,7 @@ static gint columns_expose(GtkWidget *widget, GdkEventExpose *event)
}
return FALSE;
}
#endif

static void columns_base_add(GtkContainer *container, GtkWidget *widget)
{
Expand Down Expand Up @@ -241,6 +281,9 @@ static void columns_remove(GtkContainer *container, GtkWidget *widget)

cols->taborder = g_list_remove_link(cols->taborder, children);
g_list_free(children);
#if GTK_CHECK_VERSION(2,0,0)
gtk_container_set_focus_chain(container, cols->taborder);
#endif
break;
}
}
Expand Down Expand Up @@ -284,7 +327,12 @@ GtkWidget *columns_new(gint spacing)
{
Columns *cols;

#if !GTK_CHECK_VERSION(2,0,0)
cols = gtk_type_new(columns_get_type());
#else
cols = g_object_new(TYPE_COLUMNS, NULL);
#endif

cols->spacing = spacing;

return GTK_WIDGET(cols);
Expand Down Expand Up @@ -332,6 +380,10 @@ void columns_add(Columns *cols, GtkWidget *child,

gtk_widget_set_parent(child, GTK_WIDGET(cols));

#if GTK_CHECK_VERSION(2,0,0)
gtk_container_set_focus_chain(GTK_CONTAINER(cols), cols->taborder);
#endif

if (GTK_WIDGET_REALIZED(cols))
gtk_widget_realize(child);

Expand Down Expand Up @@ -382,10 +434,14 @@ void columns_taborder_last(Columns *cols, GtkWidget *widget)
cols->taborder = g_list_remove_link(cols->taborder, children);
g_list_free(children);
cols->taborder = g_list_append(cols->taborder, widget);
#if GTK_CHECK_VERSION(2,0,0)
gtk_container_set_focus_chain(GTK_CONTAINER(cols), cols->taborder);
#endif
break;
}
}

#if !GTK_CHECK_VERSION(2,0,0)
/*
* Override GtkContainer's focus movement so the user can
* explicitly specify the tab order.
Expand Down Expand Up @@ -449,6 +505,7 @@ static gint columns_focus(GtkContainer *container, GtkDirectionType dir)
} else
return columns_inherited_focus(container, dir);
}
#endif

/*
* Now here comes the interesting bit. The actual layout part is
Expand Down

0 comments on commit f160b7b

Please sign in to comment.