libxaw: Changes to 'upstream-unstable'
Makefile.am | 14
configure.ac | 55 ---
include/Makefile.am | 7
man/Makefile.am | 1
man/Xaw.man | 11
src/Makefile.am | 24 -
src/OS.c | 2
src/PrintShell.c | 750 ----------------------------------------------------
src/TextSrc.c | 34 ++
src/Vendor.c | 6
src/XawI18n.h | 2
src/XawIm.c | 3
xaw.m4 | 65 ----
xaw8.pc.in | 12
14 files changed, 51 insertions(+), 935 deletions(-)
New commits:
commit 6dab13545cd26efd46dbb58a18ae651c56c7d76d
Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
Date: Fri Nov 7 15:45:32 2008 -0200
libXaw version 1.0.5.
diff --git a/configure.ac b/configure.ac
index b65f7a6..5633a46 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3,7 +3,7 @@ dnl Process this file with autoconf to create configure.
AC_PREREQ([2.57])
AC_INIT([libXaw],
- 1.0.4,
+ 1.0.5,
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
libXaw)
commit 90a343b898dabb8cac5ec831b45e20b1abd306ac
Author: Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>
Date: Fri Nov 7 15:36:15 2008 -0200
Correct build on systems that did not yet upgrade to libtool-2.2
Also correct lib Changelog generation by running "git log" instead of
"git-log", what should work on all versions of git.
The libtool correction issue is probably a hack over several other
hacks. The proper correction should be to ensure that AC_PROG_SED is run
before the AC_CONFIG_COMMANDS([libtool_hack],...), what appears to be the
case in latest libtool, but not 1.5.x.
diff --git a/Makefile.am b/Makefile.am
index 82c3f5d..6cdbece 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -34,6 +34,6 @@ MAINTAINERCLEANFILES=ChangeLog
.PHONY: ChangeLog
ChangeLog:
- (GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
+ (GIT_DIR=$(top_srcdir)/.git git log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || (touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
dist-hook: ChangeLog
diff --git a/configure.ac b/configure.ac
index e8c56b3..b65f7a6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -25,6 +25,7 @@ PKG_PROG_PKG_CONFIG
AC_PROG_SED
AC_CONFIG_COMMANDS([libtool_hack], [
cp -f libtool libtool_
+ test -z "$SED" && SED=sed
$SED '1,/^soname_spec/{
/^soname_spec/i\
# X.Org hack to match monolithic Xaw SONAME\
commit 8256de6062eb150c612ef09a1ae855de0a0cba6c
Author: Lee Leahu <freedesktop-bugs@dyweni.com>
Date: Fri Nov 7 11:00:15 2008 -0500
Fix configure error when using libtool-2.2.*
The configure script errors out when preparing to compile libXaw.
The error occurs with libtool-2.2.6a and libtool-2.2.4.
The error does not occur with libtool-1.5.26.
The error is caused because the libtool file is not created by the
time sed attempts to fix the SONAME.
Libtool-2.2 made an incompatible change to LT_INIT (which replaces
AC_PROG_LIBTOOL): it generates the libtool script at the AC_OUTPUT,
rather then right after being called. Sometimes, configure scripts
call configure to run tests or read its settings; in those cases,
LT_OUTPUT can be appended to force libtool generation earlier.
There is one caveat: libtool is still (re)generated during AC_OUTPUT,
so in our case, even adding LT_OUTPUT wouldn't help, because the sed
changes are overwritten.
AFAICS the solution is to use AC_CONFIG_COMMANDS; patch against
current git master attached.
Report and patch from: http://bugs.freedesktop.org/show_bug.cgi?id=18073
Signed-off-by: James Cloos <cloos@jhcloos.com>
diff --git a/configure.ac b/configure.ac
index 1e93691..e8c56b3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,13 +22,8 @@ PKG_PROG_PKG_CONFIG
#
# fix libtool to set SONAME to libXaw.so.$major
#
-AC_MSG_CHECKING([hacks in libtool for libXaw SONAME])
-if grep "xorglibxawname" libtool > /dev/null ; then
- AC_MSG_RESULT([already done])
-else
- AC_MSG_RESULT([no, fixing])
- AC_CHECK_PROG([SED], [sed], [sed])
- test "x$SED" = x && AC_MSG_ERROR([sed needed to hack libtool script])
+AC_PROG_SED
+AC_CONFIG_COMMANDS([libtool_hack], [
cp -f libtool libtool_
$SED '1,/^soname_spec/{
/^soname_spec/i\
@@ -36,9 +31,8 @@ else
xorglibxawname="libXaw"
/^soname_spec/s/libname/xorglibxawname/
}' libtool_ > libtool
- test "$?" = 0 || AC_MSG_ERROR([failed to hack libtool script])
rm -f libtool_
-fi
+])
# Win32 DLL rules are different.
case $host_os in
commit 012e73faab8dc8617c6da4679715dae14f6cddd4
Author: Daniel Stone <daniel@fooishbar.org>
Date: Fri Aug 15 18:25:53 2008 +0300
Remove last remaining vestiges of Xprint support
Occasionally I think I'm smart enough to commit without testing, then I
break the build. Bad Daniel. No biscuit.
diff --git a/Makefile.am b/Makefile.am
index afc0e08..82c3f5d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,8 +1,5 @@
SUBDIRS = include src man
-aclocaldir = $(datadir)/aclocal
-aclocal_DATA = xaw.m4
-
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA =
@@ -23,7 +20,6 @@ endif
EXTRA_DIST = xaw6.pc.in \
xaw7.pc.in \
autogen.sh \
- xaw.m4 \
old-doc/Changelog \
old-doc/CHANGES \
ChangeLog
diff --git a/include/Makefile.am b/include/Makefile.am
index 53c4f7f..a62ec2a 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -1,9 +1,5 @@
xawincludedir=${includedir}/X11/Xaw
-if BUILD_XAW8
-xaw8_headers = X11/Xaw/Print.h X11/Xaw/PrintSP.h
-endif
-
xawinclude_HEADERS = \
X11/Xaw/AllWidgets.h \
X11/Xaw/AsciiSink.h \
@@ -75,5 +71,4 @@ xawinclude_HEADERS = \
X11/Xaw/Viewport.h \
X11/Xaw/ViewportP.h \
X11/Xaw/XawImP.h \
- X11/Xaw/XawInit.h \
- $(xaw8_headers)
+ X11/Xaw/XawInit.h
diff --git a/xaw.m4 b/xaw.m4
deleted file mode 100644
index 60404ae..0000000
--- a/xaw.m4
+++ /dev/null
@@ -1,65 +0,0 @@
-dnl Copyright 2005 Red Hat, Inc
-dnl
-dnl Permission to use, copy, modify, distribute, and sell this software and its
-dnl documentation for any purpose is hereby granted without fee, provided that
-dnl the above copyright notice appear in all copies and that both that
-dnl copyright notice and this permission notice appear in supporting
-dnl documentation.
-dnl
-dnl The above copyright notice and this permission notice shall be included
-dnl in all copies or substantial portions of the Software.
-dnl
-dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-dnl OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-dnl MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-dnl IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
-dnl OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-dnl ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-dnl OTHER DEALINGS IN THE SOFTWARE.
-dnl
-dnl Except as contained in this notice, the name of the copyright holders shall
-dnl not be used in advertising or otherwise to promote the sale, use or
-dnl other dealings in this Software without prior written authorization
-dnl from the copyright holders.
-dnl
-
-# XAW_CHECK_XPRINT_SUPPORT()
-# --------------------------
-# Adds --enable/disable-xprint and selects the appropriate version of the Xaw
-# library. If neither --enable-xprint nor --disable-xprint are given,
-# the presence of an Xaw with Xprint support will be auto detected
-
-AC_DEFUN([XAW_CHECK_XPRINT_SUPPORT],[
- AC_ARG_ENABLE(xprint, AC_HELP_STRING([--enable-xprint], [Enable XPrint support]),
- [use_xprint=$enableval],[use_xprint=auto])
- if test "x$use_xprint" = "xyes"; then
- TMP_CHECK1=xaw8
- TMP_CHECK2=
- xaw_use_xprint=yes
- elif test "x$use_xprint" = "xno"; then
- TMP_CHECK1=xaw7
- TMP_CHECK2=
- xaw_use_xprint=no
- else
- TMP_CHECK1=xaw8
- TMP_CHECK2=xaw7
- xaw_use_xprint=yes
- fi
-
- PKG_CHECK_MODULES(TMP_XAW, $TMP_CHECK1, success=yes, success=no)
- if [[ ! -z $TMP_CHECK2 ]] ; then
- if test $success = no ; then
- PKG_CHECK_MODULES(TMP_XAW, $TMP_CHECK2, success=yes, success=no)
- xaw_use_xprint=no
- fi
- fi
-
- if test "x$success" = "xyes"; then
- $1_CFLAGS=$TMP_XAW_CFLAGS
- $1_LIBS=$TMP_XAW_LIBS
-
- AM_CONDITIONAL([XAW_USE_XPRINT], [test "x$xaw_use_xprint" = "xyes"])
- else
- AC_MSG_ERROR([No suitable version of Xaw found])
- fi
-])
commit 3cbe136d633d18b263f596638d55f8f13fabd540
Author: Daniel Stone <daniel@fooishbar.org>
Date: Fri Aug 15 17:59:59 2008 +0300
Remove Xaw8 (Xprint)
Remove Xaw8, which only provided Xprint support over Xaw7.
diff --git a/Makefile.am b/Makefile.am
index a83ed57..afc0e08 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -20,16 +20,8 @@ DEFAULT_LIB = libXaw7.so
endif
-if BUILD_XAW8
-
-pkgconfig_DATA += xaw8.pc
-DEFAULT_LIB = libXaw8.so
-
-endif
-
EXTRA_DIST = xaw6.pc.in \
xaw7.pc.in \
- xaw8.pc.in \
autogen.sh \
xaw.m4 \
old-doc/Changelog \
diff --git a/configure.ac b/configure.ac
index c382fa7..1e93691 100644
--- a/configure.ac
+++ b/configure.ac
@@ -79,34 +79,8 @@ if test "x$build_v7" = xyes; then
fi
-# Whether to build Xaw8
-
-AC_ARG_ENABLE(xaw8, AC_HELP_STRING([--disable-xaw8],
- [Disable building of libXaw.so.8]),
- [build_v8=$enableval], [build_v8=auto])
-
-if test "x$build_v8" = xyes || test "x$build_v8" = xauto; then
- PKG_CHECK_MODULES(XPRINT, xp, xprint_found=yes, xprint_found=no)
-
- if test "x$xprint_found" = xno; then
- if test "x$build_v8" = xyes; then
- AC_ERROR([
- Xprint is required to build libXaw.so.8. You can disable
- building of libXaw.so.8 by passing --disable-xaw8 to
- configure])
- fi
- build_v8=no
- else
- PKG_CHECK_MODULES(XAW8, xproto x11 xext xextproto xt xmu xpm xp printproto xau)
- AC_SUBST(XAW8_CFLAGS)
- AC_SUBST(XAW8_LIBS)
- build_v8=yes
- fi
-fi
-
AM_CONDITIONAL(BUILD_XAW6, [test x$build_v6 = xyes])
AM_CONDITIONAL(BUILD_XAW7, [test x$build_v7 = xyes])
-AM_CONDITIONAL(BUILD_XAW8, [test x$build_v8 = xyes])
# Checks for header files.
AC_HEADER_STDC
@@ -138,7 +112,3 @@ fi
if test "x$build_v7" = xyes; then
AC_OUTPUT(xaw7.pc)
fi
-
-if test "x$build_v8" = xyes; then
- AC_OUTPUT(xaw8.pc)
-fi
diff --git a/src/Makefile.am b/src/Makefile.am
index abb0229..85573ce 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -107,28 +107,4 @@ endif
endif
-if BUILD_XAW8
-
-lib_LTLIBRARIES += libXaw8.la
-
-libXaw8_la_CFLAGS = \
- $(COMMON_CFLAGS) \
- $(XAW8_CFLAGS)
-
-libXaw8_la_SOURCES = \
- $(COMMON_SOURCES) \
- PrintShell.c \
- Tip.c
-
-libXaw8_la_LDFLAGS = -version-info 8:0:0 -no-undefined
-libXaw8_la_LIBADD = $(XAW8_LIBS)
-
-if !PLATFORM_WIN32
-install-exec-hook::
- -rm -f $(DESTDIR)$(libdir)/libXaw.so.8
- (cd $(DESTDIR)$(libdir) && ln -s libXaw8.so.8 libXaw.so.8)
-endif
-
-endif
-
EXTRA_DIST = sharedlib.c
diff --git a/src/PrintShell.c b/src/PrintShell.c
deleted file mode 100644
index 5af3461..0000000
--- a/src/PrintShell.c
+++ /dev/null
@@ -1,749 +0,0 @@
-/* $Xorg: PrintShell.c,v 1.1 2003/07/11 19:46:06 gisburn Exp $ */
-/******************************************************************************
- ******************************************************************************
- **
- ** (c) Copyright 2003 Danny Backx <danny.backx@skynet.be>
- ** (c) Copyright 2003-2004 Roland Mainz <roland.mainz@nrubsig.org>
- **
- ** Permission is hereby granted, free of charge, to any person obtaining a copy
- ** of this software and associated documentation files (the "Software"), to deal
- ** in the Software without restriction, including without limitation the rights
- ** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- ** copies of the Software, and to permit persons to whom the Software is
- ** furnished to do so, subject to the following conditions:
- **
- ** The above copyright notice and this permission notice shall be included in
- ** all copies or substantial portions of the Software.
- **
- ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- ** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- ** COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
- ** IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- ** CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- **
- ** Except as contained in this notice, the names of the copyright holders shall
- ** not be used in advertising or otherwise to promote the sale, use or other
- ** dealings in this Software without prior written authorization from said
- ** copyright holders.
- **
- ******************************************************************************
- *****************************************************************************/
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-
-#include <X11/IntrinsicP.h>
-#include <X11/StringDefs.h>
-
-#include "Print.h"
-#include "PrintSP.h"
-
-/* Local prototypes */
-static void class_initialize(void);
-static void class_part_initialize(WidgetClass w_class);
-static void initialize(Widget request, Widget new_w, ArgList args, Cardinal *num_args);
-static void destroy(Widget w);
-static Boolean set_values(Widget current, Widget request, Widget new_w, ArgList args, Cardinal *num_args);
-static void XawPrintNotify(Widget w, XtPointer client, XEvent *evp, Boolean *cont);
-static void XawAttributesNotify(Widget w, XtPointer client, XEvent *evp, Boolean *cont);
-static void XawUpdateLayout(Widget w);
-static void XawUpdateResources(Widget w, XPContext pcontext);
-
-#define Offset(field) XtOffsetOf(XawPrintShellRec, print.field)
-
-#ifdef XAWDEBUG
-#define DEBUGOUT(x) XawDebug x ;
-
-static void
-XawDebug(const char *fn, Widget w, const char *fmt, ...)
-{
- va_list ap;
-
- if (w) {
- fprintf(stderr, "%s %s: ",
- w->core.widget_class->core_class.class_name, XtName(w));
- } else {
- fprintf(stderr, "(null widget): ");
- }
-
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
- va_end(ap);
-}
-#else
-#define DEBUGOUT(x)
-#endif /* XAWDEBUG */
-
-/* Resources for the PrintShell class */
-static XtResource resources[] =
-{
- {
- XawNstartJobCallback, XtCCallback, XtRCallback,
- sizeof(XtCallbackList), Offset(start_job_callback),
- XtRImmediate, (XtPointer)NULL
- },
- {
- XawNendJobCallback, XtCCallback, XtRCallback,
- sizeof(XtCallbackList), Offset(end_job_callback),
- XtRImmediate, (XtPointer)NULL
- },
- {
- XawNdocSetupCallback, XtCCallback, XtRCallback,
- sizeof(XtCallbackList), Offset(doc_setup_callback),
- XtRImmediate, (XtPointer)NULL
- },
- {
- XawNpageSetupCallback, XtCCallback, XtRCallback,
- sizeof(XtCallbackList), Offset(page_setup_callback),
- XtRImmediate, (XtPointer)NULL
- },
- {
- XawNlayoutMode, XawCLayoutMode, XtREnum,
- sizeof(XtEnum), Offset(layoutmode),
- XtRImmediate, (XtPointer)XawPrintLAYOUTMODE_PAGESIZE
- },
- {
- XawNminX, XawCMinX, XtRDimension,
- sizeof(Dimension), Offset(min_x),
- XtRImmediate, (XtPointer)NULL /* dynamic */
- },
- {
- XawNminY, XawCMinY, XtRDimension,
- sizeof(Dimension), Offset(min_y),
- XtRImmediate, (XtPointer)NULL /* dynamic */
- },
- {
- XawNmaxX, XawCMaxX, XtRDimension,
- sizeof(Dimension), Offset(max_x),
- XtRImmediate, (XtPointer)NULL /* dynamic */
- },
- {
- XawNmaxY, XawCMaxY, XtRDimension,
- sizeof(Dimension), Offset(max_y),
- XtRImmediate, (XtPointer)NULL /* dynamic */
- },
- {
- XawNcurrDocNumInJob, XawCCurrDocNumInJob, XtRInt,
- sizeof(unsigned int), Offset(curr_doc_num_in_job),
- XtRImmediate, (XtPointer)NULL /* dynamic */
- },
- {
- XawNcurrPageNumInDoc, XawCCurrPageNumInDoc, XtRInt,
- sizeof(unsigned int), Offset(curr_page_num_in_doc),
- XtRImmediate, (XtPointer)NULL /* dynamic */
- },
- {
- XawNcurrPageNumInJob, XawCCurrPageNumInJob, XtRInt,
- sizeof(unsigned int), Offset(curr_page_num_in_job),
- XtRImmediate, (XtPointer)NULL /* dynamic */
- },
- {
- XawNdefaultPixmapResolution, XawCDefaultPixmapResolution, XtRShort,
- sizeof(unsigned short), Offset(default_pixmap_resolution),
- XtRImmediate, (XtPointer)0
- },
-};
-
-static XtActionsRec actions[] =
-{
- { NULL, NULL }
-};
-
-XawPrintShellClassRec xawPrintShellClassRec = {
- /* Core class part */
- {
- /* superclass */ (WidgetClass) &applicationShellClassRec,
- /* class_name */ "XawPrintShell",
- /* widget_size */ sizeof(XawPrintShellRec),
- /* class_initialize */ class_initialize,
- /* class_part_initialize */ class_part_initialize,
- /* class_inited */ False,
- /* initialize */ initialize,
- /* initialize_hook */ NULL,
- /* realize */ XtInheritRealize,
- /* actions */ actions,
- /* num_actions */ XtNumber(actions),
- /* resources */ resources,
- /* num_resources */ XtNumber(resources),
- /* xrm_class */ NULLQUARK,
- /* compress_motion */ False,
- /* compress_exposure */ XtExposeCompressSeries,
- /* compress_enterleave */ False,
- /* visible_interest */ False,
- /* destroy */ destroy,
- /* resize */ XtInheritResize,
- /* expose */ XtInheritExpose,
- /* set_values */ set_values,
- /* set_values_hook */ NULL,
- /* set_values_almost */ XtInheritSetValuesAlmost,
- /* get_values_hook */ NULL,
- /* accept_focus */ NULL,
- /* version */ XtVersion,
- /* callback offsets */ NULL,
- /* tm_table */ XtInheritTranslations,
- /* query_geometry */ XtInheritQueryGeometry,
- /* display_accelerator */ NULL,
- /* extension */ NULL /* (XtPointer)&_XawPrintShellCoreClassExtRec */
- },
- /* Composite class part */
- {
- /* geometry manager */ XtInheritGeometryManager,
- /* change_managed */ XtInheritChangeManaged,
- /* insert_child */ XtInheritInsertChild,
- /* delete_child */ XtInheritDeleteChild,
- /* extension */ NULL,
- },
- /* Shell class part */
- {
- /* extension */ NULL,
- },
- /* WM Shell class part */
- {
- /* extension */ NULL,
- },
- /* VendorShell class part */
- {
- /* extension */ NULL,
- },
- /* TopLevelShell class part */
- {
- /* extension */ NULL,
- },
- /* ApplicationShell class part */
- {
- /* extension */ NULL,
- },
- {
- /* ?? */ NULL,
- },
-};
-
-WidgetClass xawPrintShellWidgetClass = (WidgetClass)&xawPrintShellClassRec;
-
-
-static void
-class_initialize(void)
-{
-}
-
-
-static void
-class_part_initialize(WidgetClass widget_class)
-{
-}
-
-/*
- * This is a static table to keep the link between widgets and XPContexts.
- * Yeah - this is probably not a very bright idea. Maybe it should also
- * contain the Display.
- */
-typedef struct {
- Widget w;
- XPContext c;
-} WidgetContext;
-static WidgetContext *w_ctxt = NULL;
-static int wc_nfields = 0;
-
-static void
-XawStoreWidgetContext(Widget w, XPContext c)
-{
- wc_nfields++;
- w_ctxt = (WidgetContext *)XtRealloc((XtPointer)w_ctxt, sizeof(WidgetContext) * wc_nfields);
- w_ctxt[wc_nfields-1].w = w;
- w_ctxt[wc_nfields-1].c = c;
-}
-
-/* FIXME: This is not threadsafe... */
-static Widget
-XawPrintContextToWidget(XPContext c)
-{
- int i;
-
- for( i = 0 ; i < wc_nfields ; i++ ) {
- if( w_ctxt[i].c == c ) {
- return w_ctxt[i].w;
- }
- }
- return NULL;
-}
-
-/* FIXME: This is not threadsafe... */
-static XPContext
-XawPrintWidgetToContext(Widget w)
-{
- int i;
-
- for( i = 0 ; i < wc_nfields ; i++ ) {
- if (w_ctxt[i].w == w) {
- return w_ctxt[i].c;
- }
- }
- return (XPContext)None;
-}
-
-/* FIXME: This is not threadsafe... */
-static void
-XawPrintDeleteWidgetContext(Widget w)
-{
- int i;
-
- for( i = 0 ; i < wc_nfields ; i++ ) {
- if( w_ctxt[i].w == w ) {
- w_ctxt[i].w = NULL;
- w_ctxt[i].c = None;
- }
- }
-}
-
-static void
-SelectNotify(Widget w, int *e, XtPointer *s, int n, XtPointer client)
-{
- XPContext c = XpGetContext(XtDisplay(w));
-
- if (!c) {
- XtAppWarning(XtWidgetToApplicationContext(w),
- "XawPrintShell: SelectNotify: no print context\n");
- return;
- }
-
- XpSelectInput(XtDisplay(w), c, XPPrintMask|XPAttributeMask);
-}
-
-
-static Boolean
-DispatchEvent(XEvent *evp)
-{
- XPPrintEvent *e = (XPPrintEvent*)evp;
-
- Widget w = XawPrintContextToWidget(e->context);
-
- /* Make sure this event is really for this window... */
- if (XFilterEvent(evp, XtWindow(w)))
- {
- DEBUGOUT((__FILE__, w, "XawPrintShell-DispatchEvent *** filter XFilterEvent() matched.\n"));
- return True;
- }
-
- /* Only for debugging */
-#ifdef XAWDEBUG
- {
- int error_base,
- event_base;
-
- if (!XpQueryExtension(XtDisplay(w), &event_base, &error_base)) {
- return False;
- }
-
- if (e->type == event_base + XPPrintNotify) {
- switch (e->detail) {
- case XPStartJobNotify:
- DEBUGOUT((__FILE__, w, "XawPrintShell-DispatchEvent XPStartJobNotify\n"));
- break;
- case XPEndJobNotify:
- DEBUGOUT((__FILE__, w, "XawPrintShell-DispatchEvent XPEndJobNotify\n"));
- break;
- case XPStartDocNotify:
- DEBUGOUT((__FILE__, w, "XawPrintShell-DispatchEvent XPStartDocNotify\n"));
- break;
- case XPStartPageNotify:
- DEBUGOUT((__FILE__, w, "XawPrintShell-DispatchEvent XPStartPageNotify\n"));
- break;
- case XPEndPageNotify:
- DEBUGOUT((__FILE__, w, "XawPrintShell-DispatchEvent XPEndPageNotify\n"));
- break;
- case XPEndDocNotify:
- DEBUGOUT((__FILE__, w, "XawPrintShell-DispatchEvent XPEndDocNotify\n"));
- break;
- default:
- DEBUGOUT((__FILE__, w, "XawPrintShell DispatchEvent\n"));
- }
- }
- }
-#endif /* XAWDEBUG */
-
- return XtDispatchEventToWidget(w, evp);
-}
-
-
-static void
-initialize(Widget request, Widget new_w, ArgList args, Cardinal *num_args)
-{
- int error_base,
- event_base;
- XPContext pcontext;
-
- DEBUGOUT((__FILE__, new_w, "XawPrintShell Initialize\n"));
-
- if (!XpQueryExtension(XtDisplay(new_w), &event_base, &error_base)) {
- DEBUGOUT((__FILE__, new_w, "XawPrintShell initialize: failed!!\n"));
- XtAppWarning(XtWidgetToApplicationContext(new_w),
- "XawPrintShell: initialize: XpQueryExtension() failed. BAD.\n");
- return;
- }
-
- DEBUGOUT((__FILE__, new_w, "XawPrintShell Initialize event_base %d error_base %d\n",
- event_base, error_base));
-
- pcontext = XpGetContext(XtDisplay(new_w));
-
- if( pcontext == None ) {
- XtAppWarning(XtWidgetToApplicationContext(new_w),
- "XawPrintShell: initialize: No print content. BAD.\n");
- return;
- }
-
- /* Make sure that the Xt machinery is really using the right screen (assertion) */
- if( XpGetScreenOfContext(XtDisplay(new_w), pcontext) != XtScreen(new_w) ) {
- XtAppWarning(XtWidgetToApplicationContext(new_w),
- "XawPrintShell: initialize: Widget's screen != print screen. BAD.\n");
- return;
- }
-
- XawStoreWidgetContext(new_w, pcontext);
-
- XtInsertEventTypeHandler(new_w,
- event_base + XPPrintNotify,
- (XtPointer)XPPrintMask,
- XawPrintNotify, NULL,
- XtListTail);
- XtInsertEventTypeHandler(new_w,
- event_base + XPAttributeNotify,
- (XtPointer)XPAttributeMask,
- XawAttributesNotify, NULL,
- XtListTail);
-
- XtRegisterExtensionSelector(XtDisplay(new_w),
- event_base + XPPrintNotify,
- event_base + XPAttributeNotify,
- SelectNotify,
- NULL);
-
- XtSetEventDispatcher(XtDisplay(new_w),
- event_base + XPPrintNotify,
- DispatchEvent);
- XtSetEventDispatcher(XtDisplay(new_w),
- event_base + XPAttributeNotify,
- DispatchEvent);
-
- PS_LastPageInDoc(new_w) = False;
- PS_LastPageInJob(new_w) = False;
-
- XawUpdateResources(new_w, pcontext);
- XawUpdateLayout(new_w);
-
- DEBUGOUT((__FILE__, new_w, "XawPrintShell Initialize x %d y %d wid %d ht %d\n",
- new_w->core.x,
- new_w->core.y,
- new_w->core.width,
- new_w->core.height));
-}
-
-
-static void
-destroy(Widget w)
-{
- DEBUGOUT((__FILE__, w, "XawPrintShell Destroy\n"));
- XawPrintDeleteWidgetContext(w);
-}
-
-static Boolean
-set_values(Widget current, Widget request, Widget new_w,
- ArgList args, Cardinal *num_args)
-{
- DEBUGOUT((__FILE__, new_w, "XawPrintShell SetValues\n"));
- return True;
-}
-
-void XawPrintRedisplayWidget(Widget w)
-{
- XExposeEvent xev;
- Region region;
-
- xev.type = Expose;
- xev.serial = XLastKnownRequestProcessed(XtDisplay(w));
- xev.send_event = False;
- xev.display = XtDisplay(w);
- xev.window = XtWindowOfObject(w);
- xev.x = 0;
- xev.y = 0;
- xev.width = w->core.width;
- xev.height = w->core.height;
- xev.count = 0;
-
- region = XCreateRegion();
- if (!region)
- return;
-
- XtAddExposureToRegion((XEvent*)&xev, region);
-
- if (w->core.widget_class->core_class.expose)
- (*(w->core.widget_class->core_class.expose))(w, (XEvent *)&xev, region);
-
- XDestroyRegion(region);
-}
-
-/* Returns whether the widget passed in is a print shell or "print shell"-like
- * widget (e.g. print preview).
- * Note that this will return |True| for more classes than |XawPrintShell| in
- * the future (like for |XmPrintShell| etc.)
- */
-Boolean
-XawIsPrintShell(Widget w)
-{
- return XtIsSubclass(w, xawPrintShellWidgetClass);
-}
-
-
-static void
-XawPrintNotify(Widget w, XtPointer client, XEvent *evp, Boolean *cont)
-{
- XPPrintEvent *e = (XPPrintEvent *)evp;
- XawPrintShellCallbackStruct cbs;
-
- switch (e->detail) {
- case XPStartPageNotify:
- DEBUGOUT((__FILE__, w, "XPStartPageNotify\n"));
-
- /* Re do not have to call |XawPrintRedisplayWidget(w)| here since
- * Xprint triggers an expose event anyway
- */
-
- DEBUGOUT((__FILE__, w, "XpEndPage\n"));
- XpEndPage(XtDisplay(w));
- break;
-
- case XPEndPageNotify:
- DEBUGOUT((__FILE__, w, "XPEndPageNotify\n"));
-
- if (PS_LastPageInDoc(w) || PS_LastPageInJob(w)) {
- DEBUGOUT((__FILE__, w, "XpEndDoc\n"));
- XpEndDoc(XtDisplay(w));
- }
- else {
- /* Increment page numbers... */
- PS_CurrPageNumInDoc(w) += 1;
- PS_CurrPageNumInJob(w) += 1;
-
- /* ... do the page setup callback ... */
- cbs.reason = XawCR_PAGE_SETUP;
- cbs.event = evp;
- cbs.detail = NULL;
- cbs.context = XawPrintWidgetToContext(w);
- cbs.last_page_in_doc = False;
- cbs.last_page_in_job = False;
-
- if (PS_PageSetupCallback(w))
- XtCallCallbackList(w, PS_PageSetupCallback(w), &cbs);
-
- PS_LastPageInDoc(w) = cbs.last_page_in_doc;
- PS_LastPageInJob(w) = cbs.last_page_in_job;
-
- /* ... and start the new page */
- DEBUGOUT((__FILE__, w, "XpStartPage\n"));
- XpStartPage(XtDisplay(w), XtWindow(w));
- }
- break;
-
- case XPStartDocNotify:
- DEBUGOUT((__FILE__, w, "XPStartDocNotify\n"));
-
- cbs.reason = XawCR_PAGE_SETUP;
- cbs.event = evp;
- cbs.detail = NULL;
- cbs.context = XawPrintWidgetToContext(w);
- cbs.last_page_in_doc = False;
- cbs.last_page_in_job = False;
-
- if (PS_PageSetupCallback(w))
- XtCallCallbackList(w, PS_PageSetupCallback(w), &cbs);
-
- PS_LastPageInDoc(w) = cbs.last_page_in_doc;
- PS_LastPageInJob(w) = cbs.last_page_in_job;
-
- DEBUGOUT((__FILE__, w, "XpStartPage\n"));
- XpStartPage(XtDisplay(w), XtWindow(w));
- break;
-
- case XPEndDocNotify:
- DEBUGOUT((__FILE__, w, "XPEndDocNotify\n"));
-
- /* Start a new document (via XpStartDoc()) if we are not done with the job yet,
- * otherwise finish the job (via XpEndJob())
- */
- if (PS_LastPageInJob(w)) {
- DEBUGOUT((__FILE__, w, "XpEndJob\n"));
- XpEndJob(XtDisplay(w));
- }
- else {
- PS_CurrDocNumInJob(w) += 1;
- PS_CurrPageNumInDoc(w) = 1;
-
- cbs.reason = XawCR_DOC_SETUP;
- cbs.event = evp;
- cbs.detail = NULL;
- cbs.context = XawPrintWidgetToContext(w);
- cbs.last_page_in_doc = False;
- cbs.last_page_in_job = False;
-
- if (PS_DocSetupCallback(w))
- XtCallCallbackList(w, PS_DocSetupCallback(w), &cbs);
-
- PS_LastPageInDoc(w) = cbs.last_page_in_doc;
- PS_LastPageInJob(w) = cbs.last_page_in_job;
-
- DEBUGOUT((__FILE__, w, "XpStartDoc\n"));
- XpStartDoc(XtDisplay(w), XPDocNormal);
- }
- break;
-
- case XPStartJobNotify:
- DEBUGOUT((__FILE__, w, "XPStartJobNotify\n"));
- PS_LastPageInJob(w) = False;
- PS_LastPageInDoc(w) = False;
- PS_CurrDocNumInJob(w) = 1;
- PS_CurrPageNumInDoc(w) = 1;
- PS_CurrPageNumInJob(w) = 1;
-
- cbs.reason = XawCR_START_JOB;
- cbs.event = evp;
- cbs.detail = NULL;
- cbs.context = XawPrintWidgetToContext(w);
- cbs.last_page_in_doc = False;
- cbs.last_page_in_job = False;
-
- if (PS_StartJobCallback(w))
- XtCallCallbackList(w, PS_StartJobCallback(w), &cbs);
-
- PS_LastPageInDoc(w) = cbs.last_page_in_doc;
Reply to: