home *** CD-ROM | disk | FTP | other *** search
- Path: senator-bedfellow.mit.edu!faqserv
- From: kenton@rahul.net (Ken Lee)
- Newsgroups: comp.windows.x.motif,comp.answers,news.answers
- Subject: Motif FAQ (Part 3 of 9)
- Supersedes: <motif-faq/part3_875789459@rtfm.mit.edu>
- Followup-To: poster
- Date: 18 Oct 1997 10:15:23 GMT
- Organization: none
- Lines: 1561
- Approved: news-answers-request@MIT.EDU
- Distribution: inet
- Expires: 1 Dec 1997 10:06:58 GMT
- Message-ID: <motif-faq/part3_877169218@rtfm.mit.edu>
- References: <motif-faq/part1_877169218@rtfm.mit.edu>
- Reply-To: kenton@rahul.net (Ken Lee)
- NNTP-Posting-Host: penguin-lust.mit.edu
- Summary: Motif Frequently Asked Questions (with answers).
- Keywords: FAQ question answer
- X-Last-Updated: 1997/08/27
- Originator: faqserv@penguin-lust.MIT.EDU
- Xref: senator-bedfellow.mit.edu comp.windows.x.motif:60051 comp.answers:28579 news.answers:114851
-
- Archive-name: motif-faq/part3
- Last-modified: SEP 1, 1997
- Posting-Frequency: irregular
- Organization: Kenton Lee, X/Motif Consultant, http://www.rahul.net/kenton/
- URL: http://www.rahul.net/kenton/faqs/mfaq_index.html
- Version: 6.3
-
- -----------------------------------------------------------------------------
- Subject: 45) TOPIC: X and MOTIF on the WORLD WIDE WEB (WWW)
-
- -----------------------------------------------------------------------------
- Subject: 46) Is there a central location for Motif information on the WWW? Is
- there a home page for Motif developers?
-
- [Last modified: Nov 96]
-
- Answer: On March 31, 1995, Ken Sall announced a Web page called:
-
- "MW3: Motif on the World Wide Web"
- http://www.cen.com/mw3/
-
- MW3 is a meta reference intended to connect you to a wealth of resources for
- Motif and X Window System development. MW3 presently contains over 700 links!
- The current Table of Contents follows:
-
- FAQs: Frequently Asked Questions
- Widgets, Toolkits, Libraries, and GUIs
- Organizations
- Motif Providers
- Non-Commercial Applications and Shareware
- Multimedia
- Commercial Products and Vendors
- Publications and References
- Code Examples and Tutorials
- Tips and Pointers
- Security
- Internationalization
- Usenet Newsgroups
- Conferences
- Personal Home Pages
-
-
- MW3 is sponsored by Century Computing, Inc.
- -----------------------------------------------------------------------------
- Subject: 47) Where can I find X technical info on the WWW?
-
- [Last modified: Mar 96]
-
- Answer: If you couldn't find what you were looking for in "MW3: Motif on the
- WWW" (http://www.cen.com/mw3/), then check Ken Lee's excellent page:
-
-
- Technical X Window System and OSF/Motif WWW sites
- http://www.rahul.net/kenton/xsites.html
-
-
- This web site currently lists over 700 X Window System links. This site is
- more technical and less product oriented than the MW3 site listed above.
- Visit them both; one probably has what you want.
-
- -----------------------------------------------------------------------------
- Subject: 48) What is Broadway? I've heard it called "X on the Web".
-
- [Last modified: Nov 96]
-
- Answer: Broadway is a collection of X-based technologies for the World Wide
- Web. Paul Lavelle wrote a good introductory article for the November, 1995
- issue of *The X Advisor*:
-
- http://landru.unx.com/DD/advisor/docs/nov95/nov95.plavallee.shtml
-
- Thanks to Ken Lee, http://www.rahul.net/kenton/
-
- The X Consortium's Broadway web page is:
-
- http://www.x.org/consortium/broadway.html
-
- And if you're wondering. "Why did they call it Broadway?", the X Consortium is
- located at 201 Broadway, Cambridge, MA.... ksall@cen.com
-
- Century Computing's "MW3: Motif on the World Wide Web" page contains a section
- of links to Broadway info which will be actively maintained:
-
- http://www.cen.com/mw3/orgs.html#broadway-info
- Broadway - the next generation of X!
-
- including a list of Broadway-related mailing lists for X Consortium members:
-
- http://www.cen.com/mw3/broadway-mail-lists.html
-
- For a concise description of Broadway, see the question "What is Broadway?"
- in the X11 FAQ, part 3:
-
- http://www.cs.ruu.nl/wais/html/na-dir/x-faq/part3.html
-
- -----------------------------------------------------------------------------
- Subject: 49) Where's an HTML version of the Motif FAQ on World Wide Web
- (WWW)?
-
- [Last modified: Feb 95]
-
- Answer: An automatically generated HTML version of this Motif FAQ can be
- found at WWW URL:
-
- http://www.cis.ohio-state.edu/hypertext/faq/usenet/motif-faq/top.html
-
- For a searchable version of the Motif FAQ and other FAQs (via WAIS), see:
-
- http://www.cs.ruu.nl/cgi-bin/faqwais
-
- The WAIS search is great way to find a topic which may appear in several FAQs
- (Motif, X, Xt, Widget FAQ, etc.)
-
- -----------------------------------------------------------------------------
- Subject: 50) Which X and Motif developers have their own home page URLs?
-
- [Last modified: Aug 95]
-
- Answer: NOTE: For the most current version of this list, see:
-
- http://www.cen.com/mw3/people.html
-
- This subject provides an opportunity for me to thank some of you for your
- invaluable contributions (direct or indirect) to this FAQ and, at the same
- time, to make it easy for the X and Motif community to contact you.
- Contributions and corrections appreciated. It is also a way to keep a current
- contact list for some of you who have moved to other companies.
-
- Requirements for inclusion in this list:
-
- (a) have at least 2 contributions in the Motif, X, or Xt FAQ; or
- work directly for OSF or the X Consortium;
- (b) have your own home page (not just their company's home page);
- (c) submit the following info in this 4-line format:
-
- First_name Last_name
- Your_home_page_URL
- mailto:email_address
- which FAQ your name/address appears (Motif, X, or Xt)
-
- NOTE: Be sure to put "For Motif FAQ" as your email
- subject. Send it to ksall@cen.com mailto:ksall@cen.com
-
- X and Motif developer home pages listed in alphabetical order by last name:
-
- David Brooks http://www.x.org/people/dbrooks/ mailto:dbrooks@x.org
-
- John L. Cwikla http://www.wri.com:80/~cwikla/ mailto:cwikla@wri.com
-
- Daniel Dardailler http://www.x.org:80/people/daniel/
- http://www.w3.org/pub/WWW/People/danield mailto:danield@w3.org
-
- Kaleb S. Keithley http://www.x.org/people/kaleb/kaleb.html mailto:kaleb@x.org
-
- Ken Lee http://www.rahul.net/kenton/index.shtml mailto:kenton@rahul.net
-
- Jan Newmarch http://pandonia.canberra.edu.au/ mailto:jan@ise.canberra.edu.au
-
- Doug Rand http://reality.sgi.com/employees/drand/ mailto:drand@sgi.com
-
- Ralph R. Swick http://www.x.org/people/swick.html mailto:swick@x.org
-
- -----------------------------------------------------------------------------
- Subject: 51) Where can I get the HTML widget used in Mosaic?
-
- [Last modified: Mar 96]
-
- Answer: Thanks to Matthew Freedman (mattf@cac.washington.edu) and
- intasoft@cix.compulink.co.u for updates to the URLs mentioned in this answer.
- If you can't find things in the places listed below, check MW3
- (http://www.cen.com/mw3/) which is updated more frequently than is this FAQ.
-
- Also see the question "Is there a help system or Motif hypertext system
- available?"
-
- Ken Sall (ksall@cen.com) writes: The HTML (HyperText Markup Language) widget
- is part of the NCSA Mosaic source code available from ftp.ncsa.uiuc.edu. Look
- in the "libhtmlw" subdirectory of the "Mosaic-src-*" subdirectory of:
-
- ftp://ftp.ncsa.uiuc.edu/Mosaic/Unix/source/
-
- or, more generally, look for the files HTML.c, HTML.h, HTMLP.h, etc. in your
- "libhtmlw" subdirectory of the Mosaic source.
-
-
- For (old) documentation, see
-
- http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/htmlwidget.html.
-
- However, Matthew M. Freedman (mattf@cac.washington.edu) pointed out the
- document is out of date: "One important thing to know is that the on-line
- documentation for the Mosaic html widget is out of synch with the source code.
- I e-mailed NCSA about this in May, but they seem to have ignored the report.
- The one that I wasted half a day because of is HTMLSetText(). The on-line docs
- list four arguments, but in fact there are seven. I have no idea what the
- extra three undocumented parameters are used for, I just plugged in NULL's and
- it works. The other error I noticed is that they document a "page" field in
- WbAnchorCallbackData, but it does not actually exist. Also, at least for me,
- after I call HTMLSetText() the first time, the widget remains blank. I have to
- lower and raise the window for it to be drawn. Anybody know what is wrong? I
- guess will probably just spoof an expose in my code."
-
-
- For information on using Mosaic by remote control, see
-
- http://www.ncsa.uiuc.edu/SDG/Software/XMosaic/CCI/cci-spec.html
- and
- http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/remote-control.html
-
-
- Here are more details from ah627@FreeNet.Carleton.CA (Samuel Effah):
-
- To the numerous request for the NCSA HTML widget information.
-
- Everything not already copyrighted by CERN is copyrighted by NCSA (including
- the contents of the libhtmlw, libnet, libXmx, and src directories, but not
- including the contents of libdtm, which is entirely public domain). ...
-
- * The UI grants you (hereafter, Licensee) a license to use the Software *
- * for academic, research and internal business purposes only, without a *
- * fee. Licensee may distribute the binary and source code (if released) *
- * to third parties provided that the copyright notice and this statement *
- * appears on all copies and that no charge is associated with such *
- * copies. *
- * *
- ( you can read more about the copyright in the Mosaic source code ).
-
-
- Documentation on the HTML widget can be located at:
-
- http://www.ncsa.uiuc.edu/SDG/Software/Mosaic/Docs/htmlwidget.html
- ( it's on the older version, I think Mosaic1.x )
-
- For starters, you can compile directory Mosaic2.4/libhtmlw for the widget.
- Using: To create widget:
- htlmWid = XtCreateManagedWidget( "htlmWid",
- htmlWidgetClass, parent,
- htlmArgs,
- XtNumber( htlmArgs ));
-
- Callback for anchors:
- XtAddCallback(htlmWid, WbNanchorCallback, htmlRef, NULL);
-
- where htmlRef() looks like:
-
- static void htmlRef(widget, client_data, call_data) Widget widget; XtPointer
- client_data; WbAnchorCallbackData* call_data; {
- buffer = readHTMLFile( call_data->href );
- XtVaSetValues( widget, WbNtext, buffer, NULL ); }
-
- where readHTMLFile() is
-
- char * readHTMLFile( in_file ) char *in_flie; {
- /* function to read a file and return its content, given
- the file's name */ }
-
- I think this is enough to start you off.
-
- Thanks to: Samuel Effah
- -----------------------------------------------------------------------------
- Subject: 52) What widgets does Netscape use for its bookmarks list and
- preference panels?
-
- [Last modified: May 97]
-
- Answer: Netscape uses the Microline widget set. Microline is now a division
- of Neuron Data: http://www.neurondata.com/Products/Wl/xml.html
-
- Ken Lee, http://www.rahul.net/kenton/
-
-
- -----------------------------------------------------------------------------
- Subject: 53) TOPIC: BOOKS and JOURNALS
-
- -----------------------------------------------------------------------------
- Subject: 54) Is there a bibliography available?
-
- [Last modified: Mar 96]
-
- Answer: The X Bibliography, originally maintained by Ken Lee (
- http://www.rahul.net/kenton/index.shtml ), is now maintained by the editor of
- "The X Advisor" ( http://landru.unx.com/DD/advisor/index.shtml ), Steve Mikes,
- smikes@unx.com. Steve regularly posts to comp.windows.x and ba.windows.x a
- list of reference books and articles on X and X programming. The X FAQ from
- comp.windows.x reproduces part of this list.
-
- The complete X bibliography is available from these URLs:
-
- http://www.unx.com/DD/advisor/docs/bib/Xbibliography.ps
- ftp://ftp.x.org/contrib/docs/ (several suffixes)
- ftp://landru.unx.com/pub/TXA/Xbibliography.ps.Z
-
- -----------------------------------------------------------------------------
- Subject: 55) Is there a Motif tutorial? Xt tutorial? X11 tutorial?
-
- [Last modified: Nov 96]
-
- Answer: For the most up-to-date links to Motif/X11/Xt tutorials, see:
-
- http://www.cen.com/mw3/code.html
- MW3: Code Examples and Tutorials
- and
- http://www.rahul.net/kenton/xsites.html#Xtutorials
- On-line X programming tutorials (Kenton Lee's multi-lingual links)
-
-
- See http://www.cm.cf.ac.uk/Dave/X_lecture/X_lecture.html
- for a hypertext Motif tutorial (by David Marshall) with source code and
- illustrations.
-
- Marshall Brain at brain@adm.csc.ncsu.edu posted a set of simple and useful
- Motif tutorials at http://www.iftech.com/ .
-
- Jan Borchers <job@ira.uka.de> writes about his Xmtutor:
-
- A free version of "Xmtutor", a menu-driven Motif application that contains an
- interactive tutorial about programming with Motif with many executable
- examples, is available via anonymous ftp. (Thanks to Allen Fogleson
- (foggie@dtx.net) and Thomas Madeya (madeya@ira.uka.de) for the updates.) The
- exact version varies, so look in the directory:
-
- ftp://ftp.vse.cz/pub/386-unix/linux/freeware_for_motif/motif-tutor/xmtutor-1.3/
- or:
- ftp://ftp.uni-stuttgart.de/pub/X11/programming/
-
- Xmtutor is very useful to learn Motif easier than with a book, and it is a
- convenient Quick Reference and resource-settings testbed for Motif application
- developers.
-
- It has been tested on SUN Sparcs (SunOS 4.1) and DEC Alphas (OSF/1 1.3a), but
- should be working OK on most other Unix / X11R4/R5 / Motif 1.1/1.2 systems.
-
- The demo version contains all the information to get you started with Motif,
- and upon registration, which costs 49 DM, you get the complete tutorial,
- describing all widgets, other topics such as inter-client communication,
- Compound Strings, etc., as well as a formatted TeX file of the tutorial to
- print out, which gives you a complete book about Motif.
-
- -----------------------------------------------------------------------------
- Subject: 56) What books are available for Motif programmers?
-
- [Last modified: Mar 97]
-
- Answer: Note: Code examples are now available for Sebern's "Building
- OSF/Motif Applications: A Practical Introduction" (below).
-
- NOTE: This answer is always "under construction". If you are the
- author of, or an avid fan of, a book not listed here, send mail
- to ksall@cen.com. Corrections especially regarding new editions
- and ISBN's would be greatly appreciated.
-
- Authors: Do you have code examples online? Send me the location.
-
- Most of these books can be purchased at a discount from:
-
- libHiTech.a, The Exclusive Electronic Computer Book Club
- http://www.libhitech.com/libhitech/
-
- Another electronic book service is:
-
- The Bookpool - Internet Bookstore
- http://www.bookpool.com/
-
-
- For Motif 2.0, see also the subject "Where can I find Motif 2.0
- documentation?" as Prentice Hall has published the Motif 2.0 documentation.
-
- First, we present the official books from OSF. Then we include an alphabetical
- listing of selected books. (See the following question for Xt and Xlib books.)
-
- The "official" OSF/Motif 1.1 and 1.2 books are:
-
- OSF/Motif Programmers Guide, Prentice-Hall ISBN 13-640525-8 (Motif 1.0), ISBN
- 0-13-640681-5 (Motif 1.1), ISBN 0-13-643107-0 (Motif 1.2) (NB: This makes use
- of the demo programs that you get with a Motif source license. The programs
- are not included and may or may not be available on your system.)
-
- OSF/Motif Programmers Reference Manual, Prentice-Hall ISBN 13-640517-17 (Motif
- 1.0), ISBN 0-13-640616-5 (Motif 1.1), ISBN 0-13-643115-1 (Motif 1.2) You will
- need this for the system calls.
-
- OSF/Motif Style Guide, Prentice-Hall 13-640491-X (Motif 1.0), ISBN
- 0-13-640673-4 (Motif 1.1), ISBN 13-643123-2 (Motif 1.2) You will need this to
- get some idea of how to write programs with the correct `look and feel'.
-
-
- Next is an alphabetical listing (by author) of a number of essential books not
- by OSF but in wide use. I will attempt to keep this list current if the
- authors (or their readers) send me updates as new editions become available.
-
- Barkakati, Nabajyoti, X Window System Programming, SAMS. ISBN 0-672-22750-9.
- This contains a section on Motif.
-
- Berlage, Thomas Berlage, OSF/Motif: Concepts and Programming, Addison-Wesley,
- UK, 1991. ISBN 0-201-55792-4.
-
- Ferguson, Paula & Brennan, David, Motif Reference Manual, Volume 6B, O'Reilly
- & Associates, 1st Edition June 1993, 920 pages, ISBN: 1-56592-038-4. "Dan
- Heller's Motif Programming Manual [Volume 6A, below] has long been considered
- the most authoritative and insightful work on Motif. Now, with the addition of
- this companion reference manual, programmers can dispense completely with the
- original OSF documentation. In addition to covering the entire Motif toolkit,
- this book also covers OSF's "User Interface Language" or UIL, and the Motif
- Resource Manager (MRM) functions used to tie together applications with user
- interfaces defined in UIL."
-
- Updated Sept. 95:
- Flanagan, David, Motif Tools: Streamlined GUI Design and Programming with the
- Xmt Library, O'Reilly & Associates, 1st Edition August 1994, 1024 pages, ISBN:
- 1-56592-044-9. "Motif Tools and the Xmt programming library that accompanies
- it on CD-ROM offer resources to empower Motif programmers and dramatically
- speed up application development with the X Toolkit and Motif. The Xmt
- library contains nine custom widgets and over 250 convenience routines that
- handle many tricky aspects of GUI programming. The Layout widget, for example,
- is an incredibly flexible manager widget that makes the confusing and awkward
- Motif Form widget a thing of the past. And a single Menu widget will create an
- entire pulldown menu system for your application by reading a special menu
- description from a resource file or your C code. Other features of the library
- dramatically simplify the use of Motif XmStrings, automate the transfer of
- data between the fields of an application's data structures and the widgets of
- its dialog boxes, and make it possible to automatically create a widget
- hierarchy completely described in a resource file."
-
- NOTE: Xmt version 2.1.2 is available for Motif 2.0. See:
-
- ftp://ftp.ora.com/pub/examples/xbook/Xmt/xmt212.tar.gz
-
- Added Sept. 95:
- George, Alistair and Riches, Mark, Advanced Motif Programming Techniques,
- Prentice Hall, 1994. ISBN: 0-13-219965-3. Glenn Carr (gcarr@lgc.com) writes:
- "This is a concise book that has alot of great tips and other insightful
- information about less obvious Motif characteristics."
-
- Heller, Dan, Ferguson, Paula M. & Brennan, David, Motif Programming Manual,
- Volume 6A, O'Reilly & Associates, 2nd Edition February 1994, ISBN: 1-56592-
- 016-3. "The Motif Programming Manual describes how to write applications
- using the Motif toolkit from the Open Software Foundation (OSF). The book goes
- into detail on every Motif widget class, with useful examples that will help
- programmers to develop their own code. Anyone doing Motif programming who
- doesn't want to have to figure it out on their own needs this book." Although
- updated for Motif 1.2, it is still usable with Motif 1.1.
-
- Johnson, Eric F. and Kevin Reichard, Power Programming Motif, second edition,
- MIS: Press, New York, NY, 1993. ISBN 1-55828-322-6.
-
- Johnson, Eric F. and Kevin Reichard, Professional Graphics Programming in the
- X Window System, MIS: Press, New York, NY, 1993. ISBN 1-55828-255-6. This
- book covers difficult topics such as combining non-default visuals and color
- overlay planes with Motif applications.
-
- Kimball, Paul E., The X Toolkit Cookbook, Prentice Hall, 1995. ISBN 0-13-
- 973132-6. Covers the Toolkit in detail and also covers Motif & Athena widgets;
- good chapter on inter-client communication and working with other toolkits.
- Discussion of X11R6 features. Code examples in
- ftp://ftp.netcom.com/pub/pk/pkimball/cookbook/. Submitted by
- raju@BooBoo.wes.army.mil (Raju Kala).
-
- Newmarch, Jan, The X Window System and Motif - A Fast Track Approach.
- Addison-Wesley, ISBN 0-201-53931-4. As the long-time maintainer of this Motif
- FAQ, Jan's book is bound to contain unusual and useful insights.
-
- O'Reilly and Associates publishes an entire series of books concerning
- different aspects of the X Window System, including a number of books about
- Motif, as well as books on Xlib, Xt, and PEX. In this FAQ, we list O'Reilly
- books by the authors' names. For a summary of all of O'Reilly's X11 series,
- see:
-
- ftp://ftp.x.org/contrib/docs/Xbibliography.OReilly
-
- As of this writing, however, the above list was somewhat out-dated.
- Therefore, telnet to gopher.ora.com, login as "gopher", select "Detailed
- Product Descriptions", and then select from the menu. WWW users can open this
- URL:
-
- gopher://gopher.ora.com/11/descriptions/
-
- Sebern, Mark "Building OSF/Motif Applications: A Practical Introduction". The
- ISBN is 0-13-122409-3. Prentice-Hall. The book uses a large, realistic Motif
- application (a program to make slides for presentations) to demonstrate the
- use of Motif features. Both UIL and toolkit calls are discussed, though UIL is
- featured, both in the examples and in a reference chapter. The example code is
- available at ftp://ftp.x.org/contrib/book_examples/sebern.motifapp-1.1.tar.Z.
-
- Smith, Jerry, Designing X Clients with Xt/Motif, ISBN 1-55860-255-0 Morgan
- Kaufmann Publishers This adopts a higher-level approach to many of the objects
- that commonly occur in Motif but are not in the Motif API.
-
- Young, Douglas, "Object-Oriented Programming with C++ and OSF/Motif", Prentice
- Hall, 1992. ISBN 0-13-630252-1. Source code is
- ftp://ftp.x.org/contrib/book_examples/young.cxx.tar.Z
-
- Young, Douglas, "The X Window System: Programming and Applications with Xt,
- Motif Edition", Prentice Hall, 1994. ISBN 0-13-123803-5. This is the classic
- tutorial from 1989 updated for Motif 1.2. Source code is
- ftp://ftp.x.org/contrib/book_examples/young2.motif.tar.Z
-
- Young, Douglas, "Motif Debugging and Performance Tuning", Prentice Hall, 1995.
- ISBN 0-13-147984-9. Source code is
- ftp://ftp.x.org/contrib/book_examples/young.debug.tar.Z
-
- If you want to learn about UIL, one source is the "Motif Programmers's Guide"
- from Prentice-Hall. However, excellent UIL coverage appears in the O'Reilly
- and Associates books "Motif Programming Manual, Volume 6A" by Dan Heller and
- Paula M. Ferguson and in "Motif Reference Manual, Volume 6B" by Paula M.
- Perguson with UIL Material by David Brennan. (Yes, 6A and 6B were worth the
- wait!)
-
- Added May 97:
- Thomas C. McFarland, "X Windows on the World, Developing Internationalized
- Software with X, Motif, and CDE". ISBN 0-13-359787-3. Source code is
- ftp://ftp.prenhall.com/pub/ptr/hewlett_packard_professional_books.w-
- 064/mcfarland/xwindows.wld
-
-
- -----------------------------------------------------------------------------
- Subject: 57) Which Xt and X books would also be helpful?
-
- [Last modified: Feb 95]
-
- Answer: You will also need books and references on Xt and Xlib, such as:
-
- Asente, Paul J., and Swick, Ralph R., X Window System Toolkit, The Complete
- Programmer's Guide and Specification, Digital Press, 1990. The Xt bible. A
- treasury of information, excellent and invaluable. Distributed by Digital
- Press, ISBN 1-55558-051-3, Digital Press order number EY-E757E-DP; and by
- Prentice-Hall, ISBN 0-13-972191-6.
-
- Cutler, Ellie, Gilly Daniel, and O'Reilly, Tim, The X Window System in a
- Nutshell, O'Reilly & Associates, 2nd Edition April 1992, 424 pages, ISBN: 1-
- 56592-017-1. A quick reference guide to Xlib functions datatypes and events,
- Xt functions and datatypes, and the standard X clients. The second edition is
- expanded and covers X11R4 and X11R5.
-
- Flanagan, David, Programmer's Supplement for R5 of the X Window System,
- O'Reilly & Associates, 1991, ISBN: 0-937175-86-2. A programmer's guide to all
- the new features in X11R5, with reference pages for the new functions.
- [NOTE: Out-of-print; material incorporated in recent editions of Volumes 1, 2,
- 4 and 5. X11R6 supplement is in the works.]
-
- Flanagan, David, Editor, X Toolkit Intrinsics Reference Manual, Volume 5,
- O'Reilly & Associates, 3rd Edition April 1992, 916 pages, ISBN: 1-56592-007-4.
- "The X Toolkit Intrinsics Reference Manual is a complete programmer's
- reference for the X Toolkit. It provides reference pages for each of the Xt
- functions as well as the widget classes defined by Xt and the Athena widgets.
- This volume is based on Xt documentation from the X Consortium and has been
- re-edited, reorganized, and expanded... The third edition of Volume 5 has
- been completely revised. In addition to covering Release 4 and Release 5 of X,
- all the man pages have been completely rewritten for clarity and ease of use,
- and new examples and descriptions have been added throughout the book."
-
- Mui, Linda and Pearce, Eric, X Window System Administrator's Guide, Volume 8,
- O'Reilly & Associates, 1st Edition October 1992, CD-ROM Released May 1993,
- ISBN: 1-56592-052-X (with CD-ROM) "This book is the first and only book
- devoted to the issues of system administration for X and X-based networks,
- written not just for UNIX system administrators but for anyone faced with the
- job of administering X (including those running X on stand-alone
- workstations)..." A book for X system administrators, covering XDM, security,
- font management, X terminals, building X, etc. Available with a CD-ROM
- containing the complete X source code.
-
- Nye, Adrian, Xlib Programming Manual, Volume 1, O'Reilly and Associates, 3rd
- Edition July 1992, 824 pages, ISBN: 1-56592-002-3. "Updated to cover X11
- Release 5, the Xlib Programming Manual is a complete guide to programming the
- X library (Xlib), the lowest level of programming interface to X. It includes
- introductions to internationalization, device-independent color, font service,
- and scalable fonts. Includes chapters on: X Window System concepts, A simple
- client application, Window attributes, The graphics context, Graphics in
- practice, Color, Events, Interclient communication, Internationalization, The
- Resource Manager, A complete client application, Window management, and Other
- programming techniques."
-
-
- Nye, Adrian, Editor, Xlib Reference Manual, Volume 2, O'Reilly & Associates,
- 3rd Edition June 1992, ISBN 1-56592-006-6. Contains reference pages, derived
- from the MIT specification, for all Xlib functions. The third edition covers
- X11R4 and X11R5, including all the new internationalization and Xcms (Color
- Management System) functions.
-
- Nye, Adrian & O'Reilly, Tim, X Toolkit Intrinsics Programming Manual, Motif
- Edition, Volume 4M, O'Reilly and Associates, 2nd Edition August 1992, 674
- pages, ISBN: 1-56592-013-9. "Volume 4 is a complete guide to programming with
- the X Toolkit Intrinsics, the library of C language routines that facilitates
- the design of user interfaces with reusable components called widgets. It
- provides concepts and examples that show how to use the various X Toolkit
- routines. The first few chapters are devoted to using widgets; the remainder
- of the book covers the more complex task of writing new widgets. Volume 4 is
- available in two editions. The Motif Edition uses the Motif 1.2 widget set in
- examples, and covers X11 Release 5."
-
- Quercia, Valerie & O'Reilly, Tim, X Window System User's Guide, Motif Edition,
- Volume 3M, O'Reilly and Associates, 2nd Edition January 1993, 956 pages, ISBN:
- 1-56592-015-5. "The X Window System User's Guide, Motif Edition orients the
- new user to window system concepts and provides detailed tutorials for many
- client programs, including the xterm terminal emulator and the window manager.
- Building on this basic knowledge, later chapters explain how to customize the
- X environment and provide sample configurations. This alternative edition of
- the User's Guide highlights the Motif window manager, for users of the Motif
- graphical user interface. Revised for Motif 1.2 and X11 Release 5."
-
- Scheifler, Robert W., and Gettys, James, X Window System, The Complete
- Reference to Xlib, X Protocl, ICCCM, XLFD. Digital Press, 1992. The Xlib
- bible. Third edition covers X11R5. ISBN 1-55558-088-2, Digital Press order
- number EY-J802E-DP.
-
- For those interested in PHIGS and PEXlib, O'Reilly & Associates also publishes
- several books on these topics. See:
-
- gopher://gopher.ora.com/11/descriptions/prox
-
- -----------------------------------------------------------------------------
- Subject: 58) Are there books for X11R6 yet?
-
- [Last modified: Feb 95]
-
- Answer: Check the X FAQ at:
-
- ftp://ftp.x.org/contrib/faqs/FAQ or
- http://www.cis.ohio-state.edu/hypertext/faq/usenet/x-faq/top.html
-
- Also O'Reilly and Associates have a mini-FAQ regarding their plans for X11
- Release 6 books:
-
- http://nearnet.gnn.com/gnn/bus/ora/news/r6.html
-
- -----------------------------------------------------------------------------
- Subject: 59) What relevant journals are available?
-
- [Last modified: May 97]
-
- Answer: Unfortunately, none of the following magazines are still publishing.
- Their back issues are still interesting, though. Back issues of "The X
- Advisor" are still on line.
-
- Ken Lee, May, 1997
-
- There are several important periodicals:
- In June, 1995, Steve Mikes announced a new monthly periodical called "The X
- Advisor" which appears both in magazine format and on-line via the Web. The
- subtitle from the Web page calls this "The Definitive Journal For X Window
- System Professionals (X11, Motif, Common Desktop Environment and Related GUI
- Technologies)." The first issue contains about 6 features, 20 columns, and 15
- departments. You may subscribe to either format from the WWW pages. See these
- URLs:
-
- http://www.unx.com/
- http://www.unx.com/DD/advisor/index.shtml (especially)
- http://www.unx.com/DD/txaCurrent.shtml (current issue)
-
-
- "The X Journal" is published bimonthly by SIGS Publications, 212-274-0640.
- Editorial information: editors%topgun@uunet.uu.net, editors@unx.com. The URL
- is:
-
- http://www.sigs.com/publications/txjr/txjrmain.html
- 1-800-361-1279
- 615-370-4845 (fax)
- subscriptions@sigs.com
-
- SIGS Publications also has a number of magazines concerning C++ and object
- oriented programming:
-
- http://www.sigs.com/publications/sigspubs.html
-
-
- "The X Resource: A Practical Journal of the X Window System" is published
- quarterly by O'Reilly and Associates, 800-998-9938. Editorial information:
- Paula Ferguson (paula@ora.com). In addition to the valuable articles which
- appear in regular issues, the January issue of each year (issues 1, 5, 9, 13,
- etc.) contains the proceedings of the Annual X Technical Conference (from
- 1992, 1993, 1994, and 1995, respectively) sponsored by the X Consortium. An
- on-line Table of Contents per issue can be accessed via gopher. Telnet to
- gopher.ora.com, login as "gopher", select "Detailed Product Descriptions", and
- then "X Resource". Alternatively, the WWW URL is:
-
- gopher://gopher.ora.com/11/descriptions/xres/
-
- Source code examples published in "The X Resource" appear organized by issue
- in the directory:
-
- ftp://ftp.ora.com/pub/examples/xresource/
-
- -----------------------------------------------------------------------------
- Subject: 60) Is there a Motif book for shell programming, such as ksh
- (kornshell)?
-
- [Last modified: Jan 96]
-
- Answer: Steve Pendergrast recently wrote a book about Motif programming using
- the desktop kornshell (dtksh) interpreter (which is now shipped with the
- latest versions of Solaris, HP/UX, AIX, and DEC OSF/1). This is not a book
- about programming with Motif in the C language, it is a Motif book for shell
- programmers, and does not assume the reader has any prior X experience.
-
- TITLE: "Desktop KornShell Graphical Programming"
- AUTHOR: J. Stephen Pendergrast, Jr.
- ISBN: 0-201-63375-2
- PUBLISHER: Addison-Wesley
- DESCRIPTION: 840 pages, includes bibliography and index, over 100 figures,
- over 140 programming examples
- Was awarded "Best X Book of 1995" by The X Advisor magazine.
- WEB-REFS: http://landru.unx.com/~pend/dtksh.html is the official home page
- for the book. There are hyper-links out to the Addison-Wesley
- page that gives a complete TOC and the Preface along with other
- info, plus links to web based articles on dtksh, links to download
- the example programs, a dtksh FAQ, and
- other stuff of interest to dtksh programmers.
-
- -----------------------------------------------------------------------------
- Subject: 61) TOPIC: MWM and the SHELL WIDGET
-
- -----------------------------------------------------------------------------
- Subject: 62) What is the difference between Motif and mwm?
-
- Answer: mwm is a window manager. Motif itself is made up of four parts: a
- User-Interface Guideline, an API toolkit of `C' routines which helps in the
- building of applications which conform to the Guideline, the window manager
- mwm, and a language UIL which is designed to ease user interface development.
- In general mwm will run an application built with any X-windows API, and in
- general an application built using the Motif toolkit will run under any window
- manager.
-
- -----------------------------------------------------------------------------
- Subject: 63) Does anyone have an alternative set of 3-D defaults for a
- monochrome screen?
-
- Answer: This is obviously a matter of taste. Some alternatives suggested
- include
-
- !Benjamin Schreiber, bs@osf.osf.org, bs@cs.brandeis.edu
- Mwm*foreground: black ! Actually, when a window is
- Mwm*background: white ! deactivated, the background
- Mwm*backgroundPixmap: 50_foreground ! becomes white, insted of
- Mwm*topShadowPixmap: white ! 50% foreground (grey)
-
- Mwm*activeForeground: black
- Mwm*activeBackground: white
- Mwm*activeBackgroundPixmap: 50_foreground
- Mwm*activeTopShadowPixmap: white
-
- Mwm*menu*backgroundPixmap: background
- Mwm*menu*topShadowPixmap: 50_foreground
-
- Mwm*title*foreground: black
- Mwm*title*background: white
- Mwm*title*backgroundPixmap: white
- Mwm*title*topShadowPixmap: 50_foreground
- Mwm*title*activeForeground: white
- Mwm*title*activeBackground: black
- Mwm*title*activeBackgroundPixmap: black
- Mwm*title*activeBottomShadowPixmap: 50_foreground
-
- Mwm*feedback*backgroundPixmap: white
-
- or
-
- ! From: tsang@isi.com (Kam C. Tsang)
- Mwm*background: White
- Mwm*activeBackground: White
- Mwm*activeBackgroundPixmap: 25_foreground
- Mwm*foreground: Black
- Mwm*activeForeground: Black
- Mwm*menu*background: white
- Mwm*menu*foreground: black
- xterm*Foreground: black
- xterm*Background: white
-
-
- or
-
- ! From: ucsd.edu!usc!snorkelwacker!paperboy!yee (Michael K. Yee)
- Mwm*cleanText: True
-
- Mwm*activeBackground: white
- Mwm*activeForeground: black
- Mwm*background: white
- Mwm*foreground: black
-
- Mwm*client*activeBackgroundPixmap: 50_foreground
- Mwm*client*activeTopShadowPixmap: foreground
- Mwm*client*activeBottomShadowPixmap: background
-
- !Mwm*client*background: white
- !Mwm*client*foreground: black
- Mwm*client*backgroundPixmap: 75_foreground
- Mwm*client*topShadowPixmap: foreground
- Mwm*client*bottomShadowPixmap: background
-
- !Mwm*feedback*background: white
- !Mwm*feedback*foreground: black
- Mwm*feedback*backgroundPixmap: 50_foreground
- !Mwm*feedback*topShadowPixmap: 25_foreground
- !Mwm*feedback*bottomShadowPixmap: background
-
- !Mwm*menu*background: white
- !Mwm*menu*foreground: black
- Mwm*menu*backgroundPixmap: foreground
- !Mwm*menu*topShadowPixmap: foreground
- !Mwm*menu*bottomShadowPixmap: background
-
- !Mwm*icon*background: white
- !Mwm*icon*foreground: black
- Mwm*icon*activeBackgroundPixmap: 50_foreground
- Mwm*icon*activeBottomShadowPixmap: foreground
- Mwm*icon*backgroundPixmap: 75_foreground
-
- -----------------------------------------------------------------------------
- Subject: 64) What are some useful mwm resources I can control?
-
- [Last modified: Sept 95]
-
- Answer: Ken Sall (ksall@cen.com) writes: Some you might consider, taken from
- the mwm(1) man page, are:
-
- clientAutoPlace (class ClientAutoPlace)
- This resource determines the position of a window
- when the window has not been given a program- or
- user-specified position. With a value of True, win-
- dows are positioned with the top-left corners of the
- frames offset horizontally and vertically. A value
- of False causes the currently configured position of
- the window to be used. In either case, mwm will
- attempt to place the windows totally on-screen. The
- default value is True.
-
- focusAutoRaise (class FocusAutoRaise)
- When the value of this resource is True, clients are
- raised when they get the keyboard input focus. If
- the value is False, the stacking of windows on the
- display is not changed when a window gets the key-
- board input focus. The default value is True when
- keyboardFocusPolicy is explicit and False when key-
- boardFocusPolicy is pointer.
-
- interactivePlacement (class InteractivePlacement)
- This resource controls the initial placement of new
- windows on the screen. If the value is True, the
- pointer shape changes before a new window is placed
- on the screen to indicate to the user that a position
- should be selected for the upper-left corner of the
- window. If the value is False, windows are placed
- according to the initial window configuration attri-
- butes. The default value of this resource is False.
-
- positionIsFrame (class PositionIsFrame)
- This resource indicates how client window position
- information (from the WM_NORMAL_HINTS property and
- from configuration requests) is to be interpreted.
- If the resource value is True, the information is
- interpreted as
- the position of the MWM client window frame. If the
- value is False, it is interpreted as being the posi-
- tion of the client area of the window. The default
- value of this resource is True.
-
- positionOnScreen (class PositionOnScreen)
- This resource is used to indicate that windows should
- initially be placed (if possible) so that they are
- not clipped by the edge of the screen (if the
- resource value is True). If a window is larger than
- the size of the screen, at least the upper-left
- corner of the window is on-screen. If the resource
- value is False, windows are placed in the requested
- position even if totally off-screen. The default
- value of this resource is True.
-
- useIconBox (class UseIconBox)
- If this resource is given a value of True, icons are
- placed in an icon box. When an icon box is not used,
- the icons are placed on the root window (default
- value).
-
- [Note: Still looking for a WWW link to Motif man pages --- anyone got one?
- Send to ksall@cen.com]
-
- -----------------------------------------------------------------------------
- Subject: 65) How can I configure mwm, such as changing or adding to root
- menus?
-
- [Last modified: Oct 95]
-
- Answer: Read the mwm(1) man page which describes how to configure mwm using
- the .mwmrc file. The default location of the system-wide version of this file
- is /usr/lib/X11/system.mwmrc. You can override settings in the global file by
- creating your own $HOME/.mwmrc.
-
- -----------------------------------------------------------------------------
- Subject: 66) How can I modify the Motif window manager decorations?
-
- [Last modified: July 95]
-
- Answer: In resource files, use the window manager's client resource (which is
- the application) and the resource clientDecoration:
-
- Mwm*XClock.clientDecoration: none
-
- turns off all clock decorations. See the mwm(1) entry for other
- possibilities.
-
- Programmatically, set the VendorShell resource XmNmwmDecorations to 0, such
- as:
-
- #include <Xm/MwmUtil.h> /* see MWM_DECOR_* and MWM_FUNC_* */
- #include <Xm/DialogS.h>
- popupShell =
- XtVaCreatePopupShell( "PopupShell",
- xmDialogShellWidgetClass, toplevel,
- XmNmwmDecorations, 0,
- NULL );
-
- With the 0, you have no decorations at all, but if you want just a little
- frame, use MWM_DECOR_BORDER instead.
-
- Thanks to Guillaume.Gallais@asm.thomson.fr for the code fragment and pointing
- out that there is no MWM_DECOR_NONE.
-
- Reinhard M. Weiss (weissrm@execpc.com) also pointed out that MWM_DECOR_NONE
- was fictitious. He also added:
-
- "I have found that the resource XtNoverrideRedirect does cause the olwm to
- remove all decorations (my guess is that it would work in mwm roughly the
- same). This works programmatically as well as in resource files (i.e.
- *.className*overrideRedirect: true). There are some undesirable effects to
- this, however, particularly with focus and managing dialogs and popups."
-
- -----------------------------------------------------------------------------
- Subject: 67) Is there an ICCCM compliant way of setting window manager
- decorations?
-
- Answer: Tom LaStrange (toml@LaStrange.COM) writes: "No, there is no ICCCM
- portable way to alter decorations."
-
- -----------------------------------------------------------------------------
- Subject: 68) How can I put decorations on transient windows using olwm?
-
- Answer: This code is from Jean-Philippe Martin-Flatin <syj@ecmwf.int>:
-
- /**********************************************************************
- ** WindowDecorations.c
- **
- ** Manages window decorations under the OpenLook window manager (OLWM).
- **
- ** Adapted from a C++ program posted to comp.windows.x.motif by:
- **
- ** +--------------------------------------------------------------+
- ** | Ron Edmark User Interface Group |
- ** | Tel: (408) 980-1500 x282 Integrated Systems, Inc. |
- ** | Internet: edmark@isi.com 3260 Jay St. |
- ** | Voice mail: (408) 980-1590 x282 Santa Clara, CA 95054 |
- ** +--------------------------------------------------------------+
- ***********************************************************************/
-
- #include <X11/X.h>
- #include <X11/Xlib.h>
- #include <X11/Xatom.h>
- #include <X11/Intrinsic.h>
- #include <X11/StringDefs.h>
- #include <X11/Protocols.h>
- #include <Xm/Xm.h>
- #include <Xm/AtomMgr.h>
-
- /*
- ** Decorations for OpenLook:
- ** The caller can OR different mask options to change the frame decoration.
- */
- #define OLWM_Header (long)(1<<0)
- #define OLWM_Resize (long)(1<<1)
- #define OLWM_Close (long)(1<<2)
-
- /*
- ** Prototypes
- */
- static void InstallOLWMAtoms (Widget w);
- static void AddOLWMDialogFrame(Widget widget, long decorationMask);
-
-
- /*
- ** Global variables
- */
- static Atom AtomWinAttr;
- static Atom AtomWTOther;
- static Atom AtomDecor;
- static Atom AtomResize;
- static Atom AtomHeader;
- static Atom AtomClose;
- static int not_installed_yet = TRUE;
-
-
- static void InstallOLWMAtoms(Widget w)
- {
- AtomWinAttr = XInternAtom(XtDisplay(w), "_OL_WIN_ATTR" , FALSE);
- AtomWTOther = XInternAtom(XtDisplay(w), "_OL_WT_OTHER", FALSE);
- AtomDecor = XInternAtom(XtDisplay(w), "_OL_DECOR_ADD", FALSE);
- AtomResize = XInternAtom(XtDisplay(w), "_OL_DECOR_RESIZE", FALSE);
- AtomHeader = XInternAtom(XtDisplay(w), "_OL_DECOR_HEADER", FALSE);
- AtomClose = XInternAtom(XtDisplay(w), "_OL_DECOR_CLOSE", FALSE);
-
- not_installed_yet = FALSE;
- }
-
- static void AddOLWMDialogFrame(Widget widget, long decorationMask)
- {
- Atom winAttrs[2];
- Atom winDecor[3];
- Widget shell = widget;
- Window win;
- int numberOfDecorations = 0;
-
- /*
- ** Make sure atoms for OpenLook are installed only once
- */
- if (not_installed_yet) InstallOLWMAtoms(widget);
-
- while (!XtIsShell(shell)) shell = XtParent(shell);
-
- win = XtWindow(shell);
-
- /*
- ** Tell Open Look that our window is not one of the standard OLWM window
- ** types. See OLIT Widget Set Programmer's Guide pp.70-73.
- */
-
- winAttrs[0] = AtomWTOther;
-
- XChangeProperty(XtDisplay(shell),
- win,
- AtomWinAttr,
- XA_ATOM,
- 32,
- PropModeReplace,
- (unsigned char*)winAttrs,
- 1);
-
- /*
- ** Tell Open Look to add some decorations to our window
- */
- numberOfDecorations = 0;
- if (decorationMask & OLWM_Header)
- winDecor[numberOfDecorations++] = AtomHeader;
- if (decorationMask & OLWM_Resize)
- winDecor[numberOfDecorations++] = AtomResize;
- if (decorationMask & OLWM_Close)
- {
- winDecor[numberOfDecorations++] = AtomClose;
-
- /*
- ** If the close button is specified, the header must be
- ** specified. If the header bit is not set, set it.
- */
- if (!(decorationMask & OLWM_Header))
- winDecor[numberOfDecorations++] = AtomHeader;
- }
-
- XChangeProperty(XtDisplay(shell),
- win,
- AtomDecor,
- XA_ATOM,
- 32,
- PropModeReplace,
- (unsigned char*)winDecor,
- numberOfDecorations);
- }
-
-
- /*
- ** Example of use of AddOLWMDialogFrame, with a bit of extra stuff
- */
- void register_dialog_to_WM(Widget shell, XtCallbackProc Cbk_func)
- {
- Atom atom;
-
- /*
- ** Alias the "Close" item in system menu attached to dialog shell
- ** to the activate callback of "Exit" in the menubar
- */
- if (Cbk_func)
- {
- atom = XmInternAtom(XtDisplay(shell),"WM_DELETE_WINDOW",TRUE);
- XmAddWMProtocolCallback(shell,atom, Cbk_func,NULL);
- }
-
- /*
- ** If Motif is the window manager, skip OpenLook specific stuff
- */
- if (XmIsMotifWMRunning(shell)) return;
-
- /*
- ** Register dialog shell to OpenLook.
- **
- ** WARNING: on some systems, adding the "Close" button allows the title
- ** to be properly centered in the title bar. On others, activating
- ** "Close" crashes OpenLook. The reason is not clear yet, but it seems
- ** the first case occurs with OpenWindows 2 while the second occurs with
- ** Openwindows 3. Thus, comment out one of the two following lines as
- ** suitable for your site, and send e-mail to syj@ecmwf.int if you
- ** find out what is going on !
- */
- AddOLWMDialogFrame(shell,(OLWM_Header | OLWM_Resize));
- /* AddOLWMDialogFrame(shell,(OLWM_Header | OLWM_Resize | OLWM_Close)); */
- }
-
-
- -----------------------------------------------------------------------------
- Subject: 69) How can I turn off the Motif window manager functions from the
- system menu?
- [Last modified: October 92]
-
- Answer: The user of an application can control functions in the system menu
- for an application using the mwm resource clientFunctions:
-
- mwm.application_name.clientFunctions: -resize -close
-
- Note that mwm will have to be restarted after putting this in their resource
- database.
-
-
- Answer: The writer of an application can only remove items. Be warned that
- your users will probably gnash their teeth, swear furiously at your product
- and stop using it if they discover that you have done this. (Especially if
- you have removed the Close button, your application has hung and it has taken
- up all of memory and swap so it can't be killed.) Much better is to catch the
- action gracefully as in the next question.
-
- #include <Xm/MwmUtil.h>
-
- XtVaGetValues(shell, XmNmwmFunctions, &int_val, NULL);
- int_val &= ~(MWM_FUNC_CLOSE | MWM_FUNC_ALL);
- XtVaSetValues(shell, XmNmwmFunctions, int_val, NULL);
-
- -----------------------------------------------------------------------------
- Subject: 70) How can I create a multi-colored window manager icon?
-
- [Last modified: Oct 95]
-
- Answer: The only portable way to do this is with icon windows. The WMShell
- widget supports icon windows with its XmNiconWindow resource. Set this to a
- window that your application has created. The window could be the XtWindow()
- of a realized shell widget. The window must be created with the default
- visual and colormap of its screen. Other requirements on icon windows are
- specified in section 4.1.9 of the X11R6 ICCCM. Note that some window managers
- provide alternate techniques for creating color icons; none of these are
- standard or portable.
-
- Ken Lee, http://www.rahul.net/kenton/
-
- -----------------------------------------------------------------------------
- Subject: 71) How can I keep my shell windows fixed in size?
-
- [Last modified: Apr 95]
-
- Answer: In addition to the decoration controls mentioned in the previous few
- subjects of this FAQ, you can also specify size hints for your shell widget's
- windows with these resources: XmNminWidth, XmNmaxWidth, XmNminHeight,
- XmNmaxHeight. If you set the min and max values to the same size, most window
- managers will not allow the user to resize the window.
-
- Ken Lee, http://www.rahul.net/kenton/
-
- -----------------------------------------------------------------------------
- Subject: 72) Why is XtGetValues of XmNx and XmNy of my toplevel shell wrong?
-
- [Last modified: Oct 95]
-
- Answer: [Note: This answer is borrowed from the Xt FAQ,
- ftp://ftp.x.org/contrib/faqs/FAQ-Xt, devoted to X Toolkit Intrinsics.]
-
- XmNx and XmNy are the coordinates relative to your shell's parent window,
- which is usually a window manager's frame window. To translate to the root
- coordinate space, use XtTranslateCoords().
-
- -----------------------------------------------------------------------------
- Subject: 73) How do I get XmNx and XmNy positions to be honored correctly?
-
- [Last modified: Nov 96]
-
- Answer: One answer is to pass the right hints to the window manager, perhaps
- using XSetWMNormalHints. Another approach comes from Shane Burgess
- (shane@radionics.com) who writes:
-
- By setting the XmNdefaultPosition resource to False, I've found that all my
- XmNx & XmNy requests gets set correctly.
-
- Pete Sakalaukus (sakalauk@pelican.st.usm.edu) says that XmNdefaultPosition
- only works with olwm, not mwm.
-
- -----------------------------------------------------------------------------
- Subject: 74) How can my application know when the user has quit Mwm?
-
- [Last modified: Feb 95]
-
- Answer: Looking for an answer to this one. ANY TAKERS? (Still looking.)
-
- -----------------------------------------------------------------------------
- Subject: 75) How can I tell if the user has selected "Close" from the system
- menu? How do I catch the "Close"? I need to do some clean up before exiting.
-
- [Last modified: Aug 95]
-
- Answer: Catching the mwm Close involves using XmAddWMProtocolCallback and
- possibly setting the XmNdeleteResponse resource. Note that whether your
- application involves multiple applicationShells vs. a single applicationShell
- and multiple toplevelShells is significant. Following the two older code
- fragments is a complete test application which can be compiled with different
- #defines to alter the behavior. This works with R4 Intrinsics
-
- #include <Xm/Protocols.h>
-
- void FinalCleanupCB(w, client_data, call_data)
- Widget w;
- caddr_t client_data, call_data;
- {
- /* tidy up stuff here */
- ...
- /* exit if you want to */
- exit (0);
- }
-
- main()
- {
- Atom wm_delete_window;
-
- ...
- XtRealizeWidget(toplevel);
- ...
- wm_delete_window =
- XmInternAtom(XtDisplay(toplevel),
- "WM_DELETE_WINDOW", False);
- XmAddWMProtocolCallback(toplevel, wm_delete_window,
- FinalCleanupCB, NULL);
- XtMainLoop();
- }
-
- This will still kill the application. To turn this behaviour off so that the
- application is not killed, set the shell resource XmNdeleteResponse to
- XmDO_NOTHING. This means that users cannot kill your application via the
- system menu, and may be a bad thing.
-
- If you are running R3, Bob Hays (bobhays@spss.com) has suggested this:
- "Trapping on the delete window atom does not work as I cannot force my action
- routine to the top of the action list for the activity desired, so the window
- manager kills my window anyway BEFORE I can do anything about it. And, to
- make matters worse, the window manager (Motif in this case) tacks its atoms
- and handlers onto the window at some unknown point down the line after the
- creation of the shell widget as far as I can tell. So....
-
- I have a procedure as an action routine for ClientMessage. Then, if I get a
- property change event on the window manager protocols, I then tack on
- WM_SAVE_YOURSELF. If I get this request, I clean up (it seems to happen on
- WM_DELETE_WINDOW, BTW, if you remove WM_DELETE_WINDOW from the WM protocols
- atom) and exit. Works great and is less filling overall:-)."
-
- The following similar code fragment is from Dave Mink
- (mink@cadcam.pms.ford.com):
-
- void setupCloseCallback(Widget shell, XtCallbackProc closeProc)
- {
- /* get window manager delete protocol atom */
- Atom deletewin_protocol = XmInternAtom(
- XtDisplay(shell), "WM_DELETE_WINDOW", True
- );
- /* turn off default delete response */
- XtVaSetValues( shell,
- XmNdeleteResponse, XmDO_NOTHING,
- NULL);
- /* add callback for window manager delete protocol */
- XmAddWMProtocolCallback(shell, deletewin_protocol, closeProc, NULL);
- }
-
-
- Here is a complete code example which can be compiled several different ways,
- as per the comments in the code.
-
-
- /*
- * MWM Close test program.
- *
- * Creates 4 shells, testing each of 3 different values of XmNdeleteResponse.
- * Compile will -DMULTIPLE_APP_SHELLS to make all 4 shells of type
- * applicationShellWidgetClass. Otherwise, first shell created is
- * applicationShellWidgetClass, but other 3 are topLevelShellWidgetClass.
- * Results differ. You can also experiment with #defining POPUP_SHELL,
- * BEFORE_CREATE, or AFTER_CREATE.
- *
- * Ken Sall (ksall@cen.com), Motif FAQ maintainer, Century Computing, Inc.
- */
-
- #include <stdio.h>
-
- #include <X11/IntrinsicP.h>
- #include <X11/StringDefs.h>
-
- #include <X11/Shell.h>
- #include <Xm/Xm.h>
- #include <Xm/XmP.h>
-
- #include <Xm/RowColumn.h> /* for popup */
- #include <Xm/Label.h>
-
- #include <X11/Protocols.h>
- #include <X11/AtomMgr.h>
- #include <X11/MwmUtil.h>
-
- void CloseCB();
- void popup_handler();
-
- #ifdef MULTIPLE_APP_SHELLS
- #define P1_TITLE "P1: applicationShell: XmDO_NOTHING"
- #define P2_TITLE "P2: applicationShell: XmDESTROY"
- #define P3_TITLE "P3: applicationShell: XmUNMAP"
- #define P4_TITLE "P4: applicationShell: default"
- #else
- #define P1_TITLE "P1: applicationShell: XmDO_NOTHING"
- #define P2_TITLE "P2: topLevelShell: XmDESTROY"
- #define P3_TITLE "P3: topLevelShell: XmUNMAP"
- #define P4_TITLE "P4: topLevelShell: XmDO_NOTHING"
- #endif
-
- void CloseCB (w, client_data, call_data)
- Widget w; /* widget id */
- caddr_t client_data; /* data from application */
- caddr_t call_data; /* data from widget class */
- {
- XmAnyCallbackStruct *cb = (XmAnyCallbackStruct *) call_data;
-
- printf ("caught Close from: %s\n", (char *)client_data );
- if (strcmp ( P1_TITLE, (char *)client_data ) == 0 )
- {
- /* do something */
- }
- else if (strcmp ( P2_TITLE, (char *)client_data ) == 0 )
- {
- /* do something else */
- }
- else if (strcmp ( P3_TITLE, (char *)client_data ) == 0 )
- {
- /* do something else */
- }
- else if (strcmp ( P4_TITLE, (char *)client_data ) == 0 )
- {
- /* do something else */
- }
- else /* unreachable */
- {
- printf ("oops\n");
- }
- }
-
- void popup_handler()
- {
- printf ("popup handler\n");
- }
-
- int main (argc,argv, envp)
- int argc;
- char **argv;
- char **envp;
- {
- XtAppContext app_context;
- Display *theDisplay;
- Widget shell1, shell2, shell3, shell4;
- Widget label, DrawWindow, WindowPopupMenu;
- Arg al[10];
- int ac;
- Atom delwinAtom1, delwinAtom2, delwinAtom3, delwinAtom4;
- XmString xms;
-
- #ifdef MULTIPLE_APP_SHELLS
- printf ("This version will demonstrate a problem if you Close P2.\n");
- printf ("Since there are multiple appshells, closing (destroying) P2 cause the app to exit.\n");
- #else
- #ifdef POPUP_SHELL
- printf ("This version uses XtCreatePopupShell rather than XtAppCreateShell \n");
- #else
- printf ("Compile with '-DMULTIPLE_APP_SHELLS' to demonstrate a problem.\n");
- #endif
- #endif
-
- #ifdef BEFORE_CREATE
- printf ("This version adds the XmNdeleteResponse _before_ the shell is created.\n");
- #else
- printf ("This version adds the XmNdeleteResponse _after the shell is created.\n");
- #endif
-
- XtToolkitInitialize ();
- app_context = XtCreateApplicationContext ();
-
- theDisplay = XtOpenDisplay ( app_context, NULL,
- "my_program", "ProgramClass",
- NULL, 0, &argc, argv);
-
- /* --------------------- BEGIN P1 -------------------- */
- ac = 0;
- XtSetArg(al[ac], XmNx, 0); ac++;
- XtSetArg(al[ac], XmNy, 0); ac++;
- XtSetArg(al[ac], XmNwidth, 350); ac++;
- XtSetArg(al[ac], XmNheight, 200); ac++;
- XtSetArg (al[ac], XmNtitle, P1_TITLE); ac++;
- #ifdef BEFORE_CREATE
- XtSetArg (al[ac], XmNdeleteResponse, XmDO_NOTHING); ac++;
- #endif
-
- /* The ONLY applicationShell unless MULTIPLE_APP_SHELLS is defined. */
-
- shell1 = XtAppCreateShell ("shell1", "ProgramClass",
- applicationShellWidgetClass, theDisplay, al, ac);
-
- /* Tell mwm to exec CloseCB when close is detected. */
- delwinAtom1 = XmInternAtom (XtDisplay(shell1),
- "WM_DELETE_WINDOW", False);
- XmAddWMProtocolCallback (shell1, delwinAtom1, CloseCB, P1_TITLE);
-
- #ifndef BEFORE_CREATE
- XtVaSetValues( shell1, XmNdeleteResponse, XmDO_NOTHING, NULL);
- #endif
-
- /* --------------------- BEGIN P2 -------------------- */
- ac = 0;
- XtSetArg(al[ac], XmNx, 375); ac++;
- XtSetArg(al[ac], XmNy, 0); ac++;
- XtSetArg(al[ac], XmNwidth, 350); ac++;
- XtSetArg(al[ac], XmNheight, 200); ac++;
- XtSetArg (al[ac], XmNtitle, P2_TITLE); ac++;
- #ifdef BEFORE_CREATE
- XtSetArg (al[ac], XmNdeleteResponse, XmDESTROY); ac++;
- #endif
-
- #ifdef MULTIPLE_APP_SHELLS
- shell2 = XtAppCreateShell ("shell2", "ProgramClass",
- applicationShellWidgetClass, theDisplay, al, ac);
- #else
- #ifdef POPUP_SHELL
- /*
- * NOTE use of XtCreatePopupShell (not XtCreateMAnagedWidget) and
- * topLevelShellWidgetClass (not applicationShellWidgetClass).
- * Parent of topLevelShell is applicationShell.
- * Use XtPopup rather than XtRealize for topLevelShell.
- */
- shell2 = XtCreatePopupShell ("shell2",
- topLevelShellWidgetClass, shell1, al, ac);
- #else
- shell2 = XtAppCreateShell ("shell2", "ProgramClass",
- topLevelShellWidgetClass, theDisplay, al, ac);
- #endif
- #endif
-
- /* Tell mwm to exec CloseCB when close is detected. */
- delwinAtom2 = XmInternAtom (XtDisplay(shell2),
- "WM_DELETE_WINDOW", False);
- XmAddWMProtocolCallback (shell2, delwinAtom2, CloseCB, P2_TITLE);
-
- #ifndef BEFORE_CREATE
- XtVaSetValues( shell2, XmNdeleteResponse, XmDESTROY, NULL);
- #endif
-
- /* --------------------- BEGIN P3 -------------------- */
- ac = 0;
- XtSetArg(al[ac], XmNx, 750); ac++;
- XtSetArg(al[ac], XmNy, 0); ac++;
- XtSetArg(al[ac], XmNwidth, 350); ac++;
- XtSetArg(al[ac], XmNheight, 200); ac++;
- XtSetArg (al[ac], XmNtitle, P3_TITLE); ac++;
- #ifdef BEFORE_CREATE
- XtSetArg (al[ac], XmNdeleteResponse, XmUNMAP); ac++;
- #endif
-
- #ifdef MULTIPLE_APP_SHELLS
- shell3 = XtAppCreateShell ("shell3", "ProgramClass",
- applicationShellWidgetClass, theDisplay, al, ac);
- #else
- #ifdef POPUP_SHELL
- /* See comments for shell2 */
- shell3 = XtCreatePopupShell ("shell3",
- topLevelShellWidgetClass, shell1, al, ac);
- #else
- shell3 = XtAppCreateShell ("shell3", "ProgramClass",
- topLevelShellWidgetClass, theDisplay, al, ac);
- #endif
- #endif
-
- /* Tell mwm to exec CloseCB when close is detected. */
- delwinAtom3 = XmInternAtom (XtDisplay(shell3),
- "WM_DELETE_WINDOW", False);
- XmAddWMProtocolCallback (shell3, delwinAtom3, CloseCB, P3_TITLE);
-
- #ifndef BEFORE_CREATE
- XtVaSetValues( shell3, XmNdeleteResponse, XmUNMAP, NULL);
- #endif
-
- /* --------------------- BEGIN P4 -------------------- */
- ac = 0;
- XtSetArg(al[ac], XmNx, 0); ac++;
- XtSetArg(al[ac], XmNy, 250); ac++;
- XtSetArg(al[ac], XmNwidth, 350); ac++;
- XtSetArg(al[ac], XmNheight, 200); ac++;
- XtSetArg (al[ac], XmNtitle, P4_TITLE); ac++;
- #ifdef BEFORE_CREATE
- XtSetArg (al[ac], XmNdeleteResponse, XmDO_NOTHING); ac++;
- #endif
-
- #ifdef MULTIPLE_APP_SHELLS
- shell4 = XtAppCreateShell ("shell4", "ProgramClass",
- applicationShellWidgetClass, theDisplay, al, ac);
- #else
- #ifdef POPUP_SHELL
- /* See comments for shell2 */
- shell4 = XtCreatePopupShell ("shell4",
- topLevelShellWidgetClass, shell1, al, ac);
- #else
- shell4 = XtAppCreateShell ("shell4", "ProgramClass",
- topLevelShellWidgetClass, theDisplay, al, ac);
- #endif
- #endif
-
- /* Tell mwm to exec CloseCB when close is detected. */
- delwinAtom4 = XmInternAtom (XtDisplay(shell4),
- "WM_DELETE_WINDOW", False);
- XmAddWMProtocolCallback (shell4, delwinAtom4, CloseCB, P4_TITLE);
-
- #ifndef BEFORE_CREATE
- XtVaSetValues( shell4, XmNdeleteResponse, XmDO_NOTHING, NULL);
- #endif
-
- /* just for fun */
- ac = 0;
- WindowPopupMenu = XmCreatePopupMenu(shell1, "PopupMenu", al, ac);
- XtAddEventHandler( shell1, ButtonPressMask, FALSE, popup_handler,
- WindowPopupMenu);
-
- ac = 0;
- xms = (XmString) XmStringCreateLocalized ( "Button3 = popup; Button2 = DnD.");
- XtSetArg(al[ac], XmNlabelString, xms); ac++;
- XtSetArg(al[ac], XmNshadowThickness, 2); ac++;
- label = XmCreateLabel (shell1, "label", al, ac);
- XtManageChild ( label );
-
- XtRealizeWidget( shell1 );
-
- /* NOTE use of XtPopup rather than XtRealizeWidget for topLevels */
-
- #ifdef MULTIPLE_APP_SHELLS
- XtRealizeWidget( shell2 );
- XtRealizeWidget( shell3 );
- XtRealizeWidget( shell4 );
- #else
- #ifdef POPUP_SHELL
- XtPopup ( shell2, XtGrabNone );
- XtPopup ( shell3, XtGrabNone );
- XtPopup ( shell4, XtGrabNone );
- #else
- XtRealizeWidget( shell2 );
- XtRealizeWidget( shell3 );
- XtRealizeWidget( shell4 );
- #endif
- #endif
-
- XtAppMainLoop (app_context);
- }
-
- -----------------------------------------------------------------------------
- END OF PART THREE
-