1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 20:38:08 +01:00

definable cursor code updates from Jim Knoble <jmknoble@pobox.com>

This commit is contained in:
dan
2001-09-06 09:42:51 +00:00
parent 2d5a062064
commit e44cc81a03
6 changed files with 181 additions and 62 deletions

View File

@@ -1,10 +1,10 @@
# README.definable-cursor: How to use definable-cursor patch for Window Maker # README.definable-cursor: How to use definable-cursor patch for Window Maker
# created 1999-Apr-24 14:53 jmk # created 1999-Apr-24 14:53 jmk
# autodate: 1999-Apr-24 16:29 # autodate: 2001-Sep-05 22:40
__________________________________________________ +------------------------------------------+
|O| Definable Mouse Cursors for Window Maker |X| | Definable Mouse Cursors for Window Maker |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +------------------------------------------+
The definable-cursor patch for Window Maker The definable-cursor patch for Window Maker
<http://www.windowmaker.org/> allows user-definable mouse cursors; the <http://www.windowmaker.org/> allows user-definable mouse cursors; the
@@ -12,56 +12,95 @@ cursors can either be the built-in ones from the X11 cursor font, or
they can be bitmap (XBM) files. User-definable cursors can be useful they can be bitmap (XBM) files. User-definable cursors can be useful
for theme-builders, lefthanders, and the visually impaired. for theme-builders, lefthanders, and the visually impaired.
This README describes how to apply the patch to Window Maker and how to This README describes how to enable user-definable cursors in Window
use the features it enables. Maker as well as how to use them.
____________________________ +----------------------------+
|O| Applying the Patch |X| | Enabling Definable Cursors |
^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +----------------------------+
The definable-cursor patch is available from If you want to enable definable mouse cursors in Window Maker, you must
<http://www.pobox.com/~jmknoble/WindowMaker/patches/>. do so before you configure and build Window Maker. Here's how:
To apply the patch, do the following (where `XX' is the version of (1) Edit src/wconfig.h.in and change the following line:
Window Maker you're patching):
(0) gzip -dc WindowMaker-XX.tar.gz | tar -xvf - #undef DEFINABLE_CURSOR
(1) cd ./WindowMaker-XX to:
(2) patch </wherever/you/put/WindowMaker-XX-definable-cursor.patch #define DEFINABLE_CURSOR
(3) Build Window Maker according to the instructions in the (2) Configure and build Window Maker as you normally would:
accompanying `INSTALL' file.
___________________________________ ./configure
|O| Defining Your Own Cursors |X| make
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
A cursor specification is one of: +---------------------------+
| Defining Your Own Cursors |
+---------------------------+
A cursor specification takes one of the following forms in the
~/GNUstep/Defaults/WindowMaker file:
(none) (none)
(builtin, <cursor-name>) (builtin, <cursor-name>)
(bitmap, <bitmap-filename>, <mask-filename>) (bitmap, <bitmap-filename>, <mask-filename>)
where <cursor-name> uses the same syntax as for `xsetroot -cursor_name', They have the following meanings:
and <bitmap-filename> and <mask-filename> are the same as for
`xsetroot -cursor'; <bitmap-filename> and <mask-filename> are searched none The cursor is inherited from the parent window (often,
for along WM's PixmapPath. If you use `(none)', the cursor will be this means the root window).
inherited from the parent window (which often ends up being the root
window). builtin Use the cursor named <cursor-name> from X11's set of
built-in cursors. The names are the same as you use
with 'xsetroot -cursor_name'. See the xsetroot(1) man
page for more information.
bitmap Use the bitmap in <bitmap-filename> as the foreground
cursor bitmap, and the one in <mask-filename> as the
background (mask) bitmap. This is pretty much the same
as 'xsetroot -cursor', except that Window Maker searches
for the bitmaps along its PixmapPath.
You can set the following cursor types (they're shown here with their You can set the following cursor types (they're shown here with their
defaults): defaults):
NormalCursor = (builtin, left_ptr); NormalCursor = (builtin, left_ptr);
ArrowCursor = (builtin, top_left_arrow);
MoveCursor = (builtin, fleur); MoveCursor = (builtin, fleur);
ResizeCursor = (builtin, sizing); TopLeftResizeCursor = (builtin, top_left_corner);
TopRightResizeCursor = (builtin, top_right_corner);
BottomLeftResizeCursor = (builtin, bottom_left_corner);
BottomRightResizeCursor = (builtin, bottom_right_corner);
VerticalResizeCursor = (builtin, sb_v_double_arrow);
HorizontalResizeCursor = (builtin, sb_h_double_arrow);
WaitCursor = (builtin, watch); WaitCursor = (builtin, watch);
QuestionCursor = (builtin, question_arrow);
TextCursor = (builtin, xterm);
SelectCursor = (builtin, cross);
______________________ The following cursor types are allowed, but they're deprecated (Window
|O| Random Notes |X| Maker used them in the past, but doesn't use them anymore):
^^^^^^^^^^^^^^^^^^^^^^
ResizeCursor = (builtin, sizing);
+----------------------------------------------+
| Using Cursors with 'getstyle' and 'setstyle' |
+----------------------------------------------+
The 'getstyle' and 'setstyle' style- and theme-management utilities
can handle user-definable cursors. By default, 'getstyle' ignores
cursor definitions; using 'getstyle -t' to get theme-related settings
will also include any cursors you've defined in the resulting
stylefile.
However, by default, 'setstyle' does *not* ignore cursor settings. If
you wish to set a style or theme without installing cursor settings,
you can use 'setstyle --no-cursors' to ignore the cursor definitions.
+--------------+
| Random Notes |
+--------------+
Most X11 cursors are 16x16 bitmaps. Many X servers can actually handle Most X11 cursors are 16x16 bitmaps. Many X servers can actually handle
larger cursors, though. To check, use: larger cursors, though. To check, use:
@@ -75,12 +114,7 @@ and in the resulting output look for a line such as:
The example above indicates that my X server can handle cursors up to The example above indicates that my X server can handle cursors up to
64 pixels wide by 64 pixels high. 64 pixels wide by 64 pixels high.
You can create your own bitmap cursors using the `bitmap' program that You can create your own bitmap cursors using the 'bitmap' program that
accompanies most X11 distributions. For example bitmap cursors, see accompanies most X11 distributions. For example bitmap cursors and
<http://www.pobox.com/~jmknoble/WindowMaker/cursors/>. masks, see <http://www.pobox.com/~jmknoble/WindowMaker/cursors/>.
For an example
--jim
%%%%%%%%%%%%%%% jim knoble %%%%%%%% jmknoble@pobox.com %%%%%%%%%%%%%%%%%

View File

@@ -24,15 +24,23 @@ The following options are stored by default: \fIIconBack\fP,
\fIFTitleColor\fP, \fIPTitleColor\fP, \fIUTitleColor\fP, \fIFTitleColor\fP, \fIPTitleColor\fP, \fIUTitleColor\fP,
\fIFTitleBack\fP, \fIPTitleBack, UTitleBack\fP, \fIMenuTitleColor\fP, \fIFTitleBack\fP, \fIPTitleBack, UTitleBack\fP, \fIMenuTitleColor\fP,
\fIMenuTextColor\fP, \fIMenuDisabledColor\fP, \fIMenuTitleBack\fP and \fIMenuTextColor\fP, \fIMenuDisabledColor\fP, \fIMenuTitleBack\fP and
\fIMenuTextBack\fP. If either \fB-t\fP or \fB--theme-options\fP is \fIMenuTextBack\fP.
specificied, in addition to the previous options, \fIWorkspaceBack\fP
is \fIalso\fP stored. If either \fB-t\fP or \fB--theme-options\fP is specified, in addition
to the previous options, \fIWorkspaceBack\fP is \fIalso\fP stored,
along with any user-definable mouse cursor settings
(\fINormalCursor\fP, \fIArrowCursor\fP, \fIMoveCursor\fP,
\fITopLeftResizeCursor\fP, \fITopRightResizeCursor\fP,
\fIBottomLeftResizeCursor\fP, \fIBottomRightResizeCursor\fP,
\fIVerticalResizeCursor\fP, \fIHorizontalResizeCursor\fP,
\fIWaitCursor\fP, \fIQuestionCursor\fP, \fITextCursor\fP,
\fISelectCursor\fP) that are present.
.SH OPTIONS .SH OPTIONS
.TP .TP
.B \-t .B \-t
dumps theme related information too, which is the root background texture. dumps theme related information too, which includes the root background
This option is always enabled when the \-p option is used. texture. This option is always enabled when the \-p option is used.
.TP .TP
.B \-p .B \-p
creates a theme pack in the directory named by the theme name appended creates a theme pack in the directory named by the theme name appended

View File

@@ -4,7 +4,7 @@
setstyle \- set style related options for Window Maker or loads a theme setstyle \- set style related options for Window Maker or loads a theme
.SH SYNOPSIS .SH SYNOPSIS
.B setstyle .B setstyle
.I "[--no-fonts] [--help] [--version]" .I "[--no-fonts] [--no-cursors] [--help] [--version]"
.I stylefile .I stylefile
.SH DESCRIPTION .SH DESCRIPTION
.B setstyle .B setstyle
@@ -17,11 +17,22 @@ be treated as a theme pack and it will be loaded appropriately. If the
(\fIIconTitleFont\fP, \fIClipTitleFont\fP, \fIDisplayFont\fP, (\fIIconTitleFont\fP, \fIClipTitleFont\fP, \fIDisplayFont\fP,
\fIMenuTextFont\fP, \fIMenuTitleFont\fP, \fIWindowTitleFont\fP) in the \fIMenuTextFont\fP, \fIMenuTitleFont\fP, \fIWindowTitleFont\fP) in the
style file will be ignored. style file will be ignored.
If the \fB\-\-no\-cursors\fP flag is specified, any mouse cursor
definitions (\fINormalCursor\fP, \fIArrowCursor\fP, \fIMoveCursor\fP,
\fITopLeftResizeCursor\fP, \fITopRightResizeCursor\fP,
\fIBottomLeftResizeCursor\fP, \fIBottomRightResizeCursor\fP,
\fIVerticalResizeCursor\fP, \fIHorizontalResizeCursor\fP,
\fIWaitCursor\fP, \fIQuestionCursor\fP, \fITextCursor\fP,
\fISelectCursor\fP) in the style or theme will be ignored.
.SH OPTIONS .SH OPTIONS
.TP .TP
.B \-\-no\-fonts .B \-\-no\-fonts
ignore font related options in style file. ignore font related options in style file.
.TP .TP
.B \-\-no\-cursors
ignore cursor definition options in style file.
.TP
.B \-\-help .B \-\-help
print a help message print a help message
.TP .TP

View File

@@ -814,35 +814,51 @@ WDefaultEntry optionList[] = {
,{"NormalCursor", "(builtin, left_ptr)", (void*)WCUR_ROOT, ,{"NormalCursor", "(builtin, left_ptr)", (void*)WCUR_ROOT,
NULL, getCursor, setCursor NULL, getCursor, setCursor
}, },
{"ArrowCursor", "(builtin, top_left_arrow)", (void*)WCUR_ARROW,
NULL, getCursor, setCursor
},
{"MoveCursor", "(builtin, fleur)", (void*)WCUR_MOVE, {"MoveCursor", "(builtin, fleur)", (void*)WCUR_MOVE,
NULL, getCursor, setCursor NULL, getCursor, setCursor
}, },
#if 0 {"ResizeCursor", "(builtin, sizing)", (void*)WCUR_RESIZE,
{"TopLeftResizeCursor", "(builtin, sizing)", (void*)WCUR_TOPLEFTRESIZE,
NULL, getCursor, setCursor NULL, getCursor, setCursor
}, },
{"TopRightResizeCursor", "(builtin, sizing)", (void*)WCUR_TOPRIGHTRESIZE, {"TopLeftResizeCursor", "(builtin, top_left_corner)",
(void*)WCUR_TOPLEFTRESIZE,
NULL, getCursor, setCursor NULL, getCursor, setCursor
}, },
{"BottomLeftResizeCursor", "(builtin, sizing)", (void*)WCUR_BOTTOMLEFTRESIZE, {"TopRightResizeCursor", "(builtin, top_right_corner)",
(void*)WCUR_TOPRIGHTRESIZE,
NULL, getCursor, setCursor NULL, getCursor, setCursor
}, },
{"BottomRightResizeCursor", "(builtin, sizing)", (void*)WCUR_BOTTOMRIGHTRESIZE, {"BottomLeftResizeCursor", "(builtin, bottom_left_corner)",
(void*)WCUR_BOTTOMLEFTRESIZE,
NULL, getCursor, setCursor NULL, getCursor, setCursor
}, },
{"VerticalResizeCursor", "(builtin, sizing)", (void*)WCUR_VERTICALRESIZE, {"BottomRightResizeCursor", "(builtin, bottom_right_corner)",
(void*)WCUR_BOTTOMRIGHTRESIZE,
NULL, getCursor, setCursor NULL, getCursor, setCursor
}, },
{"HorizonResizeCursor", "(builtin, sizing)", (void*)WCUR_HORIZONRESIZE, {"VerticalResizeCursor", "(builtin, sb_v_double_arrow)",
(void*)WCUR_VERTICALRESIZE,
NULL, getCursor, setCursor
},
{"HorizontalResizeCursor", "(builtin, sb_h_double_arrow)",
(void*)WCUR_HORIZONRESIZE,
NULL, getCursor, setCursor NULL, getCursor, setCursor
}, },
{"WaitCursor", "(builtin, watch)", (void*)WCUR_WAIT, {"WaitCursor", "(builtin, watch)", (void*)WCUR_WAIT,
NULL, getCursor, setCursor NULL, getCursor, setCursor
}, },
{"ArrowCursor", "(builtin, top_left_arrow)", (void*)WCUR_ARROW, {"QuestionCursor", "(builtin, question_arrow)", (void*)WCUR_QUESTION,
NULL, getCursor, setCursor
},
{"TextCursor", "(builtin, xterm)", (void*)WCUR_TEXT,
NULL, getCursor, setCursor
},
{"SelectCursor", "(builtin, cross)", (void*)WCUR_SELECT,
NULL, getCursor, setCursor NULL, getCursor, setCursor
} }
#endif
#endif /* DEFINABLE_CURSOR */ #endif /* DEFINABLE_CURSOR */
}; };

View File

@@ -77,7 +77,6 @@ static char *options[] = {
"WindowTitleExtendSpace", "WindowTitleExtendSpace",
"MenuTitleExtendSpace", "MenuTitleExtendSpace",
"MenuTextExtendSpace", "MenuTextExtendSpace",
"NormalCursor",
NULL NULL
}; };
@@ -85,6 +84,20 @@ static char *options[] = {
/* table of theme related options */ /* table of theme related options */
static char *theme_options[] = { static char *theme_options[] = {
"WorkspaceBack", "WorkspaceBack",
"NormalCursor",
"ArrowCursor",
"MoveCursor",
"ResizeCursor",
"TopLeftResizeCursor",
"TopRightResizeCursor",
"BottomLeftResizeCursor",
"BottomRightResizeCursor",
"VerticalResizeCursor",
"HorizontalResizeCursor",
"WaitCursor",
"QuestionCursor",
"TextCursor",
"SelectCursor",
NULL NULL
}; };

View File

@@ -48,10 +48,29 @@ char *FontOptions[] = {
NULL NULL
}; };
char *CursorOptions[] = {
"NormalCursor"
,"ArrowCursor"
,"MoveCursor"
,"ResizeCursor"
,"TopLeftResizeCursor"
,"TopRightResizeCursor"
,"BottomLeftResizeCursor"
,"BottomRightResizeCursor"
,"VerticalResizeCursor"
,"HorizontalResizeCursor"
,"WaitCursor"
,"QuestionCursor"
,"TextCursor"
,"SelectCursor"
,NULL
};
char *ProgName; char *ProgName;
int ignoreFonts = 0; int ignoreFonts = 0;
int ignoreCursors = 0;
Display *dpy; Display *dpy;
@@ -287,6 +306,17 @@ hackStyle(proplist_t style)
if (found) if (found)
continue; continue;
} }
if (ignoreCursors) {
for (j = 0, found = 0; CursorOptions[j] != NULL; j++) {
if (strcasecmp(str, CursorOptions[j]) == 0) {
PLRemoveDictionaryEntry(style, tmp);
found = 1;
break;
}
}
if (found)
continue;
}
if (strcasecmp(str, "IconTitleColor")==0 if (strcasecmp(str, "IconTitleColor")==0
|| strcasecmp(str, "IconTitleBack")==0) { || strcasecmp(str, "IconTitleBack")==0) {
@@ -367,6 +397,11 @@ print_help()
puts("Reads style/theme configuration from FILE and updates Window Maker."); puts("Reads style/theme configuration from FILE and updates Window Maker.");
puts(""); puts("");
puts(" --no-fonts ignore font related options"); puts(" --no-fonts ignore font related options");
/* Why these stupid tabs? They're misleading to the programmer,
* and they don't do any better than aligning via spaces: If you
* have a proportional font, all bets are off anyway. Sheesh.
*/
puts(" --no-cursors ignore cursor related options");
puts(" --ignore <option> ignore changes in the specified option"); puts(" --ignore <option> ignore changes in the specified option");
puts(" --help display this help and exit"); puts(" --help display this help and exit");
/* /*
@@ -412,6 +447,8 @@ main(int argc, char **argv)
} else if (strcmp("--no-fonts", argv[i])==0) { } else if (strcmp("--no-fonts", argv[i])==0) {
ignoreFonts = 1; ignoreFonts = 1;
} else if (strcmp("--no-cursors", argv[i])==0) {
ignoreCursors = 1;
} else if (strcmp("--version", argv[i])==0) { } else if (strcmp("--version", argv[i])==0) {
puts(PROG_VERSION); puts(PROG_VERSION);
exit(0); exit(0);