mouse-position
and set-mouse-position
give
access to the current position of the mouse.
mouse-position
returns a description of the position of the mouse.
The value looks like (frame x . y)
, where x
and y are measured in pixels relative to the top left corner of
the inside of frame.
set-mouse-position
takes three arguments, frame, x
and y, and warps the mouse cursor to that location on the screen.
track-mouse
is a new special form for tracking mouse motion.
Use it in definitions of mouse clicks that want pay to attention to
the motion of the mouse, not just where the buttons are pressed and
released. Here is how to use it:
(track-mouse body...)While body executes, mouse motion generates input events just as mouse clicks do. body can read them with
read-event
or
read-key-sequence
.
track-mouse
returns the value of the last form in body.
The format of these events is described under "New Input Event Formats."
x-set-selection
sets a "selection" in the X server.
It takes two arguments: a selection type type, and the value to
assign to it, data. If data is nil
, it means to
clear out the selection. Otherwise, data may be a string, a
symbol, an integer (or a cons of two integers or list of two integers),
or a cons of two markers pointing to the same buffer. In the last case,
the selection is considered to be the text between the markers. The
data may also be a vector of valid non-vector selection values.
Each possible type has its own selection value, which changes
independently. The usual values of type are PRIMARY
and
SECONDARY
; these are symbols with upper-case names, in accord
with X protocol conventions. The default is PRIMARY
.
To get the value of the selection, call x-get-selection
. This
function accesses selections set up by Emacs and those set up by other X
clients. It takes two optional arguments, type and
data-type. The default for type is PRIMARY
.
The data-type argument specifies the form of data conversion to
use; meaningful values include TEXT
, STRING
,
TARGETS
, LENGTH
, DELETE
, FILE_NAME
,
CHARACTER_POSITION
, LINE_NUMBER
, COLUMN_NUMBER
,
OWNER_OS
, HOST_NAME
, USER
, CLASS
,
NAME
, ATOM
, and INTEGER
. (These are symbols with
upper-case names in accord with X Windows conventions.)
The default for data-type is STRING
.
x-get-cut-buffer
to get the contents of a cut buffer; specify the
cut buffer number as argument. Use x-set-cut-buffer
with
argument string to store a new string into the first cut buffer
(moving the other values down through the series of cut buffers,
kill-ring-style).
Cut buffers are considered obsolete, but Emacs supports them for the
sake of X clients that still use them.
x-close-current-connection
. This takes no arguments.
Then you can connect to a different X server with
x-open-connection
. The first argument, display, is the
name of the display to connect to.
The optional second argument xrm-string is a string of resource
names and values, in the same format used in the `.Xresources'
file. The values you specify override the resource values recorded in
the X server itself. Here's an example of what this string might look
like:
"*BorderWidth: 3\n*InternalBorder: 2\n"
x-display-screens
x-server-version
x-server-vendor
x-display-pixel-height
x-display-mm-height
x-display-pixel-width
x-display-mm-width
x-display-backing-store
always
, when-mapped
, or not-useful
.
x-display-save-under
nil
if this X screen supports the SaveUnder feature.
x-display-planes
x-display-visual-class
static-gray
, gray-scale
, static-color
,
pseudo-color
, true-color
, and direct-color
.
x-display-color-p
t
if the X screen in use is a color screen.
x-display-color-cells
x-no-window-manager
, whose value is
t
if no X window manager is in use.
x-synchronize
enables or disables an X Windows
debugging mode: synchronous communication. It takes one argument,
non-nil
to enable the mode and nil
to disable.
In synchronous mode, Emacs waits for a response to each X protocol
command before doing anything else. This means that errors are reported
right away, and you can directly find the erroneous command.
Synchronous mode is not the default because it is much slower.
x-get-resource
retrieves a resource value from the X
Windows defaults database. Its three arguments are attribute,
name and class. It searches using a key of the form
`instance.attribute', with class `Emacs', where
instance is the name under which Emacs was invoked.
The optional arguments component and subclass add to the key
and the class, respectively. You must specify both of them or neither.
If you specify them, the key is
`instance.component.attribute', and the class is
`Emacs.subclass'.
x-display-color-p
returns t
if you are using an X server
with a color display, and nil
otherwise.
x-color-defined-p
takes as argument a string describing a color; it
returns t
if the display supports that color. (If the color is
"black"
or "white"
then even black-and-white displays
support it.)
x-popup-menu
has been generalized. It now accepts a keymap as
the menu argument. Then the menu items are the prompt strings of
individual key bindings, and the item values are the keys which have
those bindings.
You can also supply a list of keymaps as the first argument; then each
keymap makes one menu pane (but keymaps that don't provide any menu
items don't appear in the menu at all).
x-popup-menu
also accepts a mouse button event as the
position argument. Then it displays the menu at the location at
which the event took place. This is convenient for mouse-invoked
commands that pop up menus.
x-rebind-key
to change the sequence of
characters generated by the X server for one of the keyboard keys.
The first two arguments, keycode and shift-mask, should be
numbers representing the keyboard code and shift mask respectively.
They specify what key to change.
The third argument, newstring, is the new definition of the key.
It is a sequence of characters that the key should produce as input.
The shift mask value is a combination of bits according to this table:
nil
for shift-mask, then the key specified
by keycode is redefined for all possible shift combinations.
For the possible values of keycode and their meanings, see the
file `/usr/lib/Xkeymap.txt'. Keep in mind that the codes in that
file are in octal!
The related function x-rebind-keys
redefines a single keyboard
key, specifying the behavior for each of the 16 shift masks
independently. The first argument is keycode, as in
x-rebind-key
. The second argument strings is a list of 16
elements, one for each possible shift mask value; each element says how
to redefine the key keycode with the corresponding shift mask
value. If an element is a string, it is the new definition. If an
element is nil
, the definition does not change for that shift
mask.
x-parse-geometry
parses a string specifying window
size and position in the usual X format. It returns an alist describing
which parameters were specified, and the values that were given for
them.
The elements of the alist look like (parameter .
value)
. The possible parameter values are left
,
top
, width
, and height
.