home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / doc / HOWTO / mini / X-Big-Cursor < prev    next >
Text File  |  1997-08-18  |  9KB  |  225 lines

  1.   X11-big-cursor MINIHOWTO
  2.   How to use enlarged mouse cursors with the X window system
  3.   J÷rg Schneider <mailto:joerg.schneider@ira.uka.de>
  4.   V2, August 11 1997
  5.  
  6.   This document describes how to use enlarged mouse cursors with the X
  7.   window system.
  8.  
  9.   1.  Introduction
  10.  
  11.   There are several reasons why the standard X mouse cursors are hard to
  12.   track for some people:
  13.  
  14.   ╖  when running X on a notebook with low contrast LCD
  15.  
  16.   ╖  on normal screens when using high resolution, 1600x1280 e. g.
  17.  
  18.   ╖  for visually impaired persons even on normal hardware
  19.  
  20.   In all cases it might help to use enlarged mouse cursors. Ideally this
  21.   job should be done by a single X program that automatically enlarges
  22.   every mouse cursor.
  23.  
  24.   To my knowledge there is no simple way to write a utility like this,
  25.   because the X protocol has no provision to query mouse cursors. For
  26.   more details see section ``Technical discussion'' below.
  27.  
  28.   If we aim for a less general goal, though, something can be done:
  29.  
  30.   There is a set of standard mouse cursors that can be found in the
  31.   cursor font (try xfd -fn cursor to look at it). Most programs use
  32.   these mouse cursors and the key idea is to replace the standard cursor
  33.   font with an enlarged version.
  34.  
  35.   2.  About this document
  36.  
  37.   The motivation for this MINIHOWTO was a visually impaired co-student
  38.   who asked me how to enlarge the mouse cursor under X. After I found
  39.   out how this can be done, I wrote an initial version of this document.
  40.   The knowledge about the method described here does not seem to be
  41.   common, so I decided to share it and submitted this document as a
  42.   Linux MINIHOWTO, despite the fact that it is not specific to Linux at
  43.   all. As all other MINIHOWTOs it can be found in the home of of the
  44.   Linux Documentation Project (LDP) <http://sunsite.unc.edu/LDP/HOWTO/>.
  45.  
  46.   The master <http://i11www.ira.uka.de/~schneid/X11-big-cursor/master/>
  47.   of this document is maintained in the SGML/linuxdoc format. This makes
  48.   it possible to automatically provide versions in the following formats
  49.   (which can be found in the same place as the master): html, text,
  50.   LaTeX, DVI, PostScript, GNU info.
  51.  
  52.   Shinobu Miyata <mailto:shinobu@emichan.rim.or.jp> has done a Japanese
  53.   translation of this MINIHOWTO. It can be found in
  54.   <http://i11www.ira.uka.de/~schneid/jp/X11-big-cursor/>.
  55.  
  56.   3.  How to do it
  57.  
  58.   Follow the steps detailed below. If you don't want to get and compile
  59.   the bdfresize package yourself, you can skip to step 3 and download a
  60.   magnified font instead of creating it.
  61.  
  62.   1. get cursor.bdf, the source of the cursor font, from some X
  63.      distribution, e. g. from
  64.      <ftp://ftp.x.org/pub/R6.3/xc/fonts/bdf/misc/cursor.bdf> (if you
  65.      don't find it there try an archie search or get it from my copy
  66.      <http://i11www.ira.uka.de/~schneid/X11-big-cursor/cursor.bdf>).
  67.  
  68.   2. get, compile and install the bdfresize package from
  69.      <ftp://ftp.cs.titech.ac.jp/X11/contrib/Local/bdfresize-1.4.tar.Z>
  70.      (or from my copy <http://i11www.ira.uka.de/~schneid/X11-big-
  71.      cursor/bdfresize-1.4.tar.gz>):
  72.  
  73.           zcat bdfresize-1.4.tar.Z  | tar xf -
  74.           cd bdfresize-1.4
  75.           xmkmf
  76.           make
  77.  
  78.   On Linux you probably have to use:
  79.  
  80.        make CCOPTIONS='-include /usr/include/bsd/bsd.h' clean all
  81.  
  82.   3. create a directory and install a magnified cursor font in it
  83.      (magnification factor 2 in this example):
  84.  
  85.           mkdir $HOME/fonts
  86.           bdfresize -f 2 cursor.bdf | bdftopcf >$HOME/fonts/cursor2.pcf
  87.           mkfontdir $HOME/fonts
  88.  
  89.   I have prepared some cursor fonts
  90.   <http://i11www.ira.uka.de/~schneid/X11-big-cursor/fonts/> with the
  91.   following magnification factors: 1.5, 2, 2.5, 3, 4, 5, 6, 7, 8 and 16.
  92.   You can download one of them an copy it to $HOME/fonts if you don't
  93.   want to use bdfresize.
  94.  
  95.   4. modify your .xinitrc or .xsession file: before any X client (that
  96.      uses cursors) is started the following commands must  be executed:
  97.  
  98.           xset +fp $HOME/fonts
  99.           xsetroot -cursor_name X_cursor
  100.  
  101.   5. leave your X session and restart.
  102.  
  103.   That's it---now all mouse cursors should have doubled in size.
  104.  
  105.   4.  Notes and limitations
  106.  
  107.   ╖  X servers may have a limit for the maximum cursor size, especially
  108.      if they use a hardware implementation for the mouse cursor. Others
  109.      do not have such a limit. E. g. XF86_S3 3.3 works even with a
  110.      512x512 mouse cursor (rather slowly).
  111.  
  112.   ╖  The magnified cursor font must have the same name as the original
  113.      font (the font name must be cursor, file name does not
  114.      matter)---that is no problem as bdfresize does not change the font
  115.      name.
  116.  
  117.   ╖  The directory with the new cursor font must be placed before the
  118.      directory with the standard cursor font in the the font path---this
  119.      is accomplished with xset +fp (as opposed to xset fp+).
  120.  
  121.   ╖  Changes in $HOME/fonts/ will be visible only after the command
  122.      mkfontdir $HOME/fonts; xset fp rehash and only in newly started X
  123.      clients (more exactly: for newly created cursors).
  124.  
  125.   ╖  xset +fp path may not work on a X-Terminal. In this case a font
  126.      server (see the section ``How to use a fontserver'') can be used if
  127.      supported by the X-Terminal or some other method to install the
  128.      font on the X-Terminal (this can generally only be done by your
  129.      system administrator).
  130.  
  131.   ╖  The same approach can be used for olcursor and decw$cursor fonts
  132.      and any other cursor font you may encounter.
  133.  
  134.   ╖  Cursor fonts produced by bdfresize don't look smooth, especially at
  135.      larger magnification factors. It would be nice if someone could
  136.      create better looking handcrafted version at some common sizes.
  137.  
  138.   5.  Technical discussion
  139.  
  140.   Is it possible to write a X program that enlarges cursors
  141.   automatically?
  142.  
  143.      (Partial) solution 1
  144.         Use the XTestCompareCursor from the XTEST extension. For all
  145.         windows that the mouse pointer enters compare the cursor of this
  146.         window with a set of `known' cursors (e. g. from the cursor
  147.         font). If the cursor is found, replace it with an enlarged
  148.         version, otherwise either leave it alone or substitute a
  149.         standard cursor. This will only work where the XTest extension
  150.         is available.
  151.  
  152.      Solution 2
  153.         Write a proxy X server that relays all client requests unchanged
  154.         to the real X server, except that it intercepts all requests
  155.         corresponing to the XCreate*Cursor Xlib functions.
  156.         XCreate*Cursor requests should be modified to use an enlarged
  157.         cursor.
  158.  
  159.         This proxy server simulates a new display, e. g. :1. All clients
  160.         that connect to this display (e. g. xterm -display :1) are
  161.         displayed on the real server (normally :0) and their mouse
  162.         cursors are enlarged automatically. The mouse cursors of clients
  163.         that connect to :0 will remain unchanged.
  164.  
  165.   6.  Other ideas how to make the mouse cursor more visible
  166.  
  167.   Here are some ideas for rather simple X programs that might make mouse
  168.   cursors easier to track.
  169.  
  170.   ╖  When a hot key is pressed display something (big cursor, small
  171.      window, shaped window) at pointer position for 0.5s.
  172.  
  173.   ╖  use XRecolorCursor to change the mouse cursor color every 0.1s
  174.  
  175.   A more demanding project would be mouse trails α la windoze, i. e.
  176.   when the mouse is moved and the mouse cursor needs to be drawn in a
  177.   different position, then the old mouse cursor does not disappear at
  178.   once, but after a short delay. Mouse trails would be probably best
  179.   implemented in a X server, but it might be feasible to do it as a X
  180.   client, or better as a proxy server (see section ``Technical
  181.   discussion'' for details).
  182.  
  183.   7.  Related info
  184.  
  185.   7.1.  How to use a font server
  186.  
  187.   A font server is a net service that provides a set of X11 fonts with a
  188.   simple protocol. It can be queried which fonts it provides and will
  189.   supply the font bitmap data on request.
  190.  
  191.   You might want to use a font server to provide the X server with a
  192.   modified cursor font, instead of telling it where to find the font on
  193.   the file system.
  194.  
  195.   This method is especially handy if you use several machines that don't
  196.   share a common file system or if you use X terminals that support the
  197.   font server protocol.
  198.  
  199.   A font server program and associated tools comes with the X11R5+
  200.   distribution (AFAIK).
  201.  
  202.   7.1.1.  Setting up a font server
  203.  
  204.   Read the manual pages fs(1), fslsfonts(1) (or xfs(1), xfslsfonts(1)
  205.   under X11R6) and try it---it isn't hard. Say, you are running the
  206.   server on host some.host.edu on port 7100. You can test the setup with
  207.   the command
  208.  
  209.   fslsfonts -server some.host.edu:7100
  210.  
  211.   To actually use the server issue the command
  212.  
  213.   xset +fp tcp/some.host.edu:7100
  214.  
  215.   which should return without an error message.
  216.  
  217.   7.2.  How to get the bdf source for some font
  218.  
  219.   If you have set up a font server simply use fstobdf which comes with
  220.   the font server.
  221.  
  222.   Alternatively you may try getbdf which can dump any installed X11 font
  223.   to a bdf file.
  224.  
  225.