[1661] in Athena Bugs

home help back first fref pref prev next nref lref last post

(RTPC) Version 6.0R: uwm doesn't do color cursors

daemon@ATHENA.MIT.EDU (Jonathan I. Kamens)
Sun Jan 15 23:23:56 1989

Date: Sun, 15 Jan 89 23:23:31 EST
From: Jonathan I. Kamens <jik@ATHENA.MIT.EDU>
To: bugs@ATHENA.MIT.EDU
System type, version:	(RTPC) Version 6.0R
System name:		pit-manager
What's wrong:

Uwm has no capability for selecting the color of the cursors which it
uses.  I've modified it to accept a "cursorcolor" paramater in the
bindings files (i.e. .uwmrc or whatever).  The patches to all files
that need to be modified, including modifications to the man page, are
below.

  --> Jonathan Kamens
      Project Athena Watchmaker
      SIPB (Student Information Processing Board) Member
      Volunteer OLC Consultant
      jik@ATHENA.MIT.EDU


*** Cursors.c.orig	Sun Jan 15 23:18:35 1989
--- Cursors.c	Sun Jan 15 23:15:34 1989
***************
*** 1,5 ****
  #ifndef lint
! static char *rcsid_StoreCursors_c = "$Header: Cursors.c,v 1.1 89/01/15 22:02:03 jik Exp $";
  #endif	lint
  
  #include <X11/copyright.h>
--- 1,5 ----
  #ifndef lint
! static char *rcsid_StoreCursors_c = "$Header: Cursors.c,v 1.3 89/01/15 23:15:27 jik Exp $";
  #endif	lint
  
  #include <X11/copyright.h>
***************
*** 34,41 ****
   *
   * 000 -- M. Gancarz, DEC Ultrix Engineering Group
   * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group
!  *        Convert to X11
!  */
  
  #ifndef lint
  static char *sccsid = "@(#)StoreCursors.c	3.8	1/24/86";
--- 34,43 ----
   *
   * 000 -- M. Gancarz, DEC Ultrix Engineering Group
   * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group
!  *	  Convert to X11
!  * 002 -- Jonathan Kamens, MIT Project Athena -- Modifications for
!  *        color cursors
!  */ 
  
  #ifndef lint
  static char *sccsid = "@(#)StoreCursors.c	3.8	1/24/86";
***************
*** 49,54 ****
--- 51,66 ----
   */
  StoreCursors()
  {
+      XColor fore_cursor, back_cursor;
+ 
+      /*
+       * Find the XColor values to do the color settings of the cursors.
+       */
+      fore_cursor.pixel = CursorPixel;
+      back_cursor.pixel = PBackground;
+      XQueryColor(dpy, DefaultColormap(dpy, scr), &fore_cursor);
+      XQueryColor(dpy, DefaultColormap(dpy, scr), &back_cursor);
+      
      /*
       * Main uwm cursor and movement cursor.
       */
***************
*** 56,62 ****
      if (ArrowCrossCursor == FAILURE) {
  	Error("StoreCursors -> Unable to store ArrowCrossCursor.");
      }
! 
      /*
       * Text cursor used in icons.
       */
--- 68,76 ----
      if (ArrowCrossCursor == FAILURE) {
  	Error("StoreCursors -> Unable to store ArrowCrossCursor.");
      }
!     else
! 	 XRecolorCursor(dpy, ArrowCrossCursor, &fore_cursor, &back_cursor);
!      
      /*
       * Text cursor used in icons.
       */
***************
*** 64,69 ****
--- 78,85 ----
      if (TextCursor == FAILURE) {
  	Error("StoreCursors -> Unable to store TextCursor.");
      }
+     else
+ 	 XRecolorCursor(dpy, TextCursor, &fore_cursor, &back_cursor);
  
      /*
       * Icon cursor used to iconify windows.
***************
*** 72,77 ****
--- 88,95 ----
      if (IconCursor == FAILURE) {
  	Error("StoreCursors -> Unable to store IconCursor.");
      }
+     else
+ 	 XRecolorCursor(dpy, IconCursor, &fore_cursor, &back_cursor);
  
      /*
       * Menu cursor.
***************
*** 80,85 ****
--- 98,105 ----
      if (MenuCursor == FAILURE) {
  	Error("StoreCursors -> Unable to store MenuCursor.");
      }
+     else
+ 	 XRecolorCursor(dpy, MenuCursor, &fore_cursor, &back_cursor);
  
      /*
       * Left button main cursor.
***************
*** 88,93 ****
--- 108,115 ----
      if (LeftButtonCursor == FAILURE) {
  	Error("StoreCursors -> Unable to store LeftButtonCursor.");
      }
+     else
+ 	 XRecolorCursor(dpy, LeftButtonCursor, &fore_cursor, &back_cursor);
  
      /*
       * Middle button main cursor.
***************
*** 96,101 ****
--- 118,125 ----
      if (MiddleButtonCursor == FAILURE) {
  	Error("StoreCursors -> Unable to store MiddleButtonCursor.");
      }
+     else
+ 	 XRecolorCursor(dpy, MiddleButtonCursor, &fore_cursor, &back_cursor);
  
      /*
       * Right button main cursor.
***************
*** 104,109 ****
--- 128,135 ----
      if (RightButtonCursor == FAILURE) {
  	Error("StoreCursors -> Unable to store RightButtonCursor.");
      }
+     else
+ 	 XRecolorCursor(dpy, RightButtonCursor, &fore_cursor, &back_cursor);
  
      /*
       * Targer cursor used to identify a window for an action.
***************
*** 112,116 ****
--- 138,144 ----
      if (TargetCursor == FAILURE) {
  	Error("StoreCursors -> Unable to store TargetCursor.");
      }
+     else
+ 	 XRecolorCursor(dpy, TargetCursor, &fore_cursor, &back_cursor);
  }
  
*** globals.c.orig	Sun Jan 15 23:18:39 1989
--- globals.c	Sun Jan 15 23:15:40 1989
***************
*** 1,4 ****
! /* $Header: globals.c,v 1.1 89/01/15 21:46:59 jik Exp $ */
   
  #include <X11/copyright.h>
  
--- 1,4 ----
! /* $Header: globals.c,v 1.4 89/01/15 23:15:36 jik Exp $ */
   
  #include <X11/copyright.h>
  
***************
*** 35,43 ****
--- 35,46 ----
   * 002 -- Loretta Guarino Reid, DEC Ultrix Engineering Group 
   *  Western Software Lab. April 17, 1987
   *  Convert to X11
+  * 003 -- Jonathan Kamens, MIT Project Athena -- Modifications for
+  *        color cursors
   */
   
  #ifndef lint
+ static char *rcsid_globals_c = "$Header: globals.c,v 1.4 89/01/15 23:15:36 jik Exp $";
  static char *sccsid = "%W%	%G%";
  #endif
  /*
***************
*** 59,64 ****
--- 62,68 ----
  Pixel PBackground;		/* Pop-up Window background pixmap. */
  Pixel MBorder;			/* Menu Window border pixmap. */
  Pixel MBackground;		/* Menu Window background pixmap. */
+ Pixel CursorPixel;		/* Color of all cursors */
  Cursor ArrowCrossCursor;	/* Arrow cross cursor. */
  Cursor TextCursor;		/* Text cursor used in icon windows. */
  Cursor IconCursor;		/* Icon Cursor. */
***************
*** 128,133 ****
--- 132,138 ----
  char PBackgroundName[NAME_LEN];	/* name of color to use for popup */
  char PForegroundName[NAME_LEN];	/* name of color to use for popup */
  char PBorderColor[NAME_LEN];	/* name of color to use for popup */
+ char CursorPixelName[NAME_LEN]; /* name of color to use for cursors */
  char **Argv;			/* Pointer to command line parameters. */
  char **Environ;			/* Pointer to environment. */
  
***************
*** 139,144 ****
--- 144,150 ----
   */
  Keyword KeywordTable[] = {
      { "autoselect",	IsBoolTrue,	&Autoselect,0,0,0 },
+     { "cursorcolor",    IsString,       0,0,CursorPixelName,0 },
      { "background",	IsString,	0,0,PBackgroundName, 0},
      { "bordercolor",	IsString,	0,0,PBorderColor, 0},
      { "borderwidth",	IsNumeric,	0,&PBorderWidth,0,0},
*** uwm.c.orig	Sun Jan 15 23:18:45 1989
--- uwm.c	Sun Jan 15 23:15:49 1989
***************
*** 1,4 ****
! /* $Header: uwm.c,v 1.1 89/01/15 22:10:29 jik Exp $ */
  #include <X11/copyright.h>
  
  /*
--- 1,4 ----
! /* $Header: uwm.c,v 1.4 89/01/15 23:15:42 jik Exp $ */
  #include <X11/copyright.h>
  
  /*
***************
*** 31,40 ****
--- 31,43 ----
   * 000 -- M. Gancarz, DEC Ultrix Engineering Group
   * 001 -- Loretta Guarino Reid, DEC Ultrix Engineering Group,
   *  Western Software Lab. Convert to X11.
+  * 002 -- Jonathan Kamens, MIT Project Athena -- Modifications for
+  *        color cursors
   */
  
  #ifndef lint
  static char *sccsid = "%W%	%G%";
+ static char *rcsid_uwm_c = "$Header: uwm.c,v 1.4 89/01/15 23:15:42 jik Exp $";
  #endif
  
  #include "uwm.h"
***************
*** 105,111 ****
           fallbackPFont = False,	/* popups, */
           fallbackIFont = False;	/* icons */
      XSetWindowAttributes attr;	/* for setting save under flag */
!     unsigned long whitepix, blackpix, borderpix, popborderpix;
  
  #ifdef PROFIL
      signal(SIGTERM, ptrap);
--- 108,114 ----
           fallbackPFont = False,	/* popups, */
           fallbackIFont = False;	/* icons */
      XSetWindowAttributes attr;	/* for setting save under flag */
!     unsigned long whitepix, blackpix, borderpix, popborderpix, cursorpix;
  
  #ifdef PROFIL
      signal(SIGTERM, ptrap);
***************
*** 233,238 ****
--- 236,242 ----
  
      {
  	Bool whiteset = False, blackset = False, borderset = False;
+ 	Bool cursorset = False; 
  	Colormap cmap = DefaultColormap (dpy, scr);
  	XColor cdef;
  
***************
*** 262,271 ****
--- 266,283 ----
  		    borderset = True;
  		}
  	    }
+ 	    if (CursorPixelName[0]) {
+ 		 if (XParseColor (dpy, cmap, CursorPixelName, &cdef) &&
+ 		     XAllocColor (dpy, cmap, &cdef)) {
+ 		      cursorpix = cdef.pixel;
+ 		      cursorset = True;
+ 		 }
+ 	    }    
  	}
  	if (!whiteset) whitepix = WhitePixel (dpy, scr);
  	if (!blackset) blackpix = BlackPixel (dpy, scr);
  	if (!borderset) borderpix = blackpix;
+ 	if (!cursorset) cursorpix = blackpix;
      }
  
  
***************
*** 310,316 ****
      IBackground = GrayPixmap;
      IBorderWidth = MBorderWidth = PBorderWidth;
      IBorder = MBorder = PBorder = borderpix;
! 
      /*
       * Store all the cursors.
       */
--- 322,329 ----
      IBackground = GrayPixmap;
      IBorderWidth = MBorderWidth = PBorderWidth;
      IBorder = MBorder = PBorder = borderpix;
!     CursorPixel = cursorpix;
!     
      /*
       * Store all the cursors.
       */
*** uwm.h.orig	Sun Jan 15 23:18:51 1989
--- uwm.h	Sun Jan 15 23:16:01 1989
***************
*** 1,4 ****
! /* $Header: uwm.h,v 1.1 89/01/15 21:55:20 jik Exp $ */
   
  #include <X11/copyright.h>
  
--- 1,4 ----
! /* $Header: uwm.h,v 1.3 89/01/15 23:15:51 jik Exp $ */
   
  #include <X11/copyright.h>
  
***************
*** 35,40 ****
--- 35,42 ----
   *  Added global vars for warp options.
   * 002 -- Loretta Guarino Reid, DEC Ultrix Engineering Group,
   *  Western Software Lab, Port to X11
+  * 003 -- Jonathan Kamens, MIT Project Athena -- Modifications for
+  *        color cursors
   */
   
  #include <errno.h>
***************
*** 255,260 ****
--- 257,263 ----
  extern Pixel IBorder;		/* Icon window border pixmap. */
  extern Pixmap IBackground;	/* Icon window background pixmap. */
  extern Pixel PBorder;		/* Pop-Up Window border pixmap. */
+ extern Pixel CursorPixel;	/* Pixel for cursor color */
  extern Pixel PBackground;	/* Pop-up Window background pixmap. */
  extern Pixel MBorder;		/* Menu Window border pixmap. */
  extern Pixel MBackground;	/* Menu Window background pixmap. */
***************
*** 325,330 ****
--- 328,334 ----
  extern char PBackgroundName[];	/* name of color to use for popup */
  extern char PForegroundName[];	/* name of color to use for popup */
  extern char PBorderColor[];	/* name of color to use for popup */
+ extern char CursorPixelName[];  /* name of color to use for cursors */
  extern char **Argv;		/* Pointer to command line parameters. */
  extern char **Environ;		/* Pointer to environment. */
   
*** uwm.man.orig	Sun Jan 15 23:18:55 1989
--- uwm.man	Sun Jan 15 23:17:32 1989
***************
*** 11,17 ****
  .if n .sp 1
  .if t .sp .5
  ..
! .TH UWM 1 "1 March 1988" "X Version 11"
  .SH NAME
  .PP
  uwm - a window manager for X
--- 11,17 ----
  .if n .sp 1
  .if t .sp .5
  ..
! .TH UWM 1 "15 January 1988" "X Version 11"
  .SH NAME
  .PP
  uwm - a window manager for X
***************
*** 75,80 ****
--- 75,83 ----
  .IP "\fBforeground\fP=\fIcolor\fP"
  specifies the default foreground color for popup sizing windows, menus,
  and icons.  The default is to use the BlackPixel for the current screen.
+ .IP "\fBcursorcolor\fP=\fIcolor\fP"
+ specifies the default cursor color for all uwm cursors.  The defauls
+ is to use the BlackPixel for the current screen.
  .IP \fBfreeze\fP/\fBnofreeze\fP
  locks all other client applications 
  out of the server during certain window manager tasks, such as move 

home help back first fref pref prev next nref lref last post