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