Update to xmag 1.0.6

This commit is contained in:
matthieu 2015-05-10 10:20:17 +00:00
parent 1f9341bcd5
commit cf97e2e903
14 changed files with 1378 additions and 803 deletions

View File

@ -1,3 +1,64 @@
commit 011bec331e11d306c1811376e4de4d84ab2996ce
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Thu Apr 16 23:55:52 2015 -0700
xmag 1.0.6
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 975b6bcad6de9f57d46efc7bddb691a40703ae1e
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Jul 11 20:00:49 2014 -0700
Delete trailing whitespace from *.[ch] files
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit ec3e612fadfbdf60dc30bc8f155d5fb6a5fd501f
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Jul 11 19:58:18 2014 -0700
Convert sprintf to snprintf
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit b23149c5cda460d8ff932e891eb23df897d10dc0
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Fri Jul 11 19:56:19 2014 -0700
Fix typos & wording issues in source comments
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 2be3155114bfcd0c0071a8c8f5973d499eba8736
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat May 31 23:29:53 2014 -0700
autogen.sh: Honor NOCONFIGURE=1
See http://people.gnome.org/~walters/docs/build-api.txt
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 47ea99fc84c3067eea428cadc0cd33941bd9b04c
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat May 31 23:29:53 2014 -0700
configure: Drop AM_MAINTAINER_MODE
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit b40365c8650d58e9f0a3ba35cba20f7ece38cdd6
Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat May 31 23:29:38 2014 -0700
config: Add missing AC_CONFIG_SRCDIR
Regroup AC statements under the Autoconf initialization section.
Regroup AM statements under the Automake initialization section.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
commit 8c4b91ea40088bc80de9cc2695f77a27ce78b0d9 commit 8c4b91ea40088bc80de9cc2695f77a27ce78b0d9
Author: Alan Coopersmith <alan.coopersmith@oracle.com> Author: Alan Coopersmith <alan.coopersmith@oracle.com>
Date: Sat Jan 12 22:16:24 2013 -0800 Date: Sat Jan 12 22:16:24 2013 -0800

View File

@ -41,7 +41,7 @@ from The Open Group.
/*ARGSUSED*/ /*ARGSUSED*/
static Boolean static Boolean
ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type, ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
XtPointer *value, unsigned long *length, int *format) XtPointer *value, unsigned long *length, int *format)
{ {
Boolean success; Boolean success;
@ -50,8 +50,8 @@ ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
ScaleWidget sw = (ScaleWidget) w; ScaleWidget sw = (ScaleWidget) w;
Pixmap *pixmap = (Pixmap *) XtMalloc(sizeof(Pixmap)); Pixmap *pixmap = (Pixmap *) XtMalloc(sizeof(Pixmap));
*pixmap = XCreatePixmap(XtDisplay(w), XtWindow(w), *pixmap = XCreatePixmap(XtDisplay(w), XtWindow(w),
sw->scale.image->width, sw->scale.image->width,
sw->scale.image->height, sw->scale.image->height,
sw->scale.image->depth); sw->scale.image->depth);
XPutImage(XtDisplay(w), *pixmap, sw->scale.gc, sw->scale.image, XPutImage(XtDisplay(w), *pixmap, sw->scale.gc, sw->scale.image,
0, 0, 0, 0, sw->scale.image->width, sw->scale.image->height); 0, 0, 0, 0, sw->scale.image->width, sw->scale.image->height);
@ -81,7 +81,7 @@ ConvertSelection(Widget w, Atom *selection, Atom *target, Atom *type,
return success; return success;
} }
void void
SWGrabSelection(Widget w, Time time) SWGrabSelection(Widget w, Time time)
{ {
(void) XtOwnSelection(w, XA_PRIMARY, time, ConvertSelection, NULL, NULL); (void) XtOwnSelection(w, XA_PRIMARY, time, ConvertSelection, NULL, NULL);
@ -90,8 +90,8 @@ SWGrabSelection(Widget w, Time time)
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
SelectionCallback(Widget w, XtPointer client_data, Atom *selection, SelectionCallback(Widget w, XtPointer client_data, Atom *selection,
Atom *type, XtPointer value, unsigned long *length, Atom *type, XtPointer value, unsigned long *length,
int *format) int *format)
{ {
@ -105,7 +105,7 @@ SelectionCallback(Widget w, XtPointer client_data, Atom *selection,
pixmap = (Pixmap *) value; pixmap = (Pixmap *) value;
XGetGeometry(XtDisplay(w), *pixmap, &root, &x, &y, XGetGeometry(XtDisplay(w), *pixmap, &root, &x, &y,
&width, &height, &border_width, &depth); &width, &height, &border_width, &depth);
image = XGetImage(XtDisplay(w), *pixmap, 0, 0, width, height, image = XGetImage(XtDisplay(w), *pixmap, 0, 0, width, height,
AllPlanes, ZPixmap); AllPlanes, ZPixmap);
SWAutoscale(w, NULL, NULL, NULL); SWAutoscale(w, NULL, NULL, NULL);
SWSetImage(w, image); SWSetImage(w, image);
@ -114,7 +114,7 @@ SelectionCallback(Widget w, XtPointer client_data, Atom *selection,
} }
} }
void void
SWRequestSelection(Widget w, Time time) SWRequestSelection(Widget w, Time time)
{ {
XtGetSelectionValue(w, XA_PRIMARY, XA_PIXMAP, SelectionCallback, NULL, XtGetSelectionValue(w, XA_PRIMARY, XA_PIXMAP, SelectionCallback, NULL,

View File

@ -1,11 +1,13 @@
Installation Instructions Installation Instructions
************************* *************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005, Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
2006, 2007, 2008 Free Software Foundation, Inc. Inc.
This file is free documentation; the Free Software Foundation gives Copying and distribution of this file, with or without modification,
unlimited permission to copy, distribute and modify it. are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without warranty of any kind.
Basic Installation Basic Installation
================== ==================
@ -13,7 +15,11 @@ Basic Installation
Briefly, the shell commands `./configure; make; make install' should Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for more-detailed instructions are generic; see the `README' file for
instructions specific to this package. instructions specific to this package. Some packages provide this
`INSTALL' file but do not implement all of the features documented
below. The lack of an optional feature in a given package is not
necessarily a bug. More recommendations for GNU packages can be found
in *note Makefile Conventions: (standards)Makefile Conventions.
The `configure' shell script attempts to guess correct values for The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses various system-dependent variables used during compilation. It uses
@ -42,7 +48,7 @@ may remove or edit it.
you want to change it or regenerate `configure' using a newer version you want to change it or regenerate `configure' using a newer version
of `autoconf'. of `autoconf'.
The simplest way to compile this package is: The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type 1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. `./configure' to configure the package for your system.
@ -53,12 +59,22 @@ The simplest way to compile this package is:
2. Type `make' to compile the package. 2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with 3. Optionally, type `make check' to run any self-tests that come with
the package. the package, generally using the just-built uninstalled binaries.
4. Type `make install' to install the programs and any data files and 4. Type `make install' to install the programs and any data files and
documentation. documentation. When installing into a prefix owned by root, it is
recommended that the package be configured and built as a regular
user, and only the `make install' phase executed with root
privileges.
5. You can remove the program binaries and object files from the 5. Optionally, type `make installcheck' to repeat any self-tests, but
this time using the binaries in their final installed location.
This target does not install anything. Running this target as a
regular user, particularly if the prior `make install' required
root privileges, verifies that the installation completed
correctly.
6. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is a different kind of computer), type `make distclean'. There is
@ -67,8 +83,15 @@ The simplest way to compile this package is:
all sorts of other programs in order to regenerate files that came all sorts of other programs in order to regenerate files that came
with the distribution. with the distribution.
6. Often, you can also type `make uninstall' to remove the installed 7. Often, you can also type `make uninstall' to remove the installed
files again. files again. In practice, not all packages have tested that
uninstallation works correctly, even though it is required by the
GNU Coding Standards.
8. Some packages, particularly those that use Automake, provide `make
distcheck', which can by used by developers to test that all other
targets like `make install' and `make uninstall' work correctly.
This target is generally not run by end users.
Compilers and Options Compilers and Options
===================== =====================
@ -93,7 +116,8 @@ same time, by placing the object files for each architecture in their
own directory. To do this, you can use GNU `make'. `cd' to the own directory. To do this, you can use GNU `make'. `cd' to the
directory where you want the object files and executables to go and run directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'. source code in the directory that `configure' is in and in `..'. This
is known as a "VPATH" build.
With a non-GNU `make', it is safer to compile the package for one With a non-GNU `make', it is safer to compile the package for one
architecture at a time in the source code directory. After you have architecture at a time in the source code directory. After you have
@ -120,7 +144,8 @@ Installation Names
By default, `make install' installs the package's commands under By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You `/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving can specify an installation prefix other than `/usr/local' by giving
`configure' the option `--prefix=PREFIX'. `configure' the option `--prefix=PREFIX', where PREFIX must be an
absolute file name.
You can specify separate installation prefixes for You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you architecture-specific files and architecture-independent files. If you
@ -131,15 +156,46 @@ Documentation and other data files still use the regular prefix.
In addition, if you use an unusual directory layout you can give In addition, if you use an unusual directory layout you can give
options like `--bindir=DIR' to specify different values for particular options like `--bindir=DIR' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them. you can set and what kinds of files go in them. In general, the
default for these options is expressed in terms of `${prefix}', so that
specifying just `--prefix' will affect all of the other directory
specifications that were not explicitly provided.
The most portable way to affect installation locations is to pass the
correct locations to `configure'; however, many packages provide one or
both of the following shortcuts of passing variable assignments to the
`make install' command line to change installation locations without
having to reconfigure or recompile.
The first method involves providing an override variable for each
affected directory. For example, `make install
prefix=/alternate/directory' will choose an alternate location for all
directory configuration variables that were expressed in terms of
`${prefix}'. Any directories that were specified during `configure',
but not in terms of `${prefix}', must each be overridden at install
time for the entire installation to be relocated. The approach of
makefile variable overrides for each directory variable is required by
the GNU Coding Standards, and ideally causes no recompilation.
However, some platforms have known limitations with the semantics of
shared libraries that end up requiring recompilation when using this
method, particularly noticeable in packages that use GNU Libtool.
The second method involves providing the `DESTDIR' variable. For
example, `make install DESTDIR=/alternate/directory' will prepend
`/alternate/directory' before all installation names. The approach of
`DESTDIR' overrides is not required by the GNU Coding Standards, and
does not work on platforms that have drive letters. On the other hand,
it does better at avoiding recompilation issues, and works well even
when some directory options were not specified in terms of `${prefix}'
at `configure' time.
Optional Features
=================
If the package supports it, you can cause programs to be installed If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package. `configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE They may also pay attention to `--with-PACKAGE' options, where PACKAGE
@ -152,6 +208,13 @@ find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations. `--x-libraries=DIR' to specify their locations.
Some packages offer the ability to configure how verbose the
execution of `make' will be. For these packages, running `./configure
--enable-silent-rules' sets the default to minimal output, which can be
overridden with `make V=1'; while running `./configure
--disable-silent-rules' sets the default to verbose, which can be
overridden with `make V=0'.
Particular systems Particular systems
================== ==================
@ -159,10 +222,15 @@ Particular systems
CC is not installed, it is recommended to use the following options in CC is not installed, it is recommended to use the following options in
order to use an ANSI C compiler: order to use an ANSI C compiler:
./configure CC="cc -Ae" ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
and if that doesn't work, install pre-built binaries of GCC for HP-UX. and if that doesn't work, install pre-built binaries of GCC for HP-UX.
HP-UX `make' updates targets which have the same time stamps as
their prerequisites, which makes it generally unusable when shipped
generated files such as `configure' are involved. Use GNU `make'
instead.
On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
parse its `<wchar.h>' header file. The option `-nodtk' can be used as parse its `<wchar.h>' header file. The option `-nodtk' can be used as
a workaround. If GNU CC is not installed, it is therefore recommended a workaround. If GNU CC is not installed, it is therefore recommended
@ -174,6 +242,16 @@ and if that doesn't work, try
./configure CC="cc -nodtk" ./configure CC="cc -nodtk"
On Solaris, don't put `/usr/ucb' early in your `PATH'. This
directory contains several dysfunctional programs; working variants of
these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
in your `PATH', put it _after_ `/usr/bin'.
On Haiku, software installed for all users goes in `/boot/common',
not `/usr/local'. It is recommended to use the following options:
./configure --prefix=/boot/common
Specifying the System Type Specifying the System Type
========================== ==========================
@ -189,7 +267,8 @@ type, such as `sun4', or a canonical name which has the form:
where SYSTEM can have one of these forms: where SYSTEM can have one of these forms:
OS KERNEL-OS OS
KERNEL-OS
See the file `config.sub' for the possible values of each field. If See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't `config.sub' isn't included in this package, then this package doesn't
@ -277,7 +356,7 @@ operates.
`configure' can determine that directory automatically. `configure' can determine that directory automatically.
`--prefix=DIR' `--prefix=DIR'
Use DIR as the installation prefix. *Note Installation Names:: Use DIR as the installation prefix. *note Installation Names::
for more details, including other options available for fine-tuning for more details, including other options available for fine-tuning
the installation locations. the installation locations.

View File

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.12.5 from Makefile.am. # Makefile.in generated by automake 1.12.6 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994-2012 Free Software Foundation, Inc. # Copyright (C) 1994-2012 Free Software Foundation, Inc.
@ -76,8 +76,8 @@ bin_PROGRAMS = xmag$(EXEEXT)
subdir = . subdir = .
DIST_COMMON = README $(am__configure_deps) $(dist_appdefault_DATA) \ DIST_COMMON = README $(am__configure_deps) $(dist_appdefault_DATA) \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/config.h.in $(top_srcdir)/configure AUTHORS COPYING \ $(srcdir)/config.h.in $(top_srcdir)/configure COPYING \
ChangeLog INSTALL NEWS config.guess config.sub depcomp \ ChangeLog INSTALL NEWS compile config.guess config.sub depcomp \
install-sh missing install-sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__aclocal_m4_deps = $(top_srcdir)/configure.ac
@ -261,7 +261,6 @@ LIBS = @LIBS@
LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_DIR = @LIB_MAN_DIR@
LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MAN_SUBSTS = @MAN_SUBSTS@ MAN_SUBSTS = @MAN_SUBSTS@
MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_DIR = @MISC_MAN_DIR@
@ -277,6 +276,8 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@ PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
SED = @SED@ SED = @SED@
SET_MAKE = @SET_MAKE@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@ SHELL = @SHELL@
@ -368,7 +369,7 @@ all: config.h
.SUFFIXES: .c .o .obj .SUFFIXES: .c .o .obj
am--refresh: Makefile am--refresh: Makefile
@: @:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \ @for dep in $?; do \
case '$(am__configure_deps)' in \ case '$(am__configure_deps)' in \
*$$dep*) \ *$$dep*) \
@ -395,9 +396,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
$(SHELL) ./config.status --recheck $(SHELL) ./config.status --recheck
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(top_srcdir)/configure: $(am__configure_deps)
$(am__cd) $(srcdir) && $(AUTOCONF) $(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
$(am__aclocal_m4_deps): $(am__aclocal_m4_deps):
@ -408,7 +409,7 @@ config.h: stamp-h1
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1 @rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(srcdir)/config.h.in: $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER)) ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1 rm -f stamp-h1
touch $@ touch $@

View File

@ -76,7 +76,7 @@ RootWindowClassRec rootWindowClassRec = {
WidgetClass rootWindowWidgetClass = (WidgetClass)&rootWindowClassRec; WidgetClass rootWindowWidgetClass = (WidgetClass)&rootWindowClassRec;
/*ARGSUSED*/ /*ARGSUSED*/
static void static void
Realize(Widget w, XtValueMask *value_mask, XSetWindowAttributes *attributes) Realize(Widget w, XtValueMask *value_mask, XSetWindowAttributes *attributes)
{ {
w->core.window = RootWindowOfScreen(w->core.screen); w->core.window = RootWindowOfScreen(w->core.screen);

View File

@ -105,18 +105,18 @@ static void ClassInitialize ( void );
static void GetGC ( ScaleWidget sw ); static void GetGC ( ScaleWidget sw );
static void GetInitialScaleValues ( ScaleWidget sw ); static void GetInitialScaleValues ( ScaleWidget sw );
static void GetRectangleBuffer ( ScaleWidget sw, Cardinal buffer_size ); static void GetRectangleBuffer ( ScaleWidget sw, Cardinal buffer_size );
static void Initialize ( Widget request, Widget new, ArgList args, static void Initialize ( Widget request, Widget new, ArgList args,
Cardinal *num_args ); Cardinal *num_args );
static void BuildTable ( ScaleWidget sw ); static void BuildTable ( ScaleWidget sw );
static void FlushRectangles ( ScaleWidget sw, Drawable drawable, GC gc ); static void FlushRectangles ( ScaleWidget sw, Drawable drawable, GC gc );
static void FillRectangle ( ScaleWidget sw, Drawable drawable, GC gc, static void FillRectangle ( ScaleWidget sw, Drawable drawable, GC gc,
Position x, Position y, Position x, Position y,
Dimension width, Dimension height ); Dimension width, Dimension height );
static void ScaleImage ( ScaleWidget sw, Drawable drawable, static void ScaleImage ( ScaleWidget sw, Drawable drawable,
Position img_x, Position img_y, Position img_x, Position img_y,
Position dst_x, Position dst_y, Position dst_x, Position dst_y,
Dimension img_width, Dimension img_height ); Dimension img_width, Dimension img_height );
static int FindPixel ( ScaleWidget sw, Position x, Position y, static int FindPixel ( ScaleWidget sw, Position x, Position y,
Position *img_x, Position *img_y, Pixel *img_pixel ); Position *img_x, Position *img_y, Pixel *img_pixel );
static void Redisplay ( Widget w, XEvent *event, Region region ); static void Redisplay ( Widget w, XEvent *event, Region region );
static void TryResize ( ScaleWidget sw ); static void TryResize ( ScaleWidget sw );
@ -130,11 +130,11 @@ static void PositionImage ( ScaleWidget sw );
static void Resize ( Widget w ); static void Resize ( Widget w );
static void Realize ( Widget wid, Mask *vmask, XSetWindowAttributes *attr ); static void Realize ( Widget wid, Mask *vmask, XSetWindowAttributes *attr );
static void Destroy ( Widget w ); static void Destroy ( Widget w );
static Boolean SetValues ( Widget current, Widget request, Widget new, static Boolean SetValues ( Widget current, Widget request, Widget new,
ArgList args, Cardinal *num_args ); ArgList args, Cardinal *num_args );
static XtActionsRec actions[] = static XtActionsRec actions[] =
{ {
{"unscale", SWUnscale}, {"unscale", SWUnscale},
@ -187,13 +187,13 @@ ScaleClassRec scaleClassRec = {
/* display_accelerator */ XtInheritDisplayAccelerator, /* display_accelerator */ XtInheritDisplayAccelerator,
/* extension */ NULL /* extension */ NULL
}, },
{ {
/* change_sensitive */ XtInheritChangeSensitive, /* change_sensitive */ XtInheritChangeSensitive,
} }
}; };
WidgetClass scaleWidgetClass = (WidgetClass) &scaleClassRec; WidgetClass scaleWidgetClass = (WidgetClass) &scaleClassRec;
/* /*
@ -201,25 +201,25 @@ WidgetClass scaleWidgetClass = (WidgetClass) &scaleClassRec;
*/ */
static void static void
ClassInitialize(void) ClassInitialize(void)
{ {
} }
static void static void
GetGC(ScaleWidget sw) GetGC(ScaleWidget sw)
{ {
XGCValues values; XGCValues values;
values.foreground = sw->scale.foreground_pixel; values.foreground = sw->scale.foreground_pixel;
values.background = sw->core.background_pixel; values.background = sw->core.background_pixel;
values.function = GXcopy; values.function = GXcopy;
sw->scale.gc = XtGetGC((Widget) sw, sw->scale.gc = XtGetGC((Widget) sw,
GCForeground | GCForeground |
GCBackground | GCBackground |
GCFunction, GCFunction,
&values); &values);
} }
@ -227,7 +227,7 @@ GetGC(ScaleWidget sw)
static void static void
GetInitialScaleValues(ScaleWidget sw) GetInitialScaleValues(ScaleWidget sw)
{ {
if (sw->scale.proportional) { if (sw->scale.proportional) {
@ -244,7 +244,7 @@ GetInitialScaleValues(ScaleWidget sw)
static void static void
GetRectangleBuffer(ScaleWidget sw, Cardinal buffer_size) GetRectangleBuffer(ScaleWidget sw, Cardinal buffer_size)
/* /*
* This procedure will realloc a new rectangles buffer. * This procedure will realloc a new rectangles buffer.
@ -257,7 +257,7 @@ GetRectangleBuffer(ScaleWidget sw, Cardinal buffer_size)
XtWarning("buffer size has to be a positive number greater than zero"); XtWarning("buffer size has to be a positive number greater than zero");
} }
sw->scale.rectangles = (XRectangle *) sw->scale.rectangles = (XRectangle *)
XtRealloc((char *) sw->scale.rectangles, XtRealloc((char *) sw->scale.rectangles,
buffer_size * sizeof(XRectangle)); buffer_size * sizeof(XRectangle));
sw->scale.buffer_size = buffer_size; sw->scale.buffer_size = buffer_size;
} }
@ -265,29 +265,29 @@ GetRectangleBuffer(ScaleWidget sw, Cardinal buffer_size)
/* ARGSUSED */ /* ARGSUSED */
static void static void
Initialize(Widget request, Widget new, ArgList args, Cardinal *num_args) Initialize(Widget request, Widget new, ArgList args, Cardinal *num_args)
{ {
ScaleWidget new_sw = (ScaleWidget) new; ScaleWidget new_sw = (ScaleWidget) new;
new_sw->scale.table.x = (Position *) NULL; new_sw->scale.table.x = (Position *) NULL;
new_sw->scale.table.y = (Position *) NULL; new_sw->scale.table.y = (Position *) NULL;
new_sw->scale.table.width = (Dimension *) NULL; new_sw->scale.table.width = (Dimension *) NULL;
new_sw->scale.table.height = (Dimension *) NULL; new_sw->scale.table.height = (Dimension *) NULL;
new_sw->scale.nrectangles = 0; new_sw->scale.nrectangles = 0;
new_sw->scale.rectangles = (XRectangle *) NULL; new_sw->scale.rectangles = (XRectangle *) NULL;
GetRectangleBuffer(new_sw, new_sw->scale.buffer_size); GetRectangleBuffer(new_sw, new_sw->scale.buffer_size);
GetGC(new_sw); GetGC(new_sw);
if (new_sw->scale.image != NULL) { if (new_sw->scale.image != NULL) {
if (new_sw->core.width == 0) if (new_sw->core.width == 0)
new_sw->core.width = new_sw->core.width =
new_sw->scale.image->width + 2 * new_sw->scale.internal_width; new_sw->scale.image->width + 2 * new_sw->scale.internal_width;
if (new_sw->core.height == 0) if (new_sw->core.height == 0)
new_sw->core.height = new_sw->core.height =
new_sw->scale.image->height + 2 *new_sw->scale.internal_height; new_sw->scale.image->height + 2 *new_sw->scale.internal_height;
} }
else { else {
@ -296,14 +296,14 @@ Initialize(Widget request, Widget new, ArgList args, Cardinal *num_args)
if (new_sw->core.height == 0) if (new_sw->core.height == 0)
new_sw->core.height = 1 + 2 * new_sw->scale.internal_height; new_sw->core.height = 1 + 2 * new_sw->scale.internal_height;
new_sw->scale.image = XCreateImage(XtDisplay(new), new_sw->scale.image = XCreateImage(XtDisplay(new),
DefaultVisual(XtDisplay(new), DefaultVisual(XtDisplay(new),
DefaultScreen(XtDisplay(new))), DefaultScreen(XtDisplay(new))),
1, XYBitmap, 0, 1, XYBitmap, 0,
XtCalloc(1, sizeof(char)), XtCalloc(1, sizeof(char)),
1, 1, 8, 0); 1, 1, 8, 0);
} }
if ((new_sw->scale.aspect_ratio = if ((new_sw->scale.aspect_ratio =
atof(new_sw->scale.aspect_ratio_str)) < 0.0) { atof(new_sw->scale.aspect_ratio_str)) < 0.0) {
new_sw->scale.aspect_ratio = 1.0; new_sw->scale.aspect_ratio = 1.0;
XtWarning("AspectRatio has to be a positive number. (forced to 1.0)"); XtWarning("AspectRatio has to be a positive number. (forced to 1.0)");
@ -314,18 +314,18 @@ Initialize(Widget request, Widget new, ArgList args, Cardinal *num_args)
new_sw->scale.precision = 0.001; new_sw->scale.precision = 0.001;
XtWarning("Precision has to be a positive number. (forced to 0.001)"); XtWarning("Precision has to be a positive number. (forced to 0.001)");
} }
if (new_sw->scale.scale_x_str == DefaultScaleFactor if (new_sw->scale.scale_x_str == DefaultScaleFactor
|| ||
new_sw->scale.scale_y_str == DefaultScaleFactor) new_sw->scale.scale_y_str == DefaultScaleFactor)
GetInitialScaleValues(new_sw); GetInitialScaleValues(new_sw);
else { else {
if ((new_sw->scale.scale_x = if ((new_sw->scale.scale_x =
atof(new_sw->scale.scale_x_str)) < 0.0) { atof(new_sw->scale.scale_x_str)) < 0.0) {
new_sw->scale.scale_x = 1.0; new_sw->scale.scale_x = 1.0;
XtWarning("ScaleValue has to be a positive number. (forced to 1.0)"); XtWarning("ScaleValue has to be a positive number. (forced to 1.0)");
} }
if ((new_sw->scale.scale_y = if ((new_sw->scale.scale_y =
atof(new_sw->scale.scale_y_str)) < 0.0) { atof(new_sw->scale.scale_y_str)) < 0.0) {
new_sw->scale.scale_y = 1.0; new_sw->scale.scale_y = 1.0;
XtWarning("ScaleValue has to be a positive number. (forced to 1.0)"); XtWarning("ScaleValue has to be a positive number. (forced to 1.0)");
@ -335,29 +335,29 @@ Initialize(Widget request, Widget new, ArgList args, Cardinal *num_args)
static void static void
BuildTable(ScaleWidget sw) BuildTable(ScaleWidget sw)
/* /*
* This procedure builds scaling table for image in the scale struct * This procedure builds scaling table for image in the scale struct
* Requires image, scale_x and scale_y to be set properly * Requires image, scale_x and scale_y to be set properly
*/ */
{ {
Position x, y; Position x, y;
XtFree((char *) sw->scale.table.x); XtFree((char *) sw->scale.table.x);
XtFree((char *) sw->scale.table.y); XtFree((char *) sw->scale.table.y);
XtFree((char *) sw->scale.table.width); XtFree((char *) sw->scale.table.width);
XtFree((char *) sw->scale.table.height); XtFree((char *) sw->scale.table.height);
sw->scale.table.x = sw->scale.table.x =
(Position *) XtMalloc(sizeof(Position) * sw->scale.image->width); (Position *) XtMalloc(sizeof(Position) * sw->scale.image->width);
sw->scale.table.y = sw->scale.table.y =
(Position *) XtMalloc(sizeof(Position) * sw->scale.image->height); (Position *) XtMalloc(sizeof(Position) * sw->scale.image->height);
sw->scale.table.width = sw->scale.table.width =
(Dimension *) XtMalloc(sizeof(Dimension) * sw->scale.image->width); (Dimension *) XtMalloc(sizeof(Dimension) * sw->scale.image->width);
sw->scale.table.height = sw->scale.table.height =
(Dimension *) XtMalloc(sizeof(Dimension) * sw->scale.image->height); (Dimension *) XtMalloc(sizeof(Dimension) * sw->scale.image->height);
/* Build the scaling table */ /* Build the scaling table */
for (x = 0; x < sw->scale.image->width; x++) { for (x = 0; x < sw->scale.image->width; x++) {
sw->scale.table.x[(int) x] = (Position) myrint(sw->scale.scale_x * x); sw->scale.table.x[(int) x] = (Position) myrint(sw->scale.scale_x * x);
sw->scale.table.width[(int) x] = (Dimension) sw->scale.table.width[(int) x] = (Dimension)
@ -372,22 +372,22 @@ BuildTable(ScaleWidget sw)
static void static void
FlushRectangles(ScaleWidget sw, Drawable drawable, GC gc) FlushRectangles(ScaleWidget sw, Drawable drawable, GC gc)
{ {
XFillRectangles(XtDisplay(sw), drawable, gc, XFillRectangles(XtDisplay(sw), drawable, gc,
sw->scale.rectangles, sw->scale.nrectangles); sw->scale.rectangles, sw->scale.nrectangles);
sw->scale.nrectangles = 0; sw->scale.nrectangles = 0;
} }
static void static void
FillRectangle(ScaleWidget sw, Drawable drawable, GC gc, FillRectangle(ScaleWidget sw, Drawable drawable, GC gc,
Position x, Position y, Dimension width, Dimension height) Position x, Position y, Dimension width, Dimension height)
{ {
if (sw->scale.nrectangles == sw->scale.buffer_size) if (sw->scale.nrectangles == sw->scale.buffer_size)
FlushRectangles(sw, drawable, gc); FlushRectangles(sw, drawable, gc);
@ -401,11 +401,11 @@ FillRectangle(ScaleWidget sw, Drawable drawable, GC gc,
static void static void
ScaleImage(ScaleWidget sw, Drawable drawable, Position img_x, Position img_y, ScaleImage(ScaleWidget sw, Drawable drawable, Position img_x, Position img_y,
Position dst_x, Position dst_y, Position dst_x, Position dst_y,
Dimension img_width, Dimension img_height) Dimension img_width, Dimension img_height)
/* /*
* This procedure scales image into the specified drawable * This procedure scales image into the specified drawable
* It assumes scaling table was already built * It assumes scaling table was already built
*/ */
@ -414,18 +414,18 @@ ScaleImage(ScaleWidget sw, Drawable drawable, Position img_x, Position img_y,
XGCValues gcv; XGCValues gcv;
Position x, y; Position x, y;
Pixel pixel; Pixel pixel;
/* Clip the img coordinates */ /* Clip the img coordinates */
img_x = min(max(img_x, 0), (Position) sw->scale.image->width - 1); img_x = min(max(img_x, 0), (Position) sw->scale.image->width - 1);
img_y = min(max(img_y, 0), (Position) sw->scale.image->height - 1); img_y = min(max(img_y, 0), (Position) sw->scale.image->height - 1);
img_width = img_width =
min(img_width, (Dimension)(sw->scale.image->width - (Dimension)img_x)); min(img_width, (Dimension)(sw->scale.image->width - (Dimension)img_x));
img_height = img_height =
min(img_height, (Dimension)(sw->scale.image->height - (Dimension)img_y)); min(img_height, (Dimension)(sw->scale.image->height - (Dimension)img_y));
if (sw->scale.scale_x == 1.0 && sw->scale.scale_y == 1.0) if (sw->scale.scale_x == 1.0 && sw->scale.scale_y == 1.0)
XPutImage(XtDisplay(sw), drawable, sw->scale.gc, sw->scale.image, XPutImage(XtDisplay(sw), drawable, sw->scale.gc, sw->scale.image,
img_x, img_y, dst_x, dst_y, img_x, img_y, dst_x, dst_y,
img_width, img_height); img_width, img_height);
else { else {
dst_x = dst_x - sw->scale.table.x[(int) img_x]; dst_x = dst_x - sw->scale.table.x[(int) img_x];
@ -438,29 +438,29 @@ ScaleImage(ScaleWidget sw, Drawable drawable, Position img_x, Position img_y,
/* make sure gc knows the right background */ /* make sure gc knows the right background */
gcv.background = sw->core.background_pixel; gcv.background = sw->core.background_pixel;
XChangeGC(XtDisplay(sw), gc, GCBackground, &gcv); XChangeGC(XtDisplay(sw), gc, GCBackground, &gcv);
/* Set the background of drawable. If the most frequent color /* Set the background of drawable. If the most frequent color
is the background color it can speed up scaling process. */ is the background color it can speed up scaling process. */
gcv.foreground = gcv.background; gcv.foreground = gcv.background;
XChangeGC(XtDisplay(sw), gc, GCForeground, &gcv); XChangeGC(XtDisplay(sw), gc, GCForeground, &gcv);
XFillRectangle(XtDisplay(sw), drawable, gc, XFillRectangle(XtDisplay(sw), drawable, gc,
sw->scale.table.x[(int) img_x] + dst_x, sw->scale.table.x[(int) img_x] + dst_x,
sw->scale.table.y[(int) img_y] + dst_y, sw->scale.table.y[(int) img_y] + dst_y,
sw->scale.table.x[(int) img_x + img_width - 1] - sw->scale.table.x[(int) img_x + img_width - 1] -
sw->scale.table.x[(int) img_x], sw->scale.table.x[(int) img_x],
sw->scale.table.y[(int) img_y + img_height - 1] - sw->scale.table.y[(int) img_y + img_height - 1] -
sw->scale.table.y[(int) img_y]); sw->scale.table.y[(int) img_y]);
if (sw->scale.image->format == XYBitmap) { if (sw->scale.image->format == XYBitmap) {
for (x = img_x; x < img_x + (Position)img_width; x++) for (x = img_x; x < img_x + (Position)img_width; x++)
for (y = img_y; y < img_y + (Position)img_height; y++) { for (y = img_y; y < img_y + (Position)img_height; y++) {
pixel = XGetPixel(sw->scale.image, x, y); pixel = XGetPixel(sw->scale.image, x, y);
if (pixel) /* Do not draw background */ if (pixel) /* Do not draw background */
FillRectangle(sw, drawable, sw->scale.gc, FillRectangle(sw, drawable, sw->scale.gc,
sw->scale.table.x[(int) x] + dst_x, sw->scale.table.x[(int) x] + dst_x,
sw->scale.table.y[(int) y] + dst_y, sw->scale.table.y[(int) y] + dst_y,
sw->scale.table.width[(int) x], sw->scale.table.width[(int) x],
sw->scale.table.height[(int) y]); sw->scale.table.height[(int) y]);
} }
FlushRectangles(sw, drawable, sw->scale.gc); FlushRectangles(sw, drawable, sw->scale.gc);
@ -475,9 +475,9 @@ ScaleImage(ScaleWidget sw, Drawable drawable, Position img_x, Position img_y,
XChangeGC(XtDisplay(sw), gc, GCForeground, &gcv); XChangeGC(XtDisplay(sw), gc, GCForeground, &gcv);
} }
XFillRectangle(XtDisplay(sw), drawable, gc, XFillRectangle(XtDisplay(sw), drawable, gc,
sw->scale.table.x[(int) x] + dst_x, sw->scale.table.x[(int) x] + dst_x,
sw->scale.table.y[(int) y] + dst_y, sw->scale.table.y[(int) y] + dst_y,
sw->scale.table.width[(int) x], sw->scale.table.width[(int) x],
sw->scale.table.height[(int) y]); sw->scale.table.height[(int) y]);
} }
} }
@ -488,21 +488,21 @@ ScaleImage(ScaleWidget sw, Drawable drawable, Position img_x, Position img_y,
static int static int
FindPixel(ScaleWidget sw, Position x, Position y, FindPixel(ScaleWidget sw, Position x, Position y,
Position *img_x, Position *img_y, Pixel *img_pixel) Position *img_x, Position *img_y, Pixel *img_pixel)
/* (x,y) == (0,0) where image starts in sw window*/ /* (x,y) == (0,0) where image starts in sw window*/
{ {
if (*img_x < 0 || *img_x >= sw->scale.image->width if (*img_x < 0 || *img_x >= sw->scale.image->width
|| ||
*img_y < 0 || *img_y >= sw->scale.image->height) *img_y < 0 || *img_y >= sw->scale.image->height)
return (-1); return (-1);
if (sw->scale.table.x[(int) *img_x] >= x) { if (sw->scale.table.x[(int) *img_x] >= x) {
--*img_x; --*img_x;
return FindPixel(sw, x, y, img_x, img_y, img_pixel); return FindPixel(sw, x, y, img_x, img_y, img_pixel);
} }
if (sw->scale.table.x[(int) *img_x] + if (sw->scale.table.x[(int) *img_x] +
(Position)sw->scale.table.width[(int) *img_x] < x) { (Position)sw->scale.table.width[(int) *img_x] < x) {
++*img_x; ++*img_x;
return FindPixel(sw, x, y, img_x, img_y, img_pixel); return FindPixel(sw, x, y, img_x, img_y, img_pixel);
@ -511,38 +511,38 @@ FindPixel(ScaleWidget sw, Position x, Position y,
--*img_y; --*img_y;
return FindPixel(sw, x, y, img_x, img_y, img_pixel); return FindPixel(sw, x, y, img_x, img_y, img_pixel);
} }
if (sw->scale.table.y[(int) *img_y] + if (sw->scale.table.y[(int) *img_y] +
(Position)sw->scale.table.height[(int) *img_y] < y) { (Position)sw->scale.table.height[(int) *img_y] < y) {
++*img_y; ++*img_y;
return FindPixel(sw, x, y, img_x, img_y, img_pixel); return FindPixel(sw, x, y, img_x, img_y, img_pixel);
} }
*img_pixel = XGetPixel(sw->scale.image, *img_x, *img_y); *img_pixel = XGetPixel(sw->scale.image, *img_x, *img_y);
return (0); return (0);
} }
int int
SWGetImagePixel(Widget w, Position x, Position y, SWGetImagePixel(Widget w, Position x, Position y,
Position *img_x, Position *img_y, Pixel *img_pixel) Position *img_x, Position *img_y, Pixel *img_pixel)
{ {
ScaleWidget sw = (ScaleWidget) w; ScaleWidget sw = (ScaleWidget) w;
x -= sw->scale.x; x -= sw->scale.x;
y -= sw->scale.y; y -= sw->scale.y;
*img_x = (Position) floor(x / sw->scale.scale_x); *img_x = (Position) floor(x / sw->scale.scale_x);
*img_y = (Position) floor(y / sw->scale.scale_y); *img_y = (Position) floor(y / sw->scale.scale_y);
return FindPixel(sw, x, y, img_x, img_y, img_pixel); return FindPixel(sw, x, y, img_x, img_y, img_pixel);
} }
/* ARGSUSED */ /* ARGSUSED */
static void static void
Redisplay(Widget w, XEvent *event, Region region) Redisplay(Widget w, XEvent *event, Region region)
{ {
ScaleWidget sw = (ScaleWidget) w; ScaleWidget sw = (ScaleWidget) w;
@ -560,7 +560,7 @@ Redisplay(Widget w, XEvent *event, Region region)
x = event->xexpose.x - sw->scale.x; x = event->xexpose.x - sw->scale.x;
width = event->xexpose.width; width = event->xexpose.width;
} }
if (event->xexpose.y < sw->scale.y) { if (event->xexpose.y < sw->scale.y) {
y = 0; y = 0;
height = event->xexpose.height - height = event->xexpose.height -
@ -570,22 +570,22 @@ Redisplay(Widget w, XEvent *event, Region region)
y = event->xexpose.y - sw->scale.y; y = event->xexpose.y - sw->scale.y;
height = event->xexpose.height; height = event->xexpose.height;
} }
img_x = min(max((Position) floor((float) x img_x = min(max((Position) floor((float) x
/ (float) sw->scale.scale_x), 0), / (float) sw->scale.scale_x), 0),
(Position) sw->scale.image->width - 1); (Position) sw->scale.image->width - 1);
img_y = min(max((Position) floor((float) y img_y = min(max((Position) floor((float) y
/ (float) sw->scale.scale_y), 0), / (float) sw->scale.scale_y), 0),
(Position) sw->scale.image->height - 1); (Position) sw->scale.image->height - 1);
if (sw->core.visible) { if (sw->core.visible) {
ScaleImage(sw, XtWindow(w), ScaleImage(sw, XtWindow(w),
img_x, img_y, img_x, img_y,
sw->scale.x + sw->scale.table.x[(int) img_x], sw->scale.x + sw->scale.table.x[(int) img_x],
sw->scale.y + sw->scale.table.y[(int) img_y], sw->scale.y + sw->scale.table.y[(int) img_y],
(Dimension) ceil((float) width (Dimension) ceil((float) width
/ sw->scale.scale_x) + 1, / sw->scale.scale_x) + 1,
(Dimension) ceil((float) height (Dimension) ceil((float) height
/ sw->scale.scale_y) + 1); / sw->scale.scale_y) + 1);
} }
@ -594,23 +594,23 @@ Redisplay(Widget w, XEvent *event, Region region)
static void static void
TryResize(ScaleWidget sw) TryResize(ScaleWidget sw)
{ {
Dimension width, height; Dimension width, height;
XtGeometryResult result; XtGeometryResult result;
width = (Dimension) width = (Dimension)
floor(sw->scale.image->width * sw->scale.scale_x) floor(sw->scale.image->width * sw->scale.scale_x)
+ 2 * sw->scale.internal_width; + 2 * sw->scale.internal_width;
height = (Dimension) height = (Dimension)
floor(sw->scale.image->height * sw->scale.scale_y) floor(sw->scale.image->height * sw->scale.scale_y)
+ 2 * sw->scale.internal_height; + 2 * sw->scale.internal_height;
while ((result = while ((result =
/* SUPPRESS 530 */XtMakeResizeRequest((Widget)sw,width,height,&width,&height)) /* SUPPRESS 530 */XtMakeResizeRequest((Widget)sw,width,height,&width,&height))
== XtGeometryAlmost); == XtGeometryAlmost);
if (result != XtGeometryNo) { if (result != XtGeometryNo) {
sw->core.width = width; sw->core.width = width;
sw->core.height = height; sw->core.height = height;
@ -619,7 +619,7 @@ TryResize(ScaleWidget sw)
static void static void
Precision(ScaleWidget sw) Precision(ScaleWidget sw)
{ {
if (sw->scale.scale_x != 1.0) if (sw->scale.scale_x != 1.0)
@ -633,14 +633,14 @@ Precision(ScaleWidget sw)
static void static void
Proportional(ScaleWidget sw) Proportional(ScaleWidget sw)
{ {
float scale_x, scale_y; float scale_x, scale_y;
scale_x = sw->scale.scale_y / sw->scale.aspect_ratio; scale_x = sw->scale.scale_y / sw->scale.aspect_ratio;
scale_y = sw->scale.scale_x * sw->scale.aspect_ratio; scale_y = sw->scale.scale_x * sw->scale.aspect_ratio;
if (scale_x <= sw->scale.scale_x && scale_y <= sw->scale.scale_y) { if (scale_x <= sw->scale.scale_x && scale_y <= sw->scale.scale_y) {
if (scale_x > scale_y) if (scale_x > scale_y)
sw->scale.scale_x = scale_x; sw->scale.scale_x = scale_x;
@ -653,24 +653,24 @@ Proportional(ScaleWidget sw)
sw->scale.scale_y = scale_y; sw->scale.scale_y = scale_y;
else { else {
float x_ratio, y_ratio; float x_ratio, y_ratio;
x_ratio = scale_x / sw->scale.scale_x; x_ratio = scale_x / sw->scale.scale_x;
y_ratio = scale_y / sw->scale.scale_y; y_ratio = scale_y / sw->scale.scale_y;
if (x_ratio < y_ratio) if (x_ratio < y_ratio)
sw->scale.scale_y /= x_ratio; sw->scale.scale_y /= x_ratio;
else else
sw->scale.scale_x /= y_ratio; sw->scale.scale_x /= y_ratio;
} }
if (fabs(sw->scale.scale_x / sw->scale.scale_y * sw->scale.aspect_ratio if (fabs(sw->scale.scale_x / sw->scale.scale_y * sw->scale.aspect_ratio
- 1.0) > sw->scale.precision) - 1.0) > sw->scale.precision)
XtWarning("can not preserve aspect ratio"); XtWarning("can not preserve aspect ratio");
} }
static void static void
GetScaledSize(ScaleWidget sw) GetScaledSize(ScaleWidget sw)
{ {
sw->scale.width = (Dimension) sw->scale.width = (Dimension)
@ -681,14 +681,14 @@ GetScaledSize(ScaleWidget sw)
static void static void
GetScaleValues(ScaleWidget sw) GetScaleValues(ScaleWidget sw)
{ {
/* /*
* Make sure to subtract internal width and height. * Make sure to subtract internal width and height.
*/ */
sw->scale.scale_x = sw->scale.scale_x =
(float) max((int)(sw->core.width - 2 * sw->scale.internal_width), 1) (float) max((int)(sw->core.width - 2 * sw->scale.internal_width), 1)
/ (float) sw->scale.image->width; / (float) sw->scale.image->width;
@ -699,19 +699,19 @@ GetScaleValues(ScaleWidget sw)
static void static void
Unscale(ScaleWidget sw) Unscale(ScaleWidget sw)
{ {
sw->scale.scale_x = sw->scale.scale_y = 1.0; sw->scale.scale_x = sw->scale.scale_y = 1.0;
GetScaledSize(sw); GetScaledSize(sw);
BuildTable(sw); BuildTable(sw);
} }
static void static void
Autoscale(ScaleWidget sw) Autoscale(ScaleWidget sw)
{ {
GetScaleValues(sw); GetScaleValues(sw);
@ -721,27 +721,27 @@ Autoscale(ScaleWidget sw)
Precision(sw); Precision(sw);
GetScaledSize(sw); GetScaledSize(sw);
BuildTable(sw); BuildTable(sw);
} }
static void static void
PositionImage(ScaleWidget sw) PositionImage(ScaleWidget sw)
{ {
/* /*
* Set as if for ForgegGravity (that is center the image) * Set as if for ForgegGravity (that is center the image)
*/ */
sw->scale.x = (Position) sw->scale.x = (Position)
(sw->core.width - sw->scale.width) / 2; (sw->core.width - sw->scale.width) / 2;
sw->scale.y = (Position) sw->scale.y = (Position)
(sw->core.height - sw->scale.height) / 2; (sw->core.height - sw->scale.height) / 2;
/***** /*****
if (sw->scale.gravity & WestGravity) { if (sw->scale.gravity & WestGravity) {
} }
if (sw->scale.gravity & EastGravity) { if (sw->scale.gravity & EastGravity) {
} }
if (sw->scale.gravity & NorthGravity) { if (sw->scale.gravity & NorthGravity) {
} }
@ -752,38 +752,38 @@ PositionImage(ScaleWidget sw)
static void static void
Resize(Widget w) Resize(Widget w)
{ {
ScaleWidget sw = (ScaleWidget) w; ScaleWidget sw = (ScaleWidget) w;
if (sw->scale.autoscale) Autoscale(sw); if (sw->scale.autoscale) Autoscale(sw);
PositionImage(sw); PositionImage(sw);
} }
static void static void
Realize(Widget wid, Mask *vmask, XSetWindowAttributes *attr) Realize(Widget wid, Mask *vmask, XSetWindowAttributes *attr)
{ {
ScaleWidget sw = (ScaleWidget) wid; ScaleWidget sw = (ScaleWidget) wid;
XtCreateWindow(wid, (unsigned int) InputOutput, XtCreateWindow(wid, (unsigned int) InputOutput,
(Visual *) sw->scale.visual, *vmask, attr); (Visual *) sw->scale.visual, *vmask, attr);
} }
static void static void
Destroy(Widget w) Destroy(Widget w)
{ {
ScaleWidget sw = (ScaleWidget) w; ScaleWidget sw = (ScaleWidget) w;
XtFree((char *) sw->scale.table.x); XtFree((char *) sw->scale.table.x);
XtFree((char *) sw->scale.table.y); XtFree((char *) sw->scale.table.y);
XtFree((char *) sw->scale.table.width); XtFree((char *) sw->scale.table.width);
XtFree((char *) sw->scale.table.height); XtFree((char *) sw->scale.table.height);
XtFree((char *) sw->scale.rectangles); XtFree((char *) sw->scale.rectangles);
XtReleaseGC(w, sw->scale.gc); XtReleaseGC(w, sw->scale.gc);
@ -794,8 +794,8 @@ Destroy(Widget w)
/* ARGSUSED */ /* ARGSUSED */
static Boolean static Boolean
SetValues(Widget current, Widget request, Widget new, SetValues(Widget current, Widget request, Widget new,
ArgList args, Cardinal *num_args) ArgList args, Cardinal *num_args)
{ {
ScaleWidget cur_sw = (ScaleWidget) current; ScaleWidget cur_sw = (ScaleWidget) current;
@ -803,30 +803,30 @@ SetValues(Widget current, Widget request, Widget new,
ScaleWidget new_sw = (ScaleWidget) new; ScaleWidget new_sw = (ScaleWidget) new;
Boolean redisplay = False; Boolean redisplay = False;
Cardinal i; Cardinal i;
for (i = 0; i < *num_args; i++) { for (i = 0; i < *num_args; i++) {
if (streq(XtNbackground, args[i].name)) { if (streq(XtNbackground, args[i].name)) {
XSetBackground(XtDisplay(new), new_sw->scale.gc, XSetBackground(XtDisplay(new), new_sw->scale.gc,
new_sw->core.background_pixel); new_sw->core.background_pixel);
} }
if (streq(XtNforeground, args[i].name)) { if (streq(XtNforeground, args[i].name)) {
XSetForeground(XtDisplay(new), new_sw->scale.gc, XSetForeground(XtDisplay(new), new_sw->scale.gc,
new_sw->scale.foreground_pixel); new_sw->scale.foreground_pixel);
} }
if (streq(XtNimage, args[i].name)) { if (streq(XtNimage, args[i].name)) {
XDestroyImage(cur_sw->scale.image); XDestroyImage(cur_sw->scale.image);
if (new_sw->scale.image == NULL) if (new_sw->scale.image == NULL)
new_sw->scale.image = XCreateImage(XtDisplay(new), new_sw->scale.image = XCreateImage(XtDisplay(new),
DefaultVisual(XtDisplay(new), DefaultVisual(XtDisplay(new),
DefaultScreen(XtDisplay(new))), DefaultScreen(XtDisplay(new))),
1, XYBitmap, 0, 1, XYBitmap, 0,
XtCalloc(1, sizeof(char)), XtCalloc(1, sizeof(char)),
1, 1, 8, 0); 1, 1, 8, 0);
else else
new_sw->scale.image = new_sw->scale.image =
XSubImage(new_sw->scale.image, XSubImage(new_sw->scale.image,
0, 0, 0, 0,
new_sw->scale.image->width, new_sw->scale.image->width,
new_sw->scale.image->height); new_sw->scale.image->height);
if (new_sw->scale.resize) if (new_sw->scale.resize)
@ -841,7 +841,7 @@ SetValues(Widget current, Widget request, Widget new,
redisplay = True; redisplay = True;
} }
if (streq(XtNuserData, args[i].name)) if (streq(XtNuserData, args[i].name))
new_sw->scale.userData = (XtPointer)args[i].value; new_sw->scale.userData = (XtPointer)args[i].value;
if (streq(XtNbufferSize, args[i].name)) { if (streq(XtNbufferSize, args[i].name)) {
@ -851,7 +851,7 @@ SetValues(Widget current, Widget request, Widget new,
} }
if (streq(XtNaspectRatio, args[i].name)) { if (streq(XtNaspectRatio, args[i].name)) {
if ((new_sw->scale.aspect_ratio = if ((new_sw->scale.aspect_ratio =
atof(new_sw->scale.aspect_ratio_str)) < 0.0) { atof(new_sw->scale.aspect_ratio_str)) < 0.0) {
new_sw->scale.aspect_ratio = cur_sw->scale.aspect_ratio; new_sw->scale.aspect_ratio = cur_sw->scale.aspect_ratio;
XtWarning("AspectRatio has to be a positive number."); XtWarning("AspectRatio has to be a positive number.");
@ -867,7 +867,7 @@ SetValues(Widget current, Widget request, Widget new,
} }
} }
} }
if (streq(XtNproportional, args[i].name)) { if (streq(XtNproportional, args[i].name)) {
if (new_sw->scale.proportional != cur_sw->scale.proportional) { if (new_sw->scale.proportional != cur_sw->scale.proportional) {
if (new_sw->scale.proportional) Proportional(new_sw); if (new_sw->scale.proportional) Proportional(new_sw);
@ -878,21 +878,21 @@ SetValues(Widget current, Widget request, Widget new,
redisplay = True; redisplay = True;
} }
} }
if (streq(XtNscaleX, args[i].name) if (streq(XtNscaleX, args[i].name)
|| ||
streq(XtNscaleY, args[i].name)) { streq(XtNscaleY, args[i].name)) {
if (new_sw->scale.scale_x_str == DefaultScaleFactor if (new_sw->scale.scale_x_str == DefaultScaleFactor
|| ||
new_sw->scale.scale_y_str == DefaultScaleFactor) new_sw->scale.scale_y_str == DefaultScaleFactor)
GetInitialScaleValues(new_sw); GetInitialScaleValues(new_sw);
else { else {
if ((new_sw->scale.scale_x = if ((new_sw->scale.scale_x =
atof(new_sw->scale.scale_x_str)) < 0.0) { atof(new_sw->scale.scale_x_str)) < 0.0) {
new_sw->scale.scale_x = cur_sw->scale.scale_x; new_sw->scale.scale_x = cur_sw->scale.scale_x;
XtWarning("ScaleValue has to be a positive number."); XtWarning("ScaleValue has to be a positive number.");
} }
if ((new_sw->scale.scale_y = if ((new_sw->scale.scale_y =
atof(new_sw->scale.scale_y_str)) < 0.0) { atof(new_sw->scale.scale_y_str)) < 0.0) {
new_sw->scale.scale_y = cur_sw->scale.scale_y; new_sw->scale.scale_y = cur_sw->scale.scale_y;
XtWarning("ScaleValue has to be a positive number."); XtWarning("ScaleValue has to be a positive number.");
@ -901,24 +901,24 @@ SetValues(Widget current, Widget request, Widget new,
if (new_sw->scale.scale_x != cur_sw->scale.scale_x if (new_sw->scale.scale_x != cur_sw->scale.scale_x
|| ||
new_sw->scale.scale_y != cur_sw->scale.scale_y) { new_sw->scale.scale_y != cur_sw->scale.scale_y) {
/*?*?*?*?*?*?*?*?*?*?*?*?*?*?**?*?*?*?*?*?*?*?*?***?*/ /*?*?*?*?*?*?*?*?*?*?*?*?*?*?**?*?*?*?*?*?*?*?*?***?*/
fprintf(stderr, "================>>%f %f\n", fprintf(stderr, "================>>%f %f\n",
new_sw->scale.scale_x, new_sw->scale.scale_y); new_sw->scale.scale_x, new_sw->scale.scale_y);
if (new_sw->scale.proportional) Proportional(new_sw); if (new_sw->scale.proportional) Proportional(new_sw);
Precision(new_sw); Precision(new_sw);
if (new_sw->scale.resize) if (new_sw->scale.resize)
TryResize(new_sw); TryResize(new_sw);
GetScaledSize(new_sw); GetScaledSize(new_sw);
BuildTable(new_sw); BuildTable(new_sw);
PositionImage(new_sw); PositionImage(new_sw);
redisplay = True; redisplay = True;
} }
} }
if (streq(XtNprecision, args[i].name)) { if (streq(XtNprecision, args[i].name)) {
if ((new_sw->scale.precision = if ((new_sw->scale.precision =
atof(new_sw->scale.precision_str)) < 0.0) { atof(new_sw->scale.precision_str)) < 0.0) {
new_sw->scale.precision = cur_sw->scale.precision; new_sw->scale.precision = cur_sw->scale.precision;
XtWarning("Precision has to be a positive number."); XtWarning("Precision has to be a positive number.");
@ -926,19 +926,19 @@ SetValues(Widget current, Widget request, Widget new,
if (new_sw->scale.precision != cur_sw->scale.precision) { if (new_sw->scale.precision != cur_sw->scale.precision) {
if (new_sw->scale.proportional) Proportional(new_sw); if (new_sw->scale.proportional) Proportional(new_sw);
Precision(new_sw); Precision(new_sw);
GetScaledSize(new_sw); GetScaledSize(new_sw);
BuildTable(new_sw); BuildTable(new_sw);
PositionImage(new_sw); PositionImage(new_sw);
redisplay = True; redisplay = True;
} }
} }
} }
return(redisplay); return(redisplay);
} }
void void
SWUnscale(Widget w, XEvent *event, String *params, Cardinal *num_params) SWUnscale(Widget w, XEvent *event, String *params, Cardinal *num_params)
{ {
ScaleWidget sw = (ScaleWidget) w; ScaleWidget sw = (ScaleWidget) w;
@ -950,7 +950,7 @@ SWUnscale(Widget w, XEvent *event, String *params, Cardinal *num_params)
void void
SWAutoscale(Widget w, XEvent *event, String *params, Cardinal *num_params) SWAutoscale(Widget w, XEvent *event, String *params, Cardinal *num_params)
{ {
ScaleWidget sw = (ScaleWidget) w; ScaleWidget sw = (ScaleWidget) w;
@ -962,18 +962,18 @@ SWAutoscale(Widget w, XEvent *event, String *params, Cardinal *num_params)
void void
SWInitialSize(Widget w, XEvent *event, String *params, Cardinal *num_params) SWInitialSize(Widget w, XEvent *event, String *params, Cardinal *num_params)
{ {
ScaleWidget sw = (ScaleWidget) w; ScaleWidget sw = (ScaleWidget) w;
GetInitialScaleValues(sw); GetInitialScaleValues(sw);
if (sw->scale.proportional) Proportional(sw); if (sw->scale.proportional) Proportional(sw);
Precision(sw); Precision(sw);
if (sw->scale.resize) if (sw->scale.resize)
TryResize(sw); TryResize(sw);
GetScaledSize(sw); GetScaledSize(sw);
BuildTable(sw); BuildTable(sw);
PositionImage(sw); PositionImage(sw);
XClearArea(XtDisplay(w), XtWindow(w), 0, 0, 0, 0, True); XClearArea(XtDisplay(w), XtWindow(w), 0, 0, 0, 0, True);
@ -981,12 +981,12 @@ SWInitialSize(Widget w, XEvent *event, String *params, Cardinal *num_params)
void void
SWSetImage(Widget w, XImage *image) SWSetImage(Widget w, XImage *image)
{ {
int n; int n;
Arg wargs[2]; Arg wargs[2];
n = 0; n = 0;
XtSetArg(wargs[n], XtNimage, (XtArgVal) image); n++; XtSetArg(wargs[n], XtNimage, (XtArgVal) image); n++;
XtSetValues(w, wargs, n); XtSetValues(w, wargs, n);
@ -995,7 +995,7 @@ SWSetImage(Widget w, XImage *image)
void void
RequestSelection(Widget w, XEvent *event, String *params, Cardinal *num_params) RequestSelection(Widget w, XEvent *event, String *params, Cardinal *num_params)
{ {
SWRequestSelection(w, event->xbutton.time); SWRequestSelection(w, event->xbutton.time);
@ -1003,7 +1003,7 @@ RequestSelection(Widget w, XEvent *event, String *params, Cardinal *num_params)
void void
GrabSelection(Widget w, XEvent *event, String *params, Cardinal *num_params) GrabSelection(Widget w, XEvent *event, String *params, Cardinal *num_params)
{ {
SWGrabSelection(w, event->xbutton.time); SWGrabSelection(w, event->xbutton.time);
@ -1011,20 +1011,20 @@ GrabSelection(Widget w, XEvent *event, String *params, Cardinal *num_params)
Pixmap Pixmap
SWGetPixmap(Widget w) SWGetPixmap(Widget w)
{ {
ScaleWidget sw = (ScaleWidget) w; ScaleWidget sw = (ScaleWidget) w;
Pixmap pixmap; Pixmap pixmap;
pixmap = XCreatePixmap(XtDisplay(w), XtWindow(w), pixmap = XCreatePixmap(XtDisplay(w), XtWindow(w),
sw->scale.width, sw->scale.width,
sw->scale.height, sw->scale.height,
sw->scale.image->depth); sw->scale.image->depth);
ScaleImage(sw, pixmap, ScaleImage(sw, pixmap,
0, 0, 0, 0, 0, 0, 0, 0,
(Dimension) sw->scale.image->width, (Dimension) sw->scale.image->width,
(Dimension) sw->scale.image->height); (Dimension) sw->scale.image->height);
return(pixmap); return(pixmap);
} }

View File

@ -108,19 +108,19 @@ extern WidgetClass scaleWidgetClass;
typedef struct _ScaleClassRec *ScaleWidgetClass; typedef struct _ScaleClassRec *ScaleWidgetClass;
typedef struct _ScaleRec *ScaleWidget; typedef struct _ScaleRec *ScaleWidget;
extern int SWGetImagePixel ( Widget w, Position x, Position y, extern int SWGetImagePixel ( Widget w, Position x, Position y,
Position *img_x, Position *img_y, Position *img_x, Position *img_y,
Pixel *img_pixel ); Pixel *img_pixel );
extern void SWUnscale ( Widget w, XEvent *event, String *params, extern void SWUnscale ( Widget w, XEvent *event, String *params,
Cardinal *num_params ); Cardinal *num_params );
extern void SWAutoscale ( Widget w, XEvent *event, String *params, extern void SWAutoscale ( Widget w, XEvent *event, String *params,
Cardinal *num_params ); Cardinal *num_params );
extern void SWInitialSize ( Widget w, XEvent *event, String *params, extern void SWInitialSize ( Widget w, XEvent *event, String *params,
Cardinal *num_params ); Cardinal *num_params );
extern void SWSetImage ( Widget w, XImage *image ); extern void SWSetImage ( Widget w, XImage *image );
extern void RequestSelection ( Widget w, XEvent *event, String *params, extern void RequestSelection ( Widget w, XEvent *event, String *params,
Cardinal *num_params ); Cardinal *num_params );
extern void GrabSelection ( Widget w, XEvent *event, String *params, extern void GrabSelection ( Widget w, XEvent *event, String *params,
Cardinal *num_params ); Cardinal *num_params );
extern Pixmap SWGetPixmap ( Widget w ); extern Pixmap SWGetPixmap ( Widget w );

221
app/xmag/aclocal.m4 vendored
View File

@ -1,4 +1,4 @@
# generated automatically by aclocal 1.12.5 -*- Autoconf -*- # generated automatically by aclocal 1.12.6 -*- Autoconf -*-
# Copyright (C) 1996-2012 Free Software Foundation, Inc. # Copyright (C) 1996-2012 Free Software Foundation, Inc.
@ -20,6 +20,7 @@ If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically 'autoreconf'.])]) To do so, use the procedure documented by the package, typically 'autoreconf'.])])
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
# serial 1 (pkg-config-0.24)
# #
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>. # Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
# #
@ -46,8 +47,12 @@ To do so, use the procedure documented by the package, typically 'autoreconf'.])
# ---------------------------------- # ----------------------------------
AC_DEFUN([PKG_PROG_PKG_CONFIG], AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) [m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl m4_pattern_allow([^PKG_CONFIG_(DISABLE_UNINSTALLED|TOP_BUILD_DIR|DEBUG_SPEW)$])
AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi fi
@ -60,7 +65,6 @@ if test -n "$PKG_CONFIG"; then
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
PKG_CONFIG="" PKG_CONFIG=""
fi fi
fi[]dnl fi[]dnl
])# PKG_PROG_PKG_CONFIG ])# PKG_PROG_PKG_CONFIG
@ -69,34 +73,32 @@ fi[]dnl
# Check to see whether a particular set of modules exists. Similar # Check to see whether a particular set of modules exists. Similar
# to PKG_CHECK_MODULES(), but does not set variables or print errors. # to PKG_CHECK_MODULES(), but does not set variables or print errors.
# #
# # Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
# Similar to PKG_CHECK_MODULES, make sure that the first instance of # only at the first occurence in configure.ac, so if the first place
# this or PKG_CHECK_MODULES is called, or make sure to call # it's called might be skipped (such as if it is within an "if", you
# PKG_CHECK_EXISTS manually # have to call PKG_CHECK_EXISTS manually
# -------------------------------------------------------------- # --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_EXISTS], AC_DEFUN([PKG_CHECK_EXISTS],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
if test -n "$PKG_CONFIG" && \ if test -n "$PKG_CONFIG" && \
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
m4_ifval([$2], [$2], [:]) m4_default([$2], [:])
m4_ifvaln([$3], [else m4_ifvaln([$3], [else
$3])dnl $3])dnl
fi]) fi])
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
# --------------------------------------------- # ---------------------------------------------
m4_define([_PKG_CONFIG], m4_define([_PKG_CONFIG],
[if test -n "$PKG_CONFIG"; then [if test -n "$$1"; then
if test -n "$$1"; then pkg_cv_[]$1="$$1"
pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then
else PKG_CHECK_EXISTS([$3],
PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`
[pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], test "x$?" != "x0" && pkg_failed=yes ],
[pkg_failed=yes]) [pkg_failed=yes])
fi else
else pkg_failed=untried
pkg_failed=untried
fi[]dnl fi[]dnl
])# _PKG_CONFIG ])# _PKG_CONFIG
@ -138,16 +140,17 @@ and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.]) See the pkg-config man page for more details.])
if test $pkg_failed = yes; then if test $pkg_failed = yes; then
AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED _PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1`
else else
$1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1`
fi fi
# Put the nasty error message in config.log where it belongs # Put the nasty error message in config.log where it belongs
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
ifelse([$4], , [AC_MSG_ERROR(dnl m4_default([$4], [AC_MSG_ERROR(
[Package requirements ($2) were not met: [Package requirements ($2) were not met:
$$1_PKG_ERRORS $$1_PKG_ERRORS
@ -155,28 +158,67 @@ $$1_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix. installed software in a non-standard prefix.
_PKG_TEXT _PKG_TEXT])[]dnl
])], ])
[AC_MSG_RESULT([no])
$4])
elif test $pkg_failed = untried; then elif test $pkg_failed = untried; then
ifelse([$4], , [AC_MSG_FAILURE(dnl AC_MSG_RESULT([no])
m4_default([$4], [AC_MSG_FAILURE(
[The pkg-config script could not be found or is too old. Make sure it [The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config. path to pkg-config.
_PKG_TEXT _PKG_TEXT
To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.])], To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
[$4]) ])
else else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
ifelse([$3], , :, [$3]) $3
fi[]dnl fi[]dnl
])# PKG_CHECK_MODULES ])# PKG_CHECK_MODULES
# PKG_INSTALLDIR(DIRECTORY)
# -------------------------
# Substitutes the variable pkgconfigdir as the location where a module
# should install pkg-config .pc files. By default the directory is
# $libdir/pkgconfig, but the default can be changed by passing
# DIRECTORY. The user can override through the --with-pkgconfigdir
# parameter.
AC_DEFUN([PKG_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${libdir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([pkgconfigdir],
[AS_HELP_STRING([--with-pkgconfigdir], pkg_description)],,
[with_pkgconfigdir=]pkg_default)
AC_SUBST([pkgconfigdir], [$with_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
]) dnl PKG_INSTALLDIR
# PKG_NOARCH_INSTALLDIR(DIRECTORY)
# -------------------------
# Substitutes the variable noarch_pkgconfigdir as the location where a
# module should install arch-independent pkg-config .pc files. By
# default the directory is $datadir/pkgconfig, but the default can be
# changed by passing DIRECTORY. The user can override through the
# --with-noarch-pkgconfigdir parameter.
AC_DEFUN([PKG_NOARCH_INSTALLDIR],
[m4_pushdef([pkg_default], [m4_default([$1], ['${datadir}/pkgconfig'])])
m4_pushdef([pkg_description],
[pkg-config arch-independent installation directory @<:@]pkg_default[@:>@])
AC_ARG_WITH([noarch-pkgconfigdir],
[AS_HELP_STRING([--with-noarch-pkgconfigdir], pkg_description)],,
[with_noarch_pkgconfigdir=]pkg_default)
AC_SUBST([noarch_pkgconfigdir], [$with_noarch_pkgconfigdir])
m4_popdef([pkg_default])
m4_popdef([pkg_description])
]) dnl PKG_NOARCH_INSTALLDIR
# Copyright (C) 2002-2012 Free Software Foundation, Inc. # Copyright (C) 2002-2012 Free Software Foundation, Inc.
# #
# This file is free software; the Free Software Foundation # This file is free software; the Free Software Foundation
@ -192,7 +234,7 @@ AC_DEFUN([AM_AUTOMAKE_VERSION],
[am__api_version='1.12' [am__api_version='1.12'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro. dnl require some minimum version. Point them to the right macro.
m4_if([$1], [1.12.5], [], m4_if([$1], [1.12.6], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
]) ])
@ -208,7 +250,7 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
[AM_AUTOMAKE_VERSION([1.12.5])dnl [AM_AUTOMAKE_VERSION([1.12.6])dnl
m4_ifndef([AC_AUTOCONF_VERSION], m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
@ -757,44 +799,6 @@ fi
rmdir .tst 2>/dev/null rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])]) AC_SUBST([am__leading_dot])])
# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
# From Jim Meyering
# Copyright (C) 1996-2012 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# AM_MAINTAINER_MODE([DEFAULT-MODE])
# ----------------------------------
# Control maintainer-specific portions of Makefiles.
# Default is to disable them, unless 'enable' is passed literally.
# For symmetry, 'disable' may be passed as well. Anyway, the user
# can override the default with the --enable/--disable switch.
AC_DEFUN([AM_MAINTAINER_MODE],
[m4_case(m4_default([$1], [disable]),
[enable], [m4_define([am_maintainer_other], [disable])],
[disable], [m4_define([am_maintainer_other], [enable])],
[m4_define([am_maintainer_other], [enable])
m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
dnl maintainer-mode's default is 'disable' unless 'enable' is passed
AC_ARG_ENABLE([maintainer-mode],
[AS_HELP_STRING([--]am_maintainer_other[-maintainer-mode],
am_maintainer_other[ make rules and dependencies not useful
(and sometimes confusing) to the casual installer])],
[USE_MAINTAINER_MODE=$enableval],
[USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
AC_MSG_RESULT([$USE_MAINTAINER_MODE])
AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
MAINT=$MAINTAINER_MODE_TRUE
AC_SUBST([MAINT])dnl
]
)
AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
# Check to see how 'make' treats includes. -*- Autoconf -*- # Check to see how 'make' treats includes. -*- Autoconf -*-
# Copyright (C) 2001-2012 Free Software Foundation, Inc. # Copyright (C) 2001-2012 Free Software Foundation, Inc.
@ -1201,7 +1205,7 @@ AC_SUBST([am__untar])
dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure. dnl xorg-macros.m4. Generated from xorg-macros.m4.in xorgversion.m4 by configure.
dnl dnl
dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved. dnl Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
dnl dnl
dnl Permission is hereby granted, free of charge, to any person obtaining a dnl Permission is hereby granted, free of charge, to any person obtaining a
dnl copy of this software and associated documentation files (the "Software"), dnl copy of this software and associated documentation files (the "Software"),
dnl to deal in the Software without restriction, including without limitation dnl to deal in the Software without restriction, including without limitation
@ -1234,10 +1238,10 @@ dnl DEALINGS IN THE SOFTWARE.
# [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])]) # [m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])])
# #
# #
# See the "minimum version" comment for each macro you use to see what # See the "minimum version" comment for each macro you use to see what
# version you require. # version you require.
m4_defun([XORG_MACROS_VERSION],[ m4_defun([XORG_MACROS_VERSION],[
m4_define([vers_have], [1.17]) m4_define([vers_have], [1.19.0])
m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.]))) m4_define([maj_have], m4_substr(vers_have, 0, m4_index(vers_have, [.])))
m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.]))) m4_define([maj_needed], m4_substr([$1], 0, m4_index([$1], [.])))
m4_if(m4_cmp(maj_have, maj_needed), 0,, m4_if(m4_cmp(maj_have, maj_needed), 0,,
@ -1257,7 +1261,7 @@ m4_undefine([maj_needed])
# such as man pages and config files # such as man pages and config files
AC_DEFUN([XORG_PROG_RAWCPP],[ AC_DEFUN([XORG_PROG_RAWCPP],[
AC_REQUIRE([AC_PROG_CPP]) AC_REQUIRE([AC_PROG_CPP])
AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}], AC_PATH_PROGS(RAWCPP, [cpp], [${CPP}],
[$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib]) [$PATH:/bin:/usr/bin:/usr/lib:/usr/libexec:/usr/ccs/lib:/usr/ccs/lbin:/lib])
# Check for flag to avoid builtin definitions - assumes unix is predefined, # Check for flag to avoid builtin definitions - assumes unix is predefined,
@ -1287,6 +1291,7 @@ if test `${RAWCPP} < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then
AC_MSG_RESULT([no]) AC_MSG_RESULT([no])
else else
if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then if test `${RAWCPP} -traditional < conftest.$ac_ext | grep -c 'preserve \"'` -eq 1 ; then
TRADITIONALCPPFLAGS="-traditional"
RAWCPPFLAGS="${RAWCPPFLAGS} -traditional" RAWCPPFLAGS="${RAWCPPFLAGS} -traditional"
AC_MSG_RESULT([yes]) AC_MSG_RESULT([yes])
else else
@ -1295,6 +1300,7 @@ else
fi fi
rm -f conftest.$ac_ext rm -f conftest.$ac_ext
AC_SUBST(RAWCPPFLAGS) AC_SUBST(RAWCPPFLAGS)
AC_SUBST(TRADITIONALCPPFLAGS)
]) # XORG_PROG_RAWCPP ]) # XORG_PROG_RAWCPP
# XORG_MANPAGE_SECTIONS() # XORG_MANPAGE_SECTIONS()
@ -1819,9 +1825,10 @@ AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
]) # XORG_WITH_ASCIIDOC ]) # XORG_WITH_ASCIIDOC
# XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT]) # XORG_WITH_DOXYGEN([MIN-VERSION], [DEFAULT])
# -------------------------------- # -------------------------------------------
# Minimum version: 1.5.0 # Minimum version: 1.5.0
# Minimum version for optional DEFAULT argument: 1.11.0 # Minimum version for optional DEFAULT argument: 1.11.0
# Minimum version for optional DOT checking: 1.18.0
# #
# Documentation tools are not always available on all platforms and sometimes # Documentation tools are not always available on all platforms and sometimes
# not at the appropriate level. This macro enables a module to test for the # not at the appropriate level. This macro enables a module to test for the
@ -1841,6 +1848,7 @@ AM_CONDITIONAL([HAVE_ASCIIDOC], [test "$have_asciidoc" = yes])
# #
AC_DEFUN([XORG_WITH_DOXYGEN],[ AC_DEFUN([XORG_WITH_DOXYGEN],[
AC_ARG_VAR([DOXYGEN], [Path to doxygen command]) AC_ARG_VAR([DOXYGEN], [Path to doxygen command])
AC_ARG_VAR([DOT], [Path to the dot graphics utility])
m4_define([_defopt], m4_default([$2], [auto])) m4_define([_defopt], m4_default([$2], [auto]))
AC_ARG_WITH(doxygen, AC_ARG_WITH(doxygen,
AS_HELP_STRING([--with-doxygen], AS_HELP_STRING([--with-doxygen],
@ -1884,6 +1892,20 @@ m4_ifval([$1],
AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed]) AC_MSG_ERROR([doxygen version $doxygen_version found, but $1 needed])
fi]) fi])
fi]) fi])
dnl Check for DOT if we have doxygen. The caller decides if it is mandatory
dnl HAVE_DOT is a variable that can be used in your doxygen.in config file:
dnl HAVE_DOT = @HAVE_DOT@
HAVE_DOT=no
if test "x$have_doxygen" = "xyes"; then
AC_PATH_PROG([DOT], [dot])
if test "x$DOT" != "x"; then
HAVE_DOT=yes
fi
fi
AC_SUBST([HAVE_DOT])
AM_CONDITIONAL([HAVE_DOT], [test "$HAVE_DOT" = "yes"])
AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes]) AM_CONDITIONAL([HAVE_DOXYGEN], [test "$have_doxygen" = yes])
]) # XORG_WITH_DOXYGEN ]) # XORG_WITH_DOXYGEN
@ -2066,6 +2088,29 @@ fi])
AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes]) AM_CONDITIONAL([HAVE_FOP], [test "$have_fop" = yes])
]) # XORG_WITH_FOP ]) # XORG_WITH_FOP
# XORG_WITH_M4([MIN-VERSION])
# ---------------------------
# Minimum version: 1.19.0
#
# This macro attempts to locate an m4 macro processor which supports
# -I option and is only useful for modules relying on M4 in order to
# expand macros in source code files.
#
# Interface to module:
# M4: returns the path of the m4 program found
# returns the path set by the user in the environment
#
AC_DEFUN([XORG_WITH_M4], [
AC_CACHE_CHECK([for m4 that supports -I option], [ac_cv_path_M4],
[AC_PATH_PROGS_FEATURE_CHECK([M4], [m4 gm4],
[[$ac_path_M4 -I. /dev/null > /dev/null 2>&1 && \
ac_cv_path_M4=$ac_path_M4 ac_path_M4_found=:]],
[AC_MSG_ERROR([could not find m4 that supports -I option])],
[$PATH:/usr/gnu/bin])])
AC_SUBST([M4], [$ac_cv_path_M4])
]) # XORG_WITH_M4
# XORG_WITH_PS2PDF([DEFAULT]) # XORG_WITH_PS2PDF([DEFAULT])
# ---------------- # ----------------
# Minimum version: 1.6.0 # Minimum version: 1.6.0
@ -2520,7 +2565,8 @@ AC_ARG_ENABLE(malloc0returnsnull,
AC_MSG_CHECKING([whether malloc(0) returns NULL]) AC_MSG_CHECKING([whether malloc(0) returns NULL])
if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
AC_RUN_IFELSE([AC_LANG_PROGRAM([ AC_CACHE_VAL([xorg_cv_malloc0_returns_null],
[AC_RUN_IFELSE([AC_LANG_PROGRAM([
#include <stdlib.h> #include <stdlib.h>
],[ ],[
char *m0, *r0, *c0, *p; char *m0, *r0, *c0, *p;
@ -2530,9 +2576,9 @@ if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then
c0 = calloc(0,10); c0 = calloc(0,10);
exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1); exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1);
])], ])],
[MALLOC_ZERO_RETURNS_NULL=yes], [xorg_cv_malloc0_returns_null=yes],
[MALLOC_ZERO_RETURNS_NULL=no], [xorg_cv_malloc0_returns_null=no])])
[MALLOC_ZERO_RETURNS_NULL=yes]) MALLOC_ZERO_RETURNS_NULL=$xorg_cv_malloc0_returns_null
fi fi
AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL]) AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL])
@ -2743,18 +2789,18 @@ fi
found="no" found="no"
m4_foreach([flag], m4_cdr($@), [ m4_foreach([flag], m4_cdr($@), [
if test $found = "no" ; then if test $found = "no" ; then
if test "x$xorg_testset_unknown_warning_option" = "xyes" ; then if test "x$xorg_testset_]CACHE_PREFIX[_unknown_warning_option" = "xyes" ; then
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option" PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unknown-warning-option"
fi fi
if test "x$xorg_testset_unused_command_line_argument" = "xyes" ; then if test "x$xorg_testset_]CACHE_PREFIX[_unused_command_line_argument" = "xyes" ; then
PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument" PREFIX[FLAGS]="$PREFIX[FLAGS] -Werror=unused-command-line-argument"
fi fi
PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag[" PREFIX[FLAGS]="$PREFIX[FLAGS] ]flag["
dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname
AC_MSG_CHECKING([if ]COMPILER[ supports]flag[]) AC_MSG_CHECKING([if ]COMPILER[ supports ]flag[])
cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[]) cacheid=AS_TR_SH([xorg_cv_]CACHE_PREFIX[_flag_]flag[])
AC_CACHE_VAL($cacheid, AC_CACHE_VAL($cacheid,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])], [AC_LINK_IFELSE([AC_LANG_PROGRAM([int i;])],
@ -2821,7 +2867,7 @@ AC_LANG_CASE(
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-prototypes])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wnested-externs])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wbad-function-cast])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wold-style-definition], [-fd])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wdeclaration-after-statement])
] ]
) )
@ -2830,16 +2876,17 @@ AC_LANG_CASE(
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wunused])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wuninitialized])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wshadow])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-noreturn])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute]) XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wmissing-format-attribute])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wredundant-decls])
XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
# These are currently disabled because they are noisy. They will be enabled # These are currently disabled because they are noisy. They will be enabled
# in the future once the codebase is sufficiently modernized to silence # in the future once the codebase is sufficiently modernized to silence
# them. For now, I don't want them to drown out the other warnings. # them. For now, I don't want them to drown out the other warnings.
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wlogical-op])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses]) # XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wparentheses])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align]) # XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-align])
# XORG_TESTSET_CFLAG([[BASE_]PREFIX[FLAGS]], [-Wcast-qual])
# Turn some warnings into errors, so we don't accidently get successful builds # Turn some warnings into errors, so we don't accidently get successful builds
# when there are problems that should be fixed. # when there are problems that should be fixed.
@ -3013,7 +3060,7 @@ dnl
# XORG_RELEASE_VERSION # XORG_RELEASE_VERSION
# -------------------- # --------------------
# Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use. # Defines PACKAGE_VERSION_{MAJOR,MINOR,PATCHLEVEL} for modules to use.
AC_DEFUN([XORG_RELEASE_VERSION],[ AC_DEFUN([XORG_RELEASE_VERSION],[
AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR], AC_DEFINE_UNQUOTED([PACKAGE_VERSION_MAJOR],
[`echo $PACKAGE_VERSION | cut -d . -f 1`], [`echo $PACKAGE_VERSION | cut -d . -f 1`],

347
app/xmag/compile Normal file
View File

@ -0,0 +1,347 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-10-14.11; # UTC
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

8
app/xmag/config.sub vendored
View File

@ -4,7 +4,7 @@
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, # 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012 Free Software Foundation, Inc. # 2011, 2012 Free Software Foundation, Inc.
timestamp='2012-10-10' timestamp='2012-12-06'
# This file is (in principle) common to ALL GNU software. # This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software # The presence of a machine in this file suggests that SOME GNU software
@ -1026,7 +1026,11 @@ case $basic_machine in
basic_machine=i586-unknown basic_machine=i586-unknown
os=-pw32 os=-pw32
;; ;;
rdos) rdos | rdos64)
basic_machine=x86_64-pc
os=-rdos
;;
rdos32)
basic_machine=i386-pc basic_machine=i386-pc
os=-rdos os=-rdos
;; ;;

804
app/xmag/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -21,11 +21,15 @@ dnl PERFORMANCE OF THIS SOFTWARE.
dnl dnl
dnl Process this file with autoconf to create configure. dnl Process this file with autoconf to create configure.
# Initialize Autoconf
AC_PREREQ([2.60]) AC_PREREQ([2.60])
AC_INIT([xmag], [1.0.5], AC_INIT([xmag], [1.0.6],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xmag]) [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [xmag])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
# Initialize Automake
AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_INIT_AUTOMAKE([foreign dist-bzip2])
AM_MAINTAINER_MODE
# Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS # Require X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
m4_ifndef([XORG_MACROS_VERSION], m4_ifndef([XORG_MACROS_VERSION],
@ -33,8 +37,6 @@ m4_ifndef([XORG_MACROS_VERSION],
XORG_MACROS_VERSION(1.8) XORG_MACROS_VERSION(1.8)
XORG_DEFAULT_OPTIONS XORG_DEFAULT_OPTIONS
AC_CONFIG_HEADERS([config.h])
AC_CHECK_FUNCS([nanosleep poll select]) AC_CHECK_FUNCS([nanosleep poll select])
# Math libraries & functions # Math libraries & functions

View File

@ -1,4 +1,4 @@
# Makefile.in generated by automake 1.12.5 from Makefile.am. # Makefile.in generated by automake 1.12.6 from Makefile.am.
# @configure_input@ # @configure_input@
# Copyright (C) 1994-2012 Free Software Foundation, Inc. # Copyright (C) 1994-2012 Free Software Foundation, Inc.
@ -153,7 +153,6 @@ LIBS = @LIBS@
LIB_MAN_DIR = @LIB_MAN_DIR@ LIB_MAN_DIR = @LIB_MAN_DIR@
LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
LTLIBOBJS = @LTLIBOBJS@ LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@ MAKEINFO = @MAKEINFO@
MAN_SUBSTS = @MAN_SUBSTS@ MAN_SUBSTS = @MAN_SUBSTS@
MISC_MAN_DIR = @MISC_MAN_DIR@ MISC_MAN_DIR = @MISC_MAN_DIR@
@ -169,6 +168,8 @@ PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@ PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG = @PKG_CONFIG@
PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
SED = @SED@ SED = @SED@
SET_MAKE = @SET_MAKE@ SET_MAKE = @SET_MAKE@
SHELL = @SHELL@ SHELL = @SHELL@
@ -239,7 +240,7 @@ all: all-am
.SUFFIXES: .SUFFIXES:
.SUFFIXES: .$(APP_MAN_SUFFIX) .man .SUFFIXES: .$(APP_MAN_SUFFIX) .man
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \ @for dep in $?; do \
case '$(am__configure_deps)' in \ case '$(am__configure_deps)' in \
*$$dep*) \ *$$dep*) \
@ -264,9 +265,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) $(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps): $(am__aclocal_m4_deps):
install-appmanDATA: $(appman_DATA) install-appmanDATA: $(appman_DATA)

View File

@ -85,14 +85,14 @@ from The Open Group.
#endif #endif
/* highlight mode */ /* highlight mode */
typedef enum { drag, resize, done } hlMode; typedef enum { drag, resize, done } hlMode;
/* highlight data structure */ /* highlight data structure */
typedef struct { typedef struct {
Boolean newScale; Boolean newScale;
hlMode selectMode; hlMode selectMode;
GC gc; GC gc;
XWindowAttributes win_info; XWindowAttributes win_info;
XImage *image; XImage *image;
Position homeX, homeY, x, y; Position homeX, homeY, x, y;
Dimension width, height; Dimension width, height;
@ -106,7 +106,7 @@ static XtAppContext app;
static Cursor ulAngle, urAngle, lrAngle, llAngle; static Cursor ulAngle, urAngle, lrAngle, llAngle;
static Display *dpy; static Display *dpy;
static int scr; static int scr;
static GC selectGC; static GC selectGC;
static XGCValues selectGCV; static XGCValues selectGCV;
static Widget toplevel, root; static Widget toplevel, root;
static Atom wm_delete_window; static Atom wm_delete_window;
@ -170,7 +170,7 @@ static XrmOptionDescRec optionDesc[] = {
{"-bd", "*borderColor", XrmoptionSepArg, (XtPointer)NULL}, {"-bd", "*borderColor", XrmoptionSepArg, (XtPointer)NULL},
{"-bg", "*background", XrmoptionSepArg, (XtPointer)NULL}, {"-bg", "*background", XrmoptionSepArg, (XtPointer)NULL},
{"-bw", "*borderWidth", XrmoptionSepArg, (XtPointer)NULL}, {"-bw", "*borderWidth", XrmoptionSepArg, (XtPointer)NULL},
{"-geometry", "*geometry", XrmoptionSepArg, (XtPointer)NULL}, {"-geometry", "*geometry", XrmoptionSepArg, (XtPointer)NULL},
{"-mag", "*mag", XrmoptionSepArg, (XtPointer)NULL}, {"-mag", "*mag", XrmoptionSepArg, (XtPointer)NULL},
{"-source", "*source", XrmoptionSepArg, (XtPointer)NULL}, {"-source", "*source", XrmoptionSepArg, (XtPointer)NULL},
@ -196,10 +196,10 @@ static XtActionsRec actions_table[] = {
/* /*
* Error() -- Error handler: Catch a bad match in magnifing an * Error() -- Error handler: Catch a bad match in magnifying an
* area that contains bits of different depths. * area that contains bits of different depths.
*/ */
static int static int
Error(Display *dpy, XErrorEvent *err) Error(Display *dpy, XErrorEvent *err)
{ {
(void) XmuPrintDefaultErrorMessage (dpy, err, stderr); (void) XmuPrintDefaultErrorMessage (dpy, err, stderr);
@ -209,7 +209,7 @@ Error(Display *dpy, XErrorEvent *err)
/* /*
* CloseAP() -- Close this dialog. If its the last one exit the program. * CloseAP() -- Close this dialog. If its the last one exit the program.
* *
*/ */
static void /* ARGSUSED */ static void /* ARGSUSED */
CloseAP(Widget w, XEvent *event, String *params, Cardinal *num_params) CloseAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
@ -219,7 +219,7 @@ CloseAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
if (event->type != ClientMessage) { if (event->type != ClientMessage) {
n = 0; /* get user data */ n = 0; /* get user data */
XtSetArg(wargs[0], XtNuserData, &data); n++; XtSetArg(wargs[0], XtNuserData, &data); n++;
XtGetValues(w, wargs, n); XtGetValues(w, wargs, n);
w = data->scaleShell; w = data->scaleShell;
} }
XtPopdown(w); XtPopdown(w);
@ -230,7 +230,7 @@ CloseAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
/* /*
* SetCmapPropsAP() -- Put the scale widget first in WM_COLORMAP_WINDOWS * SetCmapPropsAP() -- Put the scale widget first in WM_COLORMAP_WINDOWS
* *
*/ */
static void /* ARGSUSED */ static void /* ARGSUSED */
SetCmapPropsAP(Widget w, XEvent *event, String *params, Cardinal *num_params) SetCmapPropsAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
@ -250,7 +250,7 @@ SetCmapPropsAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
/* /*
* UnsetCmapPropsAP() -- Put the shell first in WM_COLORMAP_WINDOWS * UnsetCmapPropsAP() -- Put the shell first in WM_COLORMAP_WINDOWS
* *
*/ */
static void /* ARGSUSED */ static void /* ARGSUSED */
UnsetCmapPropsAP(Widget w, XEvent *event, String *params, Cardinal *num_params) UnsetCmapPropsAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
@ -289,7 +289,7 @@ ReplaceAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
Arg wargs[2]; int n; hlPtr data; Arg wargs[2]; int n; hlPtr data;
n = 0; /* get user data */ n = 0; /* get user data */
XtSetArg(wargs[0], XtNuserData, &data); n++; XtSetArg(wargs[0], XtNuserData, &data); n++;
XtGetValues(w, wargs, n); XtGetValues(w, wargs, n);
StartRootPtrGrab(False, data); StartRootPtrGrab(False, data);
} }
@ -317,13 +317,13 @@ PopupPixelAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
XtSetArg(wargs[n], XtNheight, &scale_height); n++; XtSetArg(wargs[n], XtNheight, &scale_height); n++;
XtGetValues(w, wargs, n); XtGetValues(w, wargs, n);
XtTranslateCoords(w, -1, -1, &scale_x, &scale_y); XtTranslateCoords(w, -1, -1, &scale_x, &scale_y);
XtRealizeWidget(data->pixShell); /* to get the right height */ XtRealizeWidget(data->pixShell); /* to get the right height */
n = 0; n = 0;
XtSetArg(wargs[n], XtNheight, &label_height); n++; XtSetArg(wargs[n], XtNheight, &label_height); n++;
XtGetValues(data->pixShell, wargs, n); XtGetValues(data->pixShell, wargs, n);
if ((double) event->xbutton.y / (double) scale_height > 0.5) { if ((double) event->xbutton.y / (double) scale_height > 0.5) {
label_x = scale_x; label_x = scale_x;
label_y = scale_y; label_y = scale_y;
@ -366,11 +366,12 @@ UpdatePixelAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
else { else {
color.pixel = pixel; color.pixel = pixel;
XQueryColor(dpy, data->win_info.colormap, &color); XQueryColor(dpy, data->win_info.colormap, &color);
sprintf(string, "Pixel %ld at (%d,%d) colored (%x,%x,%x).", snprintf(string, sizeof(string),
pixel, x + data->x, y + data->y, "Pixel %ld at (%d,%d) colored (%x,%x,%x).",
color.red, color.green, color.blue); pixel, x + data->x, y + data->y,
color.red, color.green, color.blue);
n = 0; n = 0;
XtSetArg(wargs[n], XtNlabel, string); n++; XtSetArg(wargs[n], XtNlabel, string); n++;
XtSetValues(data->pixLabel, wargs, n); XtSetValues(data->pixLabel, wargs, n);
XtPopup(data->pixShell, XtGrabNone); XtPopup(data->pixShell, XtGrabNone);
} }
@ -387,7 +388,7 @@ PopdownPixelAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
int n; int n;
Arg wargs[3]; Arg wargs[3];
hlPtr data = NULL; hlPtr data = NULL;
n = 0; n = 0;
XtSetArg(wargs[0], XtNuserData, &data); n++; XtSetArg(wargs[0], XtNuserData, &data); n++;
XtGetValues(w, wargs, n); XtGetValues(w, wargs, n);
@ -400,14 +401,14 @@ PopdownPixelAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
static void /* ARGSUSED */ static void /* ARGSUSED */
SelectRegionAP(Widget w, XEvent *event, String *params, Cardinal *num_params) SelectRegionAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
{ {
/***** NOT SURE WHAT TO DO WITH THIS /***** NOT SURE WHAT TO DO WITH THIS
if (app_resources.unmap) if (app_resources.unmap)
XtUnmapWidget(toplevel); XtUnmapWidget(toplevel);
Redisplay(XtDisplay(w), RootWindow(XtDisplay(w), Redisplay(XtDisplay(w), RootWindow(XtDisplay(w),
DefaultScreen(XtDisplay(w))), DefaultScreen(XtDisplay(w))),
source.width, source.height, source.width, source.height,
app_resources.freq, app_resources.puls, app_resources.freq, app_resources.puls,
ul_angle, lr_angle, ul_angle, lr_angle,
app_resources.grab); app_resources.grab);
@ -418,19 +419,19 @@ SelectRegionAP(Widget w, XEvent *event, String *params, Cardinal *num_params)
/* /*
* CheckPoints() -- Change the cursor for the correct quadrant. * CheckPoints() -- Change the cursor for the correct quadrant.
* Make sure the first point is less than the second * Make sure the first point is less than the second
* for drawing the selection rectangle. * for drawing the selection rectangle.
* *
*/ */
static void static void
CheckPoints(Position *x1, Position *x2, Position *y1, Position *y2) CheckPoints(Position *x1, Position *x2, Position *y1, Position *y2)
{ {
Position tmp; Position tmp;
Boolean above, left; Boolean above, left;
Cursor newC; Cursor newC;
above = (*y2 < *y1); left = (*x2 < *x1); above = (*y2 < *y1); left = (*x2 < *x1);
if (above&&left) newC = ulAngle; if (above&&left) newC = ulAngle;
else if (above&&!left) newC = urAngle; else if (above&&!left) newC = urAngle;
else if (!above&&!left) newC = lrAngle; else if (!above&&!left) newC = lrAngle;
@ -453,24 +454,24 @@ HighlightTO(XtPointer closure, XtIntervalId *id) /* ARGSUSED */
hlPtr data = (hlPtr)closure; hlPtr data = (hlPtr)closure;
XGrabServer(dpy); XGrabServer(dpy);
if (data->selectMode == drag) { if (data->selectMode == drag) {
XDrawRectangle(dpy, DefaultRootWindow(dpy), data->gc, XDrawRectangle(dpy, DefaultRootWindow(dpy), data->gc,
data->x, data->y, data->width, data->height); data->x, data->y, data->width, data->height);
XFlush(dpy); XFlush(dpy);
HLSLEEP; HLSLEEP;
XDrawRectangle(dpy, DefaultRootWindow(dpy), data->gc, XDrawRectangle(dpy, DefaultRootWindow(dpy), data->gc,
data->x, data->y, data->width, data->height); data->x, data->y, data->width, data->height);
} }
else if (data->selectMode == resize) { else if (data->selectMode == resize) {
Position x1 = data->homeX, Position x1 = data->homeX,
x2 = data->x, x2 = data->x,
y1 = data->homeY, y1 = data->homeY,
y2 = data->y; y2 = data->y;
CheckPoints(&x1, &x2, &y1, &y2); CheckPoints(&x1, &x2, &y1, &y2);
XDrawRectangle(dpy, DefaultRootWindow(dpy), data->gc, XDrawRectangle(dpy, DefaultRootWindow(dpy), data->gc,
x1, y1, x2 - x1, y2 - y1); x1, y1, x2 - x1, y2 - y1);
XFlush(dpy); XFlush(dpy);
HLSLEEP; HLSLEEP;
XDrawRectangle(dpy, DefaultRootWindow(dpy), data->gc, XDrawRectangle(dpy, DefaultRootWindow(dpy), data->gc,
x1, y1, x2 - x1, y2 - y1); x1, y1, x2 - x1, y2 - y1);
} }
XUngrabServer(dpy); XUngrabServer(dpy);
@ -545,7 +546,7 @@ PasteCB(Widget w, XtPointer clientData, XtPointer callData)
/* /*
* SetupGC() -- Graphics context for magnification selection. * SetupGC() -- Graphics context for magnification selection.
*/ */
static void static void
SetupGC(void) SetupGC(void)
{ {
selectGCV.function = GXxor; selectGCV.function = GXxor;
@ -553,16 +554,16 @@ SetupGC(void)
selectGCV.subwindow_mode = IncludeInferiors; selectGCV.subwindow_mode = IncludeInferiors;
selectGC = XtGetGC(toplevel, GCFunction|GCForeground|GCSubwindowMode, selectGC = XtGetGC(toplevel, GCFunction|GCForeground|GCSubwindowMode,
&selectGCV); &selectGCV);
} }
/* /*
* FindWindow() -- Determin window the pointer is over. * FindWindow() -- Determine window the pointer is over.
* *
*/ */
static Window static Window
FindWindow(int x, int y) /* Locatation of cursor */ FindWindow(int x, int y) /* Location of cursor */
{ {
XWindowAttributes wa; XWindowAttributes wa;
Window findW = DefaultRootWindow(dpy), stopW, childW; Window findW = DefaultRootWindow(dpy), stopW, childW;
@ -571,7 +572,7 @@ FindWindow(int x, int y) /* Locatation of cursor */
stopW = findW; stopW = findW;
while (stopW) { while (stopW) {
XTranslateCoordinates(dpy, findW, stopW, XTranslateCoordinates(dpy, findW, stopW,
x, y, &x, &y, &childW); x, y, &x, &y, &childW);
findW = stopW; findW = stopW;
/* If child is not InputOutput (for example, InputOnly) */ /* If child is not InputOutput (for example, InputOnly) */
@ -591,15 +592,15 @@ FindWindow(int x, int y) /* Locatation of cursor */
/* /*
* ResizeEH() -- Event Handler for resize of selection box. * ResizeEH() -- Event Handler for resize of selection box.
*/ */
static void static void
ResizeEH(Widget w, XtPointer closure, XEvent *event, ResizeEH(Widget w, XtPointer closure, XEvent *event,
Boolean *continue_to_dispatch) /* ARGSUSED */ Boolean *continue_to_dispatch) /* ARGSUSED */
{ {
hlPtr data = (hlPtr)closure; hlPtr data = (hlPtr)closure;
switch (event->type) { switch (event->type) {
case MotionNotify: case MotionNotify:
data->x = event->xmotion.x_root; data->x = event->xmotion.x_root;
data->y = event->xmotion.y_root; data->y = event->xmotion.y_root;
break; break;
case ButtonRelease: case ButtonRelease:
GetImageAndAttributes(FindWindow(event->xmotion.x_root, GetImageAndAttributes(FindWindow(event->xmotion.x_root,
@ -611,7 +612,7 @@ ResizeEH(Widget w, XtPointer closure, XEvent *event,
data); data);
if (data->newScale) if (data->newScale)
PopupNewScale(data); PopupNewScale(data);
else else
SWSetImage(data->scaleInstance, data->image); SWSetImage(data->scaleInstance, data->image);
XtUngrabPointer(w, CurrentTime); XtUngrabPointer(w, CurrentTime);
/***** /*****
@ -628,10 +629,10 @@ ResizeEH(Widget w, XtPointer closure, XEvent *event,
/* /*
* DragEH() -- Event Handler for draging selection box. * DragEH() -- Event Handler for dragging selection box.
*/ */
static void static void
DragEH(Widget w, XtPointer closure, XEvent *event, DragEH(Widget w, XtPointer closure, XEvent *event,
Boolean *continue_to_dispatch) /* ARGSUSED */ Boolean *continue_to_dispatch) /* ARGSUSED */
{ {
hlPtr data = (hlPtr)closure; hlPtr data = (hlPtr)closure;
@ -647,9 +648,9 @@ DragEH(Widget w, XtPointer closure, XEvent *event,
* where the depth of the window does not match the depth of * where the depth of the window does not match the depth of
* the root window. * the root window.
*/ */
GetImageAndAttributes(FindWindow(event->xmotion.x_root, GetImageAndAttributes(FindWindow(event->xmotion.x_root,
event->xmotion.y_root), event->xmotion.y_root),
event->xbutton.x_root, event->xbutton.x_root,
event->xbutton.y_root, event->xbutton.y_root,
srcWidth, srcHeight, data); srcWidth, srcHeight, data);
if (data->newScale) if (data->newScale)
@ -664,21 +665,21 @@ DragEH(Widget w, XtPointer closure, XEvent *event,
} }
break; break;
case ButtonPress: case ButtonPress:
if (event->xbutton.button == Button2) { /* turn on resize mode */ if (event->xbutton.button == Button2) { /* turn on resize mode */
data->homeX = event->xbutton.x_root; data->homeX = event->xbutton.x_root;
data->homeY = event->xbutton.y_root; data->homeY = event->xbutton.y_root;
data->x = event->xbutton.x_root + srcWidth; data->x = event->xbutton.x_root + srcWidth;
data->y = event->xbutton.y_root + srcHeight; data->y = event->xbutton.y_root + srcHeight;
data->selectMode = resize; data->selectMode = resize;
XtRemoveRawEventHandler(w, PointerMotionMask|ButtonPressMask| XtRemoveRawEventHandler(w, PointerMotionMask|ButtonPressMask|
ButtonReleaseMask, True, DragEH, (XtPointer)data); ButtonReleaseMask, True, DragEH, (XtPointer)data);
XChangeActivePointerGrab XChangeActivePointerGrab
(dpy, PointerMotionMask|ButtonPressMask|ButtonReleaseMask, (dpy, PointerMotionMask|ButtonPressMask|ButtonReleaseMask,
lrAngle, CurrentTime); lrAngle, CurrentTime);
XWarpPointer(dpy, None, None, 0, 0, 0, 0, XWarpPointer(dpy, None, None, 0, 0, 0, 0,
srcWidth, srcHeight); srcWidth, srcHeight);
XtAddEventHandler(w, PointerMotionMask|ButtonReleaseMask, XtAddEventHandler(w, PointerMotionMask|ButtonReleaseMask,
True, ResizeEH, (XtPointer)data); True, ResizeEH, (XtPointer)data);
} }
break; break;
@ -690,11 +691,11 @@ DragEH(Widget w, XtPointer closure, XEvent *event,
/* /*
* StartRootPtrGrab() -- Bring up the selection box. * StartRootPtrGrab() -- Bring up the selection box.
* *
*/ */
static void static void
StartRootPtrGrab(int new, /* do we cretate a new scale instance? */ StartRootPtrGrab(int new, /* do we create a new scale instance? */
hlPtr data) /* highligh data */ hlPtr data) /* highlight data */
{ {
Window rootR, childR; Window rootR, childR;
int rootX, rootY, winX, winY; int rootX, rootY, winX, winY;
@ -704,7 +705,7 @@ StartRootPtrGrab(int new, /* do we cretate a new scale instance? */
(root, False, (root, False,
PointerMotionMask|ButtonPressMask|ButtonReleaseMask, PointerMotionMask|ButtonPressMask|ButtonReleaseMask,
GrabModeAsync, GrabModeAsync, None, ulAngle, CurrentTime); GrabModeAsync, GrabModeAsync, None, ulAngle, CurrentTime);
XQueryPointer(dpy, DefaultRootWindow(dpy), &rootR, &childR, XQueryPointer(dpy, DefaultRootWindow(dpy), &rootR, &childR,
&rootX, &rootY, &winX, &winY, &mask); &rootX, &rootY, &winX, &winY, &mask);
if (new) { if (new) {
numXmags++; numXmags++;
@ -719,7 +720,7 @@ StartRootPtrGrab(int new, /* do we cretate a new scale instance? */
hlData->width = srcWidth; hlData->width = srcWidth;
hlData->height = srcHeight; hlData->height = srcHeight;
XtAddRawEventHandler XtAddRawEventHandler
(root, PointerMotionMask|ButtonPressMask|ButtonReleaseMask, (root, PointerMotionMask|ButtonPressMask|ButtonReleaseMask,
True, DragEH, (XtPointer)hlData); True, DragEH, (XtPointer)hlData);
(void) XtAppAddTimeOut(app, HLINTERVAL, HighlightTO, (XtPointer)hlData); (void) XtAppAddTimeOut(app, HLINTERVAL, HighlightTO, (XtPointer)hlData);
} }
@ -728,7 +729,7 @@ StartRootPtrGrab(int new, /* do we cretate a new scale instance? */
/* /*
* CreateRoot() -- Create a root window widget. If the user specified x and y * CreateRoot() -- Create a root window widget. If the user specified x and y
* in his source geometry then use this to directly get the * in the source geometry then use this to directly get the
* image. * image.
*/ */
static void static void
@ -737,7 +738,7 @@ CreateRoot(void)
hlPtr data; hlPtr data;
root = XtCreateWidget("root", rootWindowWidgetClass, toplevel, NULL, 0); root = XtCreateWidget("root", rootWindowWidgetClass, toplevel, NULL, 0);
XtRealizeWidget(root); XtRealizeWidget(root);
if (XValue & srcStat && YValue &srcStat) { if (XValue & srcStat && YValue &srcStat) {
numXmags = 1; numXmags = 1;
data = (hlPtr)XtMalloc(sizeof(hlStruct)); data = (hlPtr)XtMalloc(sizeof(hlStruct));
data = data; data = data;
@ -748,7 +749,7 @@ CreateRoot(void)
data->gc = selectGC; data->gc = selectGC;
data->width = srcWidth; data->width = srcWidth;
data->height = srcHeight; data->height = srcHeight;
GetImageAndAttributes(RootWindow(dpy, scr), srcX, srcY, srcWidth, GetImageAndAttributes(RootWindow(dpy, scr), srcX, srcY, srcWidth,
srcHeight, data); srcHeight, data);
PopupNewScale(data); PopupNewScale(data);
return; return;
@ -756,13 +757,13 @@ CreateRoot(void)
} }
/* /*
* GetImageAndAttributes() -- Get the image bits from the screen. * GetImageAndAttributes() -- Get the image bits from the screen.
* We will also determin here the colormap, depth, and * We will also determine here the colormap, depth, and
* visual to be used for the magnification image. * visual to be used for the magnification image.
*/ */
static void static void
GetImageAndAttributes(Window w, int x, int y, int width, int height, GetImageAndAttributes(Window w, int x, int y, int width, int height,
hlPtr data) hlPtr data)
{ {
/* get parameters of window being magnified */ /* get parameters of window being magnified */
@ -841,22 +842,22 @@ GetImageAndAttributes(Window w, int x, int y, int width, int height,
* This function was taken from xwd (thanks Bob...) * This function was taken from xwd (thanks Bob...)
*/ */
#define lowbit(x) ((x) & (~(x) + 1)) #define lowbit(x) ((x) & (~(x) + 1))
static int static int
Get_XColors(XWindowAttributes *win_info, XColor **colors) Get_XColors(XWindowAttributes *win_info, XColor **colors)
{ {
int i, ncolors; int i, ncolors;
if (!win_info->colormap) if (!win_info->colormap)
return(0); return(0);
ncolors = win_info->visual->map_entries; ncolors = win_info->visual->map_entries;
if (!(*colors = (XColor *) XtMalloc (sizeof(XColor) * ncolors))) if (!(*colors = (XColor *) XtMalloc (sizeof(XColor) * ncolors)))
XtError("Out of memory!"); XtError("Out of memory!");
if (win_info->visual->class == DirectColor || if (win_info->visual->class == DirectColor ||
win_info->visual->class == TrueColor) { win_info->visual->class == TrueColor) {
Pixel red, green, blue, red1, green1, blue1; Pixel red, green, blue, red1, green1, blue1;
red = green = blue = 0; red = green = blue = 0;
red1 = lowbit(win_info->visual->red_mask); red1 = lowbit(win_info->visual->red_mask);
green1 = lowbit(win_info->visual->green_mask); green1 = lowbit(win_info->visual->green_mask);
@ -880,9 +881,9 @@ Get_XColors(XWindowAttributes *win_info, XColor **colors)
(*colors)[i].pad = 0; (*colors)[i].pad = 0;
} }
} }
XQueryColors(dpy, win_info->colormap, *colors, ncolors); XQueryColors(dpy, win_info->colormap, *colors, ncolors);
return(ncolors); return(ncolors);
} }
@ -899,12 +900,12 @@ GetMaxIntensity(hlPtr data)
XColor *colors = NULL, *mptr, *tptr; XColor *colors = NULL, *mptr, *tptr;
int i, ncolors; int i, ncolors;
if (data->win_info.colormap == DefaultColormap(dpy, scr)) if (data->win_info.colormap == DefaultColormap(dpy, scr))
return WhitePixel(dpy, scr); return WhitePixel(dpy, scr);
ncolors = Get_XColors(&data->win_info, &colors); ncolors = Get_XColors(&data->win_info, &colors);
mptr = tptr = colors; tptr++; mptr = tptr = colors; tptr++;
for (i=1; i<ncolors; i++) { for (i=1; i<ncolors; i++) {
if ((int)Intensity(mptr) < (int)Intensity(tptr)) if ((int)Intensity(mptr) < (int)Intensity(tptr))
mptr = tptr; mptr = tptr;
tptr++; tptr++;
} }
@ -924,13 +925,13 @@ GetMinIntensity(hlPtr data)
XColor *colors = NULL, *mptr, *tptr; XColor *colors = NULL, *mptr, *tptr;
int i, ncolors; int i, ncolors;
if (data->win_info.colormap == DefaultColormap(dpy, scr)) if (data->win_info.colormap == DefaultColormap(dpy, scr))
return BlackPixel(dpy, scr); return BlackPixel(dpy, scr);
ncolors = Get_XColors(&data->win_info, &colors); ncolors = Get_XColors(&data->win_info, &colors);
mptr = tptr = colors; tptr++; mptr = tptr = colors; tptr++;
for (i=1; i<ncolors; i++) { for (i=1; i<ncolors; i++) {
if ((int)Intensity(mptr) > (int)Intensity(tptr)) if ((int)Intensity(mptr) > (int)Intensity(tptr))
mptr = tptr; mptr = tptr;
tptr++; tptr++;
} }
/* Null pointer protection */ /* Null pointer protection */
@ -948,13 +949,13 @@ static Widget pane1, pane2, pane3, cclose, replace, new, select_w, paste;
/* /*
* PopupNewScale() -- Create and popup a new scale composite. * PopupNewScale() -- Create and popup a new scale composite.
*/ */
static void static void
PopupNewScale(hlPtr data) PopupNewScale(hlPtr data)
{ {
Arg warg; Arg warg;
data->scaleShell = data->scaleShell =
XtVaCreatePopupShell("xmag", topLevelShellWidgetClass, toplevel, XtVaCreatePopupShell("xmag", topLevelShellWidgetClass, toplevel,
XtNgeometry, (XtArgVal)options.geometry, XtNgeometry, (XtArgVal)options.geometry,
XtNtitle, (XtArgVal)options.title, XtNtitle, (XtArgVal)options.title,
NULL); NULL);
@ -981,8 +982,8 @@ PopupNewScale(hlPtr data)
(Arg *) NULL, 0); (Arg *) NULL, 0);
pane3 = XtCreateManagedWidget("pane2", panedWidgetClass, pane1, pane3 = XtCreateManagedWidget("pane2", panedWidgetClass, pane1,
(Arg *) NULL, 0); (Arg *) NULL, 0);
data->scaleInstance = data->scaleInstance =
XtVaCreateManagedWidget("scale", scaleWidgetClass, XtVaCreateManagedWidget("scale", scaleWidgetClass,
pane3, pane3,
XtNvisual, (XtArgVal)data->win_info.visual, XtNvisual, (XtArgVal)data->win_info.visual,
XtNcolormap, (XtArgVal)data->win_info.colormap, XtNcolormap, (XtArgVal)data->win_info.colormap,
@ -996,17 +997,17 @@ PopupNewScale(hlPtr data)
XtParseTranslationTable ("<Message>WM_PROTOCOLS: close()")); XtParseTranslationTable ("<Message>WM_PROTOCOLS: close()"));
XtSetArg(warg, XtNuserData, data); XtSetArg(warg, XtNuserData, data);
XtSetValues(data->scaleInstance, &warg, 1); XtSetValues(data->scaleInstance, &warg, 1);
data->pixShell = data->pixShell =
XtVaCreatePopupShell("pixShell", overrideShellWidgetClass, XtVaCreatePopupShell("pixShell", overrideShellWidgetClass,
toplevel, toplevel,
XtNvisual, (XtArgVal)data->win_info.visual, XtNvisual, (XtArgVal)data->win_info.visual,
XtNcolormap, (XtArgVal)data->win_info.colormap, XtNcolormap, (XtArgVal)data->win_info.colormap,
XtNdepth, (XtArgVal)data->win_info.depth, XtNdepth, (XtArgVal)data->win_info.depth,
XtNborderWidth, (XtPointer)0, XtNborderWidth, (XtPointer)0,
NULL); NULL);
data->pixLabel = data->pixLabel =
XtVaCreateManagedWidget("pixLabel", labelWidgetClass, XtVaCreateManagedWidget("pixLabel", labelWidgetClass,
data->pixShell, data->pixShell,
XtNforeground, (XtPointer)GetMaxIntensity(data), XtNforeground, (XtPointer)GetMaxIntensity(data),
XtNbackground, (XtPointer)GetMinIntensity(data), XtNbackground, (XtPointer)GetMinIntensity(data),
XtNborderWidth, (XtPointer)0, XtNborderWidth, (XtPointer)0,
@ -1018,7 +1019,7 @@ PopupNewScale(hlPtr data)
(dpy, XtWindow(data->scaleShell), &wm_delete_window, 1); (dpy, XtWindow(data->scaleShell), &wm_delete_window, 1);
} }
if (data->win_info.colormap != DefaultColormap(dpy, scr)) { if (data->win_info.colormap != DefaultColormap(dpy, scr)) {
data->cmapWinList[0] = data->scaleShell; data->cmapWinList[0] = data->scaleShell;
data->cmapWinList[1] = data->scaleInstance; data->cmapWinList[1] = data->scaleInstance;
XtSetWMColormapWindows(data->scaleShell, data->cmapWinList, 2); XtSetWMColormapWindows(data->scaleShell, data->cmapWinList, 2);
} }
@ -1045,10 +1046,10 @@ RedoOldScale(hlPtr data)
XtSetArg(wargs[n], XtNvisual, &oldVis); n++; XtSetArg(wargs[n], XtNvisual, &oldVis); n++;
XtSetArg(wargs[n], XtNdepth, &oldDepth); n++; XtSetArg(wargs[n], XtNdepth, &oldDepth); n++;
XtSetArg(wargs[n], XtNcolormap, &oldCmap); n++; XtSetArg(wargs[n], XtNcolormap, &oldCmap); n++;
XtGetValues(data->scaleInstance, wargs, n); XtGetValues(data->scaleInstance, wargs, n);
if (oldVis == data->win_info.visual && oldDepth == data->win_info.depth if (oldVis == data->win_info.visual && oldDepth == data->win_info.depth
&& oldCmap == data->win_info.colormap) { && oldCmap == data->win_info.colormap) {
SWSetImage(data->scaleInstance, data->image); SWSetImage(data->scaleInstance, data->image);
return; return;
} }
/* get width and height, save and reuse them */ /* get width and height, save and reuse them */
@ -1063,7 +1064,7 @@ RedoOldScale(hlPtr data)
XtSetArg(wargs[n], XtNforeground, GetMaxIntensity(data)); n++; XtSetArg(wargs[n], XtNforeground, GetMaxIntensity(data)); n++;
XtSetArg(wargs[n], XtNbackground, GetMinIntensity(data)); n++; XtSetArg(wargs[n], XtNbackground, GetMinIntensity(data)); n++;
XtSetValues(data->pixLabel, wargs, n); XtSetValues(data->pixLabel, wargs, n);
SWSetImage(data->scaleInstance, data->image); SWSetImage(data->scaleInstance, data->image);
XtRealizeWidget(data->scaleInstance); XtRealizeWidget(data->scaleInstance);
XtManageChild(data->scaleInstance); XtManageChild(data->scaleInstance);
} }
@ -1085,13 +1086,13 @@ InitCursors(void)
/* /*
* ParseSourceGeom() -- Determin dimensions of area to magnify from resources. * ParseSourceGeom() -- Determine dimensions of area to magnify from resources.
*/ */
static void static void
ParseSourceGeom(void) ParseSourceGeom(void)
{ {
/* source */ /* source */
srcStat = srcStat =
XParseGeometry(options.source, &srcX, &srcY, &srcWidth, &srcHeight); XParseGeometry(options.source, &srcX, &srcY, &srcWidth, &srcHeight);
if (!srcWidth) srcWidth = SRCWIDTH; if (!srcWidth) srcWidth = SRCWIDTH;
if (!srcHeight) srcHeight = SRCHEIGHT; if (!srcHeight) srcHeight = SRCHEIGHT;
@ -1105,11 +1106,11 @@ ParseSourceGeom(void)
/* /*
* Main program. * Main program.
*/ */
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
XSetErrorHandler(Error); XSetErrorHandler(Error);
/* SUPPRESS 594 */ /* SUPPRESS 594 */
toplevel = XtAppInitialize(&app, "Xmag", optionDesc, XtNumber(optionDesc), toplevel = XtAppInitialize(&app, "Xmag", optionDesc, XtNumber(optionDesc),
&argc, argv, NULL, &argc, argv, NULL,
@ -1124,7 +1125,7 @@ main(int argc, char *argv[])
"usage: xmag [-source geom] [-mag magfactor] [-toolkitoption]\n"); "usage: xmag [-source geom] [-mag magfactor] [-toolkitoption]\n");
exit(1); exit(1);
} }
ParseSourceGeom(); ParseSourceGeom();
XtAppAddActions(app, actions_table, XtNumber(actions_table)); XtAppAddActions(app, actions_table, XtNumber(actions_table));