X11 cursor 制作方法

首先,做一张32×32像素的图片,保存为png格式,如click.png。
然后,打开编辑器,新建一后缀名为.cursor 的文本文件,内容如下:

1
32 0 0 click.png

分别是:图片大小 鼠标焦点在图片中x方向的起始坐标 鼠标焦点在图片中y方向的起始坐标 文件名 [延时(毫秒)]
其中最后一个如果一个鼠标只有一张图片就没必要写。
如果有多张图片用来做动态鼠标时,最后那个延时表示每张图片在切换到下一张时要显示多长时间。
最后就是用命令生成鼠标文件了:

1
xcursorgen click.cursor default

xcursorgen [配置文件] [要产生的鼠标名称]

X11 cursors 名字及其形状:
X11-cursor.png

Cursor list

Cursor

Description

default

Default cursor. Indicates the interface is idle and prepared to accept commands from the user. Used to manipulate basic user interface elements like buttons and scrollbars. Usually a left pointing diagonal arrow.

text

Text input cursor. Indicates that the cursor is in a region in which horizontal text can be selected and possibly edited. Typically rendered as a vertical I-beam.

pointer

Indicates that the object below the cursor is clickable. This cursor is typically used for links in web browsers. It shouldn’t be abused for pushbuttons and other UI elements where it’s otherwise apparent by the design of the widget that it’s a clickable object. Often rendered as a pointing hand.

help

Help cursor. Indicates that the system is in a context help mode, and if the user clicks an object a small window will open up to provide usage information for that object. The context help mode is typically activated by clicking a help button on the titlebar of a window that provides context help. Often rendered as the default cursor with a question mark symbol next to it.

progress

Default cursor + busy cursor. Indicates a pending activity which may asynchronously affect the interface but which is not blocking commands from the user.

wait

Busy cursor. Indicates that the interface is not prepared to accept commands from the user and is blocked on some external resource. Often rendered as a watch or an hourglass.

copy

!DnD copy cursor. Indicates that a copy of the dragged object will be created in the area below the cursor if dropped. Typically rendered as the default cursor with a small plus sign next to it.

alias

!DnD link cursor. Indicates that a link to the original location of the dragged object will be created in the area below the cursor if dropped. Typically rendered as the default cursor with a small curved arrow next to it.

no-drop

!DnD no-drop cursor. Indicates that the dragged object can’t be dropped in the region below the cursor. Typically rendered as the default cursor with a small circle with a diagonal line through it. Can be identical to not-allowed.

not-allowed

Forbidden cursor. Indicates that a particular region is invalid for the current operation. Often rendered as circle with a diagonal line through it.

all-scroll

Scroll/move cursor. Used to indicate that moving the mouse will also move the UI element below the cursor. Often rendered as a combined vertical and horizontal twin-headed arrow.

row-resize /td>

Horizontal splitter bar cursor. Indicates that the bar below the cursor can be moved up and down to resize the objects it separates. Used when it’s not apparent if the object below the cursor is just a visual separator between two other UI elements, or an object that can be manipulated. Usually rendered as a vertical twin-headed arrow, split in the middle by a horizontal line.

col-resize

Vertical splitter bar cursor. Indicates that the bar below the cursor can be moved left and right to resize the objects it separates. Used when it’s not apparent if the object below the cursor is just a visual separator between two other UI elements, or an object that can be manipulated. Usually rendered as a horizonal twin-headed arrow, split in the middle by a vertical line.

e-resize

Indicates that the cursor is over the right edge of a window, and that the edge can be clicked and dragged in order to resize the window horizontally.

ne-resize

Indicates that the cursor is over the top-right edge of a window, and that the edge can be clicked and dragged in order to resize the window diagonally.

nw-resize

Indicates that the cursor is over the top-left edge of a window, and that the edge can be clicked and dragged in order to resize the window diagonally.

n-resize

Indicates that the cursor is over the top edge of a window, and that the edge can be clicked and dragged in order to resize the window vertically.

se-resize

Indicates that the cursor is over the bottom-right edge of a window, and that the edge can be clicked and dragged in order to resize the window diagonally.

sw-resize

Indicates that the cursor is over the bottom-left edge of a window, and that the edge can be clicked and dragged in order to resize the window diagonally.

s-resize

Indicates that the cursor is over the bottom edge of a window, and that the edge can be clicked and dragged in order to resize the window vertically.

w-resize

Indicates that the cursor is over the left edge of a window, and that the edge can be clicked and dragged in order to resize the window horizontally.

Cursor list – Nice to have

Cursor

Description

vertical-text

Text input cursor. Indicates that the cursor is in a region in which vertical text can be selected and possibly edited. Typically rendered as a horizontal I-beam.

crosshair

Crosshair cursor. Typically used for precision drawing or manipulation of an area.

cell

The thick plus sign cursor that’s typically used in spread-sheet applications to select cells.

Cursor list – up for discussion

td style=”vertical-align: top”>

ns-resize

Cursor

Description

default

Default cursor. Indicates the interface is idle and prepared to accept commands from the user. Used to manipulate basic user interface elements like buttons and scrollbars. Usually a left pointing diagonal arrow.

up-arrow

Up pointing arrow cursor. This cursor is typically used to identify an insertion point.

context-menu

Indicates that a context menu is available for the object underneath the cursor. Typically rendered as the default cursor with a small menu-like graphic next to it.

ew-resize

Horizontal resizing cursor. Indicates that cursor is over the the left or right edge of a window, and that ithe edge can be clicked and dragged to resize the window horizontally. Typically rendered as a horizontal twin-headed arrow.

Vertical resizing cursor. Indicates that cursor is over the the top or bottom edge of a window, and that the edge can be clicked and dragged to resize the window vertically. Typically rendered as a verticaly twin-headed arrow.

nesw-resize

Back-diagonal resizing cursor. Indicates that the UI element below the cursor is the top-right or bottom-left corner of a window, and that it can be clicked and dragged to resize the window diagonally. Typically a twin-headed arrow.

nwse-resize

Forward-diagonal resizing cursor. Indicates that the UI element below the cursor is the top-left or bottom-right corner of a window, and that it can be clicked and dragged to resize the window diagonally. Typically a twin-headed arrow.

参考资料:
How to Make Your Own X11 Cursors | eHow.co.uk
Cursor conventions specification
QCursor Class Reference

更多
7 Responses Post a comment

Leave a Reply

Note: You may use basic HTML in your comments. Your email address will not be published.

Subscribe to this comment feed via RSS