Blame src/CursorName.c

Packit Service 2b1f13
/*
Packit Service 2b1f13
Packit Service 2b1f13
Copyright 1989, 1998  The Open Group
Packit Service 2b1f13
Packit Service 2b1f13
Permission to use, copy, modify, distribute, and sell this software and its
Packit Service 2b1f13
documentation for any purpose is hereby granted without fee, provided that
Packit Service 2b1f13
the above copyright notice appear in all copies and that both that
Packit Service 2b1f13
copyright notice and this permission notice appear in supporting
Packit Service 2b1f13
documentation.
Packit Service 2b1f13
Packit Service 2b1f13
The above copyright notice and this permission notice shall be included in
Packit Service 2b1f13
all copies or substantial portions of the Software.
Packit Service 2b1f13
Packit Service 2b1f13
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
Packit Service 2b1f13
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Packit Service 2b1f13
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
Packit Service 2b1f13
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
Packit Service 2b1f13
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
Packit Service 2b1f13
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Packit Service 2b1f13
Packit Service 2b1f13
Except as contained in this notice, the name of The Open Group shall not be
Packit Service 2b1f13
used in advertising or otherwise to promote the sale, use or other dealings
Packit Service 2b1f13
in this Software without prior written authorization from The Open Group.
Packit Service 2b1f13
Packit Service 2b1f13
*/
Packit Service 2b1f13
Packit Service 2b1f13
#ifdef HAVE_CONFIG_H
Packit Service 2b1f13
#include <config.h>
Packit Service 2b1f13
#endif
Packit Service 2b1f13
#include <X11/Xmu/CharSet.h>
Packit Service 2b1f13
#include <X11/Xmu/CurUtil.h>
Packit Service 2b1f13
#include <X11/cursorfont.h>
Packit Service 2b1f13
#include <string.h>
Packit Service 2b1f13
Packit Service 2b1f13
int
Packit Service 2b1f13
XmuCursorNameToIndex(_Xconst char *name)
Packit Service 2b1f13
{
Packit Service 2b1f13
    static _Xconst struct _CursorName {
Packit Service 2b1f13
	_Xconst char	*name;
Packit Service 2b1f13
	unsigned int	shape;
Packit Service 2b1f13
    } cursor_names[] = {
Packit Service 2b1f13
			{"x_cursor",		XC_X_cursor},
Packit Service 2b1f13
			{"arrow",		XC_arrow},
Packit Service 2b1f13
			{"based_arrow_down",	XC_based_arrow_down},
Packit Service 2b1f13
			{"based_arrow_up",	XC_based_arrow_up},
Packit Service 2b1f13
			{"boat",		XC_boat},
Packit Service 2b1f13
			{"bogosity",		XC_bogosity},
Packit Service 2b1f13
			{"bottom_left_corner",	XC_bottom_left_corner},
Packit Service 2b1f13
			{"bottom_right_corner",	XC_bottom_right_corner},
Packit Service 2b1f13
			{"bottom_side",		XC_bottom_side},
Packit Service 2b1f13
			{"bottom_tee",		XC_bottom_tee},
Packit Service 2b1f13
			{"box_spiral",		XC_box_spiral},
Packit Service 2b1f13
			{"center_ptr",		XC_center_ptr},
Packit Service 2b1f13
			{"circle",		XC_circle},
Packit Service 2b1f13
			{"clock",		XC_clock},
Packit Service 2b1f13
			{"coffee_mug",		XC_coffee_mug},
Packit Service 2b1f13
			{"cross",		XC_cross},
Packit Service 2b1f13
			{"cross_reverse",	XC_cross_reverse},
Packit Service 2b1f13
			{"crosshair",		XC_crosshair},
Packit Service 2b1f13
			{"diamond_cross",	XC_diamond_cross},
Packit Service 2b1f13
			{"dot",			XC_dot},
Packit Service 2b1f13
			{"dotbox",		XC_dotbox},
Packit Service 2b1f13
			{"double_arrow",	XC_double_arrow},
Packit Service 2b1f13
			{"draft_large",		XC_draft_large},
Packit Service 2b1f13
			{"draft_small",		XC_draft_small},
Packit Service 2b1f13
			{"draped_box",		XC_draped_box},
Packit Service 2b1f13
			{"exchange",		XC_exchange},
Packit Service 2b1f13
			{"fleur",		XC_fleur},
Packit Service 2b1f13
			{"gobbler",		XC_gobbler},
Packit Service 2b1f13
			{"gumby",		XC_gumby},
Packit Service 2b1f13
			{"hand1",		XC_hand1},
Packit Service 2b1f13
			{"hand2",		XC_hand2},
Packit Service 2b1f13
			{"heart",		XC_heart},
Packit Service 2b1f13
			{"icon",		XC_icon},
Packit Service 2b1f13
			{"iron_cross",		XC_iron_cross},
Packit Service 2b1f13
			{"left_ptr",		XC_left_ptr},
Packit Service 2b1f13
			{"left_side",		XC_left_side},
Packit Service 2b1f13
			{"left_tee",		XC_left_tee},
Packit Service 2b1f13
			{"leftbutton",		XC_leftbutton},
Packit Service 2b1f13
			{"ll_angle",		XC_ll_angle},
Packit Service 2b1f13
			{"lr_angle",		XC_lr_angle},
Packit Service 2b1f13
			{"man",			XC_man},
Packit Service 2b1f13
			{"middlebutton",	XC_middlebutton},
Packit Service 2b1f13
			{"mouse",		XC_mouse},
Packit Service 2b1f13
			{"pencil",		XC_pencil},
Packit Service 2b1f13
			{"pirate",		XC_pirate},
Packit Service 2b1f13
			{"plus",		XC_plus},
Packit Service 2b1f13
			{"question_arrow",	XC_question_arrow},
Packit Service 2b1f13
			{"right_ptr",		XC_right_ptr},
Packit Service 2b1f13
			{"right_side",		XC_right_side},
Packit Service 2b1f13
			{"right_tee",		XC_right_tee},
Packit Service 2b1f13
			{"rightbutton",		XC_rightbutton},
Packit Service 2b1f13
			{"rtl_logo",		XC_rtl_logo},
Packit Service 2b1f13
			{"sailboat",		XC_sailboat},
Packit Service 2b1f13
			{"sb_down_arrow",	XC_sb_down_arrow},
Packit Service 2b1f13
			{"sb_h_double_arrow",	XC_sb_h_double_arrow},
Packit Service 2b1f13
			{"sb_left_arrow",	XC_sb_left_arrow},
Packit Service 2b1f13
			{"sb_right_arrow",	XC_sb_right_arrow},
Packit Service 2b1f13
			{"sb_up_arrow",		XC_sb_up_arrow},
Packit Service 2b1f13
			{"sb_v_double_arrow",	XC_sb_v_double_arrow},
Packit Service 2b1f13
			{"shuttle",		XC_shuttle},
Packit Service 2b1f13
			{"sizing",		XC_sizing},
Packit Service 2b1f13
			{"spider",		XC_spider},
Packit Service 2b1f13
			{"spraycan",		XC_spraycan},
Packit Service 2b1f13
			{"star",		XC_star},
Packit Service 2b1f13
			{"target",		XC_target},
Packit Service 2b1f13
			{"tcross",		XC_tcross},
Packit Service 2b1f13
			{"top_left_arrow",	XC_top_left_arrow},
Packit Service 2b1f13
			{"top_left_corner",	XC_top_left_corner},
Packit Service 2b1f13
			{"top_right_corner",	XC_top_right_corner},
Packit Service 2b1f13
			{"top_side",		XC_top_side},
Packit Service 2b1f13
			{"top_tee",		XC_top_tee},
Packit Service 2b1f13
			{"trek",		XC_trek},
Packit Service 2b1f13
			{"ul_angle",		XC_ul_angle},
Packit Service 2b1f13
			{"umbrella",		XC_umbrella},
Packit Service 2b1f13
			{"ur_angle",		XC_ur_angle},
Packit Service 2b1f13
			{"watch",		XC_watch},
Packit Service 2b1f13
			{"xterm",		XC_xterm},
Packit Service 2b1f13
    };
Packit Service 2b1f13
#define NUM_CURSOR_NAMES    (sizeof (cursor_names) / sizeof (cursor_names[0]))
Packit Service 2b1f13
    register _Xconst struct _CursorName *table;
Packit Service 2b1f13
    register int i;
Packit Service 2b1f13
    char tmp[40];
Packit Service 2b1f13
Packit Service 2b1f13
    if (strlen (name) >= sizeof tmp) return -1;
Packit Service 2b1f13
    XmuCopyISOLatin1Lowered (tmp, name);
Packit Service 2b1f13
Packit Service 2b1f13
    for (i=0, table=cursor_names; i < NUM_CURSOR_NAMES; i++, table++ ) {
Packit Service 2b1f13
	if (strcmp(tmp, table->name) == 0) return table->shape;
Packit Service 2b1f13
    }
Packit Service 2b1f13
Packit Service 2b1f13
    return -1;
Packit Service 2b1f13
}
Packit Service 2b1f13
Packit Service 2b1f13
Packit Service 2b1f13
Packit Service 2b1f13
Packit Service 2b1f13