Subject: Re: FVWM: lefty cursors

From: Xris Laas <[email-masked]>
Date: Wed, 5 Mar 1997 16:05:33 -0500 (EST)

On  4 Mar, Mark Borges wrote:
> is there a simple way (in fvwm-2.0.45) to change the pointer cursor to
> have a SW-NE orientation instead of SE-NW?
> 
> i was recently advised to switch the mouse to my left hand, and i find
> it a bit awkward to use the default cursor orientation.

After a quick look at the code, I found that there is no configuration
option to change cursors.  It seems that you have to change the code at
roughly line 717 of fvwm.c, in function CreateCursors (fvwm version
2.0.43).  In your case, we'd want to change the line:

Scr.FvwmCursors[DEFAULT] = XCreateFontCursor(dpy, XC_top_left_arrow);

to:

Scr.FvwmCursors[DEFAULT] = XCreateFontCursor(dpy, XC_arrow);

I'll see if I can whip up a patch for a configuration option for
cursors.  It should be pretty simple.

--Chris

-- 
Such has been the patient sufferance of these colonies; and such is
now the necessity which constrains them to alter their former systems
of government.
    -- Thomas Jefferson, Prologue, "Declaration of Independence"

{ Chris "Xris" Laas }-----{ [email-masked] }-----{ [email-masked] }
<*>--------------{ http://www.cybercom.net/~chrisl/ }--------------<*>

--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Mark Borges <[email-masked]>
Date: 05 Mar 1997 14:24:17 -0700

>> On Wed, 5 Mar 1997 16:05:33 -0500 (EST),
>> Xris Laas(XL) wrote:
>> it a bit awkward to use the default cursor orientation.

XL> Scr.FvwmCursors[DEFAULT] = XCreateFontCursor(dpy, XC_top_left_arrow);

XL> to:

XL> Scr.FvwmCursors[DEFAULT] = XCreateFontCursor(dpy, XC_arrow);

XL> I'll see if I can whip up a patch for a configuration option for
XL> cursors.  It should be pretty simple.

Hmm, before you do read the attached note from Tom Julien. The
feature might already exist, though I haven't tried it yet and I could
find no documentation for the Cursor keyword.

Subject: Re: FVWM: lefty cursors
From: Tom Julien <[email-masked]>
To: [email-masked], [email-masked]
Date: Wed, 05 Mar 1997 16:11:59 -0500

[email-masked] (R. H. Wood) writes:

>Mark Borges recently said:
>> 
>Same here.  I hadn't noticed it 'til you mentioned it, but now
>it bothers me too!  I'd sure use such a feature!  Does it exist?

I'm not sure I understand the above exactly, but you can set
the cursor for the root window to be any cursor listed in
X11/cursorfont.h (drop the XC_ prefix) or an xbm image with
xsetroot.  For example, if you wanted an arrow with a SW-NE
orientation, you could add the following to your .xinitrc:

	xsetroot -cursor_name arrow

You can also do this for the different window cursors that
are used with fvwm via the Cursor command in your .fvwmrc.
For example,

	Cursor 6 2

will give you a SW-NE arrow for the cursor used in the menus.

Hope this helps.

tomj
----
Chief weapons of Unix: fear, surprise, and ruthless efficiency.

---

From: Barry D Benowitz <[email-masked]>
Date: Wed, 5 Mar 97 16:45 EST

>>>>> "mb" == Mark Borges <[email-masked]> writes:

    mb> --Multipart_Wed_Mar__5_14:24:08_1997-1
    mb> Content-Type: text/plain; charset=US-ASCII

    XL> to:

    mb> Hmm, before you do read the attached note from Tom Julien. The
    mb> feature might already exist, though I haven't tried it yet and I could
    mb> find no documentation for the Cursor keyword.

    mb> --Multipart_Wed_Mar__5_14:24:08_1997-1
    mb> Content-Type: message/rfc822

    mb> Message-Id: <[email-masked]>
    mb> From: Tom Julien <[email-masked]>
    mb> To: [email-masked], [email-masked]
    mb> Subject: Re: FVWM: lefty cursors 
    mb> Mime-Version: 1.0
    mb> Content-Type: text/plain; charset=us-ascii
    mb> Date: Wed, 05 Mar 1997 16:11:59 -0500

    >> it bothers me too!  I'd sure use such a feature!  Does it exist?

    mb> I'm not sure I understand the above exactly, but you can set
    mb> the cursor for the root window to be any cursor listed in
    mb> X11/cursorfont.h (drop the XC_ prefix) or an xbm image with
    mb> xsetroot.  For example, if you wanted an arrow with a SW-NE
    mb> orientation, you could add the following to your .xinitrc:

    mb> 	xsetroot -cursor_name arrow

    mb> You can also do this for the different window cursors that
    mb> are used with fvwm via the Cursor command in your .fvwmrc.
    mb> For example,

    mb> 	Cursor 6 2

    mb> will give you a SW-NE arrow for the cursor used in the menus.

    mb> Hope this helps.

I got excited seeing this, so I tried this right away. Sad to say, it
works for some things but not all. For example, right now I'm using
emacs to compose this note. When I move the cursor up to the pull down
menus, i get the usual cursor. When I select the menu item, It
switches to the left-handed one. FvwmButtons, FvwmPager and
FvwmIconBox all continue to use the right hand cursor. I think I would
prefer consistency to switching and a consistent LH one would be the
winner.

Does Chris's patch provide for that consistency?

-- 
Barry D. Benowitz - FAQ maintainer for alt.lefthanders
Email:[email-masked] 
Phone:+1 609 866 1000 x354
Snail:Securicor Telesciences Inc, 351 New Albany Rd, Moorestown, NJ, 08057-1177
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked].

---

From: [email-masked] (R. H. Wood)
Date: Wed, 5 Mar 1997 16:11:22 -0600 (CST)

Folks,

We're not talking about the Xserver's cursor (the one you can change
with xsetroot <blah, blah, blah> that you see on the "root" window.

We're talking about FVWM's cursor...the one you see if you place your
pointer on the FvwmButtons Bar, or on the title bar of an open window.

It's that little arrow-pointing-up-and-left.  
A lefty-cursor would point up-and-right, instead.

At least that's what I was referring to when I said I could use such
a feature.  (FVWM _may_ have other cursors, too, but this is the one
I thought we meant.)

-- dick
[email-masked]
Richard H. Wood @ Switch Products Division,  DSC Communications Corp.
1000 Coit Road,   PB1-1526,  M/S 121,  Plano, TX 75075   972-477-8624   
** The opinions expressed are not those of DSC Communications, Inc.**
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Trent Piepho <[email-masked]>
Date: Wed, 5 Mar 1997 15:26:34 -0800 (PST)

> pointer on the FvwmButtons Bar, or on the title bar of an open window.

It seems people are taking about all cursors, netscapes's, fvwm's and the
root window's.  

There isn't any way in fvwm2 to change any of fvwm's curors.  When I wanted a
different cursor for my title bar buttons I had to change the code in the
function CreateCursors in fvwm.c.  It would seem like a good idea, and
something twm and maybe fvwm1 do, to let the user specify the cursors to
use.o
Right now there is just a bunch of lines like:
  Scr.FvwmCursors[DEFAULT] = XCreateFontCursor(dpy, XC_top_left_arrow);

It should be possible to change the XC_top_left_arrow to something else.

Of course this doesn't solve the problem that fvwm's cursors don't effect
netscape, or xterm, or any other program.  So if you want to mirror all the
arrows you either have to reconfigure every program (which is easier than
it sounds because many programs would be reconfigured by changing one
resource), or change the cursor font.  Changing the cursor font is kind of
a kludge, but would be easiest.

|Gazing up to the breeze of the heavens \ on a quest, meaning, reason  |
|came to be, how it begun \ all alone in the family of the sun         |
|curiosity teasing everyone \ on our home, third stone from the sun.   |
|Trent Piepho ([email-masked])                   -- Metallica  |
--
Visit the official FVWM web page at <URL:http://www.hpc.uh.edu/fvwm/>.
To unsubscribe from the list, send "unsubscribe fvwm-workers" in the
body of a message to [email-masked].
To report problems, send mail to [email-masked].

---

From: Xris Laas <[email-masked]>
Date: Wed, 5 Mar 1997 18:47:43 -0500 (EST)

> it a bit awkward to use the default cursor orientation.

OK, I started a lot of discussion here, but I figure the end issue is
changing the Fvwm cursors.

I just wrote a patch that adds simple cursor configurability to fvwm
with a CursorConfig command.  The patch is against 2.0.43, so it
may be slightly outdated, but it should probably patch fine.

Side note to Chuck:  could you add this, or something similar, to the
distribution?  BTW, I wrote it before I got your message with the
previous patch, so it's not based on it.  It also doesn't do a refresh
of all windows, but that might be a good thing, since you might want
windows to retain their old cursors, i.e.:

AddToFunc Foo
+ I CursorConfig title_cursor arrow
+ I Exec foo
+ I Wait foo
+ I CursorConfig title_cursor gumby

Though that might not be too useful.  Really, the two patches look
almost the same, other than that, and the fact that mine used lookup
tables as opposed to if .. else's.

I neglected to write any docs (sorry) but the syntax is:

CursorConfig <which cursor> <X11 cursor name>

where <which cursor> is one of the names in screen.h (not case
sensitive):  position, title_cursor, default, sys, move, wait, menu,
select, destroy, top, right, bottom, left, top_left, top_right,
bottom_left, or bottom_right.  <X11 cursor name> is one of the names in
<X11/cursorfont.h>, minus the "XC_".

(Patch follows signature.  Note: patch -p2 from the distribution root
is the way to go.)

--Chris

-- 
The history of the present King of Great Britain is a history of
repeated injuries and usurpations, all having in direct object the
establishment of an absolute tyranny over these states.
    -- Thomas Jefferson, Prologue, "Declaration of Independence"

File fvwm-cursor-config.patch:
------------------------------------------------------------------------
diff -ru /usr/src/fvwm-orig/fvwm/builtins.c ./fvwm-devel/fvwm/builtins.c
--- /usr/src/fvwm-orig/fvwm/builtins.c	Thu Jun 27 10:34:19 1996
+++ ./fvwm-devel/fvwm/builtins.c	Wed Mar  5 17:10:29 1997
@@ -1139,6 +1139,150 @@
   checkPanFrames();
 }
 
+
+#define CTYPE(type) { #type , type }
+static struct {
+  char *name;
+  int id;
+} cursor_type_names[] = {
+  CTYPE(POSITION),
+  CTYPE(TITLE_CURSOR),
+  CTYPE(DEFAULT),
+  CTYPE(SYS),
+  CTYPE(MOVE),
+  CTYPE(WAIT),
+  CTYPE(MENU),
+  CTYPE(SELECT),
+  CTYPE(DESTROY),
+  CTYPE(TOP),
+  CTYPE(RIGHT),
+  CTYPE(BOTTOM),
+  CTYPE(LEFT),
+  CTYPE(TOP_LEFT),
+  CTYPE(TOP_RIGHT),
+  CTYPE(BOTTOM_LEFT),
+  CTYPE(BOTTOM_RIGHT)
+};
+static struct {
+  char *name;
+  int id;
+} cursor_names[] = {
+  {"X_cursor",                XC_X_cursor},
+  {"arrow",                   XC_arrow},
+  {"based_arrow_down",        XC_based_arrow_down},
+  {"based_arrow_up",          XC_based_arrow_up},
+  {"boat",                    XC_boat},
+  {"bogosity",                XC_bogosity},
+  {"bottom_left_corner",      XC_bottom_left_corner},
+  {"bottom_right_corner",     XC_bottom_right_corner},
+  {"bottom_side",             XC_bottom_side},
+  {"bottom_tee",              XC_bottom_tee},
+  {"box_spiral",              XC_box_spiral},
+  {"center_ptr",              XC_center_ptr},
+  {"circle",                  XC_circle},
+  {"clock",                   XC_clock},
+  {"coffee_mug",              XC_coffee_mug},
+  {"cross",                   XC_cross},
+  {"cross_reverse",           XC_cross_reverse},
+  {"crosshair",               XC_crosshair},
+  {"diamond_cross",           XC_diamond_cross},
+  {"dot",                     XC_dot},
+  {"dotbox",                  XC_dotbox},
+  {"double_arrow",            XC_double_arrow},
+  {"draft_large",             XC_draft_large},
+  {"draft_small",             XC_draft_small},
+  {"draped_box",              XC_draped_box},
+  {"exchange",                XC_exchange},
+  {"fleur",                   XC_fleur},
+  {"gobbler",                 XC_gobbler},
+  {"gumby",                   XC_gumby},
+  {"hand1",                   XC_hand1},
+  {"hand2",                   XC_hand2},
+  {"heart",                   XC_heart},
+  {"icon",                    XC_icon},
+  {"iron_cross",              XC_iron_cross},
+  {"left_ptr",                XC_left_ptr},
+  {"left_side",               XC_left_side},
+  {"left_tee",                XC_left_tee},
+  {"leftbutton",              XC_leftbutton},
+  {"ll_angle",                XC_ll_angle},
+  {"lr_angle",                XC_lr_angle},
+  {"man",                     XC_man},
+  {"middlebutton",            XC_middlebutton},
+  {"mouse",                   XC_mouse},
+  {"pencil",                  XC_pencil},
+  {"pirate",                  XC_pirate},
+  {"plus",                    XC_plus},
+  {"question_arrow",          XC_question_arrow},
+  {"right_ptr",               XC_right_ptr},
+  {"right_side",              XC_right_side},
+  {"right_tee",               XC_right_tee},
+  {"rightbutton",             XC_rightbutton},
+  {"rtl_logo",                XC_rtl_logo},
+  {"sailboat",                XC_sailboat},
+  {"sb_down_arrow",           XC_sb_down_arrow},
+  {"sb_h_double_arrow",       XC_sb_h_double_arrow},
+  {"sb_left_arrow",           XC_sb_left_arrow},
+  {"sb_right_arrow",          XC_sb_right_arrow},
+  {"sb_up_arrow",             XC_sb_up_arrow},
+  {"sb_v_double_arrow",       XC_sb_v_double_arrow},
+  {"shuttle",                 XC_shuttle},
+  {"sizing",                  XC_sizing},
+  {"spider",                  XC_spider},
+  {"spraycan",                XC_spraycan},
+  {"star",                    XC_star},
+  {"target",                  XC_target},
+  {"tcross",                  XC_tcross},
+  {"top_left_arrow",          XC_top_left_arrow},
+  {"top_left_corner",         XC_top_left_corner},
+  {"top_right_corner",        XC_top_right_corner},
+  {"top_side",                XC_top_side},
+  {"top_tee",                 XC_top_tee},
+  {"trek",                    XC_trek},
+  {"ul_angle",                XC_ul_angle},
+  {"umbrella",                XC_umbrella},
+  {"ur_angle",                XC_ur_angle},
+  {"watch",                   XC_watch},
+  {"xterm",                   XC_xterm}
+};
+#define dim(x) (sizeof(x) / sizeof(x[0]))
+
+void SetCursorConfig(XEvent *eventp,Window w,FvwmWindow *tmp_win,
+					 unsigned long context, char *action,int* Module)
+{
+  char *ctype=NULL, *fontid=NULL;
+  int i, ctypenum, fontnum;
+
+  action = GetNextToken(action, &ctype);
+  GetNextToken(action, &fontid);
+  for (i = 0; i < dim(cursor_type_names); i++) {
+	/* Is using "mystrcasecmp" really necessary?  What's wrong with
+	 * strcasecmp? */
+	if (mystrcasecmp(ctype, cursor_type_names[i].name) == 0) {
+	  ctypenum = cursor_type_names[i].id;
+	  break;
+	}
+  }
+  if (i == dim(cursor_type_names)) {
+    fvwm_msg(ERR,"SetCursorConfig","Bad cursor type");
+    return;
+  }
+  for (i = 0; i < dim(cursor_names); i++) {
+	if (mystrcasecmp(fontid, cursor_names[i].name) == 0) {
+	  fontnum = cursor_names[i].id;
+	  break;
+	}
+  }
+  if (i == dim(cursor_names)) {
+    fvwm_msg(ERR,"SetCursorConfig","Bad cursor name");
+    return;
+  }
+
+  XFreeCursor(dpy, Scr.FvwmCursors[ctypenum]);
+  Scr.FvwmCursors[ctypenum] = XCreateFontCursor(dpy, fontnum);
+}
+
+
 #ifdef XPM
 char *PixmapPath = FVWM_ICONDIR;
 void setPixmapPath(XEvent *eventp,Window w,FvwmWindow *tmp_win,
diff -ru /usr/src/fvwm-orig/fvwm/functions.c ./fvwm-devel/fvwm/functions.c
--- /usr/src/fvwm-orig/fvwm/functions.c	Wed Jun 19 20:01:56 1996
+++ ./fvwm-devel/fvwm/functions.c	Wed Mar  5 16:29:09 1997
@@ -44,6 +44,7 @@
   {"Close",        close_function,   F_CLOSE,               FUNC_NEEDS_WINDOW},
   {"ColormapFocus",SetColormapFocus, F_COLORMAP_FOCUS,      FUNC_NO_WINDOW},
   {"CursorMove",   movecursor,       F_MOVECURSOR,          FUNC_NO_WINDOW},
+  {"CursorConfig", SetCursorConfig,  F_CURSORCONFIG,        FUNC_NO_WINDOW},
   {"Delete",       delete_function,  F_DELETE,              FUNC_NEEDS_WINDOW},
   {"DesktopSize",  SetDeskSize,       F_SETDESK,            FUNC_NO_WINDOW},
   {"Desk",         changeDesks_func, F_DESK,                FUNC_NO_WINDOW},
diff -ru /usr/src/fvwm-orig/fvwm/misc.h ./fvwm-devel/fvwm/misc.h
--- /usr/src/fvwm-orig/fvwm/misc.h	Wed Jun 19 21:31:15 1996
+++ ./fvwm-devel/fvwm/misc.h	Wed Mar  5 16:30:49 1997
@@ -453,6 +453,8 @@
 		   unsigned long context, char *action,int* Module);
 void SetDeskSize(XEvent *eventp,Window w,FvwmWindow *tmp_win,
 		     unsigned long context, char *action,int* Module);
+void SetCursorConfig(XEvent *eventp,Window w,FvwmWindow *tmp_win,
+		     unsigned long context, char *action,int* Module);
 void SetOpaque(XEvent *eventp,Window w,FvwmWindow *tmp_win,
 	       unsigned long context, char *action,int* Module);
 void SetXOR(XEvent *eventp,Window w,FvwmWindow *tmp_win,
diff -ru /usr/src/fvwm-orig/fvwm/parse.h ./fvwm-devel/fvwm/parse.h
--- /usr/src/fvwm-orig/fvwm/parse.h	Thu May 30 14:03:10 1996
+++ ./fvwm-devel/fvwm/parse.h	Wed Mar  5 16:24:01 1997
@@ -73,6 +73,7 @@
 #define F_COLORMAP_FOCUS        55
 #define F_TITLESTYLE            56
 #define F_EXEC_SETUP            57
+#define F_CURSORCONFIG          58
 /* Functions which require a target window */
 #define F_RESIZE		100
 #define F_RAISE			101

---

From: Mark Borges <[email-masked]>
Date: 05 Mar 1997 17:59:29 -0700

>> On Wed, 5 Mar 1997 18:47:43 -0500 (EST),
>> Xris Laas(XL) wrote:
>> it a bit awkward to use the default cursor orientation.

XL> OK, I started a lot of discussion here, but I figure the end issue is
XL> changing the Fvwm cursors.

Yes. And for me, the end result is worth it.

XL> I just wrote a patch that adds simple cursor configurability to fvwm
XL> with a CursorConfig command.  The patch is against 2.0.43, so it
XL> may be slightly outdated, but it should probably patch fine.

Unfortunately, it doesn't apply cleanly to 2.0.45; apparently there
was some code reorganization, and 3 out of 4 hunks failed. But it was
fairly trivial to hand apply, and I updated the patch to 2.0.45
(attached). It applies to vanilla fvwm-2.0.45 using `patch
-p1'. Sorry, I didn't add any documentation, either, though.

XL> Side note to Chuck:  could you add this, or something similar, to the
XL> distribution?  BTW, I wrote it before I got your message with the

I vote for this too, in some form.

Thanks again Chris/Xris!

-- 
  -mb-

---

From: Hile Tuohela <[email-masked]>
Date: Thu, 6 Mar 1997 12:38:14 +0200 (EET)

>may be slightly outdated, but it should probably patch fine.

I don't need it because I haven't thought about cursors, but it
were nice if you added an option to your patch to use default
X root window cursor for fvwm windows- our system sets normal 
lefty cursor as default on startup and it seems a bit stupid 
that fvwm uses almost same cursor as system but not right so,
it's not same one.

Off the topic cursor, still interesting:

I wrote you some words about our fvwm2 configuration system a couple
of weeks ago. We have been talking about making a de facto fvwm2 
configuration system to allow root modify settings, still alloving
users to modify whatever they want. Those files I said you could 
look at are now obsolete, I've rewritten all our system fvwm files.
It's now about 5x faster than reading M4 parsed files and overall
design is much cleaner. 

My design is simple: /usr/local/bin/fvwm2 is a shell script which 
checks if user has fvwm2 files already installed and installs defaults 
if necessary. All users have directory .fvwm2 and this directory is
created if it doesn't exist. There are following system files:
  menus: defines default menus
  key_bindings: defines default key bindings
  style_templates: defines default decor and style parameters
  styles: defines which decor and style groups to use for each window
  icons: defines icons to use with windows
  iconboxes: defines where to put all icons
  functions: defines all system default function
Users get files menus, key_bindings, styles, icons, functions and fvwmrc
to their new directory .fvwm2 from /usr/local/share/fvwm2/default. fvwm2
script is started to parse $HOME/.fvwm2/fvwmrc, which reads users own
files, and these files read by default system files. User can remove
all files and make his own $HOME/.fvwm2/fvwmrc ignoring all system
defaults, or he can read what he wants from system files and make his
own modifications in .fvwm2 files.

When making this change wanted a new feature to fvwm2. I would like
to define in Fvwm.tmpl a variable for settings files, like 
FvwmSetupDir blaablaa
We have many different unix variants with same fvwm2 setup files and
it's a dirty hack to try to use same setup files from lib dir for
system dependent libraries directory. I suggest we add a new variable
for setup files which defaults to InstallDir/share/fvwm2, whatever
InstallDir is. Maybe we should really have another variable InstallBase
and install all other directories under that, like
InstallDir /usr/local
FvwmBinDir $InstallDir/bin
FvwmDir $InstallDir/lib/fwwm2
FvwmLibDir $InstallDir/lib
FvwmSetupDir $InstallDir/share/fvwm2

	* hile *