/* The lwlib interface to Athena widgets.
Copyright (C) 1993 Chuck Thompson <cthomp@cs.uiuc.edu>
-Copyright (C) 1994, 2001-2011 Free Software Foundation, Inc.
+Copyright (C) 1994, 2001-2014 Free Software Foundation, Inc.
This file is part of the Lucid Widget Library.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with GNU Emacs; see the file COPYING. If not, write to
-the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-Boston, MA 02110-1301, USA. */
+along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
#include <stdio.h>
#include <setjmp.h>
-#include <ctype.h>
#include <lisp.h>
XftFont *fn;
/* Try to convert Gtk-syntax (Sans 9) to Xft syntax Sans-9. */
- while (i > 0 && isdigit (fname[i]))
+ while (i > 0 && '0' <= fname[i] && fname[i] <= '9')
--i;
if (fname[i] == ' ')
{
}
fn = XftFontOpenName (XtDisplay (widget), screen, fname);
- if (fname != name) free (fname);
+ if (fname != name) xfree (fname);
return fn;
}
{
int w = 0, h = 0;
char *bp = text;
-
+
while (bp && *bp != '\0')
{
XGlyphInfo gi;
Widget parent = XtParent (widget);
struct widget_xft_data *data = NULL;
int nr;
- while (parent && !inst)
+ while (parent && !inst)
{
inst = lw_get_widget_instance (parent);
parent = XtParent (parent);
}
if (!inst || !inst->xft_data || !inst->xft_data[0].xft_font) return 0;
- for (nr = 0; data == NULL && nr < inst->nr_xft_data; ++nr)
+ for (nr = 0; data == NULL && nr < inst->nr_xft_data; ++nr)
{
- if (inst->xft_data[nr].widget == widget)
+ if (inst->xft_data[nr].widget == widget)
data = &inst->xft_data[nr];
}
Cardinal *num_params)
{
struct widget_xft_data *data = find_xft_data (widget);
- if (data)
+ if (data)
{
char *lbl;
/* Since this isn't used for rectangle buttons, use it to for armed. */
Cardinal *num_params)
{
struct widget_xft_data *data = find_xft_data (widget);
- if (data)
+ if (data)
{
Dimension cr;
XtVaGetValues (widget, XtNcornerRoundPercent, &cr, NULL);
- if (cr == 1)
+ if (cr == 1)
{
char *lbl;
XtVaSetValues (widget, XtNcornerRoundPercent, 0, NULL);
xaw_destroy_instance (widget_instance *instance)
{
#ifdef HAVE_XFT
- if (instance->xft_data)
+ if (instance->xft_data)
{
int i;
- for (i = 0; i < instance->nr_xft_data; ++i)
+ for (i = 0; i < instance->nr_xft_data; ++i)
{
if (instance->xft_data[i].xft_draw)
XftDrawDestroy (instance->xft_data[i].xft_draw);
- if (instance->xft_data[i].p != None)
+ if (instance->xft_data[i].p != None)
{
XtVaSetValues (instance->xft_data[i].widget, XtNbitmap, None,
NULL);
if (instance->xft_data[0].xft_font)
XftFontClose (XtDisplay (instance->widget),
instance->xft_data[0].xft_font);
- free (instance->xft_data);
+ xfree (instance->xft_data);
}
#endif
if (XtIsSubclass (instance->widget, dialogWidgetClass))
static Boolean actions_initted = False;
#ifdef HAVE_XFT
-static XtActionsRec button_actions[] =
+static XtActionsRec button_actions[] =
{
{ "my_reset", command_reset },
{ "my_press", command_press },
XtVaGetValues (dialog,
XtNnumChildren, &num,
XtNchildren, &ch, NULL);
- for (i = 0; i < num; ++i)
+ for (i = 0; i < num; ++i)
{
if (!XtIsSubclass (ch[i], commandWidgetClass)
&& XtIsSubclass (ch[i], labelWidgetClass))
}
instance->xft_data = 0;
instance->nr_xft_data = 0;
- if (w)
+ if (w)
{
- XtResource rec[] =
+ XtResource rec[] =
{ { "font", "Font", XtRString, sizeof(String), 0, XtRString,
(XtPointer)"Sans-10" }};
char *fontName = NULL;
else
XFreeFont (XtDisplay (dialog), xfn);
}
-
- if (xft_font)
+
+ if (xft_font)
{
instance->nr_xft_data = left_buttons + right_buttons + 1;
instance->xft_data = calloc (instance->nr_xft_data,
{
ac = 0;
XtSetArg (av [ac], XtNfromHoriz, button); ac++;
- if (i == 0)
+ if (i == 0)
{
/* Separator to the other buttons. */
XtSetArg (av [ac], XtNhorizDistance, 30); ac++;