[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

#200264 and xmessage



Hi all,

Yes, that bug is closed already, Frank was to fast. :-(
In the bug I proposed not to use xmessage to warn the user about
missing perl-tk, but rather write a small C-program linked with
X11/athena. Stefan Ulrich sent me one in a PM mail. the final program
has a size of 6KB and is linked with X11, Xt and Xaw (i.e. won't pull
in more deps, than these which are needed by xdvi anyway).
The source is attached, builds and runs with libxaw6 and libxaw7.
Further the patch for debian/rules. I've not yet made the patch for
texdoctk, but that should not be that tricky. Comments?

H.
-- 
Santa Claus is watching!
  http://hilmarpreusse.forum-rheinland.de/
--- rules.orig	Sat Apr 24 14:16:14 2004
+++ rules	Sat Apr 24 14:08:15 2004
@@ -58,6 +58,7 @@
 #	cp texk/web2c/omegafonts/lex.yy.c-dist texk/web2c/omegafonts/lex.yy.c
 	# Add here commands to compile the package.
 	make ${CFLAGS}
+	gcc -o debian/texdoctk-warn -O2 -W -Wall -ansi -pedantic -L/usr/X11R6/lib -lXaw -lXt -lX11 debian/texdoctk-warn.c
 
 	touch build-stamp
 
@@ -78,6 +79,7 @@
 	-make distclean
 	-rm -f libs/ncurses/man/edit_man.sed
 	-rm -f config.cache libs/libtiff/mkversion
+	-rm -f debian/texdoctk-warn
 #	-cd libs/libtiff && make distclean
 	-rm -f texk/web2c/pdftexdir/Makefile
 	# Removed symlinks
@@ -188,6 +190,8 @@
 #libkpathsea-dev installer
 	mkdir -p debian/$(subdev)/usr/share/doc
 	(cd debian/$(subdev)/usr/share/doc; ln -s $(sublib) $(subdev))
+#the warning for texdoctk
+	install debian/texdoctk-warn debian/$(package)/usr/bin
 #libkpathsea3 install
 #	mkdir -p debian/$(sublib)/usr/share/doc/$(sublib)
 
/* xaw-message.c: Pop up an Xaw message window.
   Written by stefanulrich@users.sourceforge.net. Public Domain.
   
   Compile with:
   gcc -o texdoctk-warn -O2 -W -Wall -ansi -pedantic -L/usr/X11R6/lib -lXaw -lXt -lX11 texdoctk-warn.c
*/
#include <stdlib.h>

#include <X11/Xlib.h>
#include <X11/StringDefs.h>
#include <X11/Intrinsic.h>

#include <X11/Xaw/Label.h>
#include <X11/Xaw/Box.h>
#include <X11/Xaw/Form.h>
#include <X11/Xaw/Command.h>
#include <X11/Xaw/Paned.h>

static void
quit_callback(Widget w, XtPointer client_data, XtPointer call_data)
{
    (void)w;
    (void)client_data;
    (void)call_data;

    exit(0);
}

int main(int argc, char *argv[])
{
    XtAppContext app_context;
    Widget toplevel, paned, text, box, button;
    int offset = 6;
    XtAccelerators accels;
    /* test for multi-lines */
    const char *msg = "Please install the package\n\"perl-tk\" to use texdoctk.";

    toplevel = XtAppInitialize(&app_context, "Info",
			       NULL, 0,
			       &argc, argv,
			       NULL, NULL, 0);

    accels = XtParseAcceleratorTable("#override\n"
				     "<Key>Return: set()notify()unset()\n"
				     "<Key>q: set()notify()unset()\n"
				     "<Key>Escape: set()notify()unset()");

    paned = XtVaCreateManagedWidget("paned", panedWidgetClass, toplevel,
				    XtNinternalBorderWidth, 0, /* no separator line */
				    NULL);
    text = XtVaCreateManagedWidget("text", labelWidgetClass, paned,
				   XtNlabel, msg,
				   XtNinternalWidth, offset,
				   XtNinternalHeight, offset,
				   NULL);
    box = XtVaCreateManagedWidget("box", formWidgetClass, paned,
				  XtNshowGrip, False,
  				  XtNdefaultDistance, offset,
				  XtNskipAdjust, True,
				  NULL);
    button = XtVaCreateManagedWidget("OK",
				     commandWidgetClass, box,
				     /* easiest to flush button left ... */
				     XtNleft, XtChainLeft,
				     XtNright, XtChainLeft,
				     XtNaccelerators, accels,
				     NULL);

    XtAddCallback(button, XtNcallback, quit_callback, (XtPointer)NULL);

    /* redirect all input to button */
    XtInstallAllAccelerators(paned, paned);
    XtInstallAllAccelerators(button, paned);

    XtRealizeWidget(toplevel);

    XtAppMainLoop(app_context);
    return 0;
}

Reply to: