Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!unido!pcsbst!aida!horst From: horst@aida.pcs.com (horst kern) Newsgroups: comp.windows.x.motif Subject: cursor fonts Message-ID: <1003@pcsbst.pcs.com> Date: 20 Nov 90 10:47:52 GMT Sender: news@pcsbst.pcs.com Reply-To: horst@aida.pcs.com (horst kern) Organization: PCS Computer Systeme GmbH Lines: 300 There was a recent posting asking how to change the cursor font to the watch cursor. The three replies were unsatisfactory in my opinion, as two of them showed how to change the cursor font to the watch cursor. (Nonetheless many thanks to them.) Of course the problem implies the question "how to change it back to the original font when the work is done". The third answer addressed this question but used a procedure call "set_cursor" that does not exist in the (our?) Motif environment. Of course it would be nice to have some way to ask Motif or X for the current value of the cursor. Finding nothing like that, I wrote a small program to be at least able to display all possible cursor fonts by selecting their name from a list. Have fun, Horst ========== Horst Kern PCS Computer Systeme GmbH Tel. : 089/68004-279 Pfaelzer-Wald-Str. 36 DOMAIN : horst@aida.pcs.com D 8000 Muenchen 90 UUCP-Europe: ...unido!pcsbst!horst UUCP-USA : ...pyramid!pcsbst!hk --------------------------------- 8< ----------------------------- #! /bin/sh # This is a shell archive. Remove anything before this line, then unpack # it by saving it into a file and typing "sh file". To overwrite existing # files, type "sh file -c". You can also feed this as standard input via # unshar, or by typing "sh 'cursor.c' <<'END_OF_FILE' X#include X#include X#include /* Motif Toolkit */ X#include X#include X#include X#include X#include X#include X XXtAppContext context; Display *display; Widget applShell; X void init_widgets(); void quit(); void sel(); X static XtCallbackRec sel_cbs[] = { X {sel, (caddr_t)NULL}, X { (XtCallbackProc)NULL, (caddr_t)NULL }, X}; X X/* Check consistency of this list with your file "" X* The values of these #defines should be even numbers without holes. X*/ X#define CURSORNUM 77 static char *table[]={ X"XC_X_cursor", X"XC_arrow", X"XC_based_arrow_down", X"XC_based_arrow_up", X"XC_boat", X"XC_bogosity", X"XC_bottom_left_corner", X"XC_bottom_right_corner", X"XC_bottom_side", X"XC_bottom_tee", X"XC_box_spiral", X"XC_center_ptr", X"XC_circle", X"XC_clock", X"XC_coffee_mug", X"XC_cross", X"XC_cross_reverse", X"XC_crosshair", X"XC_diamond_cross", X"XC_dot", X"XC_dotbox", X"XC_double_arrow", X"XC_draft_large", X"XC_draft_small", X"XC_draped_box", X"XC_exchange", X"XC_fleur", X"XC_gobbler", X"XC_gumby", X"XC_hand1", X"XC_hand2", X"XC_heart", X"XC_icon", X"XC_iron_cross", X"XC_left_ptr", X"XC_left_side", X"XC_left_tee", X"XC_leftbutton", X"XC_ll_angle", X"XC_lr_angle", X"XC_man", X"XC_middlebutton", X"XC_mouse", X"XC_pencil", X"XC_pirate", X"XC_plus", X"XC_question_arrow", X"XC_right_ptr", X"XC_right_side", X"XC_right_tee", X"XC_rightbutton", X"XC_rtl_logo", X"XC_sailboat", X"XC_sb_down_arrow", X"XC_sb_h_double_arrow", X"XC_sb_left_arrow", X"XC_sb_right_arrow", X"XC_sb_up_arrow", X"XC_sb_v_double_arrow", X"XC_shuttle", X"XC_sizing", X"XC_spider", X"XC_spraycan", X"XC_star", X"XC_target", X"XC_tcross", X"XC_top_left_arrow", X"XC_top_left_corner", X"XC_top_right_corner", X"XC_top_side", X"XC_top_tee", X"XC_trek", X"XC_ul_angle", X"XC_umbrella", X"XC_ur_angle", X"XC_watch", X"XC_xterm", X}; X void main (argc,argv) unsigned int argc; char **argv; X{ X X /* Initialize toolkit and open display. X */ X XtToolkitInitialize (); X X context=XtCreateApplicationContext(); X X display = XtOpenDisplay (context, (String)NULL, (String)NULL, X "uebung", X (XrmOptionDescRec *)NULL, 0, &argc, argv); X if (!display) X { X XtWarning ("cursor: can't open display, exiting..."); X exit (0); X } X X X /* Create ApplicationShell. X */ X applShell = XtAppCreateShell ((String)NULL, "cursor", X applicationShellWidgetClass, display, X (ArgList)NULL, 0); X X X init_widgets(); X X /* Realize toplevel widgets. X */ X XtRealizeWidget (applShell); X X X /* Process events. X */ X XtAppMainLoop (context); X} X X void init_widgets () X{ X Arg args[10]; X Cardinal n; X Widget main_window; /* MainWindow */ X Widget scrolled_list; /* ScrolledWindow */ X Widget menu_pane; /* MenuPane */ X Widget menu_bar; X Widget cascade; X Widget button; X XmStringTable StrTab; X XmString tcs; X int j; X X n = 0; X main_window = XmCreateMainWindow (applShell, "main1", args, n); X XtManageChild (main_window); X X n = 0; X menu_bar = XmCreateMenuBar (main_window, "menu_bar", args, n); X XtManageChild (menu_bar); X X n = 0; X menu_pane = XmCreatePulldownMenu (menu_bar, "menu_pane", args, n); X X n = 0; X button = XmCreatePushButton (menu_pane, "Quit", args, n); X XtManageChild (button); X XtAddCallback (button, XmNactivateCallback, quit, NULL); X X n = 0; X XtSetArg (args[n], XmNsubMenuId, menu_pane); n++; X cascade = XmCreateCascadeButton (menu_bar, "Exit", args, n); X XtManageChild (cascade); X X StrTab = (XmStringTable) XtMalloc (CURSORNUM * sizeof(XmString)); X for (j=0; j item_position - 1; X /* They've numbered them with even numbers: */ X new_cursor = XCreateFontCursor(XtDisplay(w), c_index * 2); X XDefineCursor(XtDisplay(w), XtWindow(w), new_cursor); X XFlush(XtDisplay(w)); X} X END_OF_FILE if test 4482 -ne `wc -c <'cursor.c'`; then echo shar: \"'cursor.c'\" unpacked with wrong size! fi # end of 'cursor.c' fi if test -f 'makefile' -a "${1}" != "-c" ; then echo shar: Will not clobber existing file \"'makefile'\" else echo shar: Extracting \"'makefile'\" \(488 characters\) sed "s/^X//" >'makefile' <<'END_OF_FILE' NAME=cursor CC=cc DEFINES = -DSYSV -DPCS INCLUDES = -I/usr/include/Motif LIBDIR = -L/usr/lib/Motif -L/usr/lib/X11 MLIBS = -lMrm -lXm -lXt -lX11 -lPW -lbsd #PCS libs X#MLIBS = -lMrm -lXm -lXt -lX11 -lPW #others CFLAGS = -g all: ${NAME} ${NAME}.uid X${NAME}: ${NAME}.o X ${CC} ${NAME}.o -o ${NAME} \ X ${LIBDIR} \ X ${MLIBS} X X${NAME}.o: ${NAME}.c X ${CC} -g -c ${NAME}.c ${DEFINES} ${INCLUDES} X${NAME}.uid: ${NAME}.uil X uil -o ${NAME}.uid ${NAME}.uil ${INCLUDES}/uil END_OF_FILE if test 488 -ne `wc -c <'makefile'`; then echo shar: \"'makefile'\" unpacked with wrong size! fi # end of 'makefile' fi echo shar: End of shell archive. exit 0