1
\input texinfo @c -*-texinfo-*-
2
@c $Id: clx.texinfo,v 1.3 2005/05/19 11:31:18 jjgarcia Exp $
5
@settitle Common LISP X Interface
9
@dircategory Lisp Programming
11
* CLX: (clx). Common LISP X Interface
16
@title The Common Lisp X Interface (CLX)
19
@vskip 0pt plus 1filll
21
The Common LISP X Interface (CLX)
23
Copyright @copyright{} 1988, 1989 Texas Instruments Incorporated
26
Permission is granted to any individual or institution to use, copy,
27
modify and distribute this document, provided that this complete
28
copyright and permission notice is maintained, intact, in all copies
29
and supporting documentation. Texas Instruments Incorporated makes no
30
representations about the suitability of this document or the software
31
described herein for any purpose. It is provided "as is" without
32
express or implied warranty.
41
@node Top, Acknowledgments, (dir), (dir)
42
@top The Common LISP X Interface (CLX)
45
The Common LISP X Interface (CLX)
47
Copyright @copyright{} 1988, 1989 Texas Instruments Incorporated
50
Permission is granted to any individual or institution to use, copy,
51
modify and distribute this document, provided that this complete
52
copyright and permission notice is maintained, intact, in all copies
53
and supporting documentation. Texas Instruments Incorporated makes no
54
representations about the suitability of this document or the software
55
described herein for any purpose. It is provided "as is" without
56
express or implied warranty.
64
* Introduction to CLX::
67
* Windows and Pixmaps::
69
* Graphic Operations::
71
* Font and Characters::
86
--- The Detailed Node Listing ---
90
* The X Window System::
91
* A Quick Tour of CLX::
92
* Naming and Argument Conventions::
93
* Programming Considerations::
104
* Displaying the Menu::
107
* Debugging With CLX::
111
* Opening the Display::
112
* Display Attributes::
113
* Managing the Output Buffer::
114
* Closing the Display::
118
* Screens and Visuals::
119
* Screen Attributes::
125
* Window Attributes::
129
* Destroying Windows::
134
* Creating Graphics Contexts::
135
* Graphics Context Attributes::
136
* Copying Graphics Contexts::
137
* Destroying Graphics Contexts::
138
* Graphics Context Cache::
142
* Area and Plane Operations::
145
* Drawing Rectangles::
154
* Direct Image Transfer::
167
* Chracter Attributes::
168
* Querying Text Size::
172
* Colormaps and Colors::
174
* Colormap Functions::
178
* Creating Colormaps::
179
* Installing Colormaps::
180
* Allocating Colors::
183
* Colormap Attributes::
189
* Cursor Attributes::
191
Atoms, Properties and Selections
200
* Processing Events::
201
* Managing the Event Queue::
204
* Managing Input Focus::
205
* Grabbing the Pointer::
206
* Grabbing a Button::
207
* Grabbing the Keyboard::
210
* Releasing Queued Events::
214
* Keyboard and Pointer Events::
215
* Input Focus Events::
216
* Keyboard and Pointer State Events::
218
* Window State Events::
219
* Structure Control Events::
220
* Client Communications Events::
221
* Declaring Event Types::
226
* Basic Resource Database Functions::
227
* Accessing Resource Values::
228
* Resource Database Files::
230
Accessing Resource Values
232
* Complete Names and Classes::
233
* Matching Resource Names::
234
* Resource Access Functions::
238
* Grabbing the Server::
241
* Keyboard Encodings::
242
* Client Termination::
243
* Managing Host Access::
248
* Keycodes and Keysyms::
250
* Using Keycodes and Keysyms::
254
* Extensions (Extensions)::
255
* SHAPE - The X11 Nonrectangular Window Shape Extension::
256
* RENDER - A new rendering system for X11::
258
RENDER - A new rendering system for X11
261
* The picture object::
262
* Glyphs and Glyphsets::
264
* Errors (Extensions)::
268
* Introduction (Errors)::
273
@node Acknowledgments, Introduction to CLX, Top, Top
274
@chapter Acknowledgments
276
Primary Interface Author:
281
MIT Laboratory for Computer Science
282
545 Technology Square, Room 418
284
@email{rws@@zermatt.lcs.mit.edu}
287
Primary Implementation Author:
293
PO Box 655474, MS 238
295
@email{oren@@csc.ti.com}
304
@item Scott Fahlman, CMU
305
@item Kerry Kimbrough, Texas Instruments
306
@item Chris Lindblad, MIT
307
@item Rob MacLachlan, CMU
308
@item Mike McMahon, Symbolics
309
@item David Moon, Symbolics
310
@item LaMott Oren, Texas Instruments
311
@item Daniel Weinreb, Symbolics
312
@item John Wroclawski, MIT
313
@item Richard Zippel, Symbolics
316
Documentation Contributors:
319
@item Keith Cessna, Texas Instruments
320
@item Kerry Kimbrough, Texas Instruments
322
@item LaMott Oren, Texas Instruments
323
@item Dan Stenger, Texas Instruments
326
The X Window System is a trademark of MIT.
328
UNIX is a trademark of AT&T Bell Laboratories.
330
ULTRIX, ULTRIX-32, ULTRIX-32m, ULTRIX-32w, and VAX/VMS are trademarks of Digital Equipment
333
@node Introduction to CLX, Displays, Acknowledgments, Top
334
@chapter Introduction to CLX
336
This manual assumes a basic understanding of window systems and the Common Lisp programming
337
language. To provide an introduction to the Common Lisp X Interface (CLX) programming, this
338
section discusses the following:
341
@item Overview of the X Window System
342
@item Naming and argument conventions
343
@item Programming considerations
347
* The X Window System::
348
* A Quick Tour of CLX::
349
* Naming and Argument Conventions::
350
* Programming Considerations::
354
@node The X Window System, A Quick Tour of CLX, Introduction to CLX, Introduction to CLX
355
@section The X Window System
357
The X Window System was developed at the Massachusetts Institute of
358
Technology (MIT) and first released in 1985. Since then, the X Window
359
System has become an industry-standard product available on virtually
360
every type of bit-mapped workstation. The current version of X,
361
Version 11, has been implemented for several different computer
362
architectures, for a wide variety of display hardware, and also for
363
many different operating systems. X Version 11 represents the
364
fulfillment of the original design goals proposed by MIT, as follows:
368
Support virtually any bitmap display and any interactive input device
369
(including keyboards, mice, tablets, joysticks, and touch screens).
370
Make it easy to implement the window system on different operating
373
@item Device-Independent Applications
374
Avoid rewriting, recompiling, or even relinking in order to use
375
different display/input hardware. Make it easy for an application to
376
work on both monochrome and color hardware.
378
@item Network Transparent
379
Let an application run on one computer while using another computer's
380
display, even if the other computer has a different operating system
381
or hardware architecture.
384
Support multiple applications being displayed simultaneously.
386
@item No User Interface Policy
388
Since no one agrees on what constitutes the best user interface, make
389
it possible for a broad range of user interface styles (or policies)
390
to be implemented, external to the window system and to the
391
application programs.
394
Windows should be abundant, and ubiquitous. Provide overlapping
395
windows and a simple mechanism for window hierarchy.
397
@item High-Performance Graphics
398
Provide powerful interfaces for synthesizing 2-D images (geometric
399
primitives, high-quality text with multiple typefaces, and scanned
403
Include a mechanism for adding new capabilities. Allow separate sites
404
to develop independent extensions without becoming incompatible with
408
Some of these goals lead directly to the basic X architecture -- the
409
client-server model. The basic window system is implemented by the X
410
@emph{server} program. An application program (the @emph{client})
411
sends window system @emph{requests} to the X server through a reliable
414
In general, the server and the client can be executing on separate
415
host computers, in which case the byte-stream is implemented via some
416
network protocol (TCP, DECnet(tm), Chaosnet, and so
417
forth). The X server, which is connected to several client programs
418
running concurrently, executes client requests in round-robin
419
fashion. The server is responsible for drawing client graphics on the
420
display screen and for making sure that graphics output to a window
421
stays inside its boundary.
423
The other primary job of the X server is to channel input from the
424
keyboard, pointer, and other input devices back to the appropriate
425
client programs. Input arrives at the client asynchronously in the
426
form of input @emph{events} representing up/down transitions of keys
427
or pointer buttons, changes in the pointer position, and so on. In
428
some cases, a request generates a return value (or @emph{reply}) from
429
the server, which is another kind of client input. Replies and input
430
events are received via the same byte-stream connecting the client
438
@node Windows, Input Events, The X Window System, The X Window System
441
The X Window System supports one or more screens containing
442
overlapping windows and subwindows. A @emph{screen} is a physical
443
monitor and hardware, which can be either color or black and
444
white. There can be multiple screens per display workstation. A single
445
server can provide display services for any number of screens. A set
446
of screens for a single user with one keyboard and one mouse is called
449
All windows in an X server are arranged in a strict hierarchy. At the
450
top of the hierarchy are the @emph{root windows}, which cover each of
451
the display screens. Each root window is either partially or
452
completely covered by child windows. All windows, except for root
453
windows, have parents. Any window can in turn have its own
454
children. In this way, an application program can create a window tree
455
of arbitrary depth on each screen.
457
A child window can be larger than its parent. That is, part or all of
458
the child window can extend beyond the boundaries of the parent.
459
However, all output to a window is clipped by the boundaries of its
460
parent window. If several children of a window have overlapping
461
locations, one of the children is considered to be on top of/or raised
462
over the others, @emph{obscuring} them. Window output to areas that
463
are covered by other windows is suppressed.
465
A window has a border that is zero or more pixels in width and can be
466
any pattern (pixmap) or solid color. A window usually has a background
467
pattern that is drawn by the X server. Each window has its own
468
coordinate system. Child windows obscure their parents unless the
469
child windows have no background. Graphics operations in the parent
470
window are usually clipped by the children.
472
X also provides objects called @emph{pixmaps} for off-screen storage
473
of graphics. Single-plane pixmaps (that is, of depth 1) are sometimes
474
referred to as @emph{bitmaps}. Both pixmaps and windows can be used
475
interchangeably in most graphics functions. Pixmaps are also used in
476
various graphics operations to define patterns, or
477
@emph{tiles}. Windows and pixmaps together are referred to as
480
@node Input Events, , Windows, The X Window System
481
@subsection Input Events
483
The X input mechanism is conceptually simple yet quite powerful. Most
484
events are attached to a particular window (that is, contain an
485
identifier for the window receiving the event). A client program can
486
receive multiple window input streams, all multiplexed over the single
487
byte-stream connection to the server.
489
Clients can tailor their input by expressing interest in only certain
490
event types. The server uses special event types to send important
491
messages to the client. For example, the client can elect to receive
492
an @var{:enter-notify}
493
(@pxref{:enter-notify}) event
494
when the pointer cursor moves into a certain window. Another vital
495
message from the server is an @var{:exposure}
496
(@pxref{:exposure}) event. This is a
497
signal to the client indicating that at least some portion of the
498
window has suddenly become visible (perhaps the user moved another
499
window which had been overlapping it). The client is then responsible
500
for doing what is necessary to redisplay the window's image. Client
501
programs must be prepared to regenerate the contents of windows in
504
Input is also subject to policy decisions about which client window
505
receives keyboard and pointer events. Since the pointer is free to roam
506
between windows, just clicking on a window is often enough to send a
507
pointer event to that window. Keyboard events, however, must go to a
508
keyboard focus window which has to be designated in some other way.
509
Usually, the arbiter of such input management policy is a program called
510
the @emph{window manager}. The window manager gives the human
511
user a way to make a window the keyboard focus, to manage the layout of
512
windows on the screen, to represent windows with icons, and so forth. In
513
fact, the window manager client determines most of the so-called look
514
and feel of the X Window System.
516
@node A Quick Tour of CLX, Naming and Argument Conventions, The X Window System, Introduction to CLX
517
@section A Quick Tour of CLX
519
The X Window System is defined by the X Window System Protocol
520
Specification, a detailed description of the encoding and the meaning of
521
requests and events sent between a client and a server. This standard
522
protocol does not depend on any particular programming language. As a
523
result, each programming language must define its own functional
524
interface for using the X protocol. The standard X interface used by
525
Common Lisp programmers is called CLX. CLX is a set of data types,
526
functions, and macros which allow a Common Lisp client program to
527
interact with an X server to send requests and to receive input events
530
For the most part, CLX functions are closely tied to the underlying
531
requests in the X protocol. Many CLX functions simply add requests to an
532
output buffer. These requests later execute asynchronously on the X
533
display server. However, some functions of CLX lie outside the scope of
534
the protocol--for example, reading events and managing a clientside
535
event queue. CLX is also responsible for important batching and caching
536
tasks that minimize network communication.
538
The following paragraphs show an example of a CLX client program. All
539
CLX functions and macros are shown in upper case. Note that some of the
540
terms used are unique to X, while other terms that are common to other
541
window systems have different meanings in X. It may be helpful to refer
542
to the glossary when you are uncertain of a term's meaning in the
543
context of the X Window System.
547
* Displaying the Menu::
550
* Debugging With CLX::
553
@node A Simple Menu, Displaying the Menu, A Quick Tour of CLX, A Quick Tour of CLX
554
@subsection A Simple Menu
556
The example client program creates and displays a simple pop-up menu
557
consisting of a column of strings--a title string followed by selectable
558
menu item strings. The implementation uses one window to represent the
559
entire menu, plus a set of subwindows, one for each menu item. Here is
560
the definition of a structure which represents such a menu.
564
"A simple menu of text strings."
565
(title "Choose an item:")
566
item-alist ;((item-window item-string))
573
(geometry-changed-p t)) ;nil if unchanged since displayed
577
The @code{window} slot will contain the
578
@var{window} (@pxref{window})
579
object that represents the menu. The @code{item-}
580
@code{alist} represents the relationship between the menu items
581
and their associated subwindows. Each entry in @code{item-alist}
582
is a list whose first element is a (sub)window object and whose second
583
element is the corresponding item string. A
584
@var{window} (@pxref{window})
585
object is an instance of a CLX-defined data type which represents X
587
@var{window} (@pxref{window})
588
object actually carries two pieces of information: an X window ID
590
@var{display} (@pxref{display})
592
@var{display} (@pxref{display})
593
is another CLX-defined data type that represents a connection to a
594
specific X display server. The @code{gcontext} slot contains an
595
instance of a CLX data type known as a @emph{graphics context}. A
596
graphics context is a set of display attribute values, such as
597
foreground color, fill style, line style, text font, and so forth. Each
598
X graphics request (and hence each CLX graphics function call) must
599
supply a graphics context to use in displaying the request. The menu's
600
@code{gcontext} will thus hold all of the attribute values used
603
The first thing to do is make an instance of a @code{menu} object:
606
(defun create-menu (parent-window text-color background-color text-font)
608
;; Create menu graphics context
609
:gcontext (CREATE-GCONTEXT :drawable parent-window
610
:foreground text-color
611
:background background-color
614
;; Create menu window
615
:window (CREATE-WINDOW
616
:parent parent-window
618
:x 0 ;temporary value
619
:y 0 ;temporary value
620
:width 16 ;temporary value
621
:height 16 ;temporary value
624
:background background-color
626
:override-redirect :on ;override window mgr when positioning
627
:event-mask (MAKE-EVENT-MASK :leave-window :exposure))))
630
@var{create-window} (@pxref{create-window})
631
is one of the most important CLX functions, since it creates and returns
632
a @var{window} (@pxref{window})
633
object. Several of its options are shown here. The default window class
634
is @var{:input-output}, but X provides for @var{:input-only} windows,
635
too. Every window must have a parent window, except for a system-defined
636
@emph{root window}, which represents an entire display screen. The
637
@var{:event-mask} keyword value, a CLX
638
@var{event-mask} (@pxref{event-mask})
639
data type, says that an input event will be received for the menu window
640
when the window is exposed and also when the pointer cursor leaves the
641
window. The window border is a pattern-filled or (as in this case) a
642
solid-colored boundary which is maintained automatically by the X
643
server; a client cannot draw in a window's border, since all graphics
644
requests are relative to the origin (upper-left corner) of the window's
645
interior and are clipped by the server to this inside region. Turning on
646
the @var{:save-under} option is a hint to the X server that, when this
647
window is made visible, it may be more efficient to save the pixels it
648
obscures, rather than require several client programs to refresh their
649
windows when the pop-up menu disappears. This is a way to work around
650
X's client-managed refresh policy when only a small amount of screen
651
space is needed temporarily.
653
Why is @var{:override-redirect} turned on for the menu window? This is
654
actually a little unusual, because it prevents any window manager client
655
from @emph{redirecting} the position of the menu when it is popped up.
656
Remember that the window manager represents the user's policy for
657
controlling the positions of his windows, so this kind of redirection is
658
ordinarily correct. However, in this case, as a favor to the user, the
659
menu avoids redirection in order to pop up the menu at a very specific
660
location; that is, under the pointer cursor.
662
What about the item subwindows? The @code{menu-set-item-list}
663
function in the following example creates them whenever the menu's item
664
list is changed. The upper-left x and y coordinates and the width and
665
height are not important yet, because they are computed just before the
666
menu is displayed. This function also calls
667
@var{create-window} (@pxref{create-window}),
668
demonstrating the equal treatment of parent and children windows in the
672
(defun menu-set-item-list (menu &rest item-strings)
673
;; Assume the new items will change the menu's width and height
674
(setf (menu-geometry-changed-p menu) t)
676
;; Destroy any existing item windows
677
(dolist (item (menu-item-alist menu))
678
(DESTROY-WINDOW (first item)))
680
;; Add (item-window item-string) elements to item-alist
681
(setf (menu-item-alist menu)
683
(dolist (item item-strings (nreverse alist))
684
(push (list (CREATE-WINDOW
685
:parent (menu-window menu)
686
:x 0 ;temporary value
687
:y 0 ;temporary value
688
:width 16 ;temporary value
689
:height 16 ;temporary value
690
:background (GCONTEXT-BACKGROUND (menu-gcontext menu))
691
:event-mask (MAKE-EVENT-MASK :enter-window
699
@node Displaying the Menu, Menu Input, A Simple Menu, A Quick Tour of CLX
700
@subsection Displaying the Menu
702
The @code{menu-recompute-geometry} function (shown in the
703
following example) handles the job of calculating the size of the menu,
704
based on its current item list and its current text font. CLX provides a
705
way to inquire the geometrical properties of a font object (for example,
706
its ascent and descent from the baseline) and also a
707
@var{text-extents} (@pxref{text-extents})
709
@var{text-extents} (@pxref{text-extents})
710
returns the geometry of a given string as displayed in a given font.
711
Notice the use of the
712
@var{with-state} (@pxref{with-state})
713
macro when setting a window's geometry attributes. CLX strives to
714
preserve the familiar @code{setf} style of accessing individual window
715
attributes, even though an attribute access actually involves sending a
716
request to a (possibly remote) server and/or waiting for a reply.
717
@var{with-state} (@pxref{with-state})
718
tells CLX to batch together all read and write accesses to a given
719
window, using a local cache to minimize the number of server requests.
720
This CLX feature can result in a dramatic improvement in client
721
performance without burdening the programmer interface.
723
@code{menu-recompute-geometry} causes all the item subwindows to
724
become @emph{mapped}. Mapping a window means attempting to make it
725
visible on the screen. However, a subwindow will not actually be
726
@emph{visible} until it and all of its ancestors are mapped. Even then,
727
another window might be covering up the subwindow.
730
(defun menu-recompute-geometry (menu)
731
(when (menu-geometry-changed-p menu)
732
(let* ((menu-font (GCONTEXT-FONT (menu-gcontext menu)))
733
(title-width (TEXT-EXTENTS menu-font (menu-title menu)))
734
(item-height (+ (FONT-ASCENT menu-font)
735
(FONT-DESCENT menu-font)
738
(items (menu-item-alist menu))
741
;; Find max item string width
743
(+ *menu-item-margin*
744
(dolist (next-item items item-width)
745
(setf item-width (max item-width
746
(TEXT-EXTENTS menu-font (second next-item)))))))
748
;; Compute final menu width, taking margins into account
749
(setf menu-width (max title-width (+ item-width *menu-item-margin*)))
750
(let ((window (menu-window menu)))
752
;; Update width and height of menu window
754
(setf (DRAWABLE-WIDTH window) menu-width
755
(DRAWABLE-HEIGHT window) (* (1+ (length items)) item-height)))
757
;; Update width, height, position of item windows
758
(let ((item-left (round (- menu-width item-width) 2))
759
(next-item-top (- item-height (round *menu-item-margin* 2))))
760
(dolist (next-item items)
761
(let ((window (first next-item)))
763
(setf (DRAWABLE-HEIGHT window) item-height
764
(DRAWABLE-WIDTH window) item-width
765
(DRAWABLE-X window) item-left
766
(DRAWABLE-Y window) next-item-top)))
767
(incf next-item-top item-height))))
769
;; Map all item windows
770
(MAP-SUBWINDOWS (menu-window menu))
772
;; Save item geometry
773
(setf (menu-item-width menu) item-width
774
(menu-item-height menu) item-height
775
(menu-width menu) menu-width
776
(menu-title-width menu) title-width
777
(menu-geometry-changed-p menu) nil))))
780
Of course, the sample client must know how to draw/redraw the menu and
781
its items, so the function @code{menu-refresh} is defined next to
782
handle that task (shown in the following example). Note that the
783
location of window output is given relative to the window origin.
784
Windows and subwindows have different coordinate systems. The location
785
of the origin (upper-left corner) of a subwindow's coordinate system is
786
given with respect to its parent window's coordinate system. Negative
787
coordinates are valid, although only output to the +x/+y quadrant of a
788
window's coordinate system will ever be visible.
791
(defun menu-refresh (menu)
792
(let* ((gcontext (menu-gcontext menu))
793
(baseline-y (FONT-ASCENT (GCONTEXT-FONT gcontext))))
794
;; Show title centered in "reverse-video"
795
(let ((fg (GCONTEXT-BACKGROUND gcontext))
796
(bg (GCONTEXT-FOREGROUND gcontext)))
797
(WITH-GCONTEXT (gcontext :foreground fg :background bg)
801
(round (- (menu-width menu)
802
(menu-title-width menu)) 2) ;start x
806
;; Show each menu item (position is relative to item window)
807
(let ((box-margin (round *menu-item-margin* 2)))
808
(dolist (item (menu-item-alist menu))
810
(first item) gcontext
812
(+ baseline-y box-margin) ;start y
816
@var{with-gcontext} (@pxref{with-gcontext})
817
is a CLX macro that allows you temporarily to modify a graphics context
818
within the dynamic scope of the macro body.
819
@var{draw-image-glyphs} (@pxref{draw-image-glyphs})
820
is a CLX text drawing function which produces a terminal-like rendering:
821
foreground character on a background block. (More sophisticated text
822
rendering functions are also available.) The strange use of
823
@emph{glyphs} instead of @emph{string} here actually highlights an
824
important fact: X and Common Lisp have totally different concepts of a
825
character. A Common Lisp character is an object whose implementation can
826
comprehend a vast universe of text complexities (typefaces, type styles,
827
international character sets, symbols, and so forth). However, to X, a
828
string is just a sequence of integer indexes into the array of bitmaps
829
represented by a CLX font object. In general,
830
@var{draw-image-glyphs} (@pxref{draw-image-glyphs}),
831
@var{text-extents} (@pxref{text-extents}),
832
and other CLX text functions accept a @var{:translate} keyword
833
argument. Its value is a function which translates the characters of a
834
string argument into the appropriate font-and-index pairs needed by CLX.
835
This example relies upon the default translation function, which simply
836
uses @var{char-code} to compute an index into the current font.
838
@node Menu Input, The Main Program, Displaying the Menu, A Quick Tour of CLX
839
@subsection Menu Input
841
Now that a menu can be displayed, the sample client program must define
842
how the menu will process user input. The @code{menu-choose}
843
function (shown in the following example) has the classic structure of
844
an X client program. First, do some initialization (for example, present
845
the menu at a given location). Then, enter an input event loop. Read an
846
input event, process it, and repeat the loop until a termination event
848
@var{event-case} (@pxref{event-case})
849
macro continues reading an event from the menu window's display object
850
until one of its clauses returns non-@var{nil}. These clauses specify
851
the action to be taken for each event type and also bind values from the
852
event report to local variables, such as the @var{event-window}
853
receiving the event. Notice that the @var{:force-output-p} option is
855
@var{event-case} (@pxref{event-case})
856
to begin by sending any client requests which CLX has not yet output to
857
the server. To improve performance, CLX quietly queues up requests and
858
periodically sends them off in a batch. However, in an interactive
859
feedback loop such as this, it is important to keep the display crisply
863
(defun menu-choose (menu x y)
864
;; Display the menu so that first item is at x,y.
865
(menu-present menu x y)
867
(let ((items (menu-item-alist menu))
868
(mw (menu-window menu))
871
;; Event processing loop
872
(do () (selected-item)
873
(EVENT-CASE ((DRAWABLE-DISPLAY mw) :force-output-p t)
876
;; Discard all but final :exposure then display the menu
877
(when (zerop count) (menu-refresh menu))
883
(setf selected-item (second (assoc event-window items)))
889
(menu-highlight-item menu (find window items :key #'first))
895
;; Quit if pointer moved out of main menu window
896
(setf selected-item (when (eq kind :ancestor) :none))
897
;; Otherwise, unhighlight the item window left
898
(menu-unhighlight-item menu (find window items :key #'first)))
903
;;Ignore and discard any other event
909
;; Return selected item string, if any
910
(unless (eq selected-item :none) selected-item)))
913
The event loop in @code{menu-choose} demonstrates an idiom used in
914
all X programs: the contents of a window are displayed (in this case, by
915
calling @code{menu-refresh}) only when an
916
@var{:exposure} (@pxref{:exposure})
917
event is received, signaling that the server has actually made the
918
window @emph{viewable}. The handling of
919
@var{:exposure} (@pxref{:exposure})
920
in @code{menu-choose} also implements a little trick for improving
921
efficiency. In general, when a window is exposed after being previously
922
obscured (perhaps only partially), the server is free to send several
923
@var{:exposure} (@pxref{:exposure})
924
events, one for each rectangular tile of the exposed region. For small
925
windows like this menu, it is not worth the trouble to redraw the image
926
one tile at a time. So the code above just ignores all but the last tile
927
exposure and redraws everything in one call to
930
@node The Main Program, Debugging With CLX, Menu Input, A Quick Tour of CLX
931
@subsection The Main Program
933
After all the preceding build-up and the other functions referenced
934
(but not shown here) have been implemented, the code for the main
935
client program is very small.
938
(defun just-say-lisp (host &optional (font-name "fg-16"))
939
(let* ((display (OPEN-DISPLAY host))
940
(screen (first (DISPLAY-ROOTS display)))
941
(fg-color (SCREEN-BLACK-PIXEL screen))
942
(bg-color (SCREEN-WHITE-PIXEL screen))
943
(nice-font (OPEN-FONT display font-name))
945
;; Create a menu as a child of the root window.
946
(a-menu (create-menu (SCREEN-ROOT screen)
947
fg-color bg-color nice-font)))
949
(setf (menu-title a-menu) "Please pick your favorite language:")
950
(menu-set-item-list a-menu "Fortran" "APL" "Forth" "Lisp")
952
;; Bedevil the user until he picks a nice programming language
955
;; Determine the current root window position of the pointer
956
(multiple-value-bind (x y) (QUERY-POINTER (SCREEN-ROOT screen))
958
(let ((choice (menu-choose a-menu x y)))
959
(when (string-equal "Lisp" choice)
962
(CLOSE-DISPLAY display))))
965
Note that the main program event loop lies in the body of an
966
@var{unwind-protect} form. This is a good programming technique
967
because, without this protection, an unexpected error could cause the
968
program to terminate without freeing the @emph{server resources} it has
969
created. Server resources are CLX objects which refer to objects
970
actually stored on the X server. Examples of these are
971
@var{window} (@pxref{window}),
972
@var{font} (@pxref{font}),
973
@var{pixmap} (@pxref{pixmap}),
974
@var{cursor} (@pxref{cursor}),
975
@var{colormap} (@pxref{colormap}),
977
@var{gcontext} (@pxref{gcontext})
978
objects. These server resources are created and destroyed by user
979
requests. Server resources created by a client are also destroyed when
980
its display connection is closed. If client resources are repeatedly
981
created without being destroyed, then the server will eventually run out
984
Most server resources are potentially sharable between applications. In
985
fact, windows are manipulated explicitly by window manager programs.
986
Fonts and cursors are typically shared automatically since the X server
987
loads and unloads font storage as needed.
988
@var{gcontext} (@pxref{gcontext})
989
objects are not ordinarily shared between client applications.
991
@node Debugging With CLX, , The Main Program, A Quick Tour of CLX
992
@subsection Debugging With CLX
994
Typically, most CLX programs do not need to control the buffering of
995
output requests directly. However, CLX programmers need to be aware of
996
the asynchronous nature of client-server communication. It may be
997
convenient to control the CLX output buffer more directly, especially
1000
A client that wants a request to execute immediately instead of
1001
asynchronously can follow it with a call to
1002
@var{display-force-output} (@pxref{display-force-output}).
1003
This function @emph{blocks} (does not return) until all previously
1004
buffered output requests have been sent. Otherwise, the output buffer is
1005
always flushed by a call to any function which returns a value from the
1006
server or which waits for input (for example,
1007
@var{get-property} (@pxref{get-property}).
1008
Certain output requests can cause input events to be sent. For example,
1009
@var{map-window} (@pxref{map-window})
1011
@var{:exposure} (@pxref{:exposure})
1012
events to be sent. Synchronizing output with the resulting input can be
1014
@var{display-finish-output} (@pxref{display-finish-output})
1015
function. This function blocks until all previously buffered output has
1016
been sent and all resulting input events have been received.
1018
Functions that return information from the server block until an
1019
explicit reply is received or an error occurs. If a nonblocking call
1020
results in an error, the error is generally not reported until later.
1021
All errors (synchronous and asynchronous) are processed by calling an
1022
error handler defined for the display. If the handler is a sequence it
1023
is expected to contain handler functions specific to each error. The
1024
error code is used to index the sequence, fetching the appropriate
1025
handler. Any results returned by the handler are ignored since it is
1026
assumed that the handler either takes care of the error completely, or
1029
@node Naming and Argument Conventions, Programming Considerations, A Quick Tour of CLX, Introduction to CLX
1030
@section Naming and Argument Conventions
1032
Throughout CLX, a number of conventions for naming and syntax of the CLX
1033
functions have been followed. These conventions are intended to make the
1034
syntax of the functions more predictable.
1036
The major naming conventions are as follows:
1040
To better differentiate the CLX symbols from other symbols, they have
1041
all been placed in the package XLIB. External symbols have been
1042
explicitly exported.
1045
The @emph{display} argument, where used, is always first in the
1049
All server resource objects, where used, occur at the beginning of the
1050
argument list, immediately after the display variable.
1053
When a graphics context (@emph{gcontext}) is present together with
1054
another type of server resource (most commonly, a @emph{drawable}),
1055
the graphics context occurs in the argument list after the other
1056
server resource. Drawables out rank all other server resources.
1059
Source arguments always precede the destination arguments in the
1063
The @emph{x} argument always precedes the @emph{y} argument in the
1067
The @emph{width} argument always precedes the @emph{height} argument
1068
in the argument list.
1071
Where the @emph{x}, @emph{y}, @emph{width} and @emph{height} arguments
1072
are used together, the @emph{x} and @emph{y} arguments always precede
1073
the @emph{width} and @emph{height} arguments.
1076
Where a @emph{mask} is accompanied with a @emph{structure}, the mask
1077
always precedes the structure in the argument list.
1080
@node Programming Considerations, Data Types, Naming and Argument Conventions, Introduction to CLX
1081
@section Programming Considerations
1083
The major programming considerations are as follows:
1087
Keyboards are the greatest variable between different manufacturer's
1088
workstations. If you want your program to be portable, you should be
1089
particularly conservative here.
1092
Many display systems have limited amounts of off-screen memory. If you
1093
can, you should minimize use of pixmaps and backing store.
1096
The user should have control of his screen real-estate. Therefore, you
1097
should write your applications to react to window management, rather
1098
than presume control of the entire screen. What you do inside of your
1099
top level window, however, is up to your application.
1102
Coordinates and sizes in X are actually 16-bit quantities. They
1103
usually are declared as an
1104
@var{int16} (@pxref{int16}) in
1105
the functions. Values larger than 16 bits can be truncated silently.
1106
Sizes (width and height) are unsigned quantities.
1110
@var{color} (@pxref{color}),
1111
@var{colormap} (@pxref{colormap}),
1112
@var{cursor} (@pxref{cursor}),
1113
@var{display} (@pxref{display}),
1114
@var{font} (@pxref{font}),
1115
@var{gcontext} (@pxref{gcontext}),
1116
@var{pixmap} (@pxref{pixmap}),
1117
@var{screen} (@pxref{screen}),
1119
@var{window} (@pxref{window})
1120
are defined solely by a functional interface. Even though they are
1121
treated like structures in this document, it is not specified whether
1122
they are implemented as structures or classes. Although some
1123
interfaces are described as functions, they are not required to be
1124
defined using @var{defun.} (It is a requirement that they be
1125
functions as opposed to macros or special forms.)
1128
@node Data Types, , Programming Considerations, Introduction to CLX
1132
The following are some data type definitions that are commonly used in
1133
CLX function definitions.
1135
@deftp {Type} alist (key-type-and-name datum-type-and-name) 'list
1136
@var{alist} defines an association list. An association list is a
1137
sequence, containing zero or more repetitions of the given elements
1138
with each of the elements expressed as (@emph{type} @emph{name}).
1142
@deftp {Type} angle `(number ,(* -2pi) ,(* 2pi))
1143
@var{angle} defines an angle in units of radians and is bounded by
1144
(-2%pi;) and (2%pi;). Note that we are explicitly using a
1145
different angle representation than what is actually transmitted in
1150
@deftp {Type} arc-seq '(repeat-seq (int16 x) (int16 y) (card16 width) (card16 height) (angle angle1) (angle angle2))
1151
@var{arc-seq} defines a six-tuple sequence of the form
1152
(@emph{x}, @emph{y}, @emph{width}, @emph{height}, @emph{angle1}, @emph{angle2}).
1153
The points @emph{x} and @emph{y} are signed, 16-bit quantities with a
1154
range from -32,768 to 32,767. The @emph{width} and @emph{height}
1155
values are unsigned, 16-bit quantities and range from 0 to 65,535.
1156
@emph{angle1} and @emph{angle2} are in units of radians, and bounded
1157
by (-2%pi;) and (2%pi;).
1161
@deftp {Type} array-index `(integer 0 ,array-dimension-limit)
1162
@var{array-index} defines a type which is a subtype of the integers
1163
and can be used to describe all variables that can be array
1164
indices. The range is inclusive because start and end array index
1165
specifiers can be one (1) past the end.
1169
@deftp {Type} bit-gravity '(member gravity*)
1170
A keyword that specifies which region of a window should be retained
1171
when the window is resized.
1173
@emph{gravity} -- One of the following:
1182
@item @var{:north-east}
1183
@item @var{:south-east :west}
1186
@item @var{:north-west}
1187
@item @var{:south-west}
1190
If a window is reconfigured without changing its inside width or
1191
height, then the contents of the window moves with the window and are
1192
not lost. Otherwise, the contents of a resized window are either moved
1193
or lost, depending on its bit-gravity attribute. See
1194
@var{window-bit-gravity}, in @ref{Window Attributes}, for additional
1201
@deftp {Type} bitmap '(array bit (* *))
1202
Specifies a two-dimensional array of bits.
1206
@deftp {Structure} bitmap-format
1208
A structure that describes the storage format of a bitmap.
1210
The @var{bitmap-format} structure contains slots for @var{unit},
1211
@var{pad}, and @var{lsb-first-p}. The @var{unit} member indicates
1212
the unit of increments used to maintain the bitmap data. The units
1213
available for use are 8, 16, or 32 bits. The @var{pad} member
1214
indicates how many bits are needed to pad the left edge of the
1215
scan-line. The @var{lsb-first-p} member is a predicate which
1216
indicates the ordering of bits with the bitmap unit.
1221
@deftp {Slot of bitmap-format} unit
1223
Type: (@var{member} 8 16 32).
1225
The size of a contiguous grouping of bits, which can be 8, 16, or
1226
32. The default is 8.
1232
@deftp {Slot of bitmap-format} pad
1234
Type: (@var{member} 8 16 32).
1236
The number of bits to left-pad the scan-line, which can be 8, 16, or
1237
32. The default is 8.
1241
@deftp {Slot of bitmap-format} lsb-first-p
1243
Type: @var{boolean}.
1245
A predicate indicating whether the least significant bit comes first
1246
(@var{true}) or not (@var{nil}).
1250
@deftp {Type} boolean '(or nil (not nil))
1251
@var{boolean} defines a type which is all inclusive. It is used for
1252
variables that can take on a true (non-@var{nil}) or false
1256
@deftp {Type} boole-constant `(member value*)
1258
@var{boole-constant} defines a type that is a set of the values
1259
associated with the 16 boolean operation-code constants for the Common
1260
Lisp language. It is used for the set of allowed source and
1261
destination combination functions in a graphics context.
1263
@emph{value} -- One of the following:
1267
@item @var{boole-c1}
1268
@item @var{boole-nand}
1269
@item @var{boole-xor}
1272
@item @var{boole-c2}
1273
@item @var{boole-nor}
1275
@item @var{boole-and}
1276
@item @var{boole-clr}
1277
@item @var{boole-orc1}
1279
@item @var{boole-andc1}
1280
@item @var{boole-eqv}
1281
@item @var{boole-orc2}
1283
@item @var{boole-andc2}
1284
@item @var{boole-ior}
1285
@item @var{boole-set}
1290
@deftp {Type} card8 '(unsigned-byte 8)
1291
An unsigned integer value that is a maximum of eight bits long. This
1292
gives a number of this type a range from 0 to 255.
1296
@deftp {Type} card16 '(unsigned-byte 16)
1297
An unsigned integer value that is a maximum of 16 bits long. This
1298
gives a number of this type a range from 0 to 65,535.
1302
@deftp {Type} card29 '(unsigned-byte 29)
1303
An unsigned integer value that is a maximum of 29 bits long. This
1304
gives a number of this type a range from 0 to 536,870,911.
1308
@deftp {Type} card32 '(unsigned-byte 32)
1309
An unsigned integer value that is a maximum of 32 bits long. This
1310
gives a number of this type a range from 0 to 4,294,967,295.
1314
@deftp {Type} color '(satisfies color-p)
1316
A @var{color}. @xref{Color Functions}, for additional
1321
@deftp {Type} colormap '(satisfies colormap-p)
1323
A @var{colormap}. @xref{Colormap Functions}, for
1324
additional information.
1328
@deftp {Type} cursor '(satisfies cursor-p)
1330
A @var{cursor}. @xref{Cursors}, for additional information.
1334
@deftp {Type} device-event-mask '(or mask32 (list device-event-mask-class))
1337
Provides a way to specify a set of bits for an event bitmask. Two ways
1338
of specifying the bits are allowed: by setting the event bits in a 32
1339
bit mask, or by listing the keyword names of the device related event
1344
@deftp {Type} device-event-mask-class '(member event*)
1345
A keyword name, for a device related event, that corresponds to a
1346
particular bit in an event bitmask. The set of names is a subset of
1347
the names in the type @var{event-mask-class}.
1349
@emph{event} -- One of the following:
1352
@item @var{:button-1-motion}
1353
@item @var{:button-motion}
1355
@item @var{:button-2-motion}
1356
@item @var{:button-press}
1358
@item @var{:button-3-motion}
1359
@item @var{:key-press}
1361
@item @var{:button-4-motion}
1362
@item @var{:key-release}
1364
@item @var{:button-5-motion}
1365
@item @var{:pointer-motion}
1370
@deftp {Type} display '(satisfies display-p)
1372
A connection to an X server. @xref{Displays}, for additional
1377
@deftp {Type} drawable '(or window pixmap)
1378
Both @var{windows} and @var{pixmaps} can be used as sources and
1379
destinations in graphics operations. @var{windows} and @var{pixmaps}
1380
together are known as @emph{drawables}. However, an @var{:input-only}
1381
window cannot be used as a source or destination in a graphics
1386
@deftp {Type} draw-direction '(member :left-to-right :right-to-left)
1387
Defines a list of rotation directions for drawing arcs and
1388
fonts. @var{draw-direction} can have the values of
1389
@var{:left-to-right} or @var{:right-to-left}.
1393
@deftp {Type} error-key '(member error*)
1394
Defines a list of all predefined errors. All errors (synchronous and
1395
asynchronous) are processed by calling an error handler in the
1396
display. The handler is called with the display as the first argument
1397
and the error-key as its second argument.
1399
@emph{error} -- One of the following:
1403
@item @var{:drawable}
1404
@item @var{:implementation}
1413
@item @var{:gcontext}
1416
@item @var{:colormap}
1417
@item @var{:id-choice}
1421
@item @var{:illegal-request}
1426
@deftp {Type} event-key '(member event-type*)
1427
Defines a list that specifies all predefined event-types. Clients are
1428
informed of information asynchronously by means of events. These
1429
events can be either asynchronously generated from devices or
1430
generated as side effects of client requests.
1432
@emph{event-type} -- One of the following:
1435
@item @var{:button-press}
1436
@item @var{:exposure}
1437
@item @var{:motion-notify}
1439
@item @var{:button-release}
1440
@item @var{:focus-in}
1441
@item @var{:no-exposure}
1443
@item @var{:circulate-notify}
1444
@item @var{:focus-out}
1445
@item @var{:property-notify}
1447
@item @var{:circulate-request}
1448
@item @var{:graphics-exposure}
1449
@item @var{:reparent-notify}
1451
@item @var{:client-message}
1452
@item @var{:gravity-notify}
1453
@item @var{:resize-request}
1455
@item @var{:colormap-notify}
1456
@item @var{:keymap-notify}
1457
@item @var{:selection-clear}
1459
@item @var{:configure-notify}
1460
@item @var{:key-press}
1461
@item @var{:selection-notify}
1463
@item @var{:configure-request}
1464
@item @var{:key-release}
1465
@item @var{:selection-request}
1467
@item @var{:create-notify}
1468
@item @var{:leave-notify}
1469
@item @var{:unmap-notify}
1471
@item @var{:destroy-notify}
1472
@item @var{:map-notify}
1473
@item @var{:visibility-notify}
1475
@item @var{:enter-notify}
1476
@item @var{:map-request}
1480
@deftp {Type} event-mask '(or mask32 (list event-mask-class))
1481
Provides a way to specify a set of bits for an event bitmask. Two ways
1482
of specifying the bits are allowed: by setting the event bits in a 32
1483
bit mask, or by listing the keyword names of the event bits in a list.
1487
@deftp {Type} event-mask-class '(member event*)
1488
The elements of the type @var{event-mask-class} are keyword names
1489
that correspond to a particular bit in an event bitmask.
1491
@emph{event} -- One of the following:
1494
@item @var{:button-1-motion}
1495
@item @var{:enter-window}
1496
@item @var{:pointer-motion-hint}
1498
@item @var{:button-2-motion}
1499
@item @var{:exposure}
1500
@item @var{:property-change}
1502
@item @var{:button-3-motion}
1503
@item @var{:focus-change}
1504
@item @var{:resize-redirect}
1506
@item @var{:button-4-motion}
1507
@item @var{:key-press}
1508
@item @var{:structure-notify}
1510
@item @var{:button-5-motion}
1511
@item @var{:key-release}
1512
@item @var{:substructure-notify}
1514
@item @var{:button-motion}
1515
@item @var{:keymap-state}
1516
@item @var{:substructure-redirect}
1518
@item @var{:button-press}
1519
@item @var{:leave-window}
1520
@item @var{:visibility-change}
1522
@item @var{:button-release}
1523
@item @var{:owner-grab-button}
1525
@item @var{:colormap-change}
1526
@item @var{:pointer-motion}
1531
@defun make-event-keys event-mask
1532
Returns a list of @var{event-mask-class} keyword names for the event
1533
bits that are set in the specified event mask.
1537
An event mask (type @var{mask32}).
1543
@defun make-event-mask &rest keys
1547
@var{event-mask-class} keywords.
1550
Constructs an event mask from a set of @var{event-mask-class} keyword
1561
@deftp {Type} font '(satisfies font-p)
1564
A text font. @xref{Font and Characters}, for additional
1570
@deftp {Type} fontable '(or stringable font)
1572
A @var{fontable} is either a @var{font} object or the name of one of
1573
the fonts in the font database.
1578
@deftp {Type} font-props 'list
1580
A @var{list} that contains alternating keywords and integers.
1585
@deftp {Type} gcontext '(satisfies gcontext-p)
1588
A graphics context. @xref{Graphics Contexts}, for additional
1594
@deftp {Type} gcontext-key '(member type*)
1596
A list of predefined types for use in @var{gcontext}
1597
processing. Various information for graphics output is stored in a
1598
graphics context (GC or GContext), such as foreground pixel,
1599
background pixel, line width, clipping region, and so forth.
1601
@var{type} -- One of the following:
1604
@item @var{:arc-mode}
1605
@item @var{:exposures}
1606
@item @var{:line-width}
1608
@item @var{:background}
1609
@item @var{:fill-rule}
1610
@item @var{:plane-mask}
1612
@item @var{:cap-style :fill-style}
1613
@item @var{:stipple}
1615
@item @var{:clip-mask}
1617
@item @var{:subwindow-mode}
1620
@item @var{:foreground}
1624
@item @var{:function}
1627
@item @var{:dash-offset}
1628
@item @var{:join-style}
1632
@item @var{:line-style}
1636
@deftp {Type} grab-status '(member grab-type*)
1638
There are two kinds of grabs: active and passive. An @emph{active
1639
grab} occurs when a single client grabs the keyboard and/or pointer
1640
explicitly. Clients can also grab a particular keyboard key or pointer
1641
button in a window. The grab activates when the key or button is
1642
actually pressed, and is called a @emph{passive grab}. Passive grabs
1643
can be very convenient for implementing reliable pop-up menus.
1645
@var{grab-type} -- One of the following:
1649
@item @var{:already-grabbed}
1653
@item @var{:invalid-time}
1655
@item @var{:not-viewable}
1657
@item @var{:success}
1662
@deftp {Type} image-depth '(integer 0 32)
1663
Used in determining the depth of a pixmap, window, or image. The value
1664
specifies the number of bits deep that a given pixel has within a
1665
given pixmap, window, or image.
1669
@deftp {Type} index-size '(member :default 8 16)
1670
Used to control the element size of the destination buffer given to
1671
the translate function when drawing glyphs. If @var{:default} is
1672
specified, the size is based on the current font, if known; otherwise,
1677
@deftp {Type} int8 '(signed-byte 8)
1678
A signed integer value that is a maximum of eight bits long. A number
1679
of this type can have a range from -128 to 127.
1683
@deftp {Type} int16 '(signed-byte 16)
1685
A signed integer value that is a maximum of 16 bits long. A number of
1686
this type can have a range from -32,768 to 32,767.
1690
@deftp {Type} int32 '(signed-byte 32)
1691
A signed integer value that is a maximum of 32 bits long. A number of
1692
this type can have a range from -2,147,483,648 to 2,147,483,647.
1696
@deftp {Type} keysym 'card32
1697
Used as an encoding of a symbol on a keycap on a keyboard. It is an
1698
unsigned integer value represented in a maximum of 32 bits long. A
1699
@var{keysym} type can have a range from 0 to 4,294,967,295.
1703
@deftp {Type} mask16 ' card16
1704
A positional bitmask that contains 16 boolean flags.
1708
@deftp {Type} mask32 ' card32
1709
A positional bitmask that contains 32 boolean flags.
1713
@deftp {Type} modifier-key '(member modifier*)
1714
A keyword identifying one of the modifier keys on the keyboard device.
1716
@var{modifier} -- One of the following:
1725
@item @var{:control}
1734
@deftp {Type} modifier-mask '(or (member :any) mask16 (list modifier-key))
1735
A bitmask or list of keywords that specifies a set of modifier
1736
keys. The keyword @var{:any} is equivalent to any subset of modifier
1741
@deftp {Type} pixarray '(or (array pixel (* *)) (array card16 (* *)) (array card8 (* *)) (array (unsigned-byte 4) (* *)) (array bit (* *)))
1743
Specifies a two-dimensional array of pixels.
1749
@deftp {Type} pixel '(unsigned-byte 32)
1751
An unsigned integer value that is a maximum of 32 bits long. This
1752
gives a pixel type a value range from 0 to 4,294,967,295. Useful
1753
values are dependent on the class of colormap being used.
1758
@deftp {Type} pixmap '(satisfies pixmap-p)
1761
A @var{pixmap}, @pxref{Pixmaps}), for additional information.
1766
@deftp {Structure} pixmap-format
1768
A structure that describes the storage format of a pixmap.
1770
The @var{pixmap-format} structure contains slots for @var{depth},
1771
@var{bits-per-pixel}, and @var{scanline-pad}. The @var{depth} member
1772
indicates the number of bit planes in the pixmap. The
1773
@var{bits-per-pixel} member indicates the number of bits used to
1774
represent a single pixel. For X, a pixel can be 1, 4, 8, 16, 24, or 32
1775
bits wide. As for @var{bitmap-format}, the @var{scanline-pad} member
1776
indicates how many pixels are needed to pad the left edge of the
1780
@deftp {Slot of pixmap-format} depth
1782
Type: @var{image-depth}.
1784
The number of bit planes in the pixmap.
1788
@deftp {Slot of pixmap-format} bits-per-pixel
1791
Type: (@var{member} 1 4 8 16 24 32).
1793
The number of consecutive bits used to encode a single pixel. The
1798
@deftp {Slot of pixmap-format} scanline-pad
1800
Type: (@var{member} 8 16 32).
1802
The number of bits to left-pad the scan-line, which can be 8, 16, or
1803
32. The default is 8.
1806
@deftp {Type} point-seq '(repeat-seq (int16 x) (int16 y))
1808
The @var{point-seq} type is used to define sequences of
1809
(@var{x},@var{y}) pairs of points. The paired values are 16-bit,
1810
signed integer quantities. This gives the points in this type a range
1811
from -32,768 to 32,767.
1814
@deftp {Type} pointer-event-mask '(or mask32 (list pointer-event-mask-class))
1816
Provides a way to specify a set of bits for an event bitmask. Two ways
1817
of specifying the bits are allowed: by setting the event bits in a 32
1818
bit mask, or by listing the keyword names of the pointer related event
1824
@deftp {Type} pointer-event-mask-class '(member event*)
1826
A keyword name, for a pointer related event, that corresponds to a
1827
particular bit in an event bitmask. The set of names is a subset of
1828
the names in the type @var{event-mask-class}.
1830
@var{event} -- One of the following:
1834
@item @var{:button-1-motion}
1835
@item @var{:button-motion}
1836
@item @var{:leave-window}
1838
@item @var{:button-2-motion}
1839
@item @var{:button-press}
1840
@item @var{:pointer-motion}
1842
@item @var{:button-3-motion}
1843
@item @var{:button-release}
1844
@item @var{:pointer-motion-hint}
1846
@item @var{:button-4-motion}
1847
@item @var{:enter-window}
1849
@item @var{:button-5-motion}
1850
@item @var{:keymap-state}
1854
@deftp {Type} rect-seq '(repeat-seq (int16 x) (int16 y) (card16 width) (card16 height))
1856
@var{rect-seq} defines a four-tuple sequence of the form (@var{x},
1857
@var{y}, @var{width}, @var{height}). The points @var{x} and
1858
@var{y} are signed, 16-bit quantities with a range from -32,768 to
1859
32,767. The @var{width} and @var{height} values are unsigned, 16-bit
1860
quantities and range from 0 to 65,535.
1865
@deftp {Type} repeat-seq (&rest elts) 'sequence
1867
A subtype used to define repeating sequences.
1872
@deftp {Type} resource-id 'card29
1874
A numeric identifier that is assigned by the server to a server
1880
@deftp {Type} rgb-val '(float 0.0 1.0)
1882
An @var{rgb-val} is a floating-point value between 0 and 1 that
1883
specifies a saturation for a red, green, or blue additive primary. The
1884
0 value indicates no saturation and 1 indicates full saturation.
1888
@deftp {Type} screen '(satisfies screen-p)
1891
A display screen. @xref{Screens}, for further information.
1896
@deftp {Type} seg-seq '(repeat-seq (int16 x1) (int16 y1) (int16 x2) (int16 y2))
1898
Defines sequences of (@var{x1}, @var{y1}, @var{x2}, @var{y2}) sets
1899
of points. The point values are 16-bit, signed integer
1900
quantities. This gives the points in this type a range from -32,768 to
1906
@deftp {Type} state-mask-key '(or modifier-key (member button*))
1908
A keyword identifying one of the display modifier keys or pointer
1909
buttons whose state is reported in device events.
1911
@var{button} -- One of the following:
1914
@item @var{:button-1}
1915
@item @var{:button-4}
1916
@item @var{:button-2}
1917
@item @var{:button-5}
1918
@item @var{:button-3}
1923
@defun make-state-keys state-mask
1927
A 16-bit mask of type @var{mask16}.
1931
Returns a list of @var{state-mask-key} symbols corresponding to the
1932
@var{state-mask}. A symbol belongs to the returned list if, and only
1933
if, the corresponding @var{state-mask} bit is 1.
1936
@item state-keywords
1943
@defun make-state-mask &rest keys
1947
A list of @var{state-mask-key} symbols.
1950
Returns a 16-bit @var{mask} representing the given
1951
@var{state-mask-key} symbols. The returned @var{mask} contains a 1
1952
bit for each keyword.
1960
@deftp {Type} stringable '(or string symbol)
1962
Used for naming something. This type can be either a string or a
1963
@var{symbol} whose @var{symbol-name} is used as the string containing
1964
the name. The case of the characters in the string is ignored when
1965
comparing stringables.
1970
@deftp {Type} timestamp '(or null card32)
1972
An encoding of a time. @var{nil} stands for the current time.
1977
@deftp {Structure} visual-info
1979
A structure that represents a visual type. The elements of this
1980
structure are @var{id}, @var{class}, @var{red-mask}, @var{green-mask},
1981
@var{blue-mask}, @var{bits-per-rgb}, and @var{colormap-entries}.
1986
@deftp {Slot of visual-info} id
1990
A unique identification number.
1995
@deftp {Slot of visual-info} class
1997
Type: (member :direct-color :gray-scale :pseudo-color :static-color :static-gray :true-color).
1999
The class of the visual type.
2004
@deftp {Slots of visual-info} red-mask
2005
@deftpx {Slots of visual-info} green-mask
2006
@deftpx {Slots of visual-info} blue-mask
2010
The @var{red-mask}, @var{green-mask}, and @var{blue-mask} elements are
2011
only meaningful for the @var{:direct-color} and @var{:true-color}
2012
classes. Each mask has one contiguous set of bits with no
2017
@deftp {Slot of visual-info} bits-per-rgb
2021
Specifies the log base 2 of the approximate number of distinct color
2022
values ( individually) of red, green, and blue. Actual RGB values are
2023
unsigned 16-bit numbers.
2028
@deftp {Slot of visual-info} colormap-entries
2032
Defines the number of available colormap entries in a newly created
2033
colormap. For @var{:direct-color} and @var{:true-color}, this is the
2034
size of an individual pixel subfield.
2039
@deftp {Type} win-gravity '(member gravity*)
2041
A keyword that specifies how to reposition a window when its parent is
2044
@var{gravity} -- One of the following:
2048
@item @var{:north-west}
2056
@item @var{:south-east}
2059
@item @var{:north-east}
2060
@item @var{:south-west}
2063
If a parent window is reconfigured without changing its inside width
2064
or height, then all child windows move with the parent and are not
2065
changed. Otherwise, each child of the resized parent is moved,
2066
depending on the child's gravity attribute. See @var{window-gravity}
2067
(@pxref{Window Attributes})), for additional information.
2072
@deftp {Type} window '(satisfies window-p)
2075
A window. @xref{Windows and Pixmaps}, for additional
2081
@deftp {Type} xatom '(or string symbol)
2083
A name that has been assigned a corresponding unique ID by the
2084
server. @var{xatoms} are used to identify properties, selections, and
2085
types defined in the X server. An @var{xatom} can be either a
2086
@var{string} or @var{symbol} whose @var{symbol-name} is used as the
2087
@var{xatom} name. The case of the characters in the string are
2088
significant when comparing @var{xatoms}.
2092
@node Displays, Screens, Introduction to CLX, Top
2095
A particular X server, together with its screens and input devices, is
2096
called a @emph{display}. The CLX @var{display} object contains all the
2097
information about the particular display and its screens, as well as the
2098
state that is needed to communicate with the display over a particular
2101
Before your program can use a display, you must establish a connection to
2102
the X server driving your display. Once you have established a connection,
2103
you then can use the CLX macros and functions discussed in this section to
2104
return information about the display. This section discusses how to:
2107
@item Open (connect) a display
2108
@item Obtain information about a display
2109
@item Access and change display attributes
2110
@item Close (disconnect) a display
2114
* Opening the Display::
2115
* Display Attributes::
2116
* Managing the Output Buffer::
2117
* Closing the Display::
2120
@node Opening the Display, Display Attributes, Displays, Displays
2121
@section Opening the Display
2124
The @var{open-display} function is used to open a connection to an X
2127
@defun open-display host &key :display :protocol
2131
Specifies the name of the @emph{host} machine on which the server
2132
executes. A string must be acceptable as a @emph{host}, but otherwise
2133
the possible types are not constrained and will likely be very system
2137
An integer that specifies which display device on the @emph{host}
2138
should be used for this connection. This is needed since multiple
2139
displays can be controlled by a single X server. The default is
2143
A keyword argument that specifies which network protocol should be
2144
used for connecting to the server (for example, @var{:tcp},
2145
@var{:dna}, or @var{:chaos}). The set of possible values and the
2146
default value are implementation specific.
2150
Returns a @var{display} that serves as the connection to the X
2151
server and contains all the information about that X server.
2153
Authorization, if any, is assumed to come from the
2154
environment. After a successful call to @var{open-display}, all
2155
screens on the display can be used by the client application.
2165
@node Display Attributes, Managing the Output Buffer, Opening the Display, Displays
2166
@section Display Attributes
2168
The complete set of display attributes is discussed in the following
2171
@defun display-authorization-data display
2175
A @var{display} object.
2178
Returns the authorization data string for @var{display} that was
2179
transmitted to the server by @var{open-display} during connection
2180
setup. The data is specific to the particular authorization protocol
2181
that was used. The @var{display-authorization-name} function returns
2185
@item authorization-data
2191
@defun display-authorization-name display
2195
A @var{display} object.
2198
Returns the authorization protocol namestring for @var{display} that
2199
was transmitted by @var{open-display} to the server during connection
2200
setup. The @var{authorization-name} indicates what authorization
2201
protocol the client expects the server to use. Specification of valid
2202
authorization mechanisms is not part of the X protocol. A server that
2203
implements a different protocol than the client expects, or a server
2204
that only implements the host-based mechanism, can simply ignore this
2205
information. If both name and data strings are empty, this is to be
2206
interpreted as "no explicit authorization."
2209
@item authorization-name
2215
@defun display-bitmap-format display
2216
@anchor{display-bitmap-format}
2220
A @var{display} object.
2223
Returns the @emph{bitmap-format} information for the specified @emph{display}.
2227
Type @var{bitmap-format}.
2232
@defun display-byte-order display
2236
A @var{display} object.
2239
Returns the @var{byte-order} to be employed in communication with the
2240
server for the given @var{display}. The possible values are as
2245
Values are transmitted least significant byte first.
2247
Values are transmitted most significant byte first.
2250
Except where explicitly noted in the protocol, all 16-bit and 32-bit
2251
quantities sent by the client must be transmitted with this
2252
@var{byte-order}, and all 16-bit and 32-bit quantities returned by the
2253
server are transmitted with this @var{byte-order}.
2257
Either @var{:lsbfirst} or @var{:msbfirst}.
2262
@defun display-display display
2266
A @var{display} object.
2269
Returns the @var{display-number} for the host associated with
2273
@item display-number
2279
@defun display-error-handler display
2283
A @var{display} object.
2286
Returns and (with @code{setf}) sets the @var{error-handler} function
2287
for the given @var{display}. CLX calls (one of) the display error
2288
handler functions to handle server errors returned to the
2289
connection. The default error handler, @var{default-error-handler},
2290
signals conditions as they occur. @xref{Errors}, for a list of
2291
the conditions that CLX can signal. For more information about errors
2292
and error handling, refer to the section entitled Common Lisp
2293
Condition System in the @emph{Lisp Reference} manual.
2295
If the value of @var{error-handler} is a sequence, it is expected to
2296
contain a handler function for each specific error. The error code is
2297
used as an index into the sequence to fetch the appropriate handler
2298
function. If this element is a function, it is called for all
2299
errors. Any results returned by the handler are ignored since it is
2300
assumed the handler either takes care of the error completely or else
2301
signals. The arguments passed to the handler function are the
2302
@var{display} object, a symbol naming the type of error, and a set of
2303
keyword-value argument pairs that vary depending on the type of
2304
error. For all core errors, the keyword-value argument pairs are:
2306
@multitable @columnfractions 0.5 0.5
2307
@item @var{:current-sequence} @tab @var{card16}
2308
@item @var{:major} @tab @var{card8}
2309
@item @var{:minor} @tab @var{card16}
2310
@item @var{:sequence} @tab @var{card16}
2313
For @var{colormap}, @var{cursor}, @var{drawable}, @var{font},
2314
@var{gcontext}, @var{id-choice}, @var{pixmap}, and @var{window}
2315
errors, the keyword-value pairs are the core error pairs plus:
2317
@multitable @columnfractions 0.5 0.5
2318
@item @var{:resource-id} @tab @var{card32}
2321
For @var{:atom} errors, the keyword-value pairs are the core error
2324
@multitable @columnfractions 0.5 0.5
2325
@item @var{:atom-id} @tab @var{card32}
2328
For @var{:value} errors, the keyword-value pairs are the core error
2331
@multitable @columnfractions 0.5 0.5
2332
@item @var{:value} @tab @var{card32}
2337
Type @var{function} or @var{sequence}.
2342
@defun display-image-lsb-first-p display
2346
A @var{display} object.
2349
Although the server is generally responsible for byte swapping
2350
communication data to match the client, images (pixmaps/bitmaps) are
2351
always transmitted and received in formats (including byte order)
2352
specified by the server. Within images for each scan-line unit in
2353
bitmaps or for each pixel value in pixmaps, the leftmost bit in the
2354
image as displayed on the screen is either the least or most
2355
significant bit in the unit. For the given @var{display},
2356
@var{display-image-lsb-first-p} returns non-@var{nil} if the leftmost
2357
bit is the least significant bit; otherwise, it returns @var{nil}.
2360
@item image-lsb-first-p
2367
@defun display-keycode-range display
2371
A @var{display} object.
2374
Returns @var{min-keycode} and @var{max-keycode} as multiple
2375
values. See the @var{display-max-keycode} and
2376
@var{display-min-keycode} functions for additional information.
2387
@defun display-max-keycode display
2391
A @var{display} object.
2394
Returns the maximum keycode value for the specified
2395
@emph{display}. This value is never greater than 255. Not all keycodes
2396
in the allowed range are required to have corresponding keys.
2406
@defun display-max-request-length display
2410
A @var{display} object.
2413
Returns the maximum length of a request, in four-byte units, that is
2414
accepted by the specified @emph{display}. Requests larger than this
2415
generate a length error, and the server will read and simply discard
2416
the entire request. This length is always at least 4096 (that is,
2417
requests of length up to and including 16384 bytes are accepted by all
2421
@item max-request-length
2428
@defun display-min-keycode display
2432
A @var{display} object.
2435
Returns the minimum keycode value for the specified
2436
@var{display}. This value is never less than eight. Not all keycodes
2437
in the allowed range are required to have corresponding keys.
2447
@defun display-motion-buffer-size display
2451
A @var{display} object.
2454
Returns the approximate size of the motion buffer for the specified
2455
@var{display}. The server can retain the recent history of pointer
2456
motion at a finer granularity than is reported by @var{:motion-notify}
2457
events. Such history is available through the @var{motion-events}
2461
@item motion-buffer-size
2468
@defun display-p display
2475
Returns non-@var{nil} if @emph{display} is a @var{display} object;
2478
@defun display-pixmap-formats display
2482
A @var{display} object.
2485
Returns the list of @var{pixmap-format} values for the given
2486
@emph{display}. This list contains one entry for each depth value. The
2487
entry describes the format used to represent images of that depth. An
2488
entry for a depth is included if any screen supports that depth, and
2489
all screens supporting that depth must support (only) the format for
2493
@item pixmap-formats
2500
@defun display-plist display
2504
A @var{display} object.
2507
Returns and (with @code{setf}) sets the property list for the specified
2508
@emph{display}. This function provides a hook where extensions can add
2518
@defun display-protocol-major-version display
2522
A @var{display} object.
2525
Returns the major version number of the X protocol associated with the
2526
specified @emph{display}. In general, the major version would
2527
increment for incompatible changes. The returned protocol version
2528
number indicates the protocol the server actually supports. This might
2529
not equal the version supported by the client. The server can (but
2530
need not) refuse connections from clients that offer a different
2531
version than the server supports. A server can (but need not) support
2532
more than one version simultaneously.
2534
@item protocol-major-version
2541
@defun display-protocol-minor-version display
2545
A @var{display} object.
2548
Returns the minor protocol revision number associated with the
2549
specified @emph{display}. In general, the minor version would
2550
increment for small upward compatible changes in the X protocol.
2552
@item protocol-minor-version
2559
@defun display-protocol-version display
2563
A @var{display} object.
2566
Returns @emph{protocol-major-version} and
2567
@emph{protocol-minor-version} as multiple values. See the
2568
@var{display-protocol-major-version} and
2569
@var{display-protocol-minor-version} functions for additional
2573
@item protocol-major-version
2574
@itemx protocol-minor-version
2580
@defun display-resource-id-base display
2584
A @var{display} object.
2587
Returns the @emph{resource-id-base} value that was returned from the
2588
server during connection setup for the specified @emph{display}. This
2589
is used in combination with the @emph{resource-id-mask} to construct
2590
valid IDs for this connection.
2592
@item resource-id-base
2593
Type @var{resource-id}.
2599
@defun display-resource-id-mask display
2603
A @var{display} object.
2606
Returns the @emph{resource-id-mask} that was returned from the server
2607
during connection setup for the specified @emph{display}. The
2608
@emph{resource-id-mask} contains a single contiguous set of bits (at
2609
least 18) which the client uses to allocate resource IDs for types
2610
@var{window}, @var{pixmap}, @var{cursor}, @var{font}, @var{gcontext},
2611
and @var{colormap} by choosing a value with (only) some subset of
2612
these bits set, and @var{or}ing it with the
2613
@emph{resource-id-base}. Only values constructed in this way can be
2614
used to name newly created server resources over this
2615
connection. Server resource IDs never have the top three bits set. The
2616
client is not restricted to linear or contiguous allocation of server
2617
resource IDs. Once an ID has been freed, it can be reused, but this
2618
should not be necessary.
2621
An ID must be unique with respect to the IDs of all other server
2622
resources, not just other server resources of the same type. However,
2623
note that the value spaces of server resource identifiers, atoms,
2624
visualids, and keysyms are distinguished by context, and as such are
2625
not required to be disjoint (for example, a given numeric value might
2626
be both a valid window ID, a valid atom, and a valid keysym.)
2628
@item resource-id-mask
2629
Type @var{resource-id}.
2635
@defun display-roots display
2639
A @var{display} object.
2642
Returns a list of all the @var{screen} structures available for the
2643
given @emph{display}.
2652
@defun display-vendor display
2656
A @var{display} object.
2658
Returns @emph{vendor-name} and @emph{release-number} as
2659
multiple values. See the @var{display-vendor-name} and
2660
@var{display-release-number} functions for additional information.
2663
@itemx release-number
2669
@defun display-vendor-name display
2673
A @var{display} object.
2676
Returns a string that provides some vendor identification of the X
2677
server implementation associated with the specified @emph{display}.
2686
@defun display-version-number display
2690
A @var{display} object.
2693
Returns the X protocol version number for this implementation of CLX.
2695
@item version-number
2701
@defun display-xid display
2705
A @var{display} object.
2708
Returns the function that is used to allocate server resource IDs for
2709
this @emph{display}.
2711
@item resource-allocator
2712
Type @var{function}.
2718
@defmac with-display display &body body
2720
This macro is for use in a multi-process
2721
environment. @var{with-display} provides exclusive access to the local
2722
@var{display} object for multiple request generation. It need not
2723
provide immediate exclusive access for replies. That is, if another
2724
process is waiting for a reply (while not in a @var{with-display}),
2725
then synchronization need not (but can) occur immediately. Except
2726
where noted, all routines effectively contain an implicit
2727
@var{with-display} where needed, so that correct synchronization is
2728
always provided at the interface level on a per-call basis. Nested
2729
uses of this macro work correctly. This macro does not prevent
2730
concurrent event processing (@pxref{with-event-queue}).
2739
@node Managing the Output Buffer, Closing the Display, Display Attributes, Displays
2740
@section Managing the Output Buffer
2743
Most CLX functions cause output requests to be generated to an X
2744
server. Output requests are not transmitted immediately but instead
2745
are stored in an @emph{output buffer} for the appropriate
2746
display. Requests in the output buffer are typically sent only when
2747
the buffer is filled. Alternatively, buffered requests can be sent
2748
prior to processing an event in the input event queue
2749
(@pxref{Processing Events}). In either case, CLX sends the output
2750
buffer automatically without explicit instructions from the client
2753
However, in some cases, explicit control over the output buffer is
2754
needed, typically to ensure that the X server is in a consistent state
2755
before proceeding further. The @var{display-force-output} and
2756
@var{display-finish-output} functions allow a client program to
2757
synchronize with buffered output requests.
2759
@defun display-after-function display
2763
A @var{display} object.
2766
Returns and (with @code{setf}) sets the @emph{after-function} for the
2767
given @emph{display}. If @emph{after-function} is non-@var{nil}, it is
2768
a function that is called after every protocol request is generated,
2769
even those inside an explicit @var{with-display}, but never called
2770
from inside the @emph{after-function}. The function is called inside
2771
the effective @var{with-display} for the associated request. The
2772
default value is @var{nil}. This can be set, for example, to
2773
#'@var{display-force-output} or #' @var{display-finish-outpu}t.
2775
@item after-function
2776
Type @var{function} or @var{null}.
2782
@defun display-force-output display
2783
@anchor{display-force-output}
2787
A @var{display} object.
2790
Forces any buffered output to be sent to the X server.
2795
@defun display-finish-output display
2796
@anchor{display-finish-output}
2800
A @var{display} object.
2803
Forces any buffered output to be sent to the X server and then waits
2804
until all requests display error handler. Any events generated by
2805
output requests are read and stored in the event queue.
2809
@node Closing the Display, , Managing the Output Buffer, Displays
2810
@section Closing the Display
2812
To close or disconnect a display from the X server, use @var{close-display}.
2814
@defun close-display display
2818
A @var{display} object.
2821
Closes the connection to the X server for the specified
2822
@var{display}. It destroys all server resources (@var{window},
2823
@var{font}, @var{pixmap}, @var{colormap}, @var{cursor}, and
2824
@var{gcontext}), that the client application has created on this
2825
display, unless the close down mode of the server resource has been
2826
changed (@pxref{set-close-down-mode}). Therefore, these server
2827
resources should never be referenced again. In addition, this function
2828
discards any output requests that have been buffered but have not yet
2833
@node Screens, Windows and Pixmaps, Displays, Top
2837
* Screens and Visuals::
2838
* Screen Attributes::
2841
@node Screens and Visuals, Screen Attributes, Screens, Screens
2842
@section Screens and Visuals
2845
An X display supports graphical output to one or more
2846
@emph{screens}. Each screen has its own root window and window
2847
hierarchy. Each window belongs to exactly one screen and cannot
2848
simultaneously appear on another screen.
2851
The kinds of graphics hardware used by X screens can vary greatly in
2852
their support for color and in their methods for accessing raster
2853
memory. X uses the concept of a @emph{visual type} (usually
2854
referred to simply as a @emph{visual}) which uniquely identifies the
2855
hardware capabilities of a display screen. Fundamentally, a visual is
2856
represented by a @var{card29} integer ID, which uniquely identifies
2857
the visual type relative to a single display. CLX also represents a
2858
visual with a @var{visual-info} structure that contains other
2859
attributes associated with a visual (@pxref{Data Types}). A
2860
screen can support more than one depth (that is, pixel size), and for
2861
each supported depth, a screen may support more than one visual.
2862
However, it is more typical for a screen to have only a single depth
2863
and a single visual type.
2866
A visual represents various aspects of the screen hardware, as
2872
A screen can be color or gray-scale.
2875
A screen can have a colormap that is either writable or read-only.
2878
A screen can have a single colormap or separate colormaps for each of
2879
the red, green, and blue components. With separate colormaps, a pixel
2880
value is decomposed into three parts to determine indexes into each of
2881
the red, green, and blue colormaps.
2885
CLX supports the following classes of visual types:
2886
@var{:direct-color}, @var{:gray-scale}, @var{:pseudo-color},
2887
@var{:static-color}, @var{:static-gray}, and @var{:true-color}. The
2888
following tables show how the characteristics of a screen determine
2889
the class of its visual type.
2891
For screens with a single colormap:
2893
@multitable {} {Color} {Gray-Scale}
2894
@item Read-only @tab @var{:static-color} @tab @var{:static-gray}
2895
@item Writable @tab @var{:pseudo-color} @tab @var{:gray-scale}
2898
For screens with red, green, and blue colormaps:
2900
@multitable @columnfractions 0.3 0.3 0.3
2901
@item Read-only @tab @var{:true-color} @tab
2902
@item Writable @tab @var{:direct-color} @tab @var{:gray-scale}
2905
The visual class also indicates how screen colormaps are
2906
handled. @pxref{Colormaps and Colors}).
2908
@node Screen Attributes, , Screens and Visuals, Screens
2909
@section Screen Attributes
2911
In CLX, each display screen is represented by a @var{screen}
2912
structure. The @var{display-roots} function returns the list of
2913
@var{screen} structures for the display. The following paragraphs
2914
discuss the attributes of CLX @var{screen} structures.
2916
@defun screen-backing-stores screen
2923
Returns a value indicating when the @emph{screen} supports backing
2924
stores, although it may be storage limited in the number of windows it
2925
can support at once. The value returned can be one of @var{:always},
2926
@var{:never}, or @var{:when-mapped}.
2929
@item backing-stores-type
2930
One of @var{:always}, @var{:never}, or @var{:when-mapped}.
2936
@defun screen-black-pixel screen
2943
Returns the black pixel value for the specified @emph{screen}.
2953
@defun screen-default-colormap screen
2960
Returns the @emph{default-colormap} for the specified
2961
@emph{screen}. The @emph{default-colormap} is initially associated
2962
with the root window. Clients with minimal color requirements creating
2963
windows of the same depth as the root may want to allocate from this
2964
map by default. Most routine allocations of color should be made out
2968
@item default-colormap
2969
Type @var{colormap}.
2975
@defun screen-depths screen
2983
Returns an association list that specifies what drawable
2984
depths are supported on the specified @emph{screen}. Elements of the
2985
returned association list have the form (depth @emph{visual}*), where
2986
each @emph{visual} is a @var{visual-info} structure. Pixmaps are
2987
supported for each depth listed, and windows of that depth are
2988
supported if at least one visual type is listed for the depth. A
2989
pixmap depth of one is always supported and listed, but windows of
2990
depth one might not be supported. A depth of zero is never listed, but
2991
zero-depth @var{:input-only} windows are always supported.
3001
@defun screen-event-mask-at-open screen
3009
Returns the initial root event mask for the specified
3013
@item event-mask-at-open
3020
@defun screen-height screen
3028
Returns the @emph{height} of the specified @emph{screen} in
3039
@defun screen-height-in-millimeters screen
3047
Returns the height of the specified @emph{screen} in
3048
millimeters. The returned height can be used with the width in
3049
millimeters to determine the physical size and the aspect ratio of the
3053
@item height-in-millimeters
3060
@defun screen-max-installed-maps screen
3068
Returns the maximum number of colormaps that can be
3069
installed simultaneously with @var{install-colormap}.
3072
@item max-installed-colormaps
3079
@defun screen-min-installed-maps screen
3086
Returns the minimum number of colormaps that can be guaranteed to be
3087
installed simultaneously.
3090
@item min-installed-colormaps
3097
@defun screen-p screen
3105
Returns non-@code{nil} if the @emph{screen} argument is a
3110
@defun screen-plist screen
3118
Returns and (with @code{setf}) sets the property list for the
3119
specified @emph{screen}. This function provides a hook where
3120
extensions can add data.
3129
@defun screen-root screen
3137
Returns the @emph{root-window} for the specified
3138
@emph{screen}. This function is useful with functions that take a
3139
parent window as an argument. The class of the root window is always
3140
@var{:input-output}.
3144
Type @var{window} or @var{null}.
3150
@defun screen-root-depth screen
3157
Returns the depth of the root window for the specified
3158
@emph{screen}. Other depths can also be supported on this
3162
@item root-window-depth
3163
Type @var{image-depth}.
3169
@defun screen-root-visual screen
3177
Returns the default visual type for the root window for the
3178
specified @emph{screen}.
3181
@item root-window-visual
3188
@defun screen-save-unders-p screen
3196
If true, the server can support the save-under mode in
3197
@var{create-window} and in changing window attributes.
3207
@defun screen-white-pixel screen
3215
Returns the white pixel value for the specified
3226
@defun screen-width screen
3234
Returns the width of the specified @emph{screen} in pixel
3245
@defun screen-width-in-millimeters screen
3253
Returns the width of the specified @emph{screen} in millimeters. The
3254
returned width can be used with the height in millimeters to determine
3255
the physical size and the aspect ratio of the screen.
3258
@item width-in-millimeters
3265
@node Windows and Pixmaps, Graphics Contexts, Screens, Top
3266
@chapter Windows and Pixmaps
3270
* Creating Windows::
3271
* Window Attributes::
3273
* Window Hierarchy::
3275
* Destroying Windows::
3279
@node Drawables, Creating Windows, Windows and Pixmaps, Windows and Pixmaps
3282
Both windows and pixmaps can be used as sources and destinations in
3283
graphics operations. These are collectively known as
3284
@emph{drawables}. The following functions apply to both windows and
3287
@defun drawable-display drawable
3291
A @var{drawable} object.
3294
Returns the display for the specified @emph{drawable}.
3298
@defun drawable-equal drawable-1 drawable-2
3303
@var{drawable} objects.
3306
Returns true if the two arguments refer to the same server resource,
3307
and @var{nil} if they do not.
3312
@defun drawable-id drawable
3316
A @var{drawable} object.
3319
Returns the unique resource ID assigned to the specified
3324
Type @var{resource-id}.
3329
@defun drawable-p drawable
3336
Returns true if the argument is a @var{drawable} and @var{nil}
3341
@defun drawable-plist drawable
3348
Returns and (with @code{setf}) sets the property list for the specified
3349
@emph{drawable}. This function provides a hook where extensions can
3354
@node Creating Windows, Window Attributes, Drawables, Windows and Pixmaps
3355
@section Creating Windows
3358
A window is a @var{drawable} that can also receive input events. CLX
3359
represents a window with a @var{window} object. The
3360
@var{create-window} function creates a new @var{window} object.
3362
@defun create-window &key :parent :x :y :width :height (:depth 0) (:border-width 0) (:class :copy) (:visual :copy) :background :border :gravity :bit-gravity :backing-store :backing-planes :backing-pixel :save-under :event-mask :do-not-propagate-mask :override-redirect :colormap :cursor
3363
@anchor{create-window}
3367
The parent window. This argument is required.
3371
@var{int16} coordinates for the outside upper-left corner of the new
3372
window with respect to the origin (inside upper-left corner) of the
3373
@var{:parent}. These arguments are required.
3378
@var{card16} values for the size of the new window. These arguments
3383
A @var{card16} specifying the depth of the new window.
3387
One of @var{:input-outpu}t, @var{:input-only}, or @var{:copy}.
3391
A @var{card29} ID specifying the visual type of the new window.
3394
@itemx :backing-pixel
3395
@itemx :backing-planes
3396
@itemx :backing-store
3399
@itemx :border-width
3402
@itemx :do-not-propagate-mask
3405
@itemx :override-redirect
3408
Initial attribute values for the new window. If @var{nil}, the default
3409
value is defined by the X protocol.See paragraph
3412
Creates and returns a window. A @var{:parent} window must be
3413
specified; the first window created by a client will have a root
3414
window as its @var{:parent}. The new window is initially unmapped and
3415
is placed on top of its siblings in the stacking order. A
3416
@var{:create-notify} event is generated by the server.
3418
The @var{:class} of a window can be @var{:input-output} or
3419
@var{:input-only}. Windows of class @var{:input-only} cannot be used
3420
as the destination drawable for graphics output and can never receive
3421
@var{:exposure} events, but otherwise operate the same as
3422
@var{:input-output} windows. The @var{:class} can also be @var{:copy},
3423
in which case the new window has the same class as its @var{:parent}.
3425
For an @var{:input-output} window, the @var{:visual} and @var{:depth}
3426
must be a combination supported by the @var{:parent}'s screen, but the
3427
@var{:depth} need not be the same as the @var{:parent}'s. The
3428
@var{:parent} of an @var{:input-output} window must also be
3429
@var{:input-output}. A @var{:depth} of 0 means that the depth of the
3430
@var{:parent} is used.
3432
For an @var{:input-only} window, the @var{:depth} must be zero, and
3433
the @var{:visual} must be supported by the @var{:parent}'s screen. The
3434
@var{:parent} of an @var{:input-only} window can be of any class. The
3435
only attributes that can be given for an @var{:input-only} window are
3436
@var{:cursor}, @var{:do-not-propagate-mask}, @var{:event-mask},
3437
@var{:gravity}, and @var{:override-redirect}.
3446
@node Window Attributes, Stacking Order, Creating Windows, Windows and Pixmaps
3447
@section Window Attributes
3450
The following paragraphs describe the CLX functions used to return or
3451
change window attributes. Using the @var{with-state} macro improves
3452
the performance of attribute access by batching related accesses in
3453
the minimum number of server requests.
3455
@defun drawable-border-width drawable
3459
A @var{drawable} object.
3462
Returns the @emph{border-width} of the @emph{drawable} in pixels. It
3463
always returns zero if the @emph{drawable} is a pixmap or an
3464
@var{:input-only} window. Used with @code{setf}, this function also
3465
changes the border width of the @var{:input-only} window. The default
3466
border width of a new window is zero.
3468
Changing just the border width leaves the outer left corner of a
3469
window in a fixed position but moves the absolute position of the
3470
window's origin. It is an error to make the border width of an
3471
@var{:input-only} window nonzero.
3473
When changing the border-width of a window, if the override-redirect
3474
attribute of the window is @var{:off} and some other client has
3475
selected @var{:substructure-redirect} on the parent, a
3476
@var{:configure-request} event is generated, and no further processing
3477
is performed. Otherwise, the border-width is changed.
3487
@defun drawable-depth drawable
3491
A @var{drawable} object.
3494
Returns the depth of the specified @emph{drawable} (bits per pixel).
3504
@defun drawable-height drawable
3514
@defun drawable-width drawable
3518
A @var{drawable} object.
3521
These functions return the height or width of the
3522
@emph{drawable}. These coordinates define the inside size of the
3523
@emph{drawable}, in pixels. Used with @code{setf}, these functions also
3524
change the inside height or width of a window. However, the height or
3525
width of a pixmap cannot be changed.
3527
Changing the width and height resizes a window without changing its
3528
position or stacking priority.
3530
Changing the size of a mapped window may cause the window to lose its
3531
contents and generate an @var{:exposure} event. If a mapped window is
3532
made smaller, @var{:exposure} events are generated on windows that it
3535
When changing the size of a window, if the override-redirect attribute
3536
of the window is @var{:off} and some other client has selected
3537
@var{:substructure-redirect} on the parent, a @var{:configure-request}
3538
event is generated, and no further processing is performed. Otherwise,
3539
if another client has selected @var{:resize-redirect} on the window, a
3540
@var{:resize-request} event is generated, and the current inside width
3541
and height are maintained. Note that the override-redirect attribute
3542
of the window has no effect on @var{:resize-redirect} and that
3543
@var{:substructure-redirect} on the parent has precedence over
3544
@var{:resize-redirect} on the window.
3546
When the inside size of the window is changed, the children of the
3547
window can move according to their window gravity. Depending on the
3548
window's bit gravity, the contents of the window can also be moved.
3558
@defun drawable-x drawable
3568
@defun drawable-y drawable
3572
A @var{drawable} object.
3575
These functions return the x or y coordinate of the specified
3576
@emph{drawable}. They always return zero if the @emph{drawable} is a
3577
pixmap. These coordinates define the location of the top left pixel of
3578
the window's border or of the window, if it has no border. Used with
3579
@code{setf}, these functions also change the x or y coordinate of a
3580
window. However, the x or y coordinate of a pixmap cannot be changed.
3582
Changing the x and y coordinates moves a window without changing its
3583
size or stacking priority. Moving a mapped window generates
3584
@var{:exposure} events on any formerly obscured windows.
3586
When changing the position of a window, if the override-redirect
3587
attribute of the window is @var{:off} and some other client has
3588
selected @var{:substructure-redirect} on the parent, a
3589
@var{:configure-request} event is generated, and no further processing
3590
is performed. Otherwise, the window is moved.
3600
@defun window-all-event-masks window
3607
Returns the inclusive-or of the event masks selected on the
3608
specified @emph{window} by all clients.
3610
@item all-event-masks
3617
@defun setf (window-background) window background
3623
Either a @var{pixel}, a @var{pixmap}, @var{:none}, or @var{:parent-relative}.
3626
Changes the @emph{background} attribute of the @emph{window} to the
3627
specified value. This operation is not allowed on an @var{:input-only}
3628
window. Changing the background does not cause the window contents to
3629
be changed. Note that the background of a window cannot be returned
3630
from the X server. The default background of a new window is
3633
In general, the server automatically fills in exposed areas of the
3634
window when they are first made visible. A background pixmap is tiled
3635
to fill each area. However, if the background is @var{:none}, the
3636
server will not modify exposed areas. If the background is
3637
@var{:parent-relative}, the window and its parent must have the same
3638
depth. In this case, the window shares the same background as its
3639
parent. The parent's background is not copied and is reexamined
3640
whenever the window's background is required. If the background is
3641
@var{:parent-relative}, the background pixmap tile origin is the same
3642
as the parent's; otherwise, the tile origin is the window origin.
3646
Either a @var{pixel}, a @var{pixmap}, @var{:none}, or @var{:parent-relative}.
3652
@defun window-backing-pixel window
3659
Returns and (with @code{setf}) changes the value of the backing-pixel
3660
attribute for the specified @emph{window}. Changing the backing-pixel
3661
attribute of a mapped window may have no immediate effect. The default
3662
backing-pixel of a new window is zero.
3672
@defun window-backing-planes window
3679
Returns and (with @code{setf}) changes the value of the backing-planes
3680
attribute for the specified @emph{window}. Changing the backing-planes
3681
attribute of a mapped window may have no immediate effect. The default
3682
backing-planes of a new window is all one's.
3685
@item backing-planes
3692
@defun window-backing-store window
3699
Returns and (with @code{setf}) changes the value of the backing-store
3700
attribute for the specified @emph{window}. Changing the backing-store
3701
attribute of an obscured window to @var{:when-mapped} or @var{:always}
3702
may have no immediate effect. The default backing-store of a new
3703
window is @var{:not-useful}.
3706
@item backing-store-type
3707
One of @var{:always}, @var{:not-useful}, or @var{:when-mapped}.
3713
@defun window-bit-gravity window
3720
Returns and (with @code{setf}) changes the bit-gravity attribute of the
3721
@emph{window}. If a window is reconfigured without changing its inside
3722
width or height, the contents of the window move with the window and
3723
are not lost. Otherwise, the contents of the resized window are either
3724
moved or lost, depending on its bit-gravity attribute. The default
3725
bit-gravity of a new window is @var{:forget}.
3727
For example, suppose a window's size is changed by @emph{W} pixels
3728
in width and @emph{H} pixels in height. The following table shows,
3729
for each bit-gravity value, the change in position (relative to the
3730
window origin) that results for each pixel of the window contents.
3732
@multitable {Bit-Gravity} {X Change} {Y Change}
3733
@item @var{:center} @tab @emph{W/}2 @tab @emph{H/}2
3734
@item @var{:east} @tab @emph{W} @tab @emph{H/}2
3735
@item @var{:north} @tab @emph{W/}2 @tab 0
3736
@item @var{:north-east} @tab @emph{W} @tab 0
3737
@item @var{:north-west} @tab 0 @tab 0
3738
@item @var{:south} @tab @emph{W/}2 @tab @emph{H}
3739
@item @var{:south-east} @tab W @tab H
3740
@item @var{:south-west} @tab 0 @tab H
3741
@item @var{:west} @tab 0 @tab H/2
3745
A @var{:static} bit-gravity indicates the contents or window should
3746
not move relative to the origin of the root window.
3748
A server can choose to ignore the specified bit-gravity attribute
3749
and use @var{:forget} instead. A @var{:forget} bit-gravity
3750
attribute indicates that the window contents are always discarded
3751
after a size change, even if backing-store or save-under attributes
3752
are @var{:on}. The window's background is displayed (unless it is
3753
@var{:none}), and zero or more @var{:exposure} events are
3757
Type @var{bit-gravity}.
3763
@defun setf (window-border) window border
3769
Either a @var{pixel}, a @var{pixmap}, or @var{:copy}.
3772
Changes the @emph{border} attribute of the @emph{window} to the
3773
specified value. This operation is not allowed on an
3774
@var{:input-only} window. Changing the border attribute also causes
3775
the window border to be repainted. Note that the border of a window
3776
cannot be returned from the X server. The default border of a new
3777
window is @var{:copy}.
3779
A border pixmap is tiled to fill the border. The border pixmap tile
3780
origin is the same as the background tile origin. A border pixmap
3781
and the window must have the same root and depth. If the border is
3782
@var{:copy}, the parent's border is copied and used; subsequent
3783
changes to the parent's border do not affect the window border.
3786
Either a @var{pixel}, a @var{pixmap}, or @var{:copy}.
3792
@defun window-class window
3799
Returns the @emph{class} of the specified @emph{window}.
3802
Either @var{:input-output} or @var{:input-only}.
3808
@defun window-colormap window
3815
Returns and (with @code{setf}) changes the value of the colormap
3816
attribute for the specified @emph{window}. A value of @var{:copy} is
3817
never returned, since the parent's colormap attribute is actually
3818
copied, but the attribute can be set to @var{:copy} in a @code{setf}
3819
form. Changing the colormap of a window (defining a new map, not
3820
changing the contents of the existing map) generates a
3821
@var{:colormap-notify} event. Changing the colormap of a visible
3822
window may have no immediate effect on the screen
3823
(@pxref{install-colormap}). The default colormap of a new window is
3827
Type @var{colormap} or @var{null}.
3833
@defun window-colormap-installed-p window
3840
Returns non-@var{nil} if the colormap associated with this
3841
@emph{window} is installed. Otherwise, this function returns
3844
@item colormap-installed-p
3851
@defun setf (window-cursor) window cursor
3857
Either @var{cursor} or @var{:none}.
3860
Changes the @emph{cursor} attribute of the @emph{window} to the
3861
specified value. Changing the cursor of a root window to @var{:none}
3862
restores the default cursor. Note that the cursor of window cannot be
3863
returned from the X server. The default cursor of a new window is
3868
Type @var{cursor} or @var{:none}.
3874
@defun window-display window
3881
Returns the @var{display} object associated with the specified
3891
@defun window-do-not-propagate-mask window
3898
Returns and (with @code{setf}) changes the do-not-propagate-mask
3899
attribute for the window. The default do-not-propagate-mask of a new
3902
If a window receives an event from one of the user input devices, and
3903
if no client has selected to receive the event, the event can instead
3904
be propagated up the window hierarchy to the first ancestor for which
3905
some client has selected it. However, any event type selected by the
3906
do-not-propagate-mask is not be propagated. The types of events that
3907
can be selected by the do-not-propagate-mask are those of type
3908
@var{device-event-mask-class}. @xref{Selecting Events}.
3910
@item do-not-propagate-mask
3917
@defun window-equal window-1 window-2
3922
The windows to compare for equality.
3925
Returns non-@var{nil} if the two arguments are the same window, and
3926
@var{nil} if they are not.
3935
@defun window-event-mask window
3942
Returns and (with @code{setf}) changes the value of the event-mask
3943
attribute for the @emph{window}. The default event-mask of a new
3953
@defun window-gravity window
3960
Returns and (with @code{setf}) changes the gravity attribute of the
3961
@emph{window}. If a parent window is reconfigured without changing its
3962
inside width or height, then all child windows move with the parent
3963
and are not changed. Otherwise, each child of the resized parent is
3964
moved, depending on the child's gravity attribute. The default gravity
3965
of a new window is @var{:north-west}.
3967
For example, suppose the size of the window's parent is changed by
3968
@emph{W} pixels in width and @emph{H} pixels in height. The following
3969
table shows, for each possible gravity value, the resulting change in
3970
the window's position relative to its parent's origin. When the window
3971
is moved, two events are generated--a @var{:configure-notify} event
3972
followed by a @var{:gravity-notify} event.
3974
@multitable {Gravity} {X Change} {Y Change}
3975
@item @var{:center} @tab @emph{W/}2 @tab @emph{H/}2
3976
@item @var{:east} @tab @emph{W} @tab @emph{H/}2
3977
@item @var{:north} @tab @emph{W/}2 @tab 0
3978
@item @var{:north-east} @tab @emph{W} @tab 0
3979
@item @var{:north-west} @tab 0 @tab 0
3980
@item @var{:south} @tab @emph{W/}2 @tab @emph{H}
3981
@item @var{:south-east} @tab W @tab H
3982
@item @var{:south-west} @tab 0 @tab H
3983
@item @var{:west} @tab 0 @tab H/2
3987
A @var{:static} gravity indicates that the position of the window
3988
should not move relative to the origin of the root window.
3990
An @var{:unmap} gravity is like @var{:north-west}, except the window
3991
is also unmapped and an @var{:unmap-notify} event is generated. This
3992
@var{:unmap-notify} event is generated after the
3993
@var{:configure-notify} event is generated for the parent.
3996
Type @var{win-gravity}.
4002
@defun window-id window
4009
Returns the unique ID assigned to @emph{window}.
4012
Type @var{resource-id}.
4018
@defun window-map-state window
4025
Returns the map state of @emph{window}. A window is @var{:unviewable}
4026
if it is mapped but some ancestor is unmapped.
4029
One of @var{:unmapped}, @var{:unviewable}, or @var{:viewable}.
4035
@defun window-override-redirect window
4042
Returns and (with @code{setf}) changes the value of the
4043
override-redirect attribute for @emph{window}. The default
4044
override-redirect of a new window is @var{:off}.
4046
The override-redirect attribute determines whether or not attempts to
4047
change window geometry or parent hierarchy can be @emph{redirected} by
4048
a window manager or some other client. The functions that might be
4049
affected by the override-redirect attribute are
4050
@var{circulate-window-down}, @var{circulate-window-up},
4051
@var{drawable-border-width}, @var{drawable-height},
4052
@var{drawable-width}, @var{drawable-x}, @var{drawable-y},
4053
@var{map-window}, and @var{window-priority}.
4055
@item override-redirect
4056
Either @var{:on} or @var{:off}.
4062
@defun window-p object
4069
Returns non-@var{nil} if the @emph{object} argument is a window; otherwise, it returns @var{nil}.
4072
@defun window-plist window
4079
Returns and (with @code{setf}) sets the property list for the specified
4080
@emph{window}. This function provides a hook where extensions can hang
4091
@defun setf (window-priority window) (&optional sibling) mode
4098
An optional argument specifying that @emph{window} is to be restacked
4099
relative to this sibling @var{window}.
4102
One of @var{:above}, @var{:below}, @var{:bottom-if}, @var{:opposite}, or @var{:top-if}.
4105
Changes the stacking priority element of the @emph{window} to the
4106
specified value. It is an error if the @emph{sibling} argument is
4107
specified and is not actually a sibling of the window. Note that the
4108
priority of an existing window cannot be returned from the X server.
4110
When changing the priority of a window, if the override-redirect
4111
attribute of the window is @var{:off} and some other client has
4112
selected :substructure-redirect on the parent, a :configure-request
4113
event is generated, and no further processing is
4114
performed. Otherwise, the priority is changed.
4117
One of @var{:above}, @var{:below}, @var{:bottom-if}, @var{:opposite}, or @var{:top-if}.
4123
@defun window-save-under window
4130
Returns and (with @code{setf}) changes the value of the save-under
4131
attribute for the specified @emph{window}. Changing the save-under
4132
attribute of a mapped window may have no immediate effect.
4135
Either @var{:on} or @var{:off}.
4140
@defun window-visual window
4147
Returns the @emph{visual-type} associated with the specified @emph{window}.
4157
@defmac with-state drawable &body body
4160
Batches successive read and write accesses to window attributes and
4161
drawable geometry, in order to minimize the number of requests sent to
4162
the server. Batching occurs automatically within the dynamic extent of
4163
the @emph{body}. The @emph{body} is not executed within a
4164
@var{with-display} form.
4166
All window attributes can be returned or changed in a single
4167
request. Similarly, all drawable geometry values can be returned or
4168
changed in a single request. @var{with-state} combines accesses to
4169
these values into the minimum number of server requests necessary to
4170
guarantee that each read access returns the current server state of
4171
the @emph{drawable}. The number of server requests sent depends on
4172
the sequence of calls to reader and @code{setf} functions within the
4173
dynamic extent of the @emph{body}. There are two groups of reader and
4174
@code{setf} functions--the Window Attributes group and the Drawable
4175
Geometry group--as shown in Table 4-1.
4177
@multitable {Group} {Reader Functions} {Setf Functions}
4179
@item Window Attributes @tab @var{window-all-event-masks} @tab @var{window-background}
4181
@item @tab @var{window-backing-pixel} @tab @var{window-backing-pixel}
4182
@item @tab @var{window-backing-planes} @tab @var{window-backing-planes}
4183
@item @tab @var{window-backing-store} @tab @var{window-backing-store}
4184
@item @tab @var{window-bit-gravity} @tab @var{window-bit-gravity}
4185
@item @tab @var{window-class} @tab @var{window-border}
4186
@item @tab @var{window-colormap} @tab @var{window-colormap}
4187
@item @tab @var{window-colormap-installed-p} @tab @var{window-cursor}
4188
@item @tab @var{window-do-not-propagate-mask} @tab @var{window-do-not-propagate-mask}
4189
@item @tab @var{window-event-mask} @tab @var{window-event-mask}
4190
@item @tab @var{window-gravity} @tab @var{window-gravity}
4191
@item @tab @var{window-map-state} @tab
4192
@item @tab @var{window-override-redirect} @tab @var{window-override-redirect}
4193
@item @tab @var{window-save-under} @tab @var{window-save-under}
4194
@item @tab @var{window-visual} @tab
4196
@item Drawable Geometry @tab @var{drawable-border-width} @tab @var{drawable-border-width}
4198
@item @tab @var{drawable-depth} @tab @var{drawable-height}
4199
@item @tab @var{drawable-height} @tab @var{drawable-width}
4200
@item @tab @var{drawable-root} @tab @var{drawable-x}
4201
@item @tab @var{drawable-width} @tab @var{drawable-y}
4202
@item @tab @var{drawable-x} @tab @var{window-priority}
4203
@item @tab @var{drawable-y} @tab
4208
The results from a sequence of calls to @code{setf} functions in a
4209
given group are cached and sent in a single server request, either
4210
upon exit from the @emph{body} or when a reader function from the
4211
corresponding group is called.
4213
@var{with-state} sends a single request to update all its cached
4214
values for the @emph{drawable} before the first call to a reader
4215
function within the @emph{body} and also before the first call to a
4216
reader function following a sequence of calls to @code{setf} functions
4217
from the corresponding group.
4223
The forms in which attributes accesses are batched.
4229
@node Stacking Order, Window Hierarchy, Window Attributes, Windows and Pixmaps
4230
@section Stacking Order
4233
Sibling windows can @emph{stack} on top of each other. Windows above
4234
can @emph{obscure} or @emph{occlude} lower windows. This relationship
4235
between sibling windows is known as the stacking order. The
4236
@var{window-priority} function can be used to change the stacking
4237
order of a single window. CLX also provides functions to raise or
4238
lower children of a window. Raising a mapped window can generate
4239
@var{:exposure} events for the window and any mapped subwindows that
4240
were formerly obscured. Lowering a mapped window can generate
4241
@var{:exposure} events on any windows it formerly obscured.
4243
@defun circulate-window-down window
4250
Lowers the highest mapped child of the specified @emph{window} that
4251
partially or completely occludes another child to the bottom of the
4252
stack. Completely unobscured children are unaffected. Exposure
4253
processing is performed on formerly obscured windows.
4255
If some other client has selected @var{:substructure-redirect} on the
4256
@emph{window}, a @var{:circulate-request} event is generated, and no
4257
further processing is performed. Otherwise, the child window is
4258
lowered and a @var{:circulate-notify} event is generated if the
4259
@emph{window} is actually restacked.
4264
@defun circulate-window-up window
4271
Raises the lowest mapped child of the specified @emph{window} that is
4272
partially or completely occluded by another child to the top of the
4273
stack. Completely unobscured children are unaffected. Exposure
4274
processing is performed on formerly obscured windows.
4276
If another client has selected @var{:substructure-redirect} on the
4277
@emph{window}, a @var{:circulate-request} event is generated, and no
4278
further processing is performed. Otherwise, the child window is raised
4279
and a @var{:circulate-notify} event is generated if the @emph{window}
4280
is actually restacked.
4284
@node Window Hierarchy, Mapping Windows, Stacking Order, Windows and Pixmaps
4285
@section Window Hierarchy
4288
All the windows in X are arranged in a strict hierarchy. At the top of
4289
the hierarchy are the root windows, which cover the display
4290
screens. Each root window is partially or completely covered by its
4291
child windows. All windows, except for root windows, have
4292
parents. Child windows can have their own children. In this way, a
4293
tree of arbitrary depth on each screen can be created. CLX provides
4294
several functions for examining and modifying the window hierarchy.
4296
@defun drawable-root drawable
4303
Returns the root window of the specified @emph{drawable}.
4312
@defun query-tree window &key (:result-type `list)
4318
A valid type specifier for a sub-type of @var{sequence}. The default is a @var{list}.
4321
Returns the @emph{children} windows, the @emph{parent} window, and the
4322
@emph{root} window for the specified @emph{window}. The children are
4323
returned as a sequence of windows in current stacking order, from
4324
bottom-most (first) to top-most (last). The @var{:result-type}
4325
specifies the type of children sequence returned.
4329
Type @var{sequence} of @var{window}.
4331
Type @var{window} or @var{null}.
4339
@defun reparent-window window parent x y
4345
The new parent @var{window}.
4348
The position (type @var{int16}) of the @emph{window} in its new
4349
@emph{parent}. These coordinates are relative to the @emph{parent}'s
4350
origin, and specify the new position of the upper, left, outer corner
4351
of the @emph{window}.
4354
Changes a @emph{window}'s @emph{parent} within a single
4355
screen. There is no way to move a window between screens.
4357
The specified @emph{window} is reparented by inserting it as a child
4358
of the specified @emph{parent}. If the @emph{window} is mapped, an
4359
@var{unmap-window} operation is automatically performed on the
4360
specified @emph{window}. The @emph{window} is then removed from its
4361
current position in the hierarchy and inserted as the child of the
4362
specified @emph{parent}. The @emph{window} is placed on top in the
4363
stacking order with respect to sibling windows.
4365
After reparenting the specified @emph{window,} a
4366
@var{:reparent-notify} event is generated. The override-redirect
4367
attribute of the @emph{window} is passed on in this event. Window
4368
manager clients normally should ignore this event if this attribute is
4369
@var{:on}. @xref{Events and Input}, for more information on
4370
@var{:reparent-notify} event processing. Finally, if the specified
4371
@emph{window} was originally mapped, a @var{map-window} operation is
4372
automatically performed on it.
4374
The X server performs normal exposure processing on formerly obscured
4375
windows. It might not generate @var{:exposure} events for regions from
4376
the initial @var{unmap-window} operation if they are immediately
4377
obscured by the final @var{map-window} operation.
4379
It is an error if any of the following are true:
4384
The new @emph{parent} window is not on the same screen as the old parent window.
4387
The new @emph{parent} window is the specified @emph{window} or an
4388
inferior of the specified @emph{window}.
4391
The specified @emph{window} has a @var{:parent-relative} background
4392
attribute and the new @emph{parent} window is not the same depth as
4393
the specified @emph{window}.
4400
@defun translate-coordinates source source-x source-y destination
4404
A @var{window} defining the source coordinate system.
4408
Coordinates (@var{int16}) relative to the origin of the @emph{source}
4412
A @var{window} defining the destination coordinate system.
4416
Returns the position defined by @emph{source-x} and @emph{source-y}
4417
(relative to the origin of the @emph{source} window), expressed as
4418
coordinates relative to the origin of the @emph{destination} window.
4422
Type @var{int16} or @var{null}.
4424
Type @var{int16} or @var{null}.
4425
@item destination-child
4426
Type @var{window} or @var{null}.
4432
@node Mapping Windows, Destroying Windows, Window Hierarchy, Windows and Pixmaps
4433
@section Mapping Windows
4435
A window is considered mapped if a @var{map-window} call has been made
4436
on it. When windows are first created, they are not mapped because an
4437
application may wish to create a window long before it is mapped to
4438
the screen. A mapped window may not be visible on the screen for one
4439
of the following reasons:
4443
@item It is obscured by another opaque sibling window.
4444
@item One of its ancestors is not mapped.
4445
@item It is entirely clipped by an ancestor.
4450
A subwindow will appear on the screen as long as all of its ancestors
4451
are mapped and not obscured by a sibling or clipped by an
4452
ancestor. Mapping a window that has an unmapped ancestor does not
4453
display the window, but marks it as eligible for display when the
4454
ancestor becomes mapped. Such a window is called unviewable. When all
4455
its ancestors are mapped, the window becomes viewable and remains
4456
visible on the screen if not obscured by any sibling or ancestor.
4458
Any output to a window not visible on the screen is
4459
discarded. @var{:exposure} events are generated for the window when
4460
part or all of it becomes visible on the screen. A client only
4461
receives the @var{:exposure} events if it has selected them. Mapping
4462
or unmapping a window does not change its stacking order priority.
4464
@defun map-window window
4472
Maps the @emph{window}. This function has no effect when the
4473
@emph{window} is already mapped.
4475
If the override-redirect attribute of the @emph{window} is @var{:off}
4476
and another client has selected @var{:substructure-redirect} on the
4477
parent window, the X server generates a @var{:map-request} event and
4478
the @var{map-window} function does not map the
4479
@emph{window}. Otherwise, the @emph{window} is mapped, and the X
4480
server generates a @var{:map-notify} event.
4482
If the @emph{window} becomes visible and no earlier contents for it
4483
are remembered, @var{map-window} tiles the window with its
4484
background. If no background was defined for the window, the existing
4485
screen contents are not altered, and the X server generates one or
4486
more @var{:exposure} events. If a backing-store was maintained while
4487
the window was unmapped, no @var{:exposure} events are generated. If a
4488
backing-store will now be maintained, a full window exposure is always
4489
generated. Otherwise, only visible regions may be reported. Similar
4490
tiling and exposure take place for any newly viewable inferiors.
4492
@var{map-window} generates @var{:exposure} events on each
4493
@var{:input-output} window that it causes to become visible.
4499
@defun map-subwindows window
4506
Maps all child windows for a specified @emph{window} in top-to-bottom
4507
stacking order. The X server generates an @var{:exposure} event on
4508
each newly visible window. This function is much more efficient than
4509
mapping each child individually.
4516
@defun unmap-window window
4523
Unmaps the specified @emph{window} and causes the X server to generate
4524
an @var{:unmap-notify} event. If the specified @emph{window} is
4525
already unmapped, @var{unmap-window} has no effect. Normal exposure
4526
processing on formerly obscured windows is performed. Any child window
4527
is no longer viewable. Unmapping the @emph{window} generates
4528
@var{:exposure} events on windows that were formerly obscured by
4529
@emph{window} and its children.
4536
@defun unmap-subwindows window
4543
Unmaps all child windows for the specified @emph{window} in bottom to
4544
top stacking order. The X server generates an @var{:unmap-notify}
4545
event on each child and @var{:exposure} events on formerly obscured
4546
windows. Using this function is much more efficient than unmapping
4547
child windows individually.
4554
@node Destroying Windows, Pixmaps, Mapping Windows, Windows and Pixmaps
4555
@section Destroying Windows
4558
CLX provides functions to destroy a window or destroy all children of
4559
a window. Note that by default, windows are destroyed when a
4560
connection is closed. For further information,
4561
@xref{Closing the Display}, and @xref{Client Termination}.
4563
@defun destroy-window window
4570
Destroys the specified @emph{window} as well as all of its
4571
inferiors. The windows should never again be referenced. If the
4572
specified @emph{window} is mapped, it is automatically unmapped. The
4573
window and all of its inferiors are then destroyed, and a
4574
@var{:destroy-notify} event is generated for each window. The ordering
4575
of the @var{:destroy-notify} events is such that for any given window
4576
being destroyed, @var{:destroy-notify} is generated on the window's
4577
inferiors before being generated on the window. The ordering among
4578
siblings and across sub-hierarchies is not otherwise constrained. If
4579
the @emph{window} is a root window, no windows are
4580
destroyed. Destroying a mapped window generates @var{:exposure} events
4581
on other windows that the mapped window obscured.
4587
@defun destroy-subwindows window
4594
Destroys all inferiors of the specified @emph{window}, in bottom to
4595
top stacking order. The X server generates a @var{:destroy-notify}
4596
event for each window. This is much more efficient than deleting many
4597
windows individually. The inferiors should never be referenced again.
4603
@node Pixmaps, , Destroying Windows, Windows and Pixmaps
4607
A @emph{pixmap} is a three-dimensional array of bits. A pixmap is
4608
normally thought of as a two-dimensional array of pixels, where each
4609
pixel can be a value from 0 to 2@emph{n}-1, where @emph{n}
4610
is the depth of the pixmap. A pixmap can also be thought of as a stack
4611
of @emph{n} bitmaps. A @emph{bitmap} is a single bit pixmap of depth
4612
1. CLX provides functions to:
4616
@item Create or free a pixmap
4618
@item Test if an object is a pixmap
4620
@item Test if two pixmap objects are equal
4622
@item Return the pixmap resource ID from a @var{pixmap} object
4627
Note that pixmaps can only be used on the screen where they were
4628
created. Pixmaps are off-screen server resources that are used for a
4629
number of operations. These include defining patterns for cursors or
4630
as the source for certain raster operations.
4632
@defun create-pixmap &key :width :height :depth :drawable
4637
The nonzero width and height (type @var{card16}).
4640
The depth (type @var{card8}) of the pixmap.
4643
A @var{drawable} which determines the screen where the pixmap will be used.
4646
Creates a pixmap of the specified @var{:width}, @var{:height}, and
4647
@var{:depth}. It is valid to pass a window whose class is
4648
@var{:input-only} as the @var{:drawable} argument. The @var{:width}
4649
and @var{:height} arguments must be nonzero. The @var{:depth} must be
4650
supported by the screen of the specified @var{:drawable}.
4660
@defun free-pixmap pixmap
4667
Allows the X server to free the pixmap storage when no other server
4668
resources reference it. The pixmap should never be referenced again.
4675
@defun pixmap-display pixmap
4682
Returns the @var{display} object associated with the specified @emph{pixmap}.
4692
@defun pixmap-equal pixmap-1 pixmap-2
4697
A three-dimensional array of bits to be tested.
4700
Returns true if the two arguments refer to the same server resource,
4701
and @var{nil} if they do not.
4708
@defun pixmap-id pixmap
4715
Returns the unique resource ID that has been assigned to the specified
4720
Type @var{resource-id}.
4726
@defun pixmap-p object
4733
Returns true if the argument is a @var{pixmap} object and @var{nil}
4738
@defun pixmap-plist pixmap
4745
Returns and (with @code{setf}) sets the property list for the specified
4746
@emph{pixmap}. This function provides a hook where extensions can add
4757
@node Graphics Contexts, Graphic Operations, Windows and Pixmaps, Top
4758
@chapter Graphics Contexts
4760
Clients of the X Window System specify the visual attributes of
4761
graphical output primitives by using @emph{graphics contexts}. A
4762
graphics context is a set of graphical attribute values such as
4763
foreground color, font, line style, and so forth. Like a window, a
4764
graphics context is another kind of X server resource which is created
4765
and maintained at the request of a client program. The client program,
4766
which may use several different graphics contexts at different times,
4767
is responsible for specifying a graphics context to use with each
4768
graphical output function.
4770
CLX represents a graphics context by an object of type @var{gcontext}
4771
and defines functions to create, modify, and manipulate @var{gcontext}
4772
objects. By default, CLX also records the contents of graphics
4773
contexts in a cache associated with each display. This local caching
4774
of graphics contexts has two important advantages:
4779
Communication efficiency -- Changes to attribute values in a
4780
@var{gcontext} are first made only in the local cache. Just before a
4781
@var{gcontext} is actually used, CLX automatically sends any changes
4782
to the X server, batching all changes into a single request.
4785
Inquiring @var{gcontext} contents -- Accessor functions can be used
4786
to return the value of any individual @var{gcontext} component by
4787
reading the copy of the @var{gcontext} from the cache. This kind of
4788
inquiry is not supported by the basic X protocol. There is no way for
4789
a client program to request an X server to return the contents of a
4794
Caching graphics contexts can result in a synchronization problem if
4795
more than one client program modifies a graphics context. However,
4796
this problem is unusual. Sharing a graphics context among several
4797
clients, while possible, is not expected to be useful and is not very
4798
easy to do. At any rate, a client program can choose to not cache a
4799
@var{gcontext} when it is created.
4801
Each client program must determine its own policy for creating and
4802
using graphics contexts. Depending on the display hardware and the
4803
server implementation, creating a new graphics context can be more or
4804
less expensive than modifying an existing one. In general, some amount
4805
of graphics context information can be cached in the display hardware,
4806
in which case modifying the hardware cache is faster than replacing
4807
it. Typical display hardware can cache only a small number of graphics
4808
contexts. Graphics output is fastest when only a few graphics contexts
4809
are used without heavy modifications.
4811
This section explains the CLX functions used to:
4815
@item Create a graphics context
4817
@item Return the contents of a graphics context
4819
@item Change the contents of a graphics context
4821
@item Copy a graphics context
4823
@item Free a graphics context
4828
* Creating Graphics Contexts::
4829
* Graphics Context Attributes::
4830
* Copying Graphics Contexts::
4831
* Destroying Graphics Contexts::
4832
* Graphics Context Cache::
4835
@node Creating Graphics Contexts, Graphics Context Attributes, Graphics Contexts, Graphics Contexts
4836
@section Creating Graphics Contexts
4838
To create a graphics context, use @var{create-gcontext}.
4840
@defun create-gcontext &key :arc-mode :background (:cache-p t) :cap-style :clip-mask :clip-ordering :clip-x :clip-y :dash-offset :dashes :drawable :exposures :fill-rule :fill-style :font :foreground :function :join-style :line-style :line-width :plane-mask :stipple :subwindow-mode :tile :ts-x :ts-y
4844
Specifies if this graphics context should be cached locally by CLX. If
4845
@var{nil} then the state is not cached, otherwise a local cache is
4848
The @var{drawable} whose root and depth are to be associated with
4849
this graphics context. This is a required keyword argument.
4854
@itemx :clip-ordering
4870
@itemx :subwindow-mode
4874
Initial attribute values for the graphics context.
4877
Creates, initializes, and returns a graphics context
4878
(@var{gcontext}). The graphics context can only be used with
4879
destination drawables having the same root and depth as the specified
4880
@var{:drawable}. If @var{:cache-p} is non-@var{nil}, the graphics
4881
context state is cached locally, and changing a component has no
4882
effect unless the new value differs from the cached value. Changes to
4883
a graphics context (@code{setf} and @var{with-gcontext}) are always
4884
deferred regardless of the cache mode and sent to the server only when
4885
required by a local operation or by an explicit call to
4886
@var{force-gcontext-changes}.
4888
All of the graphics context components are set to the values that are
4889
specified by the keyword arguments, except that a value of @var{nil}
4890
causes the default value to be used. These default values are as
4893
@multitable {Component} {Default Value}
4894
@item @var{arc-mode} @tab @var{:pie-slice}
4895
@item @var{background} @tab 1
4896
@item @var{cap-style} @tab @var{:butt}
4897
@item @var{clip-mask} @tab @var{:none}
4898
@item @var{clip-ordering} @tab @var{:unsorted}
4899
@item @var{clip-x} @tab 0
4900
@item @var{clip-y} @tab 0
4901
@item @var{dash-offset} @tab 0
4902
@item @var{dashes} @tab 4 (that is, the list '(4, 4))
4903
@item @var{exposures} @tab @var{:on}
4904
@item @var{fill-rule} @tab @var{:even-odd}
4905
@item @var{fill-style} @tab @var{:solid}
4906
@item @var{font} @tab server dependent
4907
@item @var{foreground} @tab 0
4908
@item @var{function} @tab @var{boole-1}
4909
@item @var{join-style} @tab @var{:miter}
4910
@item @var{line-style} @tab @var{:solid}
4911
@item @var{line-width} @tab 0
4912
@item @var{plane-mask} @tab A bit mask of all ones
4913
@item @var{stipple} @tab Pixmap of unspecified size filled with ones
4914
@item @var{subwindow-mode} @tab @var{:clip-by-children}
4915
@item @var{tile} @tab Pixmap of an unspecified size filled with the foreground pixel (that is, the client-specified pixel if any, or else 0)
4916
@item @var{ts-x} @tab 0
4917
@item @var{ts-y} @tab 0
4921
Note that foreground and background do not default to any values that
4922
are likely to be useful on a color display. Since specifying a
4923
@var{nil} value means use the default, this implies for clip-mask that
4924
an empty rectangle sequence cannot be specified as an empty list;
4925
@var{:none} must be used instead. Specifying a @var{stringable} for
4926
font causes an implicit @var{open-font} call to occur.
4930
Type @var{gcontext}.
4936
@node Graphics Context Attributes, Copying Graphics Contexts, Creating Graphics Contexts, Graphics Contexts
4937
@section Graphics Context Attributes
4939
The following paragraphs describe the CLX functions used to return or
4940
change the attributes of a @var{gcontext}. Functions that return the
4941
contents of a @var{gcontext} return @var{nil} if the last value stored
4942
is unknown (for example, if the @var{gcontext} was not cached or if
4943
the @var{gcontext} was not created by the inquiring client).
4945
@defun gcontext-arc-mode gcontext
4952
Returns and (with @code{setf}) changes the arc-mode attribute of the
4953
specified graphics context.
4955
The arc-mode attribute of a graphics context controls the kind of
4956
filling, if any, to be done by the @var{draw-arcs} function. A value
4957
of @var{:chord} specifies that arcs are filled inward to the chord
4958
between the end points of the arc. @var{:pie-slice} specifies that
4959
arcs are filled inward to the center point of the arc, creating a pie
4964
Either @var{:chord} or @var{:pie-slice}.
4970
@defun gcontext-background gcontext
4977
Returns and (with @code{setf}) changes the background attribute of the
4978
specified graphics context.
4980
The background attribute specifies the pixel value drawn for pixels
4981
that are not set in a bitmap and for pixels that are cleared by a
4982
graphics operation, such as the gaps in dashed lines.
4992
@defun gcontext-cache-p gcontext
4999
Returns and (with @code{setf}) changes the local cache mode for the
5000
@emph{gcontext}. If true, the state of the @emph{gcontext} is cached
5001
by CLX and changes to its attributes have no effect unless the new
5002
value differs from its cached value.
5009
@defun gcontext-cap-style gcontext
5016
Returns and (with @code{setf}) changes the cap-style attribute of the
5017
specified graphics context.
5019
The cap-style attribute of a graphics context defines how the end
5020
points of a path are drawn. The possible values and their
5021
interpretations are as follows:
5022
@multitable {Cap-Style} {Interpretations}
5024
@tab Square at the end point (perpendicular to the slope of the line) with no projection beyond.
5026
@item @var{:not-last}
5028
Equivalent to @var{:butt}, except that for a line-width of zero or one
5029
the final end point is not drawn.
5031
@item @var{:projecting}
5033
Square at the end, but the path continues beyond the end point for a
5034
distance equal to half the line-width. This is equivalent to
5035
@var{:butt} for line-width zero or one.
5039
A circular arc with the radius equal to 1/2 of the line-width,
5040
centered on the end point. This is equivalent to @var{:butt} for
5041
line-width zero or one.
5044
The following table describes what happens when the end points of a
5045
line are identical. The effect depends on both the cap style and line
5048
@multitable {Cap-Style} {Line-Width} {Effect}
5049
@item @var{:butt} @tab thin
5051
Device dependent, but the desired effect is that a single pixel is
5054
@item @var{:butt} @tab wide
5058
@item @var{:not-last} @tab thin
5060
Device dependent, but the desired effect is that nothing is drawn.
5062
@item @var{:projecting} @tab thin
5064
Same as @var{:butt} with thin line-width.
5066
@item @var{:projecting} @tab wide
5068
The closed path is a square, aligned with the coordinate axes,
5069
centered at the end point, with sides equal to the line-width.
5071
@item @var{:round} @tab wide
5073
The closed path is a circle, centered at the end point, with diameter equal to the line-width.
5075
@item @var{:round} @tab thin
5077
Same as @var{:butt} with thin line-width.
5083
One of @var{:butt}, @var{:not-last}, @var{:projecting}, or @var{:round}.
5089
@defun gcontext-clip-mask gcontext &optional ordering
5095
One of @var{:unsorted}, @var{:y-sorted}, @var{:yx-banded}, @var{:yx-sorted}, or @var{nil}.
5098
Returns and (with @code{setf}) changes the clip-mask attribute of the
5101
When changing the clip-mask attribute, the new clip-mask can be
5102
specified as a pixmap or a @var{rect-seq} or as the values @var{:none}
5103
or @var{nil}. The ordering argument can be specified only with
5104
@code{setf} when the new clip-mask is a @var{rect-seq}.
5106
The clip-mask attribute of a graphics context affects all graphics
5107
operations and is used to restrict output to the destination
5108
drawable. The clip-mask does not clip the source of a graphics
5109
operation. A value of @var{:none} for clip-mask indicates that no
5110
clipping is to be done.
5112
If a pixmap is specified as the clip-mask, it must have depth one and
5113
the same root as the specified graphics context. Pixels where the
5114
clip-mask has a one bit are drawn. Pixels outside the area covered by
5115
the clip-mask or where the clip-mask has a zero bit are not drawn.
5117
If a sequence of rectangles is specified as the clip-mask, the output
5118
is clipped to remain contained within the rectangles. The rectangles
5119
should be non-intersecting, or the results of graphics operations will
5120
be undefined. The rectangle coordinates are interpreted relative to
5121
the clip origin. Note that the sequence of rectangles can be empty,
5122
which effectively disables output. This is the opposite of setting the
5123
clip-mask to @var{:none}.
5125
If known by the client, the ordering of clip-mask rectangles can be
5126
specified to provide faster operation by the server. A value of
5127
@var{:unsorted} means the rectangles are in arbitrary order. A value
5128
of @var{:y-sorted} means that the rectangles are non-decreasing in
5129
their Y origin. A @var{:yx-sorted} value is like @var{:y-sorted} with
5130
the additional constraint that all rectangles with an equal Y origin
5131
are non-decreasing in their X origin. A @var{:yx-banded} value
5132
additionally constrains @var{:yx-sorted} by requiring that, for every
5133
possible Y scan line, all rectangles that include that scan line have
5134
an identical Y origins and Y extents. If incorrect ordering is
5135
specified, the X server may generate an error, but it is not required
5136
to do so. If no error is generated, the results of the graphics
5137
operations are undefined.
5144
@defun gcontext-clip-x gcontext
5151
Returns and (with @code{setf}) changes the clip-x attribute of the
5152
specified graphics context.
5154
The clip-x and clip-y attributes specify the origin for the clip-mask,
5155
whether it is a pixmap or a sequence of rectangles. These coordinates
5156
are interpreted relative to the origin of whatever destination
5157
drawable is specified in a graphics operation.
5166
@defun gcontext-clip-y gcontext
5173
Returns and (with @code{setf}) changes the clip-y attribute of the
5174
specified graphics context.
5176
The clip-x and clip-y attributes specify the origin for the clip-mask,
5177
whether it is a pixmap or a sequence of rectangles. These coordinates
5178
are interpreted relative to the origin of whatever destination
5179
drawable is specified in a graphics operation.
5188
@defun gcontext-dash-offset gcontext
5195
Returns and (with @code{setf}) changes the dash-offset attribute of the
5196
specified graphics context.
5198
The dash-offset attribute of a graphics context defines the phase of
5199
the pattern contained in the dashes attribute. This phase specifies
5200
how many elements (pixels) into the path the pattern should actually
5201
begin in any single graphics operation. Dashing is continuous through
5202
path elements combined with a join-style, but is reset to the
5203
dash-offset each time a cap-style is applied at a line end point.
5212
@defun gcontext-dashes gcontext
5219
Returns and (with @code{setf}) changes the dashes attribute of the
5220
specified graphics context. The sequence must be non-empty and the
5221
elements must be non-zero @var{card8} values.
5223
The dashes attribute in a graphics context specifies the pattern that
5224
is used for graphics operations which use the dashed line styles. It
5225
is a non-@var{nil} sequence with each element representing the length
5226
of a single dash or space. The initial and alternating elements of the
5227
dashes are the even dashes, while the others are the odd dashes. An
5228
odd length sequence is equivalent to the same sequence concatenated
5229
with itself to produce an even length sequence. All of the elements of
5230
a dashes sequence must be non-zero.
5232
Specifying a single integer value, @emph{N}, for the dashes attribute
5233
is an abbreviated way of specifying a two element sequence with both
5234
elements equal to the specified value [@emph{N}, @emph{N}].
5236
The unit of measure for dashes is the same as in the ordinary
5237
coordinate system. Ideally, a dash length is measured along the slope
5238
of the line, but server implementations are only required to match
5239
this ideal for horizontal and vertical lines.
5242
Type @var{sequence} or @var{card8}.
5248
@defun gcontext-display gcontext
5255
Returns the @var{display} object associated with the specified
5265
@defun gcontext-equal gcontext-1 gcontext-2
5273
Returns true if the two arguments refer to the same server resource,
5274
and @var{nil} if they do not.
5283
@defun gcontext-exposures gcontext
5290
Returns and (with @code{setf}) changes the exposures attribute of the
5291
specified graphics context.
5293
The exposures attribute in a graphics context controls the generation
5294
of @var{:graphics-exposure} events for calls to the @var{copy-area}
5295
and @var{copy-plane} functions. If @var{:on},
5296
@var{:graphics-exposure} events will be reported when calling the
5297
@var{copy-area} and @var{copy-plane} functions with this graphics
5298
context. Otherwise, if @var{:off}, the events will not be reported.
5301
Either @var{:off} or @var{:on}.
5307
@defun gcontext-fill-rule gcontext
5314
Returns and (with @code{setf}) changes the fill-rule attribute of the
5315
specified graphics context.
5317
The fill-rule attribute in a graphics context specifies the rule used
5318
to determine the interior of a filled area. It can be specified as
5319
either @var{:even-odd} or @var{:winding}.
5321
The @var{:even-odd} rule defines a point to be inside if any infinite
5322
ray starting at the point crosses the border an odd number of
5323
times. Tangencies do not count as a crossing.
5325
The @var{:winding} rule defines a point to be inside if any infinite
5326
ray starting at the point crosses an unequal number of clockwise and
5327
counterclockwise directed border segments. A clockwise directed border
5328
segment crosses the ray from left to right as observed from the
5329
point. A counterclockwise segment crosses the ray from right to left
5330
as observed from the point. The case where a directed line segment is
5331
coincident with the ray is uninteresting because you can simply choose
5332
a different ray that is not coincident with a segment.
5334
For both @var{:even-odd} and @var{:winding}, a point is infinitely small, and the border is an
5335
infinitely thin line. A pixel is inside if the center point of the pixel is inside, and the center
5336
point is not on the border. If the center point is on the border, the pixel is inside if, and
5337
only if, the polygon interior is immediately to its right (x increasing direction). Pixels
5338
with centers along a horizontal edge are a special case and are inside if, and only if, the
5339
polygon interior is immediately below (y increasing direction).
5342
Either @var{:even-odd} or @var{:winding}.
5347
@defun gcontext-fill-style gcontext
5354
Returns and (with @code{setf}) changes the fill-style attribute of the
5355
specified graphics context.
5357
The fill-style attribute of a graphics context defines the contents of
5358
the source for line, text, and fill graphics operations. It determines
5359
whether the source image is drawn with a solid color, a tile, or a
5360
stippled tile. The possible values and their meanings are as follows:
5363
@item :opaque-stippled
5364
Filled with a tile with the same width and height as stipple, but with
5365
the background value used everywhere stipple has a zero and the
5366
foreground pixel value used everywhere stipple has a one.
5369
Filled with the foreground pixel value.
5372
Filled with the foreground pixel value masked by stipple.
5379
When drawing lines with line-style @var{:double-dash}, the filling of
5380
the odd dashes are controlled by the fill-style in the following
5384
@item :opaque-stippled
5385
Same as for even dashes.
5388
Filled with the background pixel value.
5391
Filled with the background pixel value masked by stipple.
5394
Filled the same as the even dashes.
5399
One of @var{:opaque-stippled}, @var{:solid}, @var{:stippled}, or @var{:tiled}.
5405
@defun gcontext-font gcontext &optional metrics-p
5412
Specifies whether a pseudo-font is returned when the real font stored
5413
in the graphics context is not known. The default is @var{nil}, which
5414
means do not return a pseudo-font.
5417
Returns and (with @code{setf}) changes the @emph{font} attribute of the
5418
specified graphics context. If the stored font is known, it is
5419
returned. If it is not known and the @emph{metrics-p} argument is
5420
@var{nil}, then @var{nil} is returned. If the font is not known and
5421
@emph{metrics-p} is true, then a pseudo-font is constructed and
5422
returned. For a constructed pseudo-font, full metric and property
5423
information can be obtained, but it does not have a name or a resource
5424
ID, and attempts to use it where a resource ID is required results in
5425
an invalid-font error.
5427
The font attribute in a graphics context defines the default text font
5428
used in text drawing operations. When setting the value of the font
5429
attribute, either a @var{font} object or a font name can be used. If a
5430
font name is passed, @var{open-font} is call automatically to get the
5435
Type @var{font} or @var{null}.
5443
@defun gcontext-foreground gcontext
5450
Returns and (with @code{setf}) changes the foreground attribute of the
5451
specified graphics context.
5453
The foreground attribute of a graphics context specifies the pixel
5454
value drawn for set bits in a bitmap and for bits set by a graphics
5464
@defun gcontext-function gcontext
5471
Returns the @emph{function} of the specified graphics context.
5473
In all graphic operations, given a source pixel and a corresponding
5474
destination pixel, the resulting pixel drawn is computed bitwise on
5475
the bits of the source and destination pixels. That is, a logical
5476
operation is used to combine each bit plane of corresponding source
5477
and destination pixels. The graphics context function attribute
5478
specifies the logical operation used via one of the 16 operation codes
5479
defined by Common Lisp for the @var{boole} function.
5481
The following table shows each of the logical operation codes that can
5482
be given by the function attribute. For each operation code, its
5483
result is shown as a logical function of a source pixel @emph{S} and a
5484
destination pixel @emph{D}.
5486
@multitable {Symbol} {Result}
5491
@item @var{boole-andc1}
5492
@tab (logandc1 @emph{S D})
5493
@item @var{boole-andc2}
5494
@tab (logandc2 @emph{S D})
5495
@item @var{boole-and}
5496
@tab (logand @emph{S D})
5497
@item @var{boole-c1}
5498
@tab (lognot @emph{S})
5499
@item @var{boole-c2}
5500
@tab (lognot @emph{D})
5501
@item @var{boole-clr}
5503
@item @var{boole-eqv}
5504
@tab (logeqv @emph{S D})
5505
@item @var{boole-ior}
5506
@tab (logior @emph{S D})
5507
@item @var{boole-nand}
5508
@tab (lognand @emph{S D})
5509
@item @var{boole-nor}
5510
@tab (lognor @emph{S D})
5511
@item @var{boole-orc1}
5512
@tab (logorc1 @emph{S D})
5513
@item @var{boole-orc2}
5514
@tab (logorc2 @emph{S D})
5515
@item @var{boole-set}
5517
@item @var{boole-xor}
5518
@tab (logxor @emph{S D})
5523
Type @var{boole-constant}.
5529
@defun gcontext-id gcontext
5536
Returns the unique ID that has been assigned to the specified graphics
5540
Type @var{resource-id}.
5546
@defun gcontext-join-style gcontext
5553
Returns and (with @code{setf}) changes the join-style attribute of the
5554
specified graphics context.
5556
The join-style attribute of a graphics context defines how the segment
5557
intersections are drawn for wide polylines. The possible values and
5558
their interpretations are as follows:
5562
Uses @var{:butt} end point styles with the triangular notch filled.
5564
The outer edges of two lines extend to meet at an angle.
5566
A circular arc with diameter equal to the line-width, centered on the join point.
5569
When the end points of a polyline segment are identical, the effect is
5570
as if the segment was removed from the polyline. When a polyline is a
5571
single point, the effect is the same as when the cap-style is applied
5576
One of @var{:bevel}, @var{:miter}, or @var{:round}.
5582
@defun gcontext-line-style gcontext
5589
Returns and (with @code{setf}) changes the line-style attribute of the
5590
specified graphics context.
5592
The line-style attribute of a graphics context specifies how (which
5593
sections of) lines are drawn for a path in graphics operations. The
5594
possible values and their meanings are as follows:
5598
The full path is drawn.
5601
The full path is drawn, but the even dashes are filled differently
5602
than the odd dashes. The @var{:butt} style is used where even and odd
5603
dashes meet (see paragraph 5.4.7, Fill-Rule and
5607
Only the even dashes are drawn, with cap-style applied to all internal
5608
ends of the individual dashes, except @var{:not-last} is treated as
5614
One of @var{:dash}, @var{:double-dash}, or @var{:solid}.
5620
@defun gcontext-line-width gcontext
5627
Returns the @emph{line-width} of the specified graphics context.
5629
The line-width is measured in pixels and can be greater than or equal
5630
to one (wide line) or can be the special value zero (thin line).
5632
Wide lines are drawn centered on the path described by the graphics
5633
operation. Unless otherwise specified by the join-style or cap-style,
5634
the bounding box of a wide line with end points [x1, y1], [x2, y2],
5635
and width w is a rectangle with vertices at the following real
5638
[x1 - (w*@emph{sin}/2), y1 + (w*@emph{cos}/2)], [x1+ (w*@emph{sin}/2), y1 - (w*@emph{cos}/2)],@*
5639
[x2 - (w*@emph{sin}/2), y2 + (w*@emph{cos}/2)], [x2 + (w*@emph{sin}/2), y2 - (w*@emph{cos}/2)]
5641
where @emph{sin} is the sine of the angle of the line and @emph{cos}
5642
is the cosine of the angle of the line. A pixel is part of the line
5643
and, hence, is drawn if the center of the pixel is fully inside the
5644
bounding box (which is viewed as having infinitely thin edges). If the
5645
center of the pixel is exactly on the bounding box, it is part of the
5646
line if, and only if, the interior is immediately to its right (x
5647
increasing direction). Pixels with centers on a horizontal edge are a
5648
special case and are part of the line if, and only if, the interior is
5649
immediately below (y increasing direction).
5651
Thin lines (zero line-width) are always one pixel wide lines drawn
5652
using an unspecified, device dependent algorithm. There are only two
5653
constraints on this algorithm.
5657
If a line is drawn unclipped from [x1,y1] to [x2,y2] and if another
5658
line is drawn unclipped from [x1+dx,y1+dy] to [x2+dx,y2+dy], a point
5659
[x,y] is touched by drawing the first line if, and only if, the
5660
point [x+dx,y+dy] is touched by drawing the second line.
5663
The effective set of points comprising a line cannot be affected by
5664
clipping. That is, a point is touched in a clipped line if, and only
5665
if, the point lies inside the clipping region and the point would be
5666
touched by the line when drawn unclipped.
5670
A wide line drawn from [x1,y1] to [x2,y2] always draws the same pixels
5671
as a wide line drawn from [x2,y2] to [x1,y1], not counting cap-style
5672
and join-style. Implementors are encouraged to make this property true
5673
for thin lines, but it is not required. A line-width of zero may
5674
differ from a line-width of one in which pixels are drawn. This
5675
permits the use of many manufacturer's line drawing hardware, which
5676
may run much faster than the more precisely specified wide lines.
5678
In general, drawing a thin line is faster than drawing a wide line of
5679
width one. However, because of their different drawing algorithms,
5680
thin lines may not mix well, aesthetically speaking, with wide
5681
lines. If it is desirable to obtain precise and uniform results across
5682
all displays, a client should always use a line-width of one, rather
5683
than a line-width of zero.
5692
@defun gcontext-p gcontext
5701
Returns non-@var{nil} if the argument is a graphics context and
5708
@defun gcontext-plane-mask gcontext
5715
Returns the @emph{plane-mask} of the specified graphics context.
5717
The plane-mask attribute of a graphics context specifies which bit
5718
planes of the destination drawable are modified during a graphic
5719
operation. The plane-mask is a pixel value in which a 1 bit means that
5720
the corresponding bit plane will be modified and a 0 bit means that
5721
the corresponding bit plane will not be affected during a graphic
5722
operations. Thus, the actual result of a graphic operation depends on
5723
both the function and plane-mask attributes of the graphics context
5724
and is given by the following expression:
5728
(boole function source destination)
5744
@defun gcontext-plist gcontext
5753
Returns and (with @code{setf}) sets the property list for the specified
5754
@emph{gcontext}. This function provides a hook where extensions can
5765
@defun gcontext-stipple gcontext
5772
Returns the @emph{stipple} of the specified graphics context.
5774
The stipple attribute of a graphics context is a bitmap used to
5775
prevent certain pixels in the destination of graphics operations from
5776
being affected by tiling.
5778
The stipple and tile have the same origin. This origin point is
5779
interpreted relative to the origin of whatever destination drawable is
5780
specified in a graphics request. The stipple pixmap must have depth
5781
one and must have the same root as the graphics context. The tile
5782
pixmap must have the same root and depth as the graphics context. For
5783
stipple operations where the fill-style is @var{:stippled} (but not
5784
@var{:opaque-stippled}), the stipple pattern is tiled in a single
5785
plane and acts as an additional clip mask to be @var{and}ed with the
5786
clip-mask. Any size pixmap can be used for stipple or tile, although
5787
some sizes may be faster to use than others.
5789
Specifying a pixmap for stipple or tile in a graphics context might or
5790
might not result in a copy being made. If the pixmap is later used as
5791
the destination for a graphics operation, the change might or might
5792
not be reflected in the graphics context. If the pixmap is used both
5793
as the destination for a graphics operation and as a stipple or tile,
5794
the results are not defined.
5796
Some displays have hardware support for tiling or stippling with
5797
patterns of specific sizes. Tiling and stippling operations that
5798
restrict themselves to those sizes may run much faster than such
5799
operations with arbitrary size patterns. CLX provides functions to
5800
determine the best size for stipple or tile (see
5801
@var{query-best-stipple} and @var{query-best-tile}).
5811
@defun gcontext-subwindow-mode gcontext
5818
Returns and (with @code{setf}) changes the subwindow-mode attribute of
5819
the specified graphics context.
5821
The subwindow-mode attribute of a graphics context specifies whether
5822
subwindows obscure the contents of their parent window during a
5823
graphics operation. For a value of @var{:clip-by-children}, both
5824
source and destination windows are clipped by all viewable
5825
@var{:input-output} class children. This clipping is in addition to
5826
the clipping provided by the clip-mode attribute. For a value of
5827
@var{:include-inferiors}, neither the source nor destination window
5828
is clipped by its inferiors. This results in the inclusion of
5829
subwindow contents in the source and the drawing through of subwindow
5830
boundaries of the destination. The use of @var{:include-inferiors} on
5831
a window of one depth with mapped inferiors of differing depth is not
5832
illegal, but the semantics are not defined by the core protocol.
5834
@item subwindow-mode
5835
One of @var{:clip-by-children} or @var{:include-inferiors}.
5841
@defun gcontext-tile gcontext
5848
Returns the @emph{tile} of the specified graphics context.
5850
The tile attribute is a pixmap used to fill in areas for graphics
5851
operations. It is so named because copies of it are laid out side by
5852
side to fill the area.
5854
The stipple and tile have the same origin. This origin point is
5855
interpreted relative to the origin of whatever destination drawable is
5856
specified in a graphics request. The stipple pixmap must have depth
5857
one and must have the same root as the graphics context. The tile
5858
pixmap must have the same root and depth as the graphics context. For
5859
stipple operations where the fill-style is @var{:stippled} (but not
5860
@var{:opaque-stippled}), the stipple pattern is tiled in a single
5861
plane and acts as an additional clip mask to be @var{and}ed with the
5862
clip-mask. Any size pixmap can be used for stipple or tile, although
5863
some sizes may be faster to use than others.
5865
Specifying a pixmap for stipple or tile in a graphics context might or
5866
might not result in a copy being made. If the pixmap is later used as
5867
the destination for a graphics operation, the change might or might
5868
not be reflected in the graphics context. If the pixmap is used both
5869
as the destination for a graphics operation and as a stipple or tile,
5870
the results are not defined.
5872
Some displays have hardware support for tiling or stippling with
5873
patterns of specific sizes. Tiling and stippling operations that
5874
restrict themselves to those sizes may run much faster than such
5875
operations with arbitrary size patterns. CLX provides functions to
5876
determine the best size for stipple or tile (see
5877
@var{query-best-stipple} and @var{query-best-tile}).
5886
@defun gcontext-ts-x gcontext
5893
Returns the @emph{ts-x} attribute of the specified graphics context.
5895
The ts-x and ts-y attributes of a graphics context are the coordinates
5896
of the origin for tile pixmaps and the stipple.
5905
@defun gcontext-ts-y gcontext
5912
Returns the @emph{ts-y} attribute of the specified graphics context.
5914
The ts-x and ts-y attributes of a graphics context are the coordinates
5915
of the origin for tile pixmaps and the stipple.
5924
@defun query-best-stipple width height drawable
5929
Specifies the width and height of the desired stipple pattern.
5934
Returns the @emph{best-width} and @emph{best-height} for stipple
5935
pixmaps on the @emph{drawable}.
5937
The @emph{drawable} indicates the screen and possibly the window class
5938
and depth. An @var{:input-only} window cannot be specified as the
5939
@emph{drawable}. The size is returned as width and height values.
5950
@defun query-best-tile width height drawable
5955
Specifies the width and height of the desired tile pattern.
5960
Returns the @emph{best-width} and @emph{best-height} for tile pixmaps
5961
on the @emph{drawable}.
5963
The @emph{drawable} indicates the screen and possibly the window class
5964
and depth. An @var{:input-only} window cannot be specified as the
5965
@emph{drawable}. The size is returned as width and height values.
5976
@node Copying Graphics Contexts, Destroying Graphics Contexts, Graphics Context Attributes, Graphics Contexts
5977
@section Copying Graphics Contexts
5979
CLX provides functions to copy some or all attribute values from one
5980
graphics context to another. These functions are generally more
5981
efficient than using @code{setf} to copy @var{gcontext} attributes
5984
@defun copy-gcontext source destination
5988
The source @var{gcontext}.
5990
The destination @var{gcontext}.
5993
Copies all the values of the attributes of the source graphics context
5994
into the destination graphics context. The source and destination
5995
graphics contexts must have the same root and depth.
6002
@defun copy-gcontext-components source destination &rest keys
6006
The source @var{gcontext}.
6008
The destination @var{gcontext}.
6011
The remaining arguments are keywords, of type @var{gcontext-key},
6012
which specify which attributes of the graphics context are to be
6016
Copies the values of the specified attributes of the source graphics
6017
context to the destination graphics context. The source and
6018
destination graphics contexts must have the same root and depth.
6024
@node Destroying Graphics Contexts, Graphics Context Cache, Copying Graphics Contexts, Graphics Contexts
6025
@section Destroying Graphics Contexts
6027
To destroy a graphics context, use @var{free-gcontext.}
6029
@defun free-gcontext gcontext
6036
Deletes the association between the assigned resource ID and the
6037
specified graphics context, and then destroys the graphics context.
6043
@node Graphics Context Cache, , Destroying Graphics Contexts, Graphics Contexts
6044
@section Graphics Context Cache
6046
CLX provides a set of functions to control the automatic graphics context
6050
@defun force-gcontext-changes gcontext
6057
Forces any delayed changes to the specified graphics context to be
6058
sent out to the server. Note that @var{force-gcontext-changes} is
6059
called by all of the graphics functions.
6065
@defmac with-gcontext gcontext &key :arc-mode :background :cap-style :clip-mask :clip-ordering :clip-x :clip-y :dashes :dash-offset :exposures :fill-rule :fill-style :font :foreground :function :join-style :line-style :line-width :plane-mask :stipple :subwindow-mode :tile :ts-x :ts-y &allow-other-keys &body body
6066
@anchor{with-gcontext}
6068
Changes the indicated graphics context components to the specified
6069
values only within the dynamic extent of the body. @var{with-gcontext}
6070
works on a per-process basis in a multiprocessing environment. The
6071
@emph{body} is not surrounded by a @var{with-display} form. If there
6072
is no local cache for the specified graphics context, or if some of
6073
the component states are unknown, @var{with-gcontext} does the save
6074
and restore by creating a temporary graphics context and copying
6075
components to and from it using @var{copy-gcontext-components}.
6084
@itemx :clip-ordering
6100
@itemx :subwindow-mode
6104
These keyword arguments and associated values specify which graphics
6105
context components are to be changed. Any components not specified are
6106
left unmodified. @xref{Creating Graphics Contexts}, for more information.
6108
The body of code which will have access to the altered graphics context.
6113
@node Graphic Operations, Images, Graphics Contexts, Top
6114
@chapter Graphic Operations
6116
Once connected to an X server, a client can use CLX functions to
6117
perform graphic operations on drawables.
6119
This section describes CLX functions to:
6123
@item Operate on areas and planes
6129
@item Draw rectangles
6139
* Area and Plane Operations::
6142
* Drawing Rectangles::
6147
@node Area and Plane Operations, Drawing Points, Graphic Operations, Graphic Operations
6148
@section Area and Plane Operations
6151
@var{clear-area} clears an area or an entire window to the background.
6152
Since pixmaps do not have backgrounds, they cannot be filled by using
6153
the functions described in the following paragraphs. Instead, you
6154
should use @var{draw-rectangle}, which sets the pixmap to a known
6155
value. @xref{Drawing Rectangles}, for information on
6156
@var{draw-rectangle}.
6158
@defun clear-area window &key (:x 0) (:y 0) :width :height :exposures-p
6166
Upper-left corner of the area to be cleared. These coordinates are
6167
relative to the @emph{window} origin. Type is @var{int16}.
6170
The width of the area to clear or @var{nil} to clear to the remaining
6171
width of the window. Type is @var{card16} or @var{null}.
6174
The height of the area to clear or @var{nil} to clear to the remaining
6175
height of the window. Type is @var{card16} or @var{null}.
6178
Specifies if @var{:exposure} events should be generated for the
6179
affected areas. Type @var{boolean}.
6182
Draws a rectangular area in the specified @emph{window} with the
6183
background pixel or pixmap of the @emph{window}. The @var{:x} and
6184
@var{:y} coordinates are relative to the @emph{window} origin, and
6185
specify the upper-left corner of the rectangular area that is to be
6186
cleared. A @var{nil} or zero value for @var{:height} or @var{:width}
6187
clears the remaining area (height - y or width - x). If the
6188
@emph{window} has a defined background tile, the rectangle is tiled by
6189
using a plane-mask of all ones and a function of @var{:copy}. If the
6190
@emph{window} has background @var{:none}, the contents of the
6191
@emph{window} are not changed. In either case, if @var{:exposures-p}
6192
is non-@var{nil}, then one or more @var{:exposure} events are
6193
generated for regions of the rectangle that are either visible or are
6194
being retained in a backing store.
6196
To clear the entire area in a specified @emph{window}, use
6197
(@var{clear-area} @emph{window}).
6202
@defun copy-area source gcontext source-x source-y width height destination destination-x destination-y
6206
Source @var{drawable}.
6209
The graphics context to use during the copy operation.
6213
The x and y coordinates of the upper-left corner of the area in the
6214
@emph{source} @var{drawable}. These coordinates are relative to the
6215
@emph{source} @var{drawable} origin. Type is @var{int16}.
6219
The width and height of the area being copied. These apply to both the
6220
@emph{source} and @emph{destination} areas. Type is @var{card16}.
6223
The destination @var{drawable}.
6226
@itemx destination-y
6227
The x and y coordinates of the upper left corner of the area in the
6228
@emph{destination} @var{drawable}. These coordinates are relative to
6229
the @emph{destination} @var{drawable} origin. Type is @var{int16}.
6232
Copies the specified rectangular area from the @emph{source}
6233
@var{drawable} to the specified rectangular area of the
6234
@emph{destination} @var{drawable}, combining them as specified in the
6235
supplied graphics context (@emph{gcontext}). The @emph{x} and @emph{y}
6236
coordinates are relative to their respective drawable origin, with
6237
each pair specifying the upper left corner of the area.
6239
If either regions of the @emph{source} area are obscured and have not
6240
been retained in backing store, or regions outside the boundaries of
6241
the @emph{source} @var{drawable} are specified, those regions are not
6242
copied. Instead, the following occurs on all corresponding
6243
@emph{destination} regions that are either visible or are retained in
6249
If the @emph{destination} rectangle is a window with a background
6250
other than @var{:none}, these corresponding regions of the
6251
@emph{destination} are tiled, using plane-mask of all ones and
6252
function of @var{boole-1} (copy source), with that background.
6255
If the exposures attribute of the graphics context is @var{:on},
6256
then @var{:graphics-exposure} events for all corresponding
6257
@emph{destination} regions are generated (regardless of tiling or
6258
whether the @emph{destination} is a window or a pixmap).
6261
If exposures is @var{:on} but no regions are exposed, a
6262
@var{:no-exposure} event is generated. Note that by default,
6263
exposures is @var{:on} for new graphics contexts. @xref{Graphics Contexts}, for further information.
6270
@defun copy-plane source gcontext plane source-x source-y width height destination destination-x destination-y
6274
The source @var{drawable}.
6276
The graphics context to use during the copy operation.
6278
Specifies the bit-plane of the @emph{source} @var{drawable}. Exactly one bit must be set.
6279
Type is @var{pixel}.
6282
The @emph{x} and @emph{y} coordinates of the upper-left corner of the
6283
area in the @emph{source} @var{drawable}. These coordinates are
6284
relative to the @emph{source} @var{drawable} origin. Type is
6289
The width and height of the area being copied. These apply to both the
6290
@emph{source} and @emph{destination} areas. Type is @var{card16}.
6293
The destination @var{drawable}.
6296
@itemx destination-y
6298
The x and y coordinates of the upper-left corner of the destination
6299
area in the @emph{destination} @var{drawable}. These coordinates are
6300
relative to the @emph{destination} @var{drawable} origin. Type is
6304
Uses a single bit plane of the specified rectangular area of the
6305
@emph{source} @var{drawable} along with the specified graphics context
6306
(@emph{gcontext}) to modify the specified rectangle area of the
6307
@emph{destination} @var{drawabl}e. The drawables specified by the
6308
@emph{source} and @emph{destination} arguments must have the same root
6309
but need not have the same depth.
6311
Effectively, this operation forms a pixmap of the same depth as
6312
@emph{destination} and with a size specified by the @emph{source}
6313
area. It then uses the foreground and background from the graphics
6314
context (foreground where the bit-plane in @emph{source} contains a
6315
one bit, background where the bit-plane in @emph{source} contains a
6316
zero bit), and the equivalent of a @var{copy-area} operation is
6317
performed with all the same exposure semantics. This can also be
6318
thought of as using the specified region of the @emph{source}
6319
bit-plane as a stipple with a fillstyle of @var{:opaque-stippled} for
6320
filling a rectangular area of the @emph{destination}.
6326
@node Drawing Points, Drawing Lines, Area and Plane Operations, Graphic Operations
6327
@section Drawing Points
6329
The @var{draw-point} and @var{draw-points} functions make use of the following graphics
6330
context components: function, plane-mask, foreground, subwindow-mode, clip-x,
6331
clip-y, clip-ordering, clip-region and clip-mask.
6333
The @var{draw-point} function uses the foreground pixel and function components of the
6334
graphics context to draw a single point into the specified drawable, while @var{draw-points}
6335
draws multiple points into the specified drawable. These functions are not affected by
6336
the tile or stipple in the graphics context.
6339
@defun draw-point drawable gcontext x y
6343
The destination @var{drawable}.
6345
The graphics context for drawing the point.
6348
The @emph{x} and @emph{y} coordinates of the point drawn. Type is @var{int16}.
6350
Combines the foreground pixel in the @emph{gcontext} with the pixel in
6351
the @emph{drawable} specified by the @emph{x} and @emph{y}
6357
@defun draw-points drawable gcontext points &optional relative-p
6361
The destination @var{drawable}.
6363
The graphics context for drawing the points.
6365
A list of points to be drawn in the order listed. The first point is always relative
6366
to the @emph{drawable}'s origin; if @emph{relative-p}, the rest of the points are drawn relative to the
6367
previous point, else they are drawn relative to the @emph{drawable}'s origin. Type is
6370
Specifies the coordinate mode used for drawing the pixels either relative to
6371
the origin or to the previous point. Type @var{boolean}.
6374
Combines the foreground pixels in the graphics context with the pixels
6375
at each point in the @emph{drawable}. The points are drawn in the
6378
@var{draw-points} requires a mode argument, @emph{relative-p} that
6379
indicates whether the points are relative to the destination origin or
6380
to the previous point. In either case, the first point is always
6381
relative to the destination origin. The rest of the points are
6382
relative either to the @emph{drawable}'s origin or to the previous
6383
point, depending on the value of @emph{relative-p}.
6389
@node Drawing Lines, Drawing Rectangles, Drawing Points, Graphic Operations
6390
@section Drawing Lines
6393
The @var{draw-line}, @var{draw-lines}, and @var{draw-segments} functions use the following
6394
graphics context components: background, cap-style, clip-x-origin, clip-y-origin,
6395
clip-mask, dash-list, dash-offset, fill-style, foreground, function, plane-mask, line-width,
6396
line-style, stipple, subwindow-mode, tile, ts-x-origin, and ts-y-origin.
6398
The @var{draw-lines} function also uses the join-style graphics context component.
6400
@defun draw-line drawable gcontext x1 y1 x2 y2 &optional relative-p
6404
The destination @var{drawable}.
6406
The graphics context for drawing the line.
6411
The end points of the line.
6413
Specifies the coordinate mode used for drawing the line either relative to
6414
the origin or the previous point. In either case, the first point is always drawn
6415
relative to the @emph{drawable}'s origin.
6418
Draws a line from the point @emph{x1},@emph{y1} to the point
6419
@emph{x2},@emph{y2}. When @emph{relative-p} is true, the first point
6420
is relative to the destination origin but the second point is relative
6421
to the first point. When @emph{relative-p} is @var{nil}, both points
6422
are relative to the destination origin.
6428
@defun draw-lines drawable gcontext points &key :relative-p :fill-p (:shape :complex)
6432
The destination @var{drawable}.
6434
The graphics context for drawing the lines.
6436
A list of points that define the lines. Type is @var{point-seq}.
6438
The coordinate mode of the points.
6440
When true, a filled polygon is drawn instead of a polyline.
6442
A hint that allows the server to use the most efficient area fill algorithm.
6443
Either @var{:convex}, @var{:non-convex}, or @var{:complex}.
6446
Draws a line between each pair of @emph{points} in the points
6447
list. The lines are drawn in the order listed and join correctly at
6448
all intermediate points. The join-style graphics context component
6449
defines the type of joint to use. When the first and last points
6450
coincide, the first and last lines also join correctly to produce a
6453
When @var{:relative-p} is true, the first point is always relative to
6454
the destination origin, but the rest are relative to the previous
6455
point. When @var{:relative-p} is @var{nil}, the rest of the points
6456
are drawn relative to the destination origin.
6458
When @var{:fill-p} is true, the polygon defined by the @emph{points}
6459
list is filled. The @var{:shape} keyword provides the server with a
6460
hint about how to fill the polygon. @var{:shape} can be either
6461
@var{:complex} (by default), @var{:convex}, or @var{:non-convex}.
6463
The @var{:convex} operand is the simplest type of area and the
6464
fastest to fill. A fill area is convex if every straight line
6465
connecting any two interior points is entirely inside the area. For
6466
example, triangles and rectangles are convex polygons.
6468
The @var{:non-convex} operand is for filling an area that is not
6469
convex and is also not self-intersecting. Filling this type of area is
6470
harder than filling a convex area, but easier than filling one that is
6471
self-intersecting. For example, the shape of the letter "T" is
6472
non-convex and non-self-intersecting.
6474
The @var{:complex} operand is the most general (and therefore the
6475
hardest) type of fill area. A complex fill area can be non-convex and
6476
self-intersecting. For example, draw the outline of a bow tie, without
6477
lifting your pencil or tracing over an edge twice. This shape is
6478
non-convex and intersects itself at the knot in the middle.
6480
@var{NOTE:} Unless you are sure that a shape is @var{:convex} or
6481
@var{:non-convex}, it should always be drawn as a @var{:complex}
6482
shape. If @var{:convex} or @var{:non-convex} is specified
6483
incorrectly, the graphics result is undefined.
6489
@defun draw-segments drawable gcontext segments
6493
The destination @var{drawable} to receive the line segments.
6495
Specifies the graphics context for drawing the lines.
6497
The points list for the segments to draw. Type is @var{seq}.
6500
Draws multiple lines, not necessarily connected. @emph{segments} is a
6501
sequence of the form @{x1 y1 x2 y2@}*, in which each subsequence
6502
specifies the end points of a line segment. Line segments are drawn in
6503
the order given by @emph{segments}. Unlike @var{draw-lines}, no
6504
joining is performed at coincident end points.
6510
@node Drawing Rectangles, Drawing Arcs, Drawing Lines, Graphic Operations
6511
@section Drawing Rectangles
6514
The @var{draw-rectangle} and @var{draw-rectangles} functions draw
6515
hollow or filled outlines of the specified rectangle or rectangles as
6516
if a five-point polyline were specified for each rectangle, as
6520
[x,y,] [x+width,y] [x+width,y+height] [x,y+height] [x,y]
6523
@var{draw-rectangle} and @var{draw-rectangles} use the following
6524
graphics context components: background, function, plane-mask,
6525
foreground, subwindow-mode, cap-style, clip-x, clip-y, clip-ordering,
6526
clip-region and clip-mask, dash-list, dash-offset, fill-style,
6527
join-style, line-width, line-style, stipple, tile, ts-x-origin, and
6530
@defun draw-rectangle drawable gcontext x y width height &optional fill-p
6534
The destination @var{drawable}.
6537
The graphics context for drawing the rectangle.
6541
The x and y coordinates that define the upper left corner of the rectangle. The
6542
coordinates are relative to the destination origin. Type is @var{int16}.
6546
Specifies the width and height that define the outline of the rectangle.
6547
Type is @var{card16}.
6550
Specifies whether the rectangle is filled or not. Type @var{boolean}.
6553
Draws a rectangle defined by the @emph{x}, @emph{y}, @emph{width}, and
6555
@emph{height} arguments.
6562
@defun draw-rectangles drawable gcontext rectangles &optional fill-p
6566
The destination @var{drawable}.
6569
The graphics context.
6572
A list specifying the upper left corner x and y, width and height of the
6573
rectangles. Type is @var{rect-seq}.
6576
Specified if the rectangles are filled or not. Type is @var{boolean}.
6579
Draws the rectangles in the order listed in @emph{rectangles}. For the
6580
specified @emph{rectangle} or @emph{rectangles}, no pixel is drawn
6581
more than once. The x and y coordinates of each rectangle are relative
6582
to the destination origin and define the upper left corner of the
6583
rectangle. If rectangles intersect, the intersecting pixels are drawn
6590
@node Drawing Arcs, Drawing Text, Drawing Rectangles, Graphic Operations
6591
@section Drawing Arcs
6593
@var{draw-arc} draws a single circular or an elliptical arc, while
6594
@var{draw-arcs} draws multiple circular or elliptical
6595
arcs. @var{draw-arc} and @var{draw-arcs} use the following graphics
6596
context components: arc-mode, background, cap-style, clip-x, clip-y,
6597
clip-mask, dash-list, dash-offset, fill-style, foreground, join-style,
6598
function, plane-mask, line-width, line-style, stipple, subwindow-mode,
6599
tile, ts-x-origin, and ts-y-origin.
6601
@defun draw-arc drawable gcontext x y width height angle1 angle2 &optional fill-p
6605
The destination @var{drawable}.
6608
The graphics context for drawing the arc.
6612
The x and y coordinates of the arc rectangle relative to the origin of the @emph{drawable}.
6613
Type is @var{int16}.
6617
Specifies the width and height of the rectangle. These are the major and
6618
minor axes of the arc. Type is @var{card16}.
6621
Specifies the start of the arc in radians. Type is @var{angle}.
6624
Specifies the direction and end point of the arc. Type is @var{angle}.
6627
Specifies whether the arc is filled or not. Type @var{boolean}.
6630
Draws either a circular or an elliptical arc. Also, outlined or filled
6631
arcs can be drawn. Each arc is specified by a rectangle (@emph{x},
6632
@emph{y}, @emph{width}, and @emph{height}) and two angles
6633
(@emph{angle1} and @emph{angle2}). The angles are signed integers in
6634
radians, with positive indicating counterclockwise motion and negative
6635
indicating clockwise motion. The start of the arc is specified by
6636
@emph{angle1}, and the path and extent of the arc is specified by
6637
@emph{angle2} relative to the start of the arc. If the magnitude of
6638
@emph{angle2} is greater than 360 degrees, it is truncated to 360
6639
degrees. The @emph{x} and @emph{y} coordinates of the rectangle are
6640
relative to the @emph{drawable}'s origin.
6642
For example, an arc specified as
6643
[@emph{x},@emph{y},@emph{width},@emph{height},@emph{angle1},@emph{angle2}]
6644
has the origin of the major and minor axes at:
6647
[@emph{x}+(@emph{width}/2),@emph{y}+(@emph{height}/2)]
6650
The infinitely thin path describing the entire circle/ellipse
6651
intersects the horizontal axis at:
6654
[@emph{x},@emph{y}+(@emph{height}/2)] and [@emph{x}+@emph{width},@emph{y}+(@emph{height}/2)]
6657
The intersection of the vertical axis is at:
6660
[@emph{x}+(@emph{width}/2),@emph{y}] and [@emph{x}+(@emph{width}/2),@emph{y}+@emph{height}]
6663
These coordinates can be fractional; that is, they are not truncated
6664
to discrete coordinates. Note that the angle values are slightly
6665
different in CLX than in the X protocol specification.
6667
If @emph{fill-p} is @var{nil}, then only the outline of the arc is
6668
drawn. Otherwise, if @emph{fill-p} is true, @var{draw-arc} fills the
6669
area bounded by the arc outline and one or two line segments,
6670
depending on the arc-mode. If the arc-mode is @var{:chord}, the
6671
filled area is bounded by the arc outline and the line segment joining
6672
the arc end points. If the arc-mode is @var{:pie-slice}, the filled
6673
area is bounded by the arc outline and the two line segments joining
6674
each arc end point with the center point.
6681
@defun draw-arcs drawable gcontext arcs &optional fill-p
6685
Specifies the @var{drawable} where you want the arcs drawn.
6687
Specifies the graphics context for drawing the arc.
6689
A sequence containing the width, height, angle1, and angle2 arguments defining
6690
the arcs. See @var{draw-arc} for more detail. Type is @var{arc-seq}.
6692
Specifies whether the arcs are filled or not. Type is @var{boolean}.
6695
Draws circular or elliptical, outlined or filled arcs. Each arc is
6696
specified by a rectangle and two angles. For a more detailed
6697
description, see @var{draw-arc}.
6699
The arcs are filled in the order listed. For any given arc, no pixel is drawn more than
6700
once. If regions intersect, the intersecting pixels are drawn multiple times.
6706
@node Drawing Text, , Drawing Arcs, Graphic Operations
6707
@section Drawing Text
6709
CLX provides functions for drawing text using text fonts provided by
6710
the X server. An X font is array of character bit maps indexed by
6711
integer codes. @xref{Font and Characters}, for a complete discussion
6712
of the CLX functions used to manage fonts and characters.
6714
Since Common Lisp programs typically represent text as sequences of
6715
characters (that is, strings), CLX text functions must be prepared to
6716
convert a Common Lisp character into the integer code used to index the
6717
appropriate character bitmap in a given font. The @var{:translate}
6718
argument to a text function is a function which performs this
6719
conversion. The default @var{:translate} function handles all
6720
characters that satisfy @var{graphic-char-p} by converting each
6721
character into its ASCII code. Note that the assumption made by the
6722
default @var{:translate} function--that is, that an X font indexes
6723
bitmaps by ASCII codes--is often valid, but other encodings are
6724
possible. In general, a @var{:translate} function can perform complex
6725
transformations. It can be used to convert non-character input, to
6726
handle non-ASCII character encodings, and to change the fonts used to
6727
access character bitmaps. The complete behavior of a @var{:translate}
6728
function is given below by describing a prototypical
6729
@var{translate-function}.
6731
CLX offers two different ways to draw text--filled text and block
6732
text. The @var{draw-glyph} and @var{draw-glyphs} functions create
6733
filled text, in which each character image is treated as an area to be
6734
filled according to the fill-style of the given graphics context,
6735
without otherwise disturbing the surrounding background. In addition,
6736
filled text sends a complex type of server request which allows a series
6737
of font indices, font changes, and horizontal position changes to be
6738
compiled into a single request. Filled text functions use the following
6739
graphics context attributes: background, clip-mask, clip-x-origin,
6740
clip-y-origin, fill-style, font, foreground, function, plane-mask,
6741
stipple, subwindow-mode, tile, ts-x-origin, ts-y-origin.
6743
Block text is a rendering style commonly used by display terminals, in
6744
which each character image appears in the foreground pixel inside a
6745
rectangular character cell drawn in the graphics context background
6746
pixel. The @var{draw-image-glyph} and @var{draw-image-glyphs}
6747
functions create block text. Block text functions use the following
6748
graphics context attributes: background, clip-mask, clip-x-origin,
6749
clip-y-origin, font, foreground, plane-mask, stipple, subwindow-mode,
6750
tile, ts-x-origin, ts-y-origin.
6753
@defun draw-glyph drawable gcontext x y element &key :translate :width (:size :default)
6757
The destination @var{drawable}.
6760
The graphics context for drawing text.
6764
The left baseline position for the character drawn.
6767
A character or other object to be translated into a font index.
6770
A function to translate text to font indexes. Default is @var{#'translate-default}.
6773
The total pixel width of the character actually drawn, if known.
6776
Specifies the element size of the destination buffer given to @var{:translate} (8, 16, or
6780
Draws a single character of filled text represented by the given
6781
@emph{element}. The given @emph{x} and @emph{y} specify the left
6782
baseline position for the character. The first return value is true if
6783
the character is successfully translated and drawn, or @var{nil} if
6784
the @var{:translate} function did not translate it. The second return
6785
value gives the total pixel width of the character actually drawn, if
6788
Specifying a @var{:width} is a hint to improve performance. The
6789
@var{:width} is assumed to be the total pixel width of the character
6790
actually drawn. Specifying @var{:width} permits appending the output
6791
of subsequent calls to the same protocol request, provided
6792
@emph{gcontext} has not been modified in the interim. If @var{:width}
6793
is not specified, appending of subsequent output might not occur
6794
(unless @var{:translate} returns the character width).
6796
The @var{:size} specifies the element size of the destination buffer
6797
given to @var{:translate} (either 8, 16, or @var{:default}). If
6798
@var{:default} is specified, the size is based on the current font,
6799
if known; otherwise, 16 is used.
6805
Type @var{int32} or @var{null}.
6810
@defun draw-glyphs drawable gcontext x y sequence &key (:start 0) :end :translate :width (:size :default)
6814
The destination @var{drawable}.
6816
The graphics context for drawing text.
6819
The left baseline position for the character drawn.
6821
A sequence of characters or other objects to be translated into font indexes.
6824
Start and end indexes defining the elements to draw.
6826
A function to translate text to font indexes. Default is
6827
@var{#'translate-default}.
6829
The total total pixel width of the character actually drawn, if known.
6831
The element size of the destination buffer given to @var{:translate} (8, 16, or
6836
Draws the filled text characters represented by the given
6837
sequence. @var{:start} and @var{:end} define the elements of the
6838
sequence which are drawn. The given @emph{x} and @emph{y} specify the
6839
left baseline position for the first character. The first return value
6840
is @var{nil} if all characters are successfully translated and drawn;
6841
otherwise, the index of the first untranslated sequence element is
6842
returned. The second return value gives the total pixel width of the
6843
characters actually drawn, if known.
6845
Specifying a @var{:width} is a hint to improve performance. The
6846
@var{:width} is assumed to be the total pixel width of the character
6847
sequence actually drawn. Specifying @var{:width} permits appending
6848
the output of subsequent calls to the same protocol request, provided
6849
@emph{gcontext} has not been modified in the interim. If @var{:width}
6850
is not specified, appending of subsequent output might not occur
6851
(unless @var{:translate} returns the character width).
6853
The @var{:size} specifies the element size of the destination buffer
6854
given to@var{ :translate} (either 8, 16, or @var{:default}). If
6855
@var{:default} is specified, the size is based on the current font,
6856
if known; otherwise, 16 is used.
6859
Type @var{array-index} or @var{null}.
6861
Type @var{int32} or @var{null}.
6867
@defun draw-image-glyph drawable gcontext x y element &key :translate :width (:size :default)
6871
The destination @var{drawable}.
6873
The graphics context for drawing text.
6876
The left baseline position for the character drawn.
6878
A character or other object to be translated into a font index.
6880
A function to translate text to font indexes. Default is
6881
@var{#'translate-default}.
6883
The total pixel width of the character actually drawn, if known.
6885
Specifies the element size of the destination buffer given to @var{:translate} (8, 16, or
6890
Draws a single character of block text represented by the given
6891
@emph{element}. The given @emph{x} and @emph{y} specify the left
6892
baseline position for the character. The first return value is true if
6893
the character is successfully translated and drawn, or @var{nil} if
6894
the @var{:translate} function did not translate it. The
6895
@var{:translate} function is allowed to return an initial font
6896
change. The second return value gives the total pixel width of the
6897
character actually drawn, if known.
6899
The @var{:translate} function may not return a horizontal position
6900
change, since @var{draw-image-glyph} does not generate complex output
6903
Specifying a @var{:width} is a hint to improve performance. The
6904
@var{:width} is assumed to be the total pixel width of the character
6905
actually drawn. Specifying @var{:width} permits appending the output
6906
of subsequent calls to the same protocol request, provided
6907
@emph{gcontext} has not been modified in the interim. If @var{:width}
6908
is not specified, appending of subsequent output might not occur
6909
(unless @var{:translate} returns the character width).
6911
The @var{:size} specifies the element size of the destination buffer
6912
given to @var{:translate} (either 8, 16, or @var{:default}). If
6913
@var{:default} is specified, the size is based on the current font,
6914
if known; otherwise, 16 is used.
6919
Type @var{int32} or @var{null}.
6926
@defun draw-image-glyphs drawable gcontext x y sequence &key (:start 0) :end :translate :width (:size :default)
6927
@anchor{draw-image-glyphs}
6931
The destination @var{drawable}.
6934
The left baseline position for the character drawn.
6936
The graphics context for drawing text.
6938
A sequence of characters or other objects to be translated into font indexes.
6941
Start and end indexes defining the elements to draw.
6943
A function to translate text to font indexes. Default is
6944
@var{#'translate-default}.
6946
The total total pixel width of the character actually drawn, if known.
6948
The element size of the destination buffer given to @var{:translate} (8, 16, or
6953
Draws the block text characters represented by the given
6954
@var{sequence}. @var{:start} and @var{:end} define the elements of
6955
the @emph{sequence} which are drawn. The given @emph{x} and @emph{y}
6956
specify the left baseline position for the first character. The first
6957
return value is @var{nil} if all characters are successfully
6958
translated and drawn; otherwise, the index of the first untranslated
6959
sequence element is returned. The @var{:translate} function is
6960
allowed to return an initial font change. The second return value
6961
gives the total pixel width of the characters actually drawn, if
6964
The @var{:translate} function may not return a horizontal position
6965
change, since @var{draw-image-glyphs} does not generate complex
6968
Specifying a @var{:width} is a hint to improve performance. The
6969
@var{:width} is assumed to be the total pixel width of the character
6970
sequence actually drawn. Specifying @var{:width} permits appending
6971
the output of subsequent calls to the same protocol request, provided
6972
@emph{gcontext} has not been modified in the interim. If @var{:width}
6973
is not specified, appending of subsequent output might not occur
6974
(unless @var{:translate} returns the character width).
6976
The @var{:size} specifies the element size of the destination buffer
6977
given to @var{:translate} (either 8, 16, or @var{:default}). If
6978
@var{:default} is specified, the size will be based on the current
6979
font, if known; otherwise, 16 is used.
6983
Type @var{array-index} or @var{null}.
6985
Type @var{int32} or @var{null}.
6991
@defun translate-function source source-start source-end font destination destination-start
6995
A sequence of characters or other objects to be translated.
6997
An array-index specifying the first @emph{source} element to be translated.
6999
An array-index specifying the end of the @emph{source} subsequence to be
7002
The font indexed by translated @emph{source} elements.
7004
A vector where translated @emph{source} elements are stored.
7005
@item destination-start
7006
An array-index specifying the position to begin storing
7007
translated @emph{source} elements.
7011
A function used as the @var{:translate} argument for text
7012
functions. Converts elements of the @emph{source} (sub)sequence
7013
into font indexes for the given @emph{font} and stores them into
7014
the @emph{destination} vector.
7016
The @emph{destination} vector is created automatically by
7017
CLX. @emph{destination} is guaranteed to have room for (-
7018
@emph{source-end source-star}t) integer elements, starting at
7019
@emph{destination-start}. Elements of @emph{destination} can be
7020
either @var{card8} or @var{card16} integers, depending on the
7021
context. @emph{font} is the current font, if known, or @var{nil}
7022
otherwise. Starting with the element at @emph{source-start},
7023
@var{translate-function} should translate as many elements of
7024
@emph{source} as possible (up to the @emph{source-end} element)
7025
into indexes in the current @emph{font}, and store them into
7026
@emph{destination}. The first return value should be the source
7027
index of the first untranslated element.
7029
The second return value indicates the changes which should be made
7030
to the current text output request before translating the
7031
remaining @emph{source} elements. If no further elements need to
7032
be translated, the second return value should be @var{nil}. If a
7033
horizontal motion is required before further translation, the
7034
second return value should be the change in x position. If a font
7035
change is required for further translation, the second return
7036
value should be the new font.
7038
If known, the pixel width of the translated text can be returned as the third value; this can
7039
allow for appending of subsequent output to the same protocol request, if no overall
7040
width has been specified at the higher level.
7042
@item first-not-done
7043
Type @var{array-index}.
7045
Type @var{int16}, @var{font}, or @var{null}.
7047
Type @var{int32} or @var{null}.
7054
@node Images, Font and Characters, Graphic Operations, Top
7057
The X protocol provides for the transfer of images (two-dimensional
7058
arrays of pixel data) between a client program and a
7059
@var{drawable}. The format for image data can vary considerably. In
7060
order to present a uniform data representation for the manipulation of a
7061
variety of images, CLX defines a special @var{image} data
7062
type. Additional @var{image} subtypes -- @var{image-xy} and
7063
@var{image-z} -- allow for the representation of an image either as a
7064
sequence of bit planes or as an array of pixels. CLX includes functions
7065
for accessing @var{image} objects; for transferring image data between
7066
@var{image} objects, @var{drawables}, and files; and also for direct
7067
transfer of raw image data.
7073
* Direct Image Transfer::
7076
@node Image Types, Image Functions, Images, Images
7077
@section Image Types
7080
The @var{image} data type is the base type for all @var{image}
7081
objects. @var{image-xy} and @var{image-z} are subtypes of the
7082
@var{image} type which furnish accessors specialized for different
7083
image representations.
7087
* XY-Format Images::
7091
@node Basic Images, XY-Format Images, Image Types, Image Types
7092
@subsection Basic Images
7094
The following paragraphs describe the CLX functions that can be used to
7095
access all types of @var{image} objects.
7097
@defun image-blue-mask image
7101
An @var{image} object.
7105
Returns (and with @code{setf}) changes the @emph{mask} that
7106
selects the pixel subfield for blue intensity values. The
7107
@emph{mask} is non-@var{nil} only for images for
7108
@var{:direct-color} or @var{:true-color} visual types.
7112
Type @var{pixel} or @var{null}.
7118
@defun image-depth image
7122
An @var{image} object.
7125
Returns the @emph{depth} (that is, the number of bits per pixel)
7126
for the @emph{image}.
7135
@defun image-green-mask image
7139
An @var{image} object.
7142
Returns (and with @code{setf}) changes the mask that selects the
7143
pixel subfield for green intensity values. The mask is
7144
non-@var{nil} only for images for @var{:direct-color} or
7145
@var{:true-color} visual types.
7148
Type @var{pixel} or @var{null}.
7154
@defun image-height image
7158
An @var{image} object.
7161
Returns the @emph{height} of the @emph{image} in pixels.
7169
@defun image-name image
7173
An @var{image} object.
7176
Returns and (with @code{setf}) changes the @emph{name} string
7177
optionally associated with the @emph{image}.
7180
Type @var{stringable} or @var{null}.
7186
@defun image-plist image
7190
An @var{image} object.
7194
Returns and (with @code{setf}) changes the @emph{image} property
7195
list. The property list is a hook for added application
7205
@defun image-red-mask image
7209
An @var{image} object.
7213
Returns (and with @code{setf}) changes the @emph{mask} which
7214
selects the pixel subfield for red intensity values. The
7215
@emph{mask} is non-@var{nil} only for images for
7216
@var{:direct-color} or @var{:true-color} visual types.
7219
Type @var{pixel} or @var{null}.
7225
@defun image-width image
7229
An @var{image} object.
7233
Returns the @emph{width} of the @emph{image} in pixels.
7242
@defun image-x-hot image
7246
An @var{image} object.
7250
Returns and (with @code{setf}) changes the x position of the hot
7251
spot for an image used as a cursor glyph. The hot spot position is
7252
specified relative to the upper-left origin of the @emph{image}.
7255
Type @var{card16} or @var{null}.
7261
@defun image-y-hot image
7265
An @var{image} object.
7269
Returns and (with @code{setf}) changes the y position of the hot
7270
spot for an image used as a cursor glyph. The hot spot position is
7271
specified relative to the upper-left origin of the @emph{image}.
7274
Type @var{card16} or @var{null}.
7280
@node XY-Format Images, Z-Format Images, Basic Images, Image Types
7281
@subsection XY-Format Images
7284
The @var{image-xy} subtype represents an image as a sequence of
7285
bitmaps, one for each plane of the image, in most-significant to
7286
least-significant bit order. The following paragraphs describe the
7287
additional CLX functions that can be used to access @var{image-xy}
7290
@defun image-xy-bitmap-list image
7294
An @var{image-xy} object.
7298
Returns and (with @code{setf}) changes the list of bitmap planes
7299
for the @emph{image}.
7302
Type @var{list} of @var{bitmap}.
7308
@node Z-Format Images, , XY-Format Images, Image Types
7309
@subsection Z-Format Images
7312
The @var{image-z} subtype represents an image as a two-dimensional
7313
array of pixels, in scanline order. The following paragraphs describe
7314
the additional CLX functions that can be used to access @var{image-z}
7317
@defun image-z-bits-per-pixel image
7321
An @var{image-z} object.
7325
Returns and (with @code{setf}) changes the number of bits per data
7326
unit used to contain a pixel value for the @emph{image}. Depending
7327
on the storage format for image data, this value can be larger
7328
than the actual @emph{image} depth.
7330
@item pixel-data-size
7331
One of 1, 4, 8, 16, 24, or 32.
7337
@defun image-z-pixarray image
7341
An @var{image-z} object.
7344
Returns and (with @code{setf}) changes the two-dimensional array
7345
of pixel data for the @emph{image}.
7348
Type @var{pixarray}.
7355
@node Image Functions, Image Files, Image Types, Images
7356
@section Image Functions
7358
The following paragraphs describe the CLX functions used to:
7361
@item Create an @var{image} object.
7363
@item Copy an image or a subimage.
7365
@item Read an image from a @var{drawable}.
7367
@item Display an image to a @var{drawable}.
7371
@defun create-image &key :bit-lsb-first-p :bits-per-pixel :blue-mask :byte-lsb-first-p :bytes-per-line :data :depth :format :green-mask :height :name :plist :red-mask :width :x-hot :y-hot Function
7374
@item :bit-lsb-first-p
7375
For a returned image, true if the order of bits in each @var{:data}
7376
byte is least-significant bit first.
7377
@item :bits-per-pixel
7378
One of 1, 4, 8, 16, 24, or 32.
7380
For @var{:true-color} or @var{:direct-color} images, a pixel mask.
7381
@item :byte-lsb-first-p
7382
For a returned @emph{image}, true if the @var{:data} byte order is
7383
least-significant byte first.
7384
@item :bytes-per-line
7385
For a returned @emph{image}, the number of @var{:data} bytes per scanline.
7387
Either a @var{list} of @var{bitmaps}, a @var{pixarray}, or an array of @var{card8} bytes.
7389
The number of bits per displayed pixel.
7391
One of @var{:bitmap}, @var{:xy-format}, or @var{:z-format}.
7393
For @var{:true-color} or @var{:direct-color} images, a pixel mask.
7395
A @var{card16} for the image height in pixels.
7397
An optional @var{stringable} for the image name.
7399
An optional image property list.
7401
For @var{:true-color} or @var{:direct-color} images, a pixel mask.
7403
A @var{card16} for the image width in pixels.
7405
For a @var{cursor} image, the x position of the hot spot.
7407
For a cursor image, the y position of the hot spot.
7410
Creates an @var{image} object from the given @var{:data} and
7411
returns either an @var{image}, @var{image-xy}, or an
7412
@var{image-z}, depending on the type of image @var{:data}. If the
7413
@var{:data} is a list, it is assumed to be a @var{list} of
7414
@var{bitmaps} and an @var{image-xy} is created. If the
7415
@var{:data} is a @var{pixarray}, an @var{image-z} is
7416
created. Otherwise, the @var{:data} must be an array of bytes
7417
(@var{card8}), in which case a basic @var{image} object is
7420
If the @var{:data} is a list, each element must be a bitmap of
7421
equal size. @var{:width} and @var{:height} default to the bitmap
7422
width -- (@var{array-dimension bitmap} 1) -- and the bitmap height
7423
-- (@var{array-dimension bitmap} 0) -- respectively. @var{:depth}
7424
defaults to the number of bitmaps.
7426
If the @var{:data} is a @var{pixarray}, @var{:width} and
7427
@var{:height} default to the @var{pixarray} width --
7428
(@var{array-dimension pixarray} 1), and the pixarray height --
7429
(@var{array-dimension pixarray} 0), respectively. @var{:depth}
7430
defaults to (@var{pixarray-depth} @var{:data}). The
7431
@var{:bits-per-pixel} is rounded to a valid size, if necessary. By
7432
default, the @var{:bits-per-pixel} is equal to the @var{:depth}.
7434
If the @var{:data} is an array of @var{card8}, the @var{:width}
7435
and @var{:height} are required to interpret the image data
7436
correctly. The @var{:bits-per-pixel} defaults to the @var{:depth},
7437
and the @var{:depth} defaults to 1. @var{:bytes-per-line} defaults
7441
(@var{floor} (@var{length :data}) (* @var{:bits-per-pixel :height}))
7444
The @var{:format} defines the storage format of image data bytes
7445
and can be one of the following values:
7449
The @var{:data} is organized as a set of bitmaps representing image
7450
bit planes, appearing in most-significant to least-significant bit
7454
The @var{:data} is organized as a set of pixel values in scanline
7458
Similar to @var{:xy-pixmap}, except that the @var{:depth} must be 1,
7459
and 1 and 0 bits represent the foreground and background pixels,
7463
By default, the @var{:format} is @var{:bitmap} if @var{:depth} is
7464
1; otherwise, @var{:z-pixmap}.
7473
@defun copy-image image &key (:x 0) (:y 0) :width :height :result-type
7477
An @var{image} object.
7480
@var{card16} values defining the position of the upper-left corner of the subimage
7484
@var{card16} values defining the size of subimage copied.
7486
One of @var{'image-x}, @var{'image-xy}, or @var{'image-z}.
7490
Returns a new image, of the given @var{:result-type}, containing a
7491
copy of the portion of the @emph{image} defined by @var{:x},
7492
@var{:y}, @var{:width}, and @var{:height}. By default,
7496
(- (@var{image-width} @emph{image}) @var{:x})
7499
and @var{:height} is:
7502
(- (@var{image-height} @emph{image}) @var{:y})
7505
If necessary, the new image is converted to the @var{:result-type},
7506
that can be one of the following values:
7510
A basic @var{image} object is returned.
7512
An @var{image-xy} is returned.
7514
An @var{image-z} is returned.
7525
@defun get-image drawable &key :x :y :width :height :plane-mask (:format :z-format) :result-type Function
7532
@var{card16} values defining the upper-left @var{drawable} pixel returned. These
7533
arguments are required.
7536
@var{card16} values defining the size of the @emph{image} returned. These
7537
arguments are required.
7541
Either @var{:xy-pixmap} or @var{:z-pixmap}.
7543
One of @var{'image-x}, @var{'image-xy}, or @var{'image-z}.
7547
Returns an @emph{image} containing pixel values from the region of
7548
the @emph{drawable} given by @var{:x}, @var{:y}, @var{:width},
7549
and @var{:height}. The bits for all planes selected by 1 bits in
7550
the @var{:plane-mask} are returned as zero; the default
7551
@var{:plane-mask} is all 1 bits. The @var{:format} of the returned
7552
pixel values may be either @var{:xy-format} or @var{:z-format}.
7554
The @var{:result-type} defines the type of image object returned:
7558
A basic @var{image} object is returned.
7560
An @var{image-xy} is returned.
7562
An @var{image-z} is returned.
7566
By default, @var{:result-type} is @var{'image-z} if @var{:format}
7567
is @var{:z-format} and @var{'image-xy} if @var{:format} is
7575
@defun put-image drawable gcontext image &key (:src-x 0) (:src-y 0) :x :y :width :height :bitmap-p
7579
The destination @var{drawable}.
7581
The graphics context used to display the @emph{image}.
7583
An @var{image} object.
7586
@var{card16} values defining the upper-left position of the @emph{image} region to
7590
The position in the @emph{drawable} where the @emph{image} region is displayed. These
7591
arguments are required.
7592
@item :width :height
7593
@var{card16} values defining the size of the @emph{image} region displayed.
7595
If @emph{image} is depth 1, then if true, foreground and background pixels are
7596
used to display 1 and 0 bits of the @emph{image}.
7599
Displays a region of the @emph{image} defined by @var{:src-x},
7600
@var{:src-y}, @var{:width}, and @var{:height} on the destination
7601
d@emph{rawable}, with the upper-left pixel of the @emph{image}
7602
region displayed at the @emph{drawable} position given by @var{:x}
7603
and @var{:y}. By default, @var{:width} is:
7606
(- (@var{image-width} @emph{image}) @var{:src-x})
7609
and @var{:height} is:
7612
(- (@var{image-height} @emph{image}) @var{:src-y})
7615
The following attributes of the @emph{gcontext} are used to display
7616
the @var{image}: clip-mask, clip-x, clip-y, function, plane-mask,
7619
The @var{:bitmap-p} argument applies only to images of depth 1. In
7620
this case, if @var{:bitmap-p} is true or if the @emph{image} is a
7621
basic @var{image} object created with @var{:format :bitmap}, the
7622
@emph{image} is combined with the foreground and background pixels
7623
of the @var{gcontext}. 1 bits of the @emph{image} are displayed in
7624
the foreground pixel and 0 bits are displayed in the background
7631
@node Image Files, Direct Image Transfer, Image Functions, Images
7632
@section Image Files
7635
CLX provides functions that allow images to be written to a file in a standard X
7636
format. The following paragraphs describe the CLX functions used to:
7639
@item Read an image from a file.
7641
@item Write an image to a file.
7645
@defun read-bitmap-file pathname
7649
An image file pathname.
7653
Reads an image file in standard X format and returns an
7654
@var{image} object. The returned @emph{image} can have
7655
depth greater than one.
7664
@defun write-bitmap-file pathname image &optional name
7668
An image file pathname.
7670
An @var{image} object.
7672
A @var{stringable} image name.
7675
Writes the @emph{image} to an image file in standard X
7676
format. The @emph{image} can have depth greater than
7677
one. The @emph{name} is an image identifier written to the
7678
file; the default @emph{name} is (@var{or}
7679
(@var{image-name} @emph{image}) @var{'image}).
7685
@node Direct Image Transfer, , Image Files, Images
7686
@section Direct Image Transfer
7689
For cases where the @var{image} representation is not needed,
7690
CLX provides functions to read and display image data
7692
@defun get-raw-image drawable &key :data (:start 0) :x :y :width :height :plane-mask (:format :z-format) (:result-type '(vector card8))
7698
An optional @var{sequence} of @var{card8}.
7700
The index of the first @var{:data} element modified.
7703
@var{card16} values defining the size of the @var{image} returned. These arguments are
7707
@var{card16} values defining the size of the image returned.These
7708
arguments are required.
7712
Either @var{:xy-pixmap} or @var{:z-pixmap}. This argument is required.
7714
The type of image data sequence to return.
7718
Returns a sequence of image data from the region of the
7719
@emph{drawable} given by @var{:x}, @var{:y},
7720
@var{:width}, and @var{:height}. If @var{:data} is
7721
given, it is modified beginning with the element at the
7722
@var{:start} index and returned. The @emph{depth} and
7723
@emph{visua}l type ID of the @emph{drawable} are also
7726
The bits for all planes selected by 1 bits in the
7727
@var{:plane-mask} are returned as zero; the default
7728
@var{:plane-mask} is all 1 bits. The @var{:format} of
7729
the returned pixel values may be either
7730
@var{:xy-format} or @var{:z-format}. The
7731
@var{:result-type} defines the type of image data
7734
The calling program is responsible for handling the
7735
byte-order and bit-order returned by the server for the
7736
@emph{drawable}'s display (see @var{display-byte-order}
7737
and @var{display-image-lsb-first-p}).
7740
Type @var{sequence} or @var{card8}.
7750
@defun put-raw-image drawable gcontext data &key (:start 0) :depth :x :y :width :height (:left-pad 0) :format
7754
The destination @var{drawable}.
7756
The graphics context used to display the image.
7758
A sequence of integers.
7760
The index of the first element of @emph{data} displayed.
7762
The number of bits per pixel displayed. This argument is required.
7765
The position in the @emph{drawable} where the image region is displayed. These
7766
arguments are required.
7769
@var{card16} values defining the size of the image region displayed. These
7770
arguments are required.
7772
A @var{card8} specifying the number of leading bits to discard for each image
7775
One of @var{:bitmap}, @var{:xy-pixmap}, or @var{:z-pixmap}.
7778
Displays a region of the image data defined by @var{:start},
7779
@var{:left-pad}, @var{:width}, and @var{:height} on the
7780
destination @emph{drawable}, with the upper-left pixel of the image
7781
region displayed at the @emph{drawable} position given by @var{:x}
7784
The @var{:format} can be either @var{:xy-pixmap},
7785
@var{:z-pixmap}, or @var{:bitmap}. If @var{:xy-pixmap} or
7786
@var{:z-pixmap} formats are used, @var{:depth} must match the
7787
depth of the destination @emph{drawable}. For @var{:xy-pixmap}, the
7788
data must be in XY format. For @var{:z-pixmap}, the data must be in
7789
Z format for the given @var{:depth}.
7791
If the @var{:format} is @var{:bitmap}, the @var{:depth} must be
7792
1. In this case, the image is combined with the foreground and
7793
background pixels of the @emph{gcontext}. 1 bits of the image are
7794
displayed in the foreground pixel and 0 bits are displayed in the
7797
The @var{:left-pad} must be zero for @var{:z-pixmap} format. For
7798
@var{:bitmap} and @var{:xy-pixmap} formats, the @var{:left-pad}
7799
must be less than the bitmap-scanline-pad for the @emph{drawable}'s
7800
display (@pxref{display-bitmap-format}). The first
7801
@var{:left-pad} bits in every scanline are to be ignored by the
7802
server; the actual image begins that many bits into the data.
7804
The following attributes of the @emph{gcontext} are used to display
7805
the @var{image}: clip-mask, clip-x, clip-y, function, plane-mask,
7808
The calling program is responsible for handling the byte-order and
7809
bit-order required by the server for the @emph{drawable}'s display
7810
(see @var{display-byte-order} and
7811
@var{display-image-lsb-first-p}).
7817
@node Font and Characters, Colors, Images, Top
7818
@chapter Font and Characters
7820
An X server maintains a set of fonts used in the text operations
7821
requested by client programs. An X font is an array of character bit
7822
maps (or @emph{glyphs}) indexed by integer codes. In fact, font glyphs
7823
can also represent cursor shapes or other images and are not limited to
7824
character images. X supports both linear and matrix encoding of font
7825
indexes. With linear encoding, a font index is interpreted as a single
7826
16-bit integer index into a one-dimensional array of glyphs. With matrix
7827
encoding, a font index is interpreted as a pair of 8-bit integer indexes
7828
into a two-dimensional array of glyphs. The type of index encoding used
7831
In order to access or use a font, a client program must first open it
7832
using the @var{open-font} function, sending a font name string as an
7833
identifier. @var{open-font} creates a CLX @var{font} object used to
7834
refer to the font in subsequent functions. Afterward, calling
7835
@var{open-font} with the same font name returns the same @var{font}
7836
object. When a font is no longer in use, a client program can call
7837
@var{close-font} to destroy the @var{font} object.
7839
A font has several attributes which describe its geometry and its
7840
glyphs. CLX provides functions to return the attributes of a font, as
7841
well functions for accessing the attributes of individual font
7842
glyphs. Glyph attributes are referred to as @emph{character attributes},
7843
since characters are the most common type of font glyphs. A font also
7844
has a property list of values recorded by the X server. However, the set
7845
of possible font properties and their values are not standardized and
7846
are implementation-dependent. Typically, CLX maintains a cache of font
7847
and character attributes, in order to minimize server requests.
7848
However, the font cache mechanism is implementation-dependent and cannot
7849
be controlled by the client. In some cases, CLX may create a
7850
@emph{pseudo-font} object solely for the purpose of accessing font
7851
attributes. A pseudo-font is represented by a special type of
7852
@var{font} object that cannot be used in a @var{gcontext}. If
7853
necessary, CLX can automatically convert a pseudo-font into a true font,
7854
if the name of the pseudo-font is known.
7856
The set of available fonts is server-dependent; that is, font names are
7857
not guaranteed to be portable from one server to the next. However, the
7858
public X implementation from MIT includes a set of fonts that are
7859
typically available with most X servers.
7861
The following paragraphs describe CLX functions to:
7864
@item Open and close fonts.
7865
@item List available fonts.
7866
@item Access font attributes.
7867
@item Access character attributes.
7868
@item Return the size of a text string.
7875
* Chracter Attributes::
7876
* Querying Text Size::
7879
@node Opening Fonts, Listing Fonts, Font and Characters, Font and Characters
7880
@section Opening Fonts
7883
The following paragraphs discuss the CLX functions for opening and
7886
@defun open-font display name
7890
A @var{display} object.
7895
Opens the font with the given @emph{name} and returns a
7896
@var{font} object. The name string should contain only ISO
7897
Latin-1 characters; case is not significant.
7907
@defun close-font font
7911
A @var{font} object.
7914
Deletes the association between the resource ID and the
7915
@emph{font}. The @emph{font} is freed when no other server
7916
resource references it. The @emph{font} can be unloaded by the X
7917
server if this is the last reference to the @emph{font} by any
7918
client. In any case, the @emph{font} should never again be
7919
referenced because its resource ID is destroyed. This might not
7920
generate a protocol request if the @emph{font} is
7921
reference-counted locally or if it is a pseudo-font.
7926
@defun discard-font-info fonts
7930
A @var{font} object.
7933
Discards any state that can be re-obtained with
7934
@var{open-font}. This is simply a performance hint for
7935
memory-limited systems.
7939
@node Listing Fonts, Font Attributes, Opening Fonts, Font and Characters
7940
@section Listing Fonts
7943
The following paragraphs describe CLX functions that return fonts or
7944
font names that match a given pattern string. Such pattern strings
7945
should contain only ISO Latin-1 characters; case is not significant. The
7946
following pattern characters can be used for @emph{wildcard} matching:
7950
Matches any sequence of zero or more characters.
7952
Matches any single character.
7955
For example, the pattern "T?mes Roman" matches the name "Times Roman"
7956
but not the name "Thames Roman". However, the pattern "T*mes Roman"
7959
@defun font-path display &key (:result-type 'list)
7963
A @var{display} object.
7965
Specifies the type of resulting sequence.
7968
Returns a @var{list} (by default) of names containing the current
7969
search path for fonts. With @code{setf}, this function sets the
7970
search path for font lookup. There is only one search path per
7971
server, not one per client. The interpretation of the names is
7972
server-dependent, but they are intended to specify directories to be
7973
searched in the order listed.
7975
Setting the path to the empty list restores the default path
7976
defined for the server. Note that as a side-effect of
7977
executing this request, the server is guaranteed to flush
7978
all cached information about fonts for which there are
7979
currently no explicit resource IDs allocated.
7982
Type @var{sequence} of either @var{string} or @var{pathname}.
7988
@defun list-font-names display pattern &key (:max-fonts 65535) (:result-type 'list)
7992
A @var{display} object.
7994
A string used to match font names. Only font names that match the pattern are
7997
The maximum number of font names returned. Default is 65535.
7999
The type of sequence to return. Default is '@var{list}.
8002
Returns a sequence of strings containing the font names that match
8003
the @emph{pattern}. The fonts available are determined by the font
8004
search path; see @var{font-path}). The maximum number of font names
8005
returned is determined by @var{:max-fonts}.
8009
Type @var{sequence} of @var{string}.
8015
@defun list-fonts display pattern &key (:max-fonts 65535) (:result-type 'list)
8019
A @var{display} object.
8021
A string used to match font names. Only fonts whose name matches the
8022
pattern are returned.
8024
The maximum number of fonts returned. Default is 65535.
8026
The type of sequence to return. Default is @var{'list}.
8029
Returns a sequence of pseudo-fonts corresponding to the available
8030
fonts whose names match the @emph{pattern}. The fonts available are
8031
determined by the font search path; see @var{font-path}). The
8032
maximum number of @var{font} objects returned is determined by
8037
Type @var{sequence} of @var{font}.
8043
@node Font Attributes, Chracter Attributes, Listing Fonts, Font and Characters
8044
@section Font Attributes
8047
The following paragraphs describe the CLX functions used to access font
8050
@defun font-all-chars-exist-p font
8058
Returns true if glyphs exist for all indexes in the range returned
8059
by @var{font-min-char} and @var{font-max-char}. Returns
8060
@var{nil} if an index in the range corresponds to empty glyph.
8064
A @var{font} object.
8070
@defun font-ascent font
8078
Returns the vertical @emph{ascent} of the @emph{font} used for
8079
interline spacing. The @emph{ascent} defines the nominal distance
8080
in pixels from the baseline to the bottom of the previous line of
8081
text. Some font glyphs may actually extend beyond the font
8085
A @var{font} object.
8091
@defun font-default-char font
8099
Returns the @emph{index} of the glyph drawn when an invalid or
8100
empty glyph index is specified. If the default index specifies an
8101
invalid or empty glyph, an invalid or empty index has no effect.
8104
A @var{font} object.
8110
@defun font-descent font
8118
Returns the vertical @emph{descent} of the @emph{font} used for
8119
interline spacing. The @emph{descent} defines the nominal distance
8120
in pixels from the baseline to the top of the next line of
8121
text. Some font glyphs may actually extend beyond the font
8125
A @var{font} object.
8131
@defun font-direction font
8135
Type @var{draw-direction}.
8139
Returns the nominal drawing @emph{direction} for the
8140
@emph{font}. The font drawing direction is only a hint that
8141
indicates whether the @emph{char-width} of most font glyphs is
8142
positive (@var{:left-to-right} direction) or negative
8143
(@var{:right-to-left} direction). Note that X does not provide
8144
any direct support for vertical text.
8147
A @var{font} object.
8153
@defun font-display font
8157
A @var{font} object.
8160
Returns the @var{display} object associated with the specified
8171
@defun font-equal font-1 font-2
8176
The @var{font} objects.
8179
Returns true if the two arguments refer to the same server
8180
resource and @var{nil} if they do not.
8190
A @var{font} object.
8193
Returns the unique resource ID assigned to the specified @emph{font}.
8197
Type @var{resource-id}.
8203
@defun font-max-byte1 font
8207
A @var{font} object.
8211
Returns zero if the @emph{font} uses linear index
8212
encoding. Otherwise, if the @emph{font} uses matrix index
8213
encoding, a value between 1 and 255 is returned that specifies the
8214
maximum value for the most significant byte of font indexes.
8217
Type @var{card8}@emph{.}
8223
@defun font-max-byte2 font
8227
A @var{font} object.
8231
Returns zero if the @emph{font} uses linear index
8232
encoding. Otherwise, if the @emph{font} uses matrix index
8233
encoding, a value between 1 and 255 is returned that specifies the
8234
maximum value for the least significant byte of font indexes.
8237
Type @var{card8}@emph{.}
8243
@defun font-max-char font
8247
A @var{font} object.
8251
Returns the maximum valid value used for linear encoded
8252
indexes. This function is not meaningful for fonts that use matrix
8262
@defun font-min-byte1 font
8266
A @var{font} object.
8270
Returns zero if the @emph{font} uses linear index
8271
encoding. Otherwise, if the @emph{font} uses matrix index
8272
encoding, a value between 1 and 255 is returned that specifies the
8273
minimum value for the most significant byte of font indexes.
8282
@defun font-min-byte2 font
8286
A @var{font} object.
8290
Returns zero if the @emph{font} uses linear index
8291
encoding. Otherwise, if the @emph{font} uses matrix index
8292
encoding, a value between 1 and 255 is returned that specifies the
8293
minimum value for the least significant byte of font indexes.
8302
@defun font-min-char font
8306
A @var{font} object.
8310
Returns the minimum valid value used for linear encoded
8311
indexes. This function is not meaningful for fonts that use matrix
8321
@defun font-name font
8325
A @var{font} object.
8329
Returns the name of the @emph{font}, or @var{nil} if @emph{font}
8333
Type @var{string} or @var{null}.
8341
Returns true if the argument is a @var{font} object and
8342
@var{nil} otherwise.
8352
@defun font-plist font
8356
A @var{font} object.
8360
Returns and (with @code{setf}) sets the property list for the
8361
specified @emph{font}. This function provides a hook where
8362
extensions can add data.
8371
@defun font-properties font
8375
A @var{font} object.
8379
Returns the list of font @emph{properties} recorded by the X
8380
server. The returned list is a property list of keyword/value
8381
pairs. The set of possible font property keywords is
8382
implementation-dependent.
8391
@defun font-property font name
8395
A @var{font} object.
8397
A font property keyword.
8401
Returns the value of the font @emph{property} specified by the
8402
@emph{name} keyword. The property value, if it exists, is returned
8403
as an uninterpreted 32-bit integer.
8406
Type @var{int32} or @var{null}.
8412
@defun max-char-ascent font
8416
A @var{font} object.
8420
Returns the maximum @var{char-ascent} value for all characters in
8430
@defun max-char-attributes font
8434
A @var{font} object.
8438
Returns the maximum @var{char-attributes} value for all
8439
characters in @emph{font}.
8448
@defun max-char-descent font
8452
A @var{font} object.
8456
Returns the maximum @var{char-descent} value for all characters
8466
@defun max-char-left-bearing font
8470
A @var{font} object.
8474
Returns the maximum @var{char-left-bearing} value for all characters in @emph{font}.
8483
@defun max-char-right-bearing font
8487
A @var{font} object.
8491
Returns the maximum @var{char-right-bearing} value for all
8492
characters in @emph{font}.
8501
@defun max-char-width font
8505
A @var{font} object.
8509
Returns the maximum @var{char-width} value for all characters in
8519
@defun min-char-ascent font
8523
A @var{font} object.
8527
Returns the minimum @var{char-ascent} for all characters in
8537
@defun min-char-attributes font
8541
A @var{font} object.
8545
Returns the minimum @var{char-attributes} for all characters in @emph{font}.
8554
@defun min-char-descent font
8558
A @var{font} object.
8562
Returns the minimum @var{char-descent} for all characters in @emph{font}.
8571
@defun min-char-left-bearing font
8575
A @var{font} object.
8579
Returns the minimum @var{char-left-bearing} for all characters in
8589
@defun min-char-right-bearing font
8593
A @var{font} object.
8597
Returns the minimum @var{char-right-bearing} for all characters
8607
@defun min-char-width font
8611
A @var{font} object.
8615
Returns the minimum @var{char-width} for all characters in
8625
@node Chracter Attributes, Querying Text Size, Font Attributes, Font and Characters
8626
@section Chracter Attributes
8629
The following paragraphs describe the CLX functions used to access the
8630
attributes of individual font glyphs.
8632
@defun char-ascent font index
8636
A @var{font} object.
8638
An @var{int16} font index.
8642
Returns the vertical distance in pixels from the baseline to the top
8643
of the given font glyph. Returns @var{nil} if the index is invalid
8644
or specifies an empty glyph, or if the @emph{font} is a pseudo-font.
8647
Type @var{int16} or @var{null}.
8653
@defun char-attributes font index
8657
A @var{font} object.
8659
An @var{int16} font index.
8663
Returns font-specific @emph{attributes} of the given glyph. The
8664
interpretation of such attributes is server-dependent. Returns
8665
@var{nil} if the @emph{index} is invalid or specifies an empty
8666
glyph, or if the @emph{font} is a pseudo-font.
8669
Type @var{int16} or @var{null}.
8675
@defun char-descent font index
8679
A @var{font} object.
8681
An @var{int16} font index.
8685
Returns the vertical distance in pixels from the baseline to the
8686
bottom of the given font glyph. Returns @var{nil} if the
8687
@emph{index} is invalid or specifies an empty glyph, or if the
8688
@emph{font} is a pseudo-font.
8691
Type @var{int16} or @var{null}.
8697
@defun char-left-bearing font index
8701
A @var{font} object.
8703
An @var{int16} font index.
8707
Returns the left side bearing of the given font glyph. If
8708
@var{draw-glyph} is called with horizontal position @emph{x},
8709
the leftmost pixel of the glyph is drawn at the position
8710
(+ @emph{x left-bearing}). Returns @var{nil} if the
8711
@emph{index} is invalid or specifies an empty glyph, or if the
8712
@emph{font} is a pseudo-font.
8715
Type @var{int16} or @var{null}.
8721
@defun char-right-bearing font index
8725
A @emph{font} object.
8727
An @var{int16} font index.
8731
Returns the right side bearing of the given font glyph. If
8732
n@var{draw-glyph} is called with horizontal position @emph{x},
8733
the rightmost pixel of the glyph is drawn at the position (+
8734
@emph{x rightbearing}). Returns @var{nil} if the
8735
@emph{index} is invalid or specifies an empty glyph, or if the
8736
@emph{font} is a pseudo-font.
8740
Type @var{int16} or @var{null}.
8746
@defun char-width font index
8750
A @var{font} object.
8752
An @var{int16} font index.
8755
Returns the @emph{width} of the given font glyph. The @emph{width}
8756
is defined to be equal to (- @emph{rightbearing
8757
left-bearing}). Returns @var{nil} if the @emph{index} is invalid
8758
or specifies an empty glyph, or if the @emph{font} is a pseudo-font.
8762
Type @var{int16} or @var{null}.
8768
@node Querying Text Size, , Chracter Attributes, Font and Characters
8769
@section Querying Text Size
8772
CLX defines functions to return the size of text drawn in a specified
8773
font. @xref{Drawing Text}, for a description of the
8774
@var{:translate} function used by the functions in the following
8777
@defun text-extents font sequence &key (:start 0) :end :translate
8778
@anchor{text-extents}
8782
The font (or @var{gcontext}) used for measuring characters.
8784
A sequence of characters or other objects to be translated into font indexes.
8787
Start and end indexes defining the elements to draw.
8789
A function to translate text to font indexes. Default is
8790
@var{#'translate-default}.
8793
Returns the complete geometry of the given @emph{sequence} when
8794
drawn in the given @emph{fon}t. The @emph{font} can be a
8795
@var{gcontext}, in which case the font attribute of the given
8796
graphics context is used. @var{:start} and @var{:end} define the
8797
elements of the @emph{sequence} which are used.
8799
The returned @emph{width} is the total pixel width of the
8800
translated character sequence. The returned @emph{ascent} and
8801
@emph{descent} give the vertical ascent and descent for characters
8802
in the translated @emph{sequence}. The returned @emph{left} gives
8803
the left bearing of the leftmost character. The returned
8804
@emph{right} gives the right bearing of the rightmost
8805
character. The returned @emph{font-ascent} and @emph{font-descent}
8806
give the maximum vertical ascent and descent for all characters in
8807
the @emph{fon}t. If @var{:translate} causes font changes, then
8808
@emph{font-ascent} and @emph{font-descent} will be the maximums
8809
over all fonts used. The @emph{direction} returns the preferred
8810
draw direction for the font. If @var{:translate} causes font
8811
changes, then the @emph{direction} will be @var{nil}. The
8812
@emph{first-not-done} value returned is @var{nil} if all elements
8813
of the @emph{sequence} were successfully translated; otherwise the
8814
index of the first untranslated element is returned.
8830
Type @var{draw-direction}.
8831
@item first-not-done
8832
Type @var{array-index} or @var{null}.
8838
@defun text-width font sequence &key (:start 0) :end :translate
8842
The font (or @var{gcontext}) used for measuring characters.
8844
A sequence of characters or other objects to be translated into font indexes.
8847
Start and end indexes defining the elements to draw.
8849
A function to translate text to font indexes. Default is
8850
@var{#'translate-default}.
8854
Returns the total pixel width of the given @emph{sequence} when
8855
drawn in the given @emph{font}. The @emph{font} can be a
8856
@var{gcontext}, in which case the font attribute of the given
8857
graphics context is used. @var{:start} and @var{:end} define the
8858
elements of the @emph{sequence} which are used. The second value
8859
returned is @var{nil} if all elements of the @emph{sequence} were
8860
successfully translated; otherwise the index of the first
8861
untranslated element is returned.
8865
@item first-not-done
8866
Type @var{array-index} or @var{null}.
8872
@node Colors, Cursors, Font and Characters, Top
8876
* Colormaps and Colors::
8878
* Colormap Functions::
8881
@node Colormaps and Colors, Color Functions, Colors, Colors
8882
@section Colormaps and Colors
8885
In X, a @emph{color} is defined by a set of three numeric values,
8886
representing intensities of red, green, and blue. Red, green, and blue
8887
are referred to as the @emph{primary} hues. A @emph{colormap} is a list
8888
of colors, each indexed by an integer @emph{pixel} value. Each entry in
8889
a colormap is called a color @emph{cell}. Raster graphics displays store
8890
pixel values in a special screen hardware memory. As the screen hardware
8891
scans this memory, it reads each pixel value, looks up the color in the
8892
corresponding cell of a colormap, and displays the color on its screen.
8894
The colormap abstraction applies to all classes of visual types
8895
supported by X, including those for screens which are actually
8896
monochrome. For example, @var{:gray-scale} screens use colormaps in
8897
which colors actually specify the monochrome intensity. A typical
8898
black-and-white monochrome display has a @var{:static-gray} screen with
8899
a two-cell colormap.
8901
The following list describes how pixel values and colormaps are handled
8902
for each visual class.
8906
A pixel value is decomposed into separate red, green, and blue
8907
subfields. Each subfield indexes a separate colormap. Entries in all colormaps can
8910
A pixel value indexes a single colormap that contains monochrome
8911
intensities. Colormap entries can be changed.
8913
A pixel value indexes a single colormap that contains color
8914
intensities. Colormap entries can be changed.
8916
Same as @var{:pseudo-color}, except that the colormap entries are
8917
predefined by the hardware and cannot be changed.
8919
Same as @var{:gray-scale}, except that the colormap entries are
8920
predefined by the hardware and cannot be changed.
8922
Same as @var{:direct-color}, except that the colormap entries are
8923
predefined by the hardware and cannot be changed. Typically, each of
8924
the red, green, and blue colormaps provides a (near) linear ramp of
8928
CLX provides functions to create colormaps, access and modify colors and
8929
color cells, and install colormaps in screen hardware.
8931
@node Color Functions, Colormap Functions, Colormaps and Colors, Colors
8932
@section Color Functions
8935
A color is represented by a CLX color object, in which each of the red,
8936
green, and blue values is specified by an @var{rgb-val} -- a floating
8937
point number between 0.0 and 1.0. (@pxref{Data Types}). The
8938
value 0.0 represents the minimum intensity, while 1.0 represents the
8939
maximum intensity. CLX automatically converts @var{rgb-val} values into
8940
16-bit integers when sending colors to an X server. The X server, in
8941
turn, scales 16-bit color values to match the actual intensity range
8942
supported by the screen.
8944
Colors used on @var{:gray-scale} screens must have the same value for
8945
each of red, green, and blue. Only one of these values is used by screen
8946
hardware to determine intensity; however, CLX does not define which of
8947
red, green, or blue is actually used.
8949
The following paragraphs describe the CLX functions used to create,
8950
access, and modify colors.
8952
@defun make-color &key (:blue 1.0) (:green 1.0) (:red 1.0) &allow-other-keys
8958
@var{rgb-val} values that specify the saturation for each primary.
8962
Creates, initializes, and returns a new @var{color} object with the
8963
specified values for red, green, and blue.
8972
@defun color-blue color
8976
A @var{color} object.
8980
Returns and (with @code{setf}) sets the value for blue in the
8983
@item blue-intensity
8990
@defun color-green color
8994
A @var{color} object.
8998
Returns and (with @code{setf}) sets the value for green in the
9001
@item green-intensity
9008
@defun color-p color
9010
Returns non-@var{nil} if the argument is a @var{color} object and
9011
@var{nil} otherwise.
9020
@defun color-red color
9024
A @var{color} object.
9028
Returns and (with @code{setf}) sets the value for red in the
9038
@defun color-rgb color
9042
A @var{color} object.
9046
Returns the values for red, green, and blue in the @emph{color}.
9057
@node Colormap Functions, , Color Functions, Colors
9058
@section Colormap Functions
9061
A colormap is represented in CLX by a @var{colormap} object. A CLX
9062
program can create and manipulate several @var{colormap}
9063
objects. However, the colors contained in a @var{colormap} are made
9064
visible only when the @var{colormap} is @emph{installed}. Each window
9065
is associated with a @var{colormap} that is used to translate window
9066
pixels into colors (see @var{window-colormap}). However, a window will
9067
appear in its true colors only if its associated @var{colormap} is
9070
The total number of colormaps that can be installed depends on the
9071
screen hardware. Most hardware devices allow exactly one
9072
@var{colormap} to be installed at any time. That is,
9073
@var{screen-min-installed-maps} and @var{screen-max-installed-maps}
9074
are both equal to 1. Installing a new @var{colormap} can cause a
9075
previously installed @var{colormap} to be uninstalled. It is important
9076
to remember that the set of installed @var{colormaps} is a hardware
9077
resource shared cooperatively among all client programs connected to an
9080
A CLX program can control the contents of @var{colormaps} by allocating
9081
color cells in one of two ways: read-only or read-write. Allocating a
9082
read-only color cell establishes a color value for a specified pixel
9083
value that cannot be changed. However, read-only color cells can be
9084
shared among all client programs. Read-only allocation is the best
9085
strategy for making use of limited @var{colormap} hardware in a
9086
multi-client environment.
9088
Alternatively, allocating a read-write color cell allows a client the
9089
exclusive right to set the color value stored in the cell. A cell
9090
allocated read-write by one client cannot be allocated by another
9091
client, not even as a read-only cell. Note that read-write allocation is
9092
not allowed for screens whose visual type belongs to one of the
9093
@var{:static-gray}, @var{:static-color}, or @var{:true-color}
9094
classes. For screens of these classes, @var{colormap} cells cannot be
9097
Two entries of the default colormap, typically containing the colors
9098
black and white, are automatically allocated read-only. The pixel values
9099
for these entries can be returned by the functions
9100
@var{screen-black-pixel} and @var{screen-white-pixel}. Applications
9101
that need only two colors and also need to operate on both monochrome
9102
and color screens should always use these pixel values. The names
9103
@emph{black} and @emph{white} are intended to reflect relative intensity
9104
levels and need not reflect the actual colors displayed for these pixel
9107
Each screen has a default @var{colormap}, which is initially
9108
installed. By conventions, clients should allocate only read-only cells
9109
from the default @var{colormap}.
9112
* Creating Colormaps::
9113
* Installing Colormaps::
9114
* Allocating Colors::
9117
* Colormap Attributes::
9120
@node Creating Colormaps, Installing Colormaps, Colormap Functions, Colormap Functions
9121
@subsection Creating Colormaps
9124
CLX provides functions for creating and freeing new @var{colormap}
9127
@defun create-colormap visual window &optional alloc-p
9131
A @var{visual} type ID.
9135
Specifies whether @var{colormap} cells are permanently allocated read-write.
9139
Creates and returns a @emph{colormap} of the specified
9140
@emph{visual} type for the screen containing the
9141
@emph{window}. The @emph{visual} type must be one of those
9142
supported by the screen.
9144
Initial color cell values are undefined for visual types belonging
9145
to the @var{:gray-scale}, @var{:pseudo-color}, and
9146
@var{:direct-color} classes. Color cell values for visual types
9147
belonging to the @var{:static-gray}, @var{:static-color}, and
9148
@var{:true-color} classes have initial values defined by the
9149
visual type. However, X does not define the set of possible visual
9150
types or their initial color cell values.
9152
If @emph{alloc-p} is true, all colormap cells are permanently
9153
allocated read-write and cannot be freed by @var{free-colors}. It
9154
is an error for @emph{alloc-p} to be true when the visual type
9155
belongs to the @var{:static-gray}, @var{:static-color}, or
9156
@var{:true-color} classes.
9160
Type @var{colormap}.
9166
@defun copy-colormap-and-free colormap
9173
Creates and returns a new @var{colormap} by copying, then
9174
freeing, allocated cells from the specified @emph{colormap}.
9176
All color cells allocated read-only or read-write in the original
9177
@var{colormap} have the same color values and the same allocation
9178
status in the @emph{new-colormap}. The values of unallocated color
9179
cells in the @emph{new-colormap} are undefined. After copying, all
9180
allocated color cells in the original @var{colormap} are freed,
9181
as if @var{free-colors} was called. The unallocated cells of the
9182
original @var{colormap} are not affected.
9184
If @emph{alloc-p} was true when the original @var{colormap} was
9185
created, then all color cells of the @emph{new-colormap} are
9186
permanently allocated read-write, and all the color cells of the
9187
original @var{colormap} are freed.
9191
Type @var{colormap}.
9197
@defun free-colormap colormap
9204
Destroys the @emph{colormap} and frees its server resource. If the
9205
@emph{colormap} is installed, it is uninstalled. For any window
9206
associated with the @emph{colormap}, the window is assigned a
9207
@var{nil} @var{colormap}, and a @var{:colormap-notify} event is
9208
generated. The colors displayed for a window with a @var{nil
9209
colormap} are undefined.
9211
However, this function has no effect if the @emph{colormap} is a
9212
screen default @var{colormap}.
9217
@node Installing Colormaps, Allocating Colors, Creating Colormaps, Colormap Functions
9218
@subsection Installing Colormaps
9221
The following paragraphs describe the CLX functions to install and
9222
uninstall colormaps and to return the set of installed colormaps.
9224
Initially, the default @var{colormap} for a screen is installed (but is
9225
not in the required list).
9227
@defun install-colormap colormap
9228
@anchor{install-colormap}
9235
Installs the @emph{colormap.} All windows associated with this
9236
@emph{colormap} immediately display with true colors. As a
9237
side-effect, additional colormaps might be implicitly uninstalled by
9240
If the specified @emph{colormap} is not already installed, a
9241
@var{:colormap-notify} event is generated on every window
9242
associated with this @emph{colormap}. In addition, for every other
9243
colormap that is implicitly uninstalled, a @var{:colormap-notify}
9244
event is generated on every associated window.
9250
@defun installed-colormaps window &key (:result-type 'list)
9256
A sub-type of @var{sequence} that indicates the type of sequence to return.
9260
Returns a sequence containing the installed @var{colormaps} for the
9261
screen of the specified @emph{window}. The order of the colormaps is
9265
Type @var{sequence} of @var{colormap}.
9271
@defun uninstall-colormap colormap
9278
Uninstalls the @emph{colormap}. However, the @emph{colormap} is not
9279
actually uninstalled if this would reduce the set of installed
9280
colormaps below the value of @var{screen-min-installed-maps}. If
9281
the @emph{colormap} is actually uninstalled, a
9282
@var{:colormap-notify} event is generated on every associated
9289
@node Allocating Colors, Finding Colors, Installing Colormaps, Colormap Functions
9290
@subsection Allocating Colors
9293
The following paragraphs describe the functions for allocating read-only
9294
and read-write color cells, allocating color planes, and freeing color
9297
@defun alloc-color colormap color
9303
A @var{color} object or a @var{stringable} containing a color name.
9307
Returns a @emph{pixel} for a read-only color cell in the
9308
@emph{colormap}. The color in the allocated cell is the closest
9309
approximation to the requested @emph{color} possible for the screen
9310
hardware. The other values returned give both the approximate color
9311
stored in the cell and the exact color requested.
9313
The requested @emph{color} can be either a @var{color} object or a
9314
@var{stringable} containing a color name. If a color name is
9315
given, a corresponding color value is looked up (see
9316
@var{lookup-color}) and used. Color name strings must contain only
9317
ISO Latin-1 characters; case is not significant.
9330
@defun alloc-color-cells colormap colors &key (:planes 0) :contiguous-p (:result-type 'list)
9336
A positive number defining the length of the pixels sequence returned.
9338
A non-negative number defining the length of the masks sequence returned.
9340
If true, the masks form contiguous sets of bits.
9342
A subtype of @var{sequence} that indicates the type of sequences returned.
9346
Returns a @var{sequence} of @emph{pixels} for read-write color
9347
cells in the @emph{colormap}. The allocated cells contain undefined
9348
color values. The visual type class of the @var{colormap} must be
9349
either @var{:gray-scale}, @var{:pseudo-color}, or
9350
@var{:direct-color}.
9352
The @emph{colors} argument and the @var{:planes} argument define
9353
the number of pixels and the number of masks returned,
9354
respectively. The number of colors must be positive, and the number
9355
of planes must be non-negative. A total of (* @emph{colors}
9356
(@var{expt} 2 @emph{planes})) color cells are allocated. The pixel
9357
values for the allocated cells can be computed by combining the
9358
returned pixels and masks.
9360
The length of the returned masks sequence is equal to
9361
@var{:planes}. Each mask of the returned masks sequence defines a
9362
single bitplane. None of the masks have any 1 bits in common. Thus,
9363
by selectively combining masks with @var{logior}, (@var{expt} 2
9364
@emph{planes}) distinct combined plane masks can be computed.
9366
The length of the returned @emph{pixels} sequence is equal to
9367
@emph{colors}. None of the pixels have any 1 bits in common with
9368
each other or with any of the returned masks. By combining pixels
9369
and plane masks with @var{logior}, (* @emph{colors} (@var{expt} 2
9370
@emph{planes})) distinct pixel values can be produced.
9372
If the @emph{colormap} class is @var{:gray-scale} or
9373
@var{:pseudo-color}, each @emph{mask} will have exactly one bit
9374
set. If the @var{colormap} class is @var{:direct-color}, each
9375
@emph{mask} will have exactly three bits set. If
9376
@var{:contiguous-p} is true, combining all masks with @var{logior}
9377
produces a plane mask with either one set of contiguous bits (for
9378
@var{:gray-scale} and @var{:pseudo-color}) or three sets of
9379
contiguous bits (for @var{:direct-color}).
9384
Type @var{sequence} of @var{pixels}.
9390
@defun alloc-color-planes colormap colors &key (:reds 0) (:greens 0) (:blues 0) :contiguous-p (:result-type 'list)
9396
A positive number defining the length of the pixels sequence returned.
9398
A non-negative number defining the length of the masks sequence returned.
9400
If true, then the masks form contiguous sets of bits.
9402
A subtype of @var{sequence} that indicates the type of sequences returned.
9406
Returns a @var{sequence} of @emph{pixels} for read-write color
9407
cells in the @emph{colormap}. The allocated cells contain undefined
9408
color values. The visual type class of the @emph{colormap} must be
9409
either @var{:gray-scale}, @var{:pseudo-color}, or
9410
@var{:direct-color}.
9412
The @emph{colors} argument defines the number of pixels
9413
returned. The @var{:reds}, @var{:greens}, and @var{:blues}
9414
arguments define the number of bits set in the returned red, green,
9415
and blue masks, respectively. The number of colors must be positive,
9416
and the number of bits for each mask must be non-negative. A total
9417
of (* @emph{colors} (@var{expt} 2 (+ @emph{reds greens}
9418
@emph{blues}))) color cells are allocated. The pixel values for the
9419
allocated cells can be computed by combining the returned
9420
@emph{pixels} and masks.
9422
Each mask of the returned masks defines a pixel subfield for the
9423
corresponding primary. None of the masks have any 1 bits in
9424
common. By selectively combining subsets of the red, green, and blue
9425
masks with @var{logior}, (@var{expt} 2 (+ @emph{reds greens
9426
blues}) distinct combined plane masks can be computed.
9428
The length of the returned @emph{pixels} @var{sequence} is equal to
9429
@emph{colors}. None of the pixels have any 1 bits in common with
9430
each other or with any of the returned masks. By combining pixels
9431
and plane masks with @var{logior}, (* @emph{colors} (@var{expt} 2
9432
(+ @emph{reds greens blues})) distinct pixel values can be produced.
9434
If @var{:contiguous-p} is true, each of returned masks consists of
9435
a set of contiguous bits. If the @var{colormap} class is
9436
@var{:direct-color}, each returned mask lies within the pixel
9437
subfield for its primary.
9441
Type @var{sequence} of @var{pixel}.
9451
@defun free-colors colormap pixels &optional (plane-mask 0)
9457
A @var{sequence} of pixel values.
9459
A pixel value with no bits in common with any of the @emph{pixels}.
9462
Frees a set of allocated color cells from the @emph{colormap}. The
9463
pixel values for the freed cells are computed by combining the given
9464
@emph{pixels} sequence and @var{:plane-mask}. The total number of
9468
(* (@var{length} @emph{pixels}) (@var{expt} 2 (@var{logcount} @emph{plane-mask})))
9471
The @var{:plane-mask} must not have any bits in common with any of
9472
the given @emph{pixels}. The pixel values for the freed cells are
9473
produced by using @var{logior} to combine each of the given pixels
9474
with all subsets of the @var{:plane-mask}.
9476
Note that freeing an individual pixel allocated by
9477
@var{alloc-color-planes} may not allow it to be reused until all
9478
related pixels computed from the same plane mask are also freed.
9480
A single error is generated if any computed pixel is invalid or if
9481
its color cell is not allocated by the client. Even if an error is
9482
generated, all valid pixel values are freed.
9488
@node Finding Colors, Changing Colors, Allocating Colors, Colormap Functions
9489
@subsection Finding Colors
9492
A CLX program can ask the X server to return the colors stored in
9493
allocated color cells. The server also maintains a dictionary of color
9494
names and their associated color values. CLX provides a function to look
9495
up the values for common colors by names such as "red", "purple", and so
9496
forth. The following paragraphs describe the CLX functions for returning
9497
the color values associated with color cells or with color names.
9499
@defun lookup-color colormap name
9505
A @var{stringable} color name.
9509
Returns the color associated by the X server with the given color
9510
@emph{name}. The @emph{name} must contain only ISO Latin-1
9511
characters; case is not significant. The first value returned is the
9512
closest approximation to the requested color possible on the screen
9513
hardware. The second value returned is the true color value for the
9525
@defun query-colors colormap pixels &key (:result-type 'list)
9531
A @var{sequence} of @var{pixel} values.
9533
A subtype of @var{sequence} that indicates the type of sequences returned.
9537
Returns a @var{sequence} of the colors contained in the allocated
9538
cells of the @emph{colormap} specified by the given
9539
@emph{pixels}. The values returned for unallocated cells are
9543
Type @var{sequence} of @var{color}.
9549
@node Changing Colors, Colormap Attributes, Finding Colors, Colormap Functions
9550
@subsection Changing Colors
9553
The following paragraphs describe the CLX functions to change the colors
9556
@defun store-color colormap pixel color &key (:red-p t) (:green-p t) (:blue-p t)
9564
A color @var{object} or a @var{stringable} containing a color name.
9568
@var{boolean} values indicating which color components to
9572
Changes the contents of the @emph{colormap} cell indexed by the
9573
@emph{pixel}. Components of the given @emph{color} are stored in the
9574
cell. The @var{:red-p}, @var{:green-p}, and @var{:blue-p}
9575
arguments indicate which components of the given @emph{color} are
9578
The @emph{color} can be either a @var{color} object or a
9579
@var{stringable} containing a color name. If a color name is given,
9580
a corresponding color value is looked up (see @var{lookup-color})
9581
and used. Color name strings must contain only ISO Latin-1
9582
characters; case is not significant.
9588
@defun store-colors colormap pixel-colors &key (:red-p t) (:green-p t) (:blue-p t)
9594
A list of the form (@{@emph{pixel color}@}*).
9598
@var{boolean} values indicating which color components to
9602
Changes the contents of multiple @emph{colormap}
9603
cells. @emph{pixel-colors} is a list of the form (@{ @emph{pixel
9604
color}@}*), indicating a set of pixel values and the colors to store
9605
in the corresponding cells. The @var{:red-p}, @var{:green-p}, and
9606
@var{:blue-p} arguments indicate which components of the given colors
9609
Each color can be either a @var{color} object or a
9610
@var{stringable} containing a color name. If a color name is given,
9611
a corresponding color value is looked up (see @var{lookup-color})
9612
and used. Color name strings must contain only ISO Latin-1
9613
characters; case is not significant.
9619
@node Colormap Attributes, , Changing Colors, Colormap Functions
9620
@subsection Colormap Attributes
9623
The complete set of colormap attributes is discussed in the following
9626
@defun colormap-display colormap
9634
Returns the @var{display} object associated with the specified
9644
@defun colormap-equal colormap-1 colormap-2
9652
Returns true if the two arguments refer to the same server resource
9653
and @var{nil} if they do not.
9659
@defun colormap-id colormap
9666
Returns the unique ID assigned to the specified @emph{colormap}.
9670
Type @var{resource-id}.
9676
@defun colormap-p colormap
9678
Returns non-@var{nil} if the argument is a @var{colormap} and
9679
@var{nil} otherwise.
9688
@defun colormap-plist colormap
9698
Returns and (with @code{setf}) sets the property list for the
9699
specified @emph{colormap}. This function provides a hook where
9700
extensions can add data.
9710
@node Cursors, Atoms, Colors, Top
9713
A @emph{cursor} is a visible shape that appears at the current position
9714
of the pointer device. The cursor shape moves with the pointer to
9715
provide continuous feedback to the user about the current location of
9716
the pointer. Each window can have a cursor attribute that defines the
9717
appearance of the pointer cursor when the pointer position lies within
9718
the window. See @var{window-cursor}.
9720
A cursor image is composed of a source bitmap, a mask bitmap, a @emph{hot
9721
spot}, a foreground color, and a background color. Either 1-bit
9722
pixmaps or font glyphs can be used to specify source and mask
9723
bitmaps. The source bitmap identifies the foreground and background
9724
pixels of the cursor image; the mask bitmap identifies which source
9725
pixels are actually drawn. The mask bitmap thus allows a cursor to
9726
assume any shape. The hot spot defines the position within the cursor
9727
image that is displayed at the pointer position.
9729
In CLX, a cursor is represented by a @var{cursor} object. This section
9730
describes the CLX functions to:
9733
@item Create and free cursor objects
9735
@item Change cursor colors
9737
@item Inquire the best cursor size
9739
@item Access cursor attributes
9743
* Creating Cursors::
9744
* Cursor Functions::
9745
* Cursor Attributes::
9748
@node Creating Cursors, Cursor Functions, Cursors, Cursors
9749
@section Creating Cursors
9752
The following paragraphs describe the CLX functions used to create and
9753
free @var{cursor} objects.
9755
@defun create-cursor &key :source :mask :x :y :foreground :background
9759
The source pixmap. This argument is required.
9764
The hot spot position in the @var{:source}. This argument is required.
9766
A @var{color} object specifying the foreground color. This argument is required.
9768
A @var{color} object specifying the background color. This argument is required.
9772
Creates and returns a cursor. @var{:x} and @var{:y} define the
9773
position of the hot spot relative to the origin of the
9774
@var{:source. :foreground} and @var{:background} colors must be
9775
specified, even if the server only has a @var{:static-gray} or
9776
@var{:gray-scale} screen. The @var{:source}, @var{:x}, and
9777
@var{:y} arguments must also be specified.
9779
The cursor image is drawn by drawing a pixel from the @var{:source}
9780
bitmap at every position where the corresponding bit in the
9781
@var{:mask} bitmap is 1. If the corresponding @var{:source} bit is
9782
1, a pixel is drawn in the @var{:foreground} color; otherwise, a
9783
pixel is drawn in the @var{:back-ground} color. If the @var{:mask}
9784
is omitted, all @var{:source} pixels are drawn. If given, the
9785
@var{:mask} must be the same size as the @var{:source}.
9787
An X server may not be able to support every cursor size. A server
9788
is free to modify any component of the cursor to satisfy hardware or
9789
software limitations.
9791
The @var{:source} and @var{:mask} can be freed immediately after
9792
the cursor is created. Subsequent drawing in the @var{:source} or
9793
@var{:mask} pixmap has an undefined effect on the cursor.
9803
@defun create-glyph-cursor &key :source-font :source-char :mask-font (:mask-char 0) :foreground :background
9807
The source font. This is a required argument.
9809
An index specifying a glyph in the source font. This is a required argument.
9813
An index specifying a glyph in the mask font.
9815
A @var{color} object specifying the foreground color. This is a required argument.
9817
A @var{color} object specifying the background color. This is a required argument.
9821
Creates and returns a cursor defined by font glyphs. The source
9822
bitmap is defined by the @var{:source-font} and
9823
@var{:source-char}. The mask bitmap is defined by the
9824
@var{:mask-font} and @var{:mask-char}. It is an error if the
9825
@var{:source-char} and @var{:mask-char} are not valid indexes for
9826
the @var{:source-font} and @var{:mask-font}, respectively. The hot
9827
spot position is defined by the "character origin" of the source
9828
glyph, that is, the position [- @emph{char-left-bearing},
9829
@emph{char-ascent}] relative to the upper left corner of the source
9832
Source and mask bits are compared after aligning the character
9833
origins of the source and mask glyphs. The source and mask glyphs
9834
need not have the same size or character origin position. If the
9835
@var{:mask-font} is omitted, all source pixels are drawn.
9837
An X server may not be able to support every cursor size. A server
9838
is free to modify any component of the cursor to satisfy hardware or
9839
software limitations.
9841
Either of the @var{:source-font} or @var{:mask-font} can be closed
9842
after the cursor is created.
9852
@defun free-cursor cursor
9856
A @var{cursor} object.
9859
Destroys the @var{cursor} object. Cursor server resources are freed
9860
when no other references remain.
9866
@node Cursor Functions, Cursor Attributes, Creating Cursors, Cursors
9867
@section Cursor Functions
9870
The following paragraphs describe the CLX functions used to operate on
9871
@var{cursor} objects.
9873
@defun query-best-cursor width height display
9877
A @var{display} object.
9880
The requested cursor size.
9883
Returns the cursor size closest to the requested @emph{width} and
9884
@emph{height} that is best suited to the display. The @emph{width}
9885
and @emph{height} returned define the largest cursor size supported
9886
by the X server. Clients should always be prepared to limit cursor
9887
sizes to those supported by the server.
9898
@defun recolor-cursor cursor foreground background
9902
A @var{cursor} object.
9904
A @var{color} object specifying the new foreground color.
9906
A @var{color} object specifying the new background color.
9909
Changes the color of the specified @emph{cursor}. If the cursor is
9910
displayed on a screen, the change is visible immediately.
9916
@node Cursor Attributes, , Cursor Functions, Cursors
9917
@section Cursor Attributes
9920
The complete set of cursor attributes is discussed in the following
9923
@defun cursor-display cursor
9927
A @var{cursor} object.
9931
Returns the @var{display} object associated with the specified
9942
@defun cursor-equal cursor-1 cursor-2
9947
@var{cursor} objects.
9950
Returns true if the two arguments refer to the same server resource
9951
and @var{nil} if they do not.
9957
@defun cursor-id cursor
9961
A @var{cursor} object.
9965
Returns the unique resource ID that has been assigned to the
9966
specified @emph{cursor}.
9970
Type @var{resource-id.}
9976
@defun cursor-p cursor
9983
Returns true if the argument is a @var{cursor} object and
9984
@var{nil} otherwise.
9988
@defun cursor-plist cursor
9992
A @var{cursor} object.
9996
Returns and (with @code{setf}) sets the property list for the
9997
specified @emph{cursor}. This function provides a hook where
9998
extensions can add data.
10008
@node Atoms, Events and Input, Cursors, Top
10009
@chapter Atoms, Properties and Selections
10017
@node Atoms (Atoms), Properties, Atoms, Atoms
10021
In X, an @emph{atom} is a unique ID used as the name for certain server
10022
resources -- properties and selections.
10024
In CLX, an atom is represented by a keyword symbol. For convenience, CLX
10025
functions also allow atoms to be specified by strings and non-keyword
10026
symbols. @var{xatom} is a CLX data type that permits either string or
10027
symbol values. A string is equivalent to the @var{xatom} given by
10028
(@var{intern} @emph{string} @var{'keyword}). A symbol is equivalent to
10029
the @var{xatom} given by ( @var{intern} (@var{symbol-name}
10030
@emph{symbol}) @var{'keyword}). The symbol name string of an
10031
@var{xatom} must consist only of ISO Latin characters. Note that the
10032
case of @var{xatom} strings is important; the @var{xatom} "Atom" is
10033
not the same as the @var{xatom} "ATOM".
10035
Certain atoms are already predefined by every X server. Predefined atoms
10036
are designed to represent common names that are likely to be useful for
10037
many client applications. Note that these atoms are predefined only in
10038
the sense of having @var{xatom} and @var{card29} values, not in the
10039
sense of having required semantics. No interpretation is placed on the
10040
meaning or use of an atom by the server. The @var{xatom} objects
10041
predefined by CLX are listed below.
10043
@multitable @columnfractions 0.3 0.3 0.3
10044
@item @var{:arc} @tab @var{:italic_angle} @tab @var{:string}
10045
@item @var{:atom} @tab @var{:max_space} @tab @var{:subscript_x}
10046
@item @var{:bitmap} @tab @var{:min_space} @tab @var{:subscript_y}
10047
@item @var{:cap_height} @tab @var{:norm_space} @tab @var{:superscript_x}
10048
@item @var{:cardinal} @tab @var{:notice} @tab @var{:superscript_y}
10049
@item @var{:colormap} @tab @var{:pixmap} @tab @var{:underline_position}
10050
@item @var{:copyright} @tab @var{:point} @tab @var{:underline_thickness}
10051
@item @var{:cursor} @tab @var{:point_size} @tab @var{:visualid}
10052
@item @var{:cut_buffer0} @tab @var{:primary} @tab @var{:weight}
10053
@item @var{:cut_buffer1} @tab @var{:quad_width} @tab @var{:window}
10054
@item @var{:cut_buffer2} @tab @var{:rectangle} @tab @var{:wm_class}
10055
@item @var{:cut_buffer3} @tab @var{:resolution} @tab @var{:wm_client_machine}
10056
@item @var{:cut_buffer4} @tab @var{:resource_manager} @tab @var{:wm_command}
10057
@item @var{:cut_buffer5} @tab @var{:rgb_best_map} @tab @var{:wm_hints}
10058
@item @var{:cut_buffer6} @tab @var{:rgb_blue_map} @tab @var{:wm_icon_name}
10059
@item @var{:cut_buffer7} @tab @var{:rgb_color_map}@tab @var{:wm_icon_size}
10060
@item @var{:drawable} @tab @var{:rgb_default_map} @tab @var{:wm_name}
10061
@item @var{:end_space} @tab @var{:rgb_gray_map} @tab @var{:wm_normal_hints}
10062
@item @var{:family_name} @tab @var{:rgb_green_map}@tab @var{:wm_size_hints}
10063
@item @var{:font} @tab @var{:rgb_red_map} @tab @var{:wm_transient_for}
10064
@item @var{:font_name} @tab @var{:secondary} @tab @var{:wm_zoom_hints}
10065
@item @var{:full_name} @tab @var{:strikeout_ascent} @tab @var{:x_height}
10066
@item @var{:integer} @tab @var{:strikeout_descent} @tab
10070
When creating a new atom, the following conventions should be obeyed in
10071
order to minimize the conflict between atom names:
10075
Symbol names beginning with an underscore should be used for atoms
10076
that are private to a particular vendor or organization. An additional
10077
prefix should identify the organization.
10080
Symbol names beginning with two underscores should be used for atoms
10081
that are private to a single application or end user.
10085
CLX provides functions to convert between an @var{xatom} and its
10086
corresponding ID integer. The data type of an atom ID is
10087
@var{card29}. The @var{xatom} representation is usually sufficient for
10088
most CLX programs. However, it is occasionally useful to be able to
10089
convert an atom ID returned in events or properties into its
10090
corresponding @var{xatom}.
10092
@defun atom-name display atom-id
10096
A @var{display} object.
10101
Returns the atom keyword for the @emph{atom-id} on the given
10102
@emph{display} server.
10106
Type @var{keyword}.
10112
@defun find-atom display atom-name
10116
A @var{display} object.
10121
Returns the atom ID for the given @emph{atom-name}, if it exists. If
10122
no atom of that name exists for the display server, @var{nil} is
10127
Type @var{card29} or @var{null}.
10133
@defun intern-atom display atom-name
10137
A @var{display} object.
10142
Creates an atom with the given name and returns its atom ID. The
10143
atom can survive the interning client; it exists until the last
10144
server connection has been closed and the server resets itself.
10148
Type @var{card29} or @var{null}.
10154
@node Properties, Selections, Atoms (Atoms), Atoms
10155
@section Properties
10158
For each window, an X server can record a set of
10159
@emph{properties}. Properties are a general mechanism for clients to
10160
associate arbitrary data with a window, and for clients to communicate
10161
window data to each other via the server. No interpretation is placed on
10162
property data by the server itself.
10164
A property consists of a name, a type, a data format, and data. The name
10165
of a property is given by an atom. The property type is another atom
10166
used to denote the intended interpretation of the property data. The
10167
property formats specifies whether the property data should be treated
10168
as a set of 8-, 16-, or 32-bit elements. The property format must be
10169
specified so that the X server can communicate property data with the
10170
correct byte order.
10172
CLX provides functions to:
10175
@item Create or change a property
10177
@item Return property data
10179
@item List window properties
10181
@item Delete a property
10185
@defun change-property window property data type format &key (:mode :replace) (:start 0) :end :transform
10191
A property name @var{xatom}.
10193
A sequence of property data elements.
10195
The property type @var{xatom}.
10197
One of 8, 16, or 32.
10199
One of @var{:replace}, @var{:append}, or @var{:prepend}.
10202
Specify the subsequence of previous data replaced when @var{:mode} is @var{:replace}.
10204
A function that transforms each data element into a data value to store.
10207
Creates a new window property or changes an existing property. A
10208
@var{:property-notify} event is generated for the @emph{window}.
10210
If the @var{:mode} is @var{:replace}, the new @emph{data},
10211
@emph{type}, and @emph{format} replace any previous values. The
10212
subsequence of previous data elements that are replaced is defined
10213
by the @var{:start} and @var{:end} indexes.
10215
If the @var{:mode} is @var{:prepend} or @var{:append}, no
10216
previous data is changed, but the new @emph{data} is added at the
10217
beginning or the end, respectively. For these modes, if the
10218
@emph{property} already exists, the new @emph{type} and
10219
@emph{format} must match the previous values.
10221
The @var{:transform}, if given, is a function used to compute the
10222
actual property data stored. The @var{:transform}, which must
10223
accept a single data element and return a single transformed data
10224
element, is called for each data element. If the @emph{data} is a
10225
string, the default @var{:transform} function transforms each
10226
character into its ASCII code; otherwise, the default is to store
10227
the @emph{data} unchanged.
10233
@defun delete-property window property
10239
A property name @var{xatom}.
10242
Deletes the @emph{window property}. If the @emph{property} already
10243
exists, a @var{:property-notify} event is generated for the
10250
@defun get-property window property &key :type (:start 0) :end :delete-p (:result-type 'list) :transform
10251
@anchor{get-property}
10257
A property name @var{xatom}.
10259
The requested type @var{xatom} or @var{nil}.
10262
Specify the subsequence of property @emph{data} returned.
10264
A function that transforms each data element into a data value to return.
10266
If true, the existing @emph{property} can be deleted.
10268
The t@emph{ype} of data sequence to return. Default is @var{'list}.
10271
Returns a subsequence of the data for the window property. The
10272
@var{:start} and @var{:end} indexes specify the property
10273
@emph{data} elements returned. The @var{:transform} function is
10274
called for elements of the specified subsequence to compute the
10275
@emph{data} sequence returned. The property @emph{type} and
10276
@emph{format} are also returned. The final return value gives the
10277
actual number of data bytes (not elements) following the last data
10280
If the @emph{property} does not exist, the returned @emph{data} and
10281
@emph{type} are @var{nil} and the returned @emph{format} and
10282
@emph{bytes-after} are zero.
10284
If the given @var{:type} is non-@var{nil} but does not match the
10285
actual property type, then the @emph{data} returned is @var{nil},
10286
the @emph{type} and @emph{format} returned give the actual property
10287
values, and the @emph{bytes-after} returned gives the total number
10288
of bytes (not elements) in the property data.
10290
If the given @var{:type} is @var{nil} or if it matches the actual
10291
property type, then:
10295
The @emph{data} returned is the transformed subsequence of the
10299
The @emph{type} and @emph{format} returned give the actual
10303
The @emph{bytes-after} returned gives the actual number of data
10304
bytes (not elements) following the last data element returned.
10308
In this case, the @var{:delete-p} argument is also examined. If
10309
@var{:delete-p} is true and @emph{bytes-after} is zero, the
10310
property is deleted and a @var{:property-notify} event is generated
10311
for the @emph{window}.
10315
Type @var{sequence}.
10319
Type (@var{member 8 16 32}).
10327
@defun list-properties window &key (:result-type 'list)
10333
The type of sequence to return. Default is @var{'list}.
10337
Returns a sequence containing the names of all @emph{window
10341
Type @var{sequence} of @var{keyword}.
10347
@defun rotate-properties window properties &optional (delta 1)
10353
A sequence of @var{xatom} values.
10355
The index interval between source and destination elements of @emph{properties}.
10358
Rotates the values of the given @emph{window properties}. The value
10359
of property @emph{i} in the given sequence is changed to the value
10360
of the property at index (@var{mod} (+ @emph{i delta})
10361
(@var{length} @emph{properties})). This function operates much like
10362
the @var{rotatef} macro in Common Lisp.
10364
If (@var{mod} @emph{delta} (@var{length} @emph{properties})) is
10365
non-zero, a @var{:property-notify} event is generated on the window
10366
for each property, in the same order as they appear in the
10367
@emph{properties} sequence.
10373
@node Selections, , Properties, Atoms
10374
@section Selections
10377
A selection is an atom used to identify data that can be shared among
10378
all client programs connected to an X server. Unlike properties, the
10379
data represented by a selection is stored by some client program, not by
10382
The data named by a selection is associated with a client window, which
10383
is referred to as the @emph{selection owner}. The server always knows
10384
which window is the owner of a selection. Selections can be created
10385
freely by clients using @var{intern-atom} to create an atom. CLX
10386
provides functions to inquire or change the owner of a selection and to
10387
@emph{convert} a selection.
10389
Conversion is the key to the use of selections for inter-client
10390
communication. Suppose Client A wants to paste the contents of the data
10391
named by selection @emph{S} into his window @emph{WA}. Client A calls
10392
@var{convert-selection} on selection atom @emph{S}, sending a
10393
conversion request to the server. The server, in turn, sends a
10394
@var{:selection-request} event to the current owner of @emph{S}, which
10395
is window @emph{WB} belonging to Client B. The @var{:selection-request}
10396
event contains the @emph{requestor} window (@emph{WA}), the selection
10397
atom (@emph{S}), an atom identifying a requested data type, and the name
10398
of a property of @emph{WA} into which the value of @emph{S} will be
10401
Since @emph{WB} is the owner of @emph{S}, it must be associated with the
10402
data defined by Client B as the value of @emph{S}. When @emph{WB} gets
10403
the @var{:selection-request} event, Client B is expected to convert the
10404
value of @emph{S} to the requested data type (if possible) and store the
10405
converted value in the given requestor property. Client B is then
10406
expected to send a @var{:selection-notify} event to the requestor
10407
window @emph{WA}, informing the requestor that the converted value for
10408
@emph{S} is ready. Upon receiving the @var{:selection-notify} event,
10409
Client A can call @var{get-property} to retrieve the converted value
10410
and to paste it into @emph{WA}.
10412
@var{NOTE:} Clients using selections must always be prepared to handle
10413
@var{:selection-request} events and/or @var{:selection-notify}
10414
events. There is no way for a client to ask not to receive these types
10417
Type atoms used in selection conversion can represent arbitrary
10418
client-defined interpretations of the selection data. For example, if
10419
the value of selection @emph{S} is a text string, Client A might request
10420
its typeface by requesting conversion to the @var{:font} type. A type
10421
@var{atom} can also represent a request to the selection owner to
10422
perform some action as a side-effect of conversion (for example,
10423
@var{:delete}). Some of the predefined atoms of an X server are
10424
intended to be used as selection types (for example, @var{:colormap},
10425
@var{:bitmap}, @var{:string}, and so forth) However, X does not impose
10426
any requirements on the interpretation of type atoms.
10428
When multiple clients negotiate for ownership of a selection, certain
10429
race conditions might be possible. For example, two clients might each
10430
receive a user command to assert ownership of the @var{:primary}
10431
selection, but the order in which the server processes these client
10432
requests is unpredictable. As a result, the ownership request initiated
10433
most recently by the user might be incorrectly overridden by the other
10434
earlier ownership request. To prevent such anomalies, the server records
10435
a @emph{last-changed} timestamp for each change of selection ownership.
10437
Although inter-client communication via selections is rather complex, it
10438
offers important benefits. Since selection communication is mediated by
10439
an X server, clients can share data even though they are running on
10440
different hosts and using different networking protocols. Data storage
10441
and conversion is distributed among clients so that the server is not
10442
required to provide all possible data types or to store multiple forms
10445
Certain predefined atoms are used as standard selections, as described
10446
in the X11 Inter-client Communications Conventions Manual. Some of the
10447
standard selections covered by these conventions are:
10451
The @emph{primary selection}. The main vehicle for inter-client cut
10452
and paste operations.
10454
The @emph{secondary selection}. In some environments, clients can use
10455
this as an auxiliary to @var{:primary}.
10457
Analogous to akill ring. Represents the most recently deleted data
10462
@defun convert-selection selection type requestor &optional property time
10466
The @var{xatom} for the selection name.
10468
The @var{xatom} for the requested data type.
10470
The @var{window} to receive the converted @emph{selection} value.
10472
The @var{xatom} for the requestor property to receive the converted value.
10477
Requests that the value of the @emph{selection} be converted to the
10478
specified @emph{type} and stored in the given @emph{property} of the
10479
@emph{requestor} window.
10481
If the @emph{selection} has an owner, the X server sends a
10482
@var{:selection-request} event to the owner window. Otherwise, if
10483
no owner exists, the server generates on the requestor a
10484
@var{:selection-notify} event containing a @var{nil}
10485
@emph{property} atom.
10487
The given @emph{property} specifies the requestor property that will
10488
receive the converted value. If the @emph{property} is omitted, the
10489
@emph{selection} owner will define a property to use. The
10490
@emph{time} furnishes a timestamp representing the time of the
10491
conversion request; by default, the current server time is used.
10493
@var{NOTE:} Standard conventions for inter-client communication
10494
require that both the requestor property and the time must be
10495
specified. If possible, the time should be the time of a user event
10496
which initiated the conversion. Alternatively, a timestamp can be
10497
obtained by calling @var{change-property} to append zero-length
10498
data to some property; the timestamp in the resulting
10499
@var{:property-notify} event can then be used.
10505
@defun selection-owner display selection &optional time
10511
The @var{xatom} for the selection name.
10517
Returns and (with @code{setf}) changes the owner and the
10518
last-changed @emph{time} for the @emph{selection}. If the owner is
10519
@var{nil}, no owner for the @emph{selection} exists. When the owner
10520
window for a @emph{selection} is destroyed, the @emph{selection}
10521
owner is set to @var{nil} without affecting the last-changed
10524
The @emph{time} argument is used only when changing the
10525
@emph{selection} owner. If the @emph{time} is @var{nil}, the
10526
current server time is used. If the @emph{time} is earlier than the
10527
current last-changed time of the @emph{selection} or if the
10528
@emph{time} is later than the current server time, the owner is not
10529
changed. Therefore, a client should always confirm successful change
10530
of ownership by immediately calling @var{selection-owner}. If the
10531
change in ownership is successful, the last-changed time of the
10532
@emph{selection} is set to the specified @emph{time}.
10534
If the change in ownership is successful and the new owner is
10535
different from the previous owner, and if the previous owner is not
10536
@var{nil}, a @var{:selection-clear} event is generated for the
10537
previous owner window.
10539
@var{NOTE:} Standard conventions for inter-client communication
10540
require that a non-nil time must be specified. If possible, the time
10541
should be the time of a user event which initiated the change of
10542
ownership. Alternatively, a timestamp can be obtained by calling
10543
change-property to append zero-length data to some property; the
10544
timestamp in the resulting @var{:property-notify} event can then be
10548
Type @var{window} or @var{null}.
10554
@node Events and Input, Resources, Atoms, Top
10555
@chapter Events and Input
10557
A client application uses CLX functions to send @emph{requests} to an X
10558
server over a display connection returned by the @var{open-display}
10559
function. In return, the X server sends back @emph{replies} and
10560
@emph{events}. Replies are synchronized with specific requests and
10561
return requested server information. Events typically occur
10562
asynchronously. Device events are generated by user input from both the
10563
keyboard and pointer devices. Other events are side-effects of the
10564
requests sent by CLX functions. The types of events returned by an X
10565
server are summarized below.
10571
@var{:key-press} @var{:key-release}
10573
@var{:button-press}
10574
@var{:button-release}
10575
@var{:enter-notify}
10576
@var{:leave-notify}
10577
@var{:motion-notify}
10583
@item Client communication
10584
@var{:client-message}
10585
@var{:property-notify}
10586
@var{:selection-clear}
10587
@var{:selection-notify}
10588
@var{:selection-request}
10589
@item Color map state
10590
@var{:colormap-notify}
10594
@var{:graphics-exposure}
10601
@item Keyboard and pointer state
10602
@var{:keymap-notify}
10603
@var{:mapping-notify}
10605
@item Structure control
10606
@var{:circulate-request}
10607
@var{:configure-request}
10611
@var{:resize-request}
10612
@var{:circulate-notify}
10613
@var{:configure-notify}
10614
@var{:create-notify}
10615
@var{:destroy-notify}
10616
@var{:gravity-notify}
10618
@var{:reparent-notify}
10619
@var{:unmap-notify}
10620
@var{:visibility-notify}
10623
Client programs can override the server's normal distribution of events
10624
by@emph{ grabbing} the pointer or the keyboard. Grabbing causes events
10625
from the pointer or keyboard device to be reported to a single specified
10626
window, rather than to their ordinary destinations. It can also cause
10627
the server to @emph{freeze} the grabbed device, sending queued events
10628
only when explicitly requested by the grabbing client. Two kinds of
10629
grabs are possible:
10632
@item Active -- Events are immediately grabbed.
10634
@item Passive -- Events are grabbed later, as soon as a specified device event occurs.
10637
Grabbing an input device is performed rarely and usually only by special
10638
clients, such as window managers.
10640
This section describes the CLX functions used to:
10643
@item Select events (@pxref{Selecting Events})
10645
@item Process an event on the event queue (@pxref{Processing Events})
10647
@item Manage the event queue (@pxref{Managing the Event Queue})
10649
@item Send events to other applications (@pxref{Sending Events})
10651
@item Read and change the pointer position (@pxref{Pointer Position})
10653
@item Manage the keyboard input focus (@pxref{Managing Input Focus})
10655
@item Grab pointer and keyboard events (@pxref{Grabbing the Pointer})
10657
@item Release queued events (@pxref{Releasing Queued Events})
10660
This section also contains a detailed description of the content of each type of event.
10663
* Selecting Events::
10664
* Processing Events::
10665
* Managing the Event Queue::
10667
* Pointer Position::
10668
* Managing Input Focus::
10669
* Grabbing the Pointer::
10670
* Grabbing a Button::
10671
* Grabbing the Keyboard::
10674
* Releasing Queued Events::
10677
@node Selecting Events, Processing Events, Events and Input, Events and Input
10678
@section Selecting Events
10681
A client @emph{selects} which types of events it receives from a
10682
specific window. The window event-mask attribute, set by the client,
10683
determines which event types are selected (see @var{window-event-mask}
10684
in @ref{Window Attributes}). Most types of events are received
10685
by a client only if they are selected for some window.
10687
In the X protocol, an event-mask is represented as a bit string. CLX
10688
also allows an event mask to be defined by a list of
10689
@var{event-mask-class} keywords. The functions @var{make-event-keys}
10690
and @var{make-event-mask} can be used to convert between these two
10691
forms of an event-mask. In general, including an @var{event-mask-class}
10692
keyword in an event-mask causes one or more related event types to be
10693
selected. The following table describes the event types selected by each
10694
@var{event-mask-class} keyword.
10696
@multitable @columnfractions 0.5 0.5
10697
@item Event Mask Keyword @tab Event Types Selected
10698
@item @var{:button-1-motion}
10699
@tab @var{:motion-notify} when @var{:button-1} is down
10700
@item @var{:button-2-motion}
10701
@tab @var{:motion-notify} when @var{:button-2} is down
10702
@item @var{:button-3-motion}
10703
@tab @var{:motion-notify} when @var{:button-3} is down
10704
@item @var{:button-4-motion}
10705
@tab @var{:motion-notify} when @var{:button-4} is down
10706
@item @var{:button-5-motion}
10707
@tab @var{:motion-notify} when @var{:button-5} is down
10708
@item @var{:button-motion}
10709
@tab @var{:motion-notify} when any pointer button is down
10710
@item @var{:button-press}
10711
@tab @var{:button-press}
10712
@item @var{:button-release}
10713
@tab @var{:button-release}
10714
@item @var{:colormap-change}
10715
@tab @var{:colormap-notify}
10716
@item @var{:enter-window}
10717
@tab @var{:enter-notify}
10718
@item @var{:exposure}
10719
@tab @var{:exposure}
10720
@item @var{:focus-change}
10721
@tab @var{:focus-in} @var{:focus-out}
10722
@item @var{:key-press}
10723
@tab @var{:key-press}
10724
@item @var{:key-release}
10725
@tab @var{:key-release}
10726
@item @var{:keymap-state}
10727
@tab @var{:keymap-notify}
10728
@item @var{:leave-window}
10729
@tab @var{:leave-notify}
10730
@item @var{:owner-grab-button}
10731
@tab Pointer events while button is grabbed
10732
@item @var{:pointer-motion}
10733
@tab @var{:motion-notify}
10734
@item @var{:pointer-motion-hint}
10735
@tab Single @var{:motion-notify} only
10736
@item @var{:property-change}
10737
@tab @var{:property-notify}
10738
@item @var{:resize-redirect}
10739
@tab @var{:resize-request}
10740
@item @var{:structure-notify}
10741
@tab @var{:circulate-notify} @var{:configure-notify} @var{:destroy-notify} @var{:gravity-notify} @var{:map-notify} @var{:reparent-notify} @var{:unmap-notify}
10742
@item @var{:substructure-redirect}
10743
@tab @var{:circulate-request} @var{:configure-request} @var{:map-request}
10744
@item @var{:visibility-change}
10745
@tab @var{:visibility-notify}
10749
Some types of events do not have to be selected to be received and
10750
therefore are not represented in an event-mask. For example, the
10751
@var{copy-plane} and @var{copy-area} functions cause
10752
@var{:graphics-exposure} and @var{:no-exposure} events to be reported,
10753
unless exposures are turned @var{:off} in the graphics context (see
10754
@var{copy-area} and @var{copy-plane} in @ref{Area and Plane Operations},
10755
and @var{gcontext-exposures} in paragraph 5.4.6, Exposures). Also, @var{:selection-clear}, @var{:selection-request},
10756
@var{:selection-notify} and @var{:client-message} events can be
10757
received at any time, but they are generally sent only to clients using
10758
selections (@pxref{Client Communications Events}). @var{:mapping-notify} is always sent to clients when the
10759
keyboard mapping is changed.
10761
Any client can select events for any window. A window maintains a
10762
separate event-mask for each interested client. In general, multiple
10763
clients can select for the same events on a window. After the X server
10764
generates an event, it sends it to all clients which selected
10765
it. However, the following restrictions apply to sharing window events
10766
among multiple clients. For a given window:
10769
@item Only one client at a time can include @var{:substructure-redirect} in its event-mask
10771
@item Only one client at a time can can include @var{:button-press} in its event-mask
10773
@item Only one client at a time can include @var{:resize-redirect} in its event-mask
10776
@node Processing Events, Managing the Event Queue, Selecting Events, Events and Input
10777
@section Processing Events
10780
Events received by a CLX client are stored in an @emph{event queue}
10781
until they are read and processed. Events are processed by @emph{handler
10784
@defun handler-function &rest event-slots &key :display :event-key :send-event-p &allow-other-keys
10788
A @var{display} for the connection that returned the event.
10790
An @var{event-key} keyword specifying the event type.
10791
@item :send-event-p
10792
If true, the event was sent from another application using the
10793
@var{send-event} function.
10797
The arguments to a handler function are keyword-value pairs that
10798
describe the contents of an event. The actual @emph{event-slots}
10799
passed depend on the event type, except that @var{:display},
10800
@var{:event-key}, and @var{:send-event-p} are given for all event
10801
types. The keyword symbols used for each event type are event slot
10802
names defined by the @var{declare-event} macro and are described in
10803
@ref{Declaring Event Types}.
10805
If a handler returns non-@var{nil}, the event is considered
10806
@emph{processed} and can be removed from the event queue. Otherwise,
10807
if a handler function returns @var{nil}, the event can remain in
10808
the event queue for later processing.
10811
Type @var{boolean}.
10817
@defun process-event display &key :handler :timeout :peek-p :discard-p (:force-output-p t)
10823
A handler function or a sequence of handler functions.
10825
Specifies the timeout delay in seconds.
10827
If @var{nil}, events are removed from the event queue after processing.
10829
If true, unprocessed events are discarded.
10830
@item :force-output-p
10831
If true, buffered output requests are sent.
10835
Invokes @var{:handler} on each queued event until @var{:handler}
10836
returns non-@var{nil}. Then, the non-@var{nil :handler} value is
10837
returned by @var{process-event}. If @var{:handler} returns
10838
@var{nil} for each event in the event queue, @var{process-event}
10839
waits for another event to arrive. If timeout is non-@var{nil} and
10840
no event arrives within the specified timeout interval (given in
10841
seconds), @var{process-event} returns @var{nil}; if timeout is
10842
@var{nil}, @var{process-event} will not return until
10843
@var{:handler} returns non-@var{nil}. @var{process-event} may
10844
wait only once on network data, and therefore timeout prematurely.
10846
If @var{:force-output-p} is true, @var{process-event} first
10847
invokes @var{display-force-output} to send any buffered
10848
requests. If @var{:peek-p} is true, a processed event is not
10849
removed from the queue. If @var{:discard-p} is true, unprocessed
10850
events are removed from the queue; otherwise, unprocessed events are
10853
If @var{:handler} is a sequence, it is expected to contain handler
10854
functions for each event type. The sequence index of the handler
10855
function for a particular event type is given by ( @var{position
10856
event-key *event-key-vector*}).
10859
Type @var{boolean}.
10865
@defmac event-case display &key :timeout :peek-p :discard-p (:force-output-p t) &body clauses
10866
@anchor{event-case}
10872
A handler function or a sequence of handler functions.
10874
Specifies the timeout delay, in seconds.
10876
If @var{nil}, events are removed from the event queue after processing.
10878
If true, unprocessed events are discarded.
10879
@item :force-output-p
10880
If true, buffered output requests are sent.
10882
Code to process specified event types.
10885
Executes the matching clause for each queued event until a clause
10886
returns non-@var{nil}. The non-@var{nil} clause value is then
10887
returned. Each of the clauses is a list of the form
10888
(@emph{event-match} [@emph{event-slots}] &rest @emph{forms}),
10893
@emph{event-match} -- Either an @var{event-key}, a list of
10894
@var{event-keys}, otherwise, or @var{t}. It is an error for the
10895
same key to appear in more than one clause.
10898
@emph{event-slots} -- If given, a list of (non-keyword) event slot
10899
symbols defined for the specified event type(s). @xref{Declaring Event Types}.
10902
@emph{forms} -- A list of forms that process the specified event
10903
type(s). The value of the last form is the value returned by the
10907
A clause matches an event if the @var{event-key} is equal to or a
10908
member of the @emph{event-match}, or if the @emph{event-match} is
10909
@var{t} or @var{otherwise}. If no @var{t} or @var{otherwise}
10910
clause appears, it is equivalent to having a final clause that
10911
returns @var{nil}. If @emph{event-slots} is given, these symbols
10912
are bound to the value of the corresponding event slot in the clause
10913
forms. Each element of @emph{event-slots} can also be a list of the
10914
form (@emph{event-slot-keyword variable}), in which case the
10915
@emph{variable} symbol is bound to the value of the event slot
10916
specified by the @emph{event-slot-keyword}.
10918
If every clause returns @var{nil} for each event in the event
10919
queue, @var{event-case} waits for another event to arrive. If
10920
@var{:timeout} is non-@var{nil} and no event arrives within the
10921
specified timeout interval (given in seconds), @var{event-case}
10922
returns @var{nil}; if @var{:timeout} is @var{nil},
10923
@var{event-case} will not return until a clause returns
10924
non-@var{nil}. @var{event-case} may wait only once on network data
10925
and therefore timeout prematurely.
10927
If @var{:force-output-p} is true, @var{event-case} first invokes
10928
@var{display-force-output} to send any buffered requests. If
10929
@var{:peek-p} is true, a processed event is not removed from the
10930
queue. If @var{:discard-p} is true, unprocessed events are removed
10931
from the queue; otherwise, unprocessed events are left in place.
10935
Type @var{boolean}.
10942
@defmac event-cond display &key :timeout :peek-p :discard-p (:force-output-p t) &body clauses
10946
Type @var{boolean}.
10950
Similar to @var{event-case} except that each of the clauses is a
10951
list of the form (@emph{event-match} [@emph{event-slots}]
10952
@emph{test-form} &rest @emph{forms}). Executes the
10953
@emph{test-form} of the clause that matches each queued event until
10954
a @emph{test-form} returns non-@var{nil}. The body @emph{forms} of
10955
the clause are then executed. The values returned by the last clause
10956
body form are then returned by @var{event-cond}.
10958
When a @emph{test-form} returns true and @var{:peek-p} is
10959
@var{nil}, or when a @emph{test-form} returns @var{nil} and
10960
@var{:discard-p} is true, the matching event is removed from the
10961
event queue before the body @emph{forms} are executed.
10966
A handler function or a sequence of handler functions.
10968
Specifies the timeout delay in seconds.
10970
If @var{nil}, events are removed from the event queue after processing.
10972
If true, unprocessed events are discarded.
10973
@item :force-output-p
10974
If true, buffered output requests are sent.
10976
Code to process specified event types.
10983
@node Managing the Event Queue, Sending Events, Processing Events, Events and Input
10984
@section Managing the Event Queue
10987
The following paragraphs describe CLX functions and macros used to:
10990
@item Put a new event on the event queue
10992
@item Discard the current event
10994
@item Return the current length of the event queue
10996
@item Gain exclusive access to the event queue for a client process
10999
@defun queue-event display event-key &rest event-slots &key :append-p &allow-other-keys
11005
Specifies the type of event placed in the queue.
11007
Keyword-value pairs that describe the contents of an event.
11009
If true, the event is placed at the tail of the queue; otherwise, the event is
11010
placed at the head of the queue.
11013
Places an event of the type given by @emph{event-key} into the event
11014
queue. When @var{:append-p} is true, the event is placed at the
11015
tail of the queue; otherwise, the event is placed at the head of the
11016
queue. The actual @emph{event-slots} passed depend on the event
11017
type. The keyword symbols used for each event type are event slot
11018
names defined by the @var{declare-event} macro and are described in
11019
@ref{Declaring Event Types}.
11026
@defun discard-current-event display
11034
Discards the current event for the @emph{display}. Returns
11035
@var{nil} when the event queue is empty; otherwise, returns
11036
@var{t}. This function provides extra flexibility for discarding
11037
events, but it should be used carefully; use @var{event-cond}
11038
instead, if possible. Typically, @var{discard-current-event} is
11039
called inside a handler function or a clause of an @var{event-case}
11040
form and is followed by another call to @var{process-event},
11041
@var{event-case}, or @var{event-cond}.
11044
Type @var{boolean}.
11050
@defun event-listen display &optional (timeout 0)
11056
The number of seconds to wait for events.
11060
Returns the number of events queued locally. If the event queue is
11061
empty, @var{event-listen} waits for an event to arrive. If timeout
11062
is non-@var{nil} and no event arrives within the specified timeout
11063
interval (given in seconds), @var{event-listen} returns @var{nil};
11064
if timeout is @var{nil}, @var{event-listen} will not return until
11068
Type @code{(or null integer)}.
11073
@defmac with-event-queue display &body body
11074
@anchor{with-event-queue}
11083
Executes the @emph{body} in a critical region in which the executing
11084
client process has exclusive access to the event queue.
11090
@node Sending Events, Pointer Position, Managing the Event Queue, Events and Input
11091
@section Sending Events
11094
A client can send an event to a window. Clients selecting this window
11095
event will receive it just like any other event sent by the X server.
11097
@defun send-event window event-key event-mask &rest event-slots &key :propagate-p :display &allow-other-keys
11101
The destination @var{window} for the event.
11103
An @var{event-key} defining the type of event to send.
11105
Specifies the event types that receiving clients must select.
11107
Keyword-value pairs that describe the contents of an event.
11109
If true, the event can be propagated to ancestors of the destination window.
11114
Sends an event specified by the @emph{event-key} and
11115
@emph{event-slots} to the given destination @emph{window}. Any
11116
active grabs are ignored. The @emph{event-slots} passed depend on
11117
the event type. The keyword symbols used for each event type are
11118
event slot names defined by the @var{declare-event} macro and are
11119
described in @ref{Declaring Event Types}.
11121
If the @emph{window} is @var{:pointer-window}, the destination
11122
@emph{window} is replaced with the window containing the
11123
pointer. If the @emph{window} is @var{:input-focus}, the
11124
destination @emph{window} is replaced with the descendant of the
11125
focus window that contains the pointer or (if no such descendant
11126
exists) the focus window. The @var{:display} keyword is only
11127
required if the @emph{window} is @var{:pointer-window} or
11128
@var{:input-focus}.
11130
The @emph{event-key} must be one of the core events, or one of the
11131
events defined by an extension, so the server can send the event
11132
with the correct byte-order. The contents of the event are
11133
otherwise unaltered and unchecked by the server, except that the
11134
@var{send-event-p} event slot is set to true.
11136
If the @emph{event-mask} is @var{nil}, the event is sent to the
11137
client that created the destination @emph{window} with an
11138
@emph{event-mask} of 0; if that client no longer exists, no event
11139
is sent. Otherwise, the event is sent to every client selecting
11140
any of the event types specified by @emph{event-mask} on the
11141
destination @emph{window}.
11143
If @var{:propagate-p} is true and no clients have selected any of
11144
the event types in @emph{event-mask} on the destination
11145
@emph{window}, the destination is replaced with the closest
11146
ancestor of @emph{window} for which some client has selected a
11147
type in @emph{event-mask} and no intervening window has that type
11148
in its do-not-propagate mask. If no such window exists, or if the
11149
@emph{window} is an ancestor of the focus window and
11150
@var{:input-focus} was originally specified as the destination,
11151
the event is not sent to any clients. Otherwise, the event is
11152
reported to every client selecting on the final destination any of
11153
the types specified in @emph{event-mask}.
11159
@node Pointer Position, Managing Input Focus, Sending Events, Events and Input
11160
@section Pointer Position
11163
The CLX functions affecting pointer position are discussed in the
11164
following paragraphs.
11166
@defun query-pointer window
11170
A @var{window} specifying the coordinate system for the returned position.
11174
Returns the current pointer coordinates relative to the given
11175
@emph{window}. If @var{query-pointer} returns @var{nil} for
11176
@emph{same-screen-p}, the pointer is not on the same screen as the
11177
@emph{window}. In this case, @var{query-pointer} returns a value
11178
of @var{nil} for @emph{child} and a value of zero for @emph{x}
11179
and @emph{y}. If @var{query-pointer} returns true for
11180
@emph{same-screen-p}, the returned @emph{x} and @emph{y} are
11181
relative to the origin of window. The @emph{child} is the child of
11182
the window containing the pointer, if any. The @emph{state-mask}
11183
returned gives the current state of the modifier keys and pointer
11184
buttons. The returned @emph{root} is the root window currently
11185
containing the pointer. The returned @emph{root-x} and
11186
@emph{root-y} specify the pointer coordinates relative to
11193
@item same-screen-p
11194
Type @var{boolean}.
11196
Type @var{window} or @var{null}.
11210
@defun global-pointer-position display
11218
Returns the @emph{root} window currently containing the @emph{display} pointer and the current
11219
position of the pointer relative to the @emph{root}.
11232
@defun pointer-position window
11236
A @var{window} specifying the coordinate system for the returned position.
11240
Returns the current pointer coordinates relative to the given
11241
@emph{window}. If @var{pointer-position} returns @var{nil} for
11242
@emph{same-screen-p}, the pointer is not on the same screen as the
11243
@emph{window}. In this case, @var{pointer-position} returns a
11244
value of @var{nil} for @emph{child} and a value of zero for
11245
@emph{x} and @emph{y}. If @var{pointer-position} returns true for
11246
@emph{same-screen-p}, the returned @emph{x} and @emph{y} are
11247
relative to the origin of @emph{window}.
11253
@item same-screen-p
11254
Type @var{boolean}.
11256
Type @var{window} or @var{null}.
11262
@defun motion-events window &key :start :stop (:result-type 'list)
11266
The @var{window} containing the returned motion events.
11269
@var{timestamp} values for the time interval for returned motion events.
11271
The form of the returned motion events.
11275
Many X server implementations maintain a more precise history of
11276
pointer motion between event notifications. The pointer position
11277
at each pointer hardware interrupt can be stored into a buffer for
11278
later retrieval.This is called the @emph{motion history buffer}. A
11279
paint program, for example, may want to have a precise history of
11280
where the pointer traveled, even though for most other
11281
applications this amount of detail is grossly excessive.
11283
The @var{motion-events} function returns all events in the motion
11284
history buffer that fall between the specified @var{:start} and
11285
@var{:stop} timestamps (inclusive) and have coordinates that lie
11286
within the specified @emph{window} (including borders) at its
11287
present placement. If the @var{:start} time is later than the
11288
@var{:stop} time or if the @var{:start} time is in the future,
11289
no events are returned.
11291
@item motion-events
11292
Type @code{(repeat-seq (int16 x) (int16 y) (timestamp time))}.
11298
@defun warp-pointer destination destination-x destination-y
11302
The @var{window} into which the pointer is moved.
11303
@item destination-x
11304
@itemx destination-y
11305
The new position of the pointer relative to the destination.
11308
Moves the pointer to the given coordinates relative to the
11309
@emph{destination} window. @var{warp-pointer} should be rarely be
11310
used since the user should normally be in control of the pointer
11311
position. @var{warp-pointer} generates events just as if the user
11312
had instantaneously moved the pointer from one position to another.
11314
@var{warp-pointer} cannot move the pointer outside the confine-to
11315
window of an active pointer grab; an attempt to do so only moves the
11316
pointer as far as the closest edge of the confine-to window.
11322
@defun warp-pointer-relative display x-offset y-offset
11329
The offsets used to adjust the pointer position.
11332
Moves the pointer by the given offsets. This function should rarely
11333
be used since the user should normally be in control of the pointer
11334
position. @var{warp-pointer-relative} generates events just as if
11335
the user had instantaneously moved the pointer from one position to
11338
@var{warp-pointer-relative} cannot move the pointer outside the
11339
confine-to window of an active pointer grab; an attempt to do so
11340
only moves the pointer as far as the closest edge of the confine-to
11347
@defun warp-pointer-if-inside destination destination-x destination-y source source-x source-y &optional (source-width 0) (source-height 0)
11351
The @var{window} into which the pointer is moved.
11352
@item destination-x
11353
@itemx destination-y
11354
The new position of the pointer relative to the @emph{destination}.
11356
The @var{window} that must currently contain the pointer.
11359
@itemx source-width
11360
@itemx source-height
11361
The source rectangle that must currently contain the pointer.
11364
Moves the pointer to the given position relative to the
11365
@emph{destination} window. However, the move can only take place if
11366
the pointer is currently contained in a visible portion of the
11367
specified rectangle of the @emph{source} window. If
11368
@emph{source-height} is zero, it is replaced with the current height
11369
of @emph{source} window minus @emph{source-y}. If
11370
@emph{source-width} is zero, it is replaced with the current width
11371
of @emph{source} window minus @emph{source-x}.
11373
@var{warp-pointer-if-inside} generates events just as if the user
11374
had instantaneously moved the pointer from one position to
11375
another. @var{warp-pointer-if-inside} cannot move the pointer
11376
outside the confine-to window of an active pointer grab; an attempt
11377
to do so only moves the pointer as far as the closest edge of the
11383
@defun warp-pointer-relative-if-inside x-offset y-offset source source-x source-y &optional (source-width 0) (source-height 0)
11388
The offsets used to adjust the pointer position.
11390
The @var{window} that must currently contain the pointer.
11393
@itemx source-width
11394
@itemx source-height
11395
The source rectangle that must currently contain the pointer.
11398
Moves the pointer by the given offsets. However, the move can only
11399
take place if the pointer is currently contained in a visible
11400
portion of the specified rectangle of the @emph{source} window. If
11401
@emph{source-height} is zero, it is replaced with the current height
11402
of @emph{source-window} minus @emph{source-y}. If
11403
@emph{source-width} is zero, it is replaced with the current width
11404
of @emph{source-window} minus @emph{source-x}.
11406
@var{warp-pointer-relative-if-inside} generates events just as if
11407
the user had instantaneously moved the pointer from one position to
11408
another. @var{warp-pointer-relative-if-inside} cannot move the
11409
pointer outside the confine-to window of an active pointer grab; an
11410
attempt to do so only moves the pointer as far as the closest edge
11411
of the confine-to window.
11418
@node Managing Input Focus, Grabbing the Pointer, Pointer Position, Events and Input
11419
@section Managing Input Focus
11422
CLX provides the @var{set-focus-input} and @var{focus-input} functions
11423
to set and get the keyboard input focus window.
11425
@defun set-input-focus display focus revert-to &optional time
11431
The new input focus @var{window}.
11433
The focus @var{window} when focus is no longer viewable.
11438
Changes the keyboard input focus and the last-focus-change
11439
time. The function has no effect if the specified @emph{time} is
11440
earlier than the current last-focus-change time or is later than
11441
the current server time; otherwise, the last-focus-change time is
11442
set to the specified @emph{time}. The @var{set-input-focus}
11443
function causes the X server to generate @var{:focus-in} and
11444
@var{:focus-out} events.
11446
If @var{:none} is specified as the @emph{focus}, all keyboard
11447
events are discarded until a new focus window is set. In this
11448
case, the @emph{revert-to} argument is ignored.
11450
If a window is specified as the @emph{focus} argument, it becomes
11451
the keyboard's focus window. If a generated keyboard event would
11452
normally be reported to this window or one of its inferiors, the
11453
event is reported normally; otherwise, the event is reported with
11454
respect to the focus window.
11456
If @var{:pointer-root} is specified as the @emph{focus} argument,
11457
the input focus window is set to the root window of the screen
11458
containing the pointer when each keyboard event occurs. In this
11459
case, the @emph{revert-to} argument is ignored.
11461
The specified @emph{focus} window must be viewable at the time of
11462
the request. If the @emph{focus} window later becomes not
11463
viewable, the new focus window depends on the @emph{revert-to}
11464
argument. If @emph{revert-to} is specified as @var{:parent}, the
11465
@emph{focus} reverts to the parent (or the closest viewable
11466
ancestor) and the new @emph{revert-to} value is take to be
11467
@var{:none}. If @emph{revert-to} is @var{:pointer-root} or
11468
@var{:none}, the @emph{focus} reverts to that value. When the
11469
@emph{focus} reverts, @var{:focus-in} and @var{:focus-out}
11470
events are generated, but the last-focus-change time is not
11477
@defun input-focus display
11485
Returns the @emph{focus} window, @var{:pointer-root}, or
11486
@var{:none}, depending on the current state of the focus
11487
window. @emph{revert-to} returns the current focus revert-to
11491
Type (@var{or window} (@var{member :none :pointer-root})).
11493
Type (@var{or window} (@var{member :none :pointer-root :parent})).
11499
@node Grabbing the Pointer, Grabbing a Button, Managing Input Focus, Events and Input
11500
@section Grabbing the Pointer
11503
CLX provides the @var{grab-pointer} and @var{ungrab-pointer} functions
11504
for grabbing and releasing pointer control.
11506
@defun grab-pointer window event-mask &key :owner-p :sync-pointer-p :sync-keyboard-p :confine-to :cursor :time
11510
The @var{window} grabbing the pointer.
11512
A @var{pointer-event-mask}.
11514
If true, all client windows receive pointer events normally.
11515
@item :sync-pointer-p
11516
Indicates whether the pointer is in synchronous or asynchronous mode.
11517
@item :sync-keyboard-p
11518
Indicates whether the keyboard is in synchronous or asynchronous mode.
11520
A @var{window} to which the pointer is confined.
11524
A @var{timestamp}. A @var{nil} value means the current server time is used.
11528
Actively grabs control of the pointer. Further pointer events are
11529
only reported to the grabbing client. The request overrides any
11530
active pointer grab by this client.
11532
If @var{:owner-p} is @var{nil}, all generated pointer events are
11533
reported with respect to @emph{window}, and are only reported if
11534
selected by @emph{event-mask}. If @var{:owner-p} is true, and if a
11535
generated pointer event would normally be reported to this client,
11536
it is reported normally; otherwise the event is reported with
11537
respect to the @emph{window}, and is only reported if selected by
11538
@emph{event-mask}. For either value of @var{:owner-p}, unreported
11539
events are simply discarded.
11541
If @var{:sync-pointer-p} is @var{nil}, pointer event processing
11542
continues normally (asynchronously); if the pointer is currently
11543
frozen by this client, then processing of pointer events is
11544
resumed. If @var{:sync-pointer-p} is true (indicating a synchronous
11545
action), the pointer (as seen via the protocol) appears to freeze,
11546
and no further pointer events are generated by the server until the
11547
grabbing client issues a releasing @var{allow-events} request.
11548
Actual pointer changes are not lost while the pointer is frozen;
11549
they are simply queued for later processing.
11551
If @var{:sync-keyboard-p} is @var{nil}, keyboard event processing
11552
is unaffected by activation of the grab. If @var{:sync-keyboard-p}
11553
is true, the keyboard (as seen via the protocol) appears to freeze,
11554
and no further keyboard events are generated by the server until the
11555
grabbing client issues a releasing @var{allow-events}
11556
request. Actual keyboard changes are not lost while the keyboard is
11557
frozen; they are simply queued for later processing.
11559
If @var{:cursor} is specified, it is displayed regardless of what
11560
window the pointer is in. Otherwise, the normal cursor for the
11561
@emph{window} is displayed.
11563
If a @var{:confine-to} window is specified, the pointer is
11564
restricted to stay within that window. The @var{:confine-to}
11565
window does not need to have any relationship to the
11566
@emph{window}. If the pointer is not initially in the
11567
@var{:confine-to} window, it is warped automatically to the closest
11568
edge (with @var{:enter}/@var{:leave-events} generated normally)
11569
just before the grab activates. If the @var{:confine-to} window is
11570
subsequently reconfigured, the pointer is warped automatically as
11571
necessary to keep it contained in the window.
11573
@var{grab-pointer} generates @var{:enter-notify} and
11574
@var{:leave-notify} events. @var{grab-pointer} can fail with a
11579
@var{:already-grabbed} if the pointer is actively grabbed by some
11583
@var{:frozen} if the pointer is frozen by an active grab of
11587
@var{:not-viewable} if the @emph{window} or the
11588
@var{:confine-to} window is not viewable, or if the
11589
@var{:confine-to} window lies completely outside the boundaries
11590
of the root window.
11593
@var{:invalid-time} if the specified time is earlier than the
11594
last-pointer-grab time or later than the current server
11595
time. Otherwise, the last-pointer-grab time is set to the
11596
specified time, with current-time replaced by the current server
11597
time, and a value of @var{:success} is returned by
11598
@var{grab-pointer}.
11602
One of @var{:already-grabbed}, @var{:frozen}, @var{:invalid-time},
11603
@var{:not-viewable}, or @var{:success}.
11609
@defun ungrab-pointer display &key :time
11618
Releases the pointer if this client has it actively grabbed (from
11619
either @var{grab-pointer}, @var{grab-button}, or from a normal
11620
button press), and releases any queued events. The request has no
11621
effect if the specified @var{:time} is earlier than the
11622
last-pointer-grab time or is later than the current server time. An
11623
@var{ungrabpointer} is performed automatically if the event window
11624
or @var{:confine-to} window for an active pointer grab becomes not
11627
This request generates @var{:enter-notify} and @var{:leave-notify}
11634
@defun change-active-pointer-grab display event-mask &optional cursor time
11640
A @var{pointer-event-mask}.
11642
A @var{cursor} or @var{nil}.
11647
Changes the specified dynamic parameters if the pointer is actively
11648
grabbed by the client and the specified @emph{time} is no earlier
11649
than the last-pointer-grab time and no later than the current server
11650
time. The interpretation of @emph{event-mask} and @emph{cursor} are
11651
as in @var{grab-pointer}. @var{change-active-pointer-grab} has no
11652
effect on the passive parameters of a @var{grab-button}.
11658
@node Grabbing a Button, Grabbing the Keyboard, Grabbing the Pointer, Events and Input
11659
@section Grabbing a Button
11662
CLX provides the @var{grab-button} and @var{ungrab-button} functions
11663
for passively grabbing and releasing pointer control.
11665
@defun grab-button window button event-mask &key (:modifiers 0) :owner-p :sync-pointer-p :sync-keyboard-p :confine-to :cursor
11671
The button (type @var{card8}) pressed or @var{:any}.
11673
A @var{pointer-event-mask}.
11675
A @var{modifier-mask}.
11677
If true, all client windows receive pointer events normally.
11678
@item :sync-pointer-p
11679
Indicates whether the pointer is handled in a synchronous or asynchronous fashion.
11680
@item :sync-keyboard-p
11681
Indicates whether the keyboard is in synchronous or asynchronous mode.
11683
A @var{window} to which the pointer is confined.
11688
This request establishes a passive grab. If the specified
11689
@emph{button} is pressed when the specified modifier keys are down
11690
(and no other buttons or modifier keys are down), and:
11693
@item @emph{window} contains the pointer
11695
@item The @var{:confine-to} window (if any) is viewable
11697
@item These constraints are not satisfied for any ancestor of @emph{window}
11704
The pointer is actively grabbed as described with
11708
The last-pointer-grab time is set to the time that the button was
11709
pressed (as transmitted in the @var{:button-press} event)
11712
The @var{:button-press} event is reported
11715
The interpretation of the remaining arguments is the same as with
11716
@var{grab-pointer}. The active grab is terminated automatically
11717
when all buttons are released (independent of the state of modifier
11720
A zero @emph{modifier} mask is equivalent to issuing the request for
11721
all possible modifier-key combinations (including the combination of
11722
no modifiers). It is not required that all specified modifiers have
11723
currently assigned keycodes. A @emph{button} of @var{:any} is
11724
equivalent to issuing the request for all possible
11725
buttons. Otherwise, it is not required that the specified
11726
@emph{button} currently be assigned to a physical button.
11732
@defun ungrab-button window button &key (:modifiers 0)
11738
The button (type @var{card8}) that is released or @var{:any}.
11740
A @var{modifier-mask}.
11743
Releases the passive button/key combination on the specified
11744
@emph{window} if it was grabbed by this client. A zero
11745
@emph{modifier} mask is equivalent to issuing the request for all
11746
possible modifier combinations including the combination of no
11747
modifiers. A @emph{button} of @var{:any} is equivalent to issuing
11748
the request for all possible buttons. This has no effect on an
11755
@node Grabbing the Keyboard, Grabbing a Key, Grabbing a Button, Events and Input
11756
@section Grabbing the Keyboard
11759
CLX provides the @var{grab-keyboard} and @var{ungrab-keyboard}
11760
functions for actively grabbing and releasing control of the keyboard.
11762
@defun grab-keyboard window &key :owner-p :sync-pointer-p :sync-keyboard-p :time
11768
If true, all client windows receive keyboard input normally.
11769
@item :sync-pointer-p
11770
Indicates whether the pointer is in synchronous or asynchronous mode.
11771
@item :sync-keyboard-p
11772
Indicates whether the keyboard is in synchronous or asynchronous mode.
11778
Actively grabs control of the keyboard. Further key events are
11779
reported only to the grabbing client. The request overrides any
11780
active keyboard grab by this client. @var{grab-keyboard} generates
11781
@var{:focus-in} and @var{:focus-out} events.
11783
If @var{:owner-p} is @var{nil}, all generated key events are
11784
reported with respect to @emph{window}. If @var{:owner-p} is true,
11785
then a generated key event that would normally be reported to this
11786
client is reported normally; otherwise the event is reported with
11787
respect to the @emph{window}. Both @var{:key-press} and
11788
@var{:key-release} events are always reported, independent of any
11789
event selection made by the client.
11791
If @var{:sync-keyboard-p} is @var{nil}, keyboard event processing
11792
continues normally (asynchronously); if the keyboard is currently
11793
frozen by this client, then processing of keyboard events is
11794
resumed. If @var{:sync-keyboard-p} is true, the keyboard (as seen
11795
via the protocol) appears to freeze, and no further keyboard events
11796
are generated by the server until the grabbing client issues a
11797
releasing @var{allow-events} request. Actual keyboard changes are
11798
not lost while the keyboard is frozen; they are simply queued for
11801
If @var{:sync-pointer-p} is @var{nil}, pointer event processing is
11802
unaffected by activation of the grab. If @var{:sync-pointer-p} is
11803
true, the pointer (as seen via the protocol) appears to freeze, and
11804
no further pointer events are generated by the server until the
11805
grabbing client issues a releasing @var{allow-events}
11806
request. Actual pointer changes are not lost while the pointer is
11807
frozen; they are simply queued for later processing.
11809
The grab can fail with a status of:
11813
@var{:already-grabbed} if the keyboard is actively grabbed by
11817
@var{:frozen} if the keyboard is frozen by an active grab from
11821
@var{:not-viewable} if @emph{window} is not viewable
11824
@var{:invalid-time} if the specified time is earlier than the
11825
last-keyboard-grab time or later than the current server
11826
time. Otherwise, @var{grab-keyboard} returns a status of
11827
@var{:success} and last-keyboard-grab time is set to the
11828
specified time, with current-time replaced by current server time.
11832
One of @var{:already-grabbed}, @var{:frozen}, @var{:invalid-time},
11833
@var{:not-viewable}, or @var{:success}.
11839
@defun ungrab-keyboard display &key :time
11848
Releases the keyboard if this client has it actively grabbed (from
11849
either @var{grab-keyboard} or @var{grab-key}), and releases any
11850
queued events. The request has no effect if the specified time is
11851
earlier than the last-keyboard-grab time or is later than the
11852
current server time. An @var{ungrab-keyboard} is performed
11853
automatically if the event window for an active keyboard grab
11854
becomes not viewable.
11860
@node Grabbing a Key, Event Types, Grabbing the Keyboard, Events and Input
11861
@section Grabbing a Key
11864
The following paragraphs describe the functions used for passively
11865
grabbing and releasing the keyboard.
11867
@defun grab-key window key &key (:modifiers 0) :owner-p :sync-pointer-p :sync-keyboard-p :time
11873
The key (type @var{card8}) to be grabbed or @var{:any}.
11875
A @var{modifier-mask}.
11877
If true, all client windows receive keyboard input normally.
11878
@item :sync-pointer-p
11879
Indicates whether the pointer is in synchronous or asynchronous mode.
11880
@item :sync-keyboard-p
11881
Indicates whether the keyboard is in synchronous or asynchronous mode.
11886
This request establishes a passive grab on the keyboard. If the
11887
specified @emph{key} (which can also be a modifier key) is pressed
11888
(whether or not any specified modifier keys are down), and either of
11889
the following is true:
11893
@emph{window} is an ancestor of (or is) the focus window
11896
@emph{window} is a descendant of the focus window and contains the
11900
These constraints are not satisfied for any ancestor of
11901
@emph{window}, then the following occurs:
11905
The keyboard is actively grabbed as described in
11906
@var{grab-keyboard}
11909
The last-keyboard-grab time is set to the time that the
11910
@emph{key} was pressed (as transmitted in the
11911
@var{:key-press} event)
11914
The @var{:key-press} event is reported
11917
The interpretation of the remaining arguments is as for
11918
@var{grab-keyboard}. The active grab is terminated automatically when
11919
the specified @emph{key} has been released, independent of the state
11920
of the modifier keys.
11922
A zero modifier mask is equivalent to issuing the request for all
11923
possible modifier combinations (including the combination of no
11924
modifiers). It is not required that all specified modifiers have
11925
currently assigned keycodes. A @emph{key} of @var{:any} is
11926
equivalent to issuing the request for all possible
11927
keycodes. Otherwise, the @emph{key} must be in the range specified
11928
by @var{display-min-keycode} and @var{display-max-keycode} in the
11935
@defun ungrab-key window key &key (:modifiers 0)
11941
The key (type @var{card8}) to be released or @var{:any}.
11943
A @var{modifier-mask}.
11946
Releases the @emph{key} combination on the specified @emph{window}
11947
if it was grabbed by this client. A zero modifier mask of
11948
@var{:any} is equivalent to issuing the request for all possible
11949
modifier combinations (including the combination of no modifiers). A
11950
@emph{key} of @var{:any} is equivalent to issuing the request for
11951
all possible keycodes. @var{ungrab-key} has no effect on an active
11958
@node Event Types, Releasing Queued Events, Grabbing a Key, Events and Input
11959
@section Event Types
11962
The following paragraphs contain detailed descriptions of the contents
11963
of each event type. In CLX, events are not actually represented by
11964
structures, but rather by lists of keyword values passed to handler
11965
functions or by values bound to symbols within the clauses of
11966
@var{event-case} and @var{event-cond} forms. Nevertheless, it is
11967
convenient to describe event contents in terms of slots and to
11968
identify the components of events with slot name symbols. In fact, CLX
11969
uses the @var{declare-event} macro to define event slot symbols and to
11970
map these symbols to specific event data items returned by the X
11971
server (@pxref{Declaring Event Types}).
11973
The following paragraphs describe each event type, listing its
11974
@var{event-key} keyword symbol and its slot name symbols. An event
11975
keyword symbol identifies a specific event type. An event keyword
11976
symbol can be given as an argument to @var{send-event} or to an event
11977
handler function; it can also appear in the @emph{event-match} form of
11978
an @var{event-case} clause. An event slot name symbol identifies a
11979
specific event data item. Event slot names appear as keywords with
11980
associated values among the arguments passed to @var{send-event} or to
11981
an event handler function; as non-keyword symbols, they can also be in
11982
the @emph{event-slots} form of an @var{event-case} clause.
11984
In certain cases, more than one name symbol is defined for the same
11985
event slot. For example, in @var{:key-press} events, the symbols
11986
@emph{window} and @emph{event-window} both refer to the same event data
11990
* Keyboard and Pointer Events::
11991
* Input Focus Events::
11992
* Keyboard and Pointer State Events::
11993
* Exposure Events::
11994
* Window State Events::
11995
* Structure Control Events::
11996
* Client Communications Events::
11997
* Declaring Event Types::
12000
@node Keyboard and Pointer Events, Input Focus Events, Event Types, Event Types
12001
@subsection Keyboard and Pointer Events
12004
The keyboard and pointer events are: @var{:key-press} @var{:key-release},
12005
@var{:button-press}, @var{:button-release}, @var{:motion-notify},
12006
@var{:enter-notify}, and @var{:leave-notify}.
12008
@deftp {Event Type} :key-press
12009
@deftpx {Event Type} :key-release
12010
@deftpx {Event Type} :button-press
12011
@deftpx {Event Type} :button-release
12013
Selected by @var{:key-press}, @var{:key-release}, @var{:button-press},
12014
or @var{:button-release}.
12016
@var{:key-press}, and @var{:key-release} events are generated when
12017
a key or pointer button changes state. Note that @var{:key-press}
12018
and @var{:key-release} are generated for all keys, even those
12019
mapped to modifiers. All of these event types have the same
12020
slots. The window containing the pointer at the time of the event is
12021
referred to as the @emph{source} window. The @emph{event}
12022
@emph{window} is the window to which the event is actually
12023
reported. The event window is found by starting with the source
12024
window and looking up the hierarchy for the first window on which
12025
any client has selected interest in the event (provided no
12026
intervening window prohibits event generation by including the event
12027
type in its do-not-propagate-mask). The actual window used for
12028
reporting can be modified by active grabs and, in the case of
12029
keyboard events, can be modified by the focus window.
12031
A @var{:button-press} event has the effect of a temporary
12032
@var{grab-button}. When a pointer button is pressed and no active
12033
pointer grab is in progress, the ancestors of the source window are
12034
searched from the @emph{root} down, looking for a passive grab to
12035
activate. If no matching passive grab on the button exists, then an
12036
active grab is started automatically for the client receiving the
12037
@var{:button-press} event, and the last-pointer-grab time is set to
12038
the current server time. The effect is essentially equivalent to
12039
calling @var{grab-button} with the following arguments:
12042
@item @emph{window}
12044
@item @emph{button}
12045
The button that was pressed.
12046
@item @emph{event-mask}
12047
The client's selected pointer events on the event window.
12048
@item @var{:modifiers}
12050
@item @var{:owner-p}
12051
@var{t} if the client has @var{:owner-grab-button} selected on the event window; otherwise @var{nil}.
12052
@item @var{:sync-pointer-p}
12054
@item @var{:sync-keyboard-p}
12056
@item @var{:confine-to}
12058
@item @var{:cursor}
12063
The @var{:button-press} grab is terminated automatically when all
12064
buttons are released. The functions @var{ungrab-pointer} and
12065
@var{change-active-pointer-grab} can both be used to modify the
12066
@var{:button-press} grab.
12073
The window receiving the event.
12078
The @emph{code} argument varies with the event type. For @var{:key-press} and
12079
@var{:key-release}, @emph{code} is the keycode (@pxref{Keyboard Encodings}). For
12080
@var{:button-press} and @var{:button-release}, @emph{code} is the pointer button number.
12085
If @emph{event-window} is on the same screen as root, then @emph{x} and @emph{y} are the pointer
12086
coordinates relative to the @emph{event-window}; otherwise @emph{x} and @emph{y} are zero.
12091
If @emph{event-window} is on the same screen as root, then @emph{x} and @emph{y} are the pointer
12092
coordinates relative to the @emph{event-window}; otherwise @emph{x} and @emph{y} are zero.
12097
A mask that gives the state of the buttons and modifier keys just before the
12103
A timestamp for the moment when the event occurred.
12108
The root window of the source window.
12113
The x coordinate of the pointer position relative to root at the time of the event.
12118
The y coordinate of the pointer position relative to root at the time of the event@emph{.}
12121
Type (@var{or null window}).
12123
If the source window is an inferior of the @emph{event-window}, @emph{child} is set to the child
12124
of @emph{event-window} that is an ancestor of (or is) the source window; otherwise, it is
12125
set to @var{nil}@emph{.}
12127
@item same-screen-p
12128
Type @var{boolean}.
12130
True if @emph{event-window} and root are on the same screen.
12136
@deftp {Event Type} :motion-notify
12138
Selected by: @var{:button-1-motion}, @var{:button-2-motion},
12139
@var{:button-3-motion}, @var{:button-4-motion},
12140
@var{:button-5-motion}, @var{:button-motion}, or
12141
@var{:pointer-motion}.
12144
The @var{:motion-notify} event is generated when the pointer
12145
moves. A @var{:motion-notify} event has the same slots as
12146
@var{:button-press} @var{:button-release}, @var{:key-press}, and
12147
@var{:key-release} events, with the exception that the @emph{code}
12148
slot is replaced by the @emph{hint-p} slot. As with these other
12149
events, the event window for @var{:motion-notify} is found by
12150
starting with the source window and looking up the hierarchy for the
12151
first window on which any client has selected interest in the event
12152
(provided no intervening window prohibits event generation by
12153
including @var{:motion-notify} in its do-not-propagate-mask).The
12154
actual window used for reporting can be modified by active grabs.
12156
@var{:motion-notify} events are generated only when the motion
12157
begins and ends in the window. The granularity of motion events is
12158
not guaranteed, but a client selecting for motion events is
12159
guaranteed to get at least one event when the pointer moves and
12160
comes to rest. Selecting @var{:pointer-motion} generates
12161
@var{:motion-notify} events regardless of the state of the pointer
12162
buttons. By selecting some subset of @var{:button[1-5]-motion}
12163
instead, @var{:motion-notify} events are only received when one or
12164
more of the specified buttons are pressed. By selecting
12165
@var{:button-motion}, @var{:motion-notify} events are only
12166
received when at least one button is pressed. If
12167
@var{:pointer-motion-hint} is also selected, the server is free to
12168
send only one @var{:motion-notify}, until either the key or button
12169
state changes, the pointer leaves the event window, or the client
12170
calls @var{query-pointer} or @var{motion-events}.
12174
Type @var{boolean}.
12176
True if the event is a hint generated by selecting @var{:pointer-motion-hint}.
12183
@deftp {Event Type} :enter-notify
12184
@deftpx {Event Type} :leave-notify
12185
@anchor{:enter-notify}
12187
Selected by: @var{:enter-window} or @var{:leave-window}.
12189
If pointer motion or a window hierarchy change causes the pointer to
12190
be in a different window than before, @var{:enter-notify} and
12191
@var{:leave-notify} events are generated instead of a
12192
@var{:motion-notify} event. All @var{:enter-notify} and
12193
@var{:leave-notify} events caused by a hierarchy change are
12194
generated after any hierarchy event (@var{:unmap-notify},
12195
@var{:map-notify}, @var{:configure-notify},
12196
@var{:gravity-notify}, or @var{:circulate-notify}) caused by that
12197
change, but the ordering of @var{:enter-notify} and
12198
@var{:leave-notify} events with respect to @var{:focus-out},
12199
@var{:visibility-notify}, and @var{:exposure} events is not
12200
constrained by the X protocol. An @var{:enter-notify} or
12201
@var{:leave-notify} event can also be generated when a client
12202
application calls @var{change-active-pointer-grab},
12203
@var{grab-pointer}, or @var{ungrab-pointer}.
12207
@itemx event-window
12210
The window receiving the event.
12215
The final pointer position. If @emph{event-window} is on the same screen as root, then @emph{x}
12216
and @emph{y} are the pointer coordinates relative to the @emph{event-window}; otherwise @emph{x} and
12222
The final pointer position. If @emph{event-window} is on the same screen as root, then @emph{x}
12223
and @emph{y} are the pointer coordinates relative to the @emph{event-window}; otherwise @emph{x} and
12227
Type (@var{member :normal :grab :ungrab}).
12229
Events caused when the pointer is actively grabbed have mode @var{:grab}. Events
12230
caused when an active pointer grab deactivates have mode @var{:ungrab}. In all
12231
other cases, mode is @var{:normal}.
12234
Type (@var{member :ancestor :virtual :inferior :nonlinear} @var{:nonlinear-virtual}).
12236
When the pointer moves from window A to window B, and A is an inferior of
12241
@var{:leave-notify} with @emph{kind} @var{:ancestor} is generated on A
12244
@var{:leave-notify} with @emph{kind} @var{:virtual} is generated on each window between A
12245
and B exclusive (in that order)
12248
@var{:enter-notify} with @emph{kind} @var{:inferior} is generated on B
12251
When the pointer moves from window A to window B, and
12252
B is an inferior of A:
12256
@var{:leave-notify} with @emph{kind} @var{:inferior} is generated on A
12259
@var{:enter-notify} with @emph{kind}
12260
@var{:virtual} is generated on each window between
12261
A and B exclusive (in that order)
12264
@var{:enter-notify} with @emph{kind} @var{:ancestor} is generated on B
12267
When the pointer moves from window A to window B, with
12268
window C being their least common ancestor:
12272
@var{:leave-notify} with @emph{kind} @var{:nonlinear} is generated on A
12275
@var{:leave-notify} with @emph{kind}
12276
@var{:nonlinear-virtual} is generated on each
12277
window between A and C exclusive (in that order)
12280
@var{:enter-notify} with @emph{kind}
12281
@var{:nonlinear-virtual} is generated on each
12282
window between C and B exclusive (in that order)
12285
@var{:enter-notify} with @emph{kind}
12286
@var{:nonlinear} is generated on B
12289
When the pointer moves from window A to window B, on different screens:
12293
@var{:leave-notify} with @emph{kind} @var{:nonlinear} is generated on A
12296
If A is not a root window, @var{:leave-notify} with @emph{kind} @var{:nonlinear-virtual} is
12297
generated on each window above A up to and including its root (in order)
12300
If B is not a root window, @var{:enter-notify} with
12301
@emph{kind} @var{:nonlinear-virtual} is generated
12302
on each window from B's root down to but not
12303
including B (in order)
12306
@var{:enter-notify} with @emph{kind} @var{:nonlinear} is generated on B
12309
When a pointer grab activates (but after any initial warp into a
12310
confine-to window, and before generating any actual
12311
@var{:button-press} event that activates the grab), with
12312
@emph{G} the @var{grab-window} for the grab and @emph{P} the
12313
window the pointer is in, then @var{:enter-notify} and
12314
@var{:leave-notify} events with mode @var{:grab} are generated
12315
(as for @var{:normal} above) as if the pointer were to suddenly
12316
warp from its current position in @emph{P} to some position in
12317
@emph{G}. However, the pointer does not warp, and the pointer
12318
position is used as both the @emph{initial} and @emph{final}
12319
positions for the events.
12321
When a pointer grab deactivates (but after generating any actual
12322
@var{:button-release} event that deactivates the grab), with
12323
@emph{G} the @var{grab-window} for the grab and @emph{P} the
12324
window the pointer is in, then @var{:enter-notify} and
12325
@var{:leave-notify} events with mode @var{:ungrab} are
12326
generated (as for @var{:normal} above) as if the pointer were
12327
to suddenly warp from from some position in @emph{G} to its
12328
current position in @emph{P}. However, the pointer does not
12329
warp, and the current pointer position is used as both the
12330
@emph{initial} and @emph{final} positions for the events.
12333
Type @var{boolean}.
12335
If @emph{event-window} is the focus window or an inferior of the focus window, then
12336
@emph{focus-p} is @var{t}; otherwise, @emph{focus-p} is @var{nil}.
12341
A mask that gives the state of the buttons and modifier keys just before the
12347
A timestamp for the moment when the event occurred.
12352
The root window containing the final pointer position.
12357
The x coordinate of the pointer position relative to root at the time of the event.
12362
The y coordinate of the pointer position relative to root at the time of the event.
12365
Type (@var{or null window}).
12367
In a @var{:leave-notify} event, if a child of the @emph{event-window} contains the initial
12368
position of the pointer, the @emph{child} slot is set to that child; otherwise, the @emph{child} slot is
12369
@var{nil}. For an @var{:enter-notify} event, if a child of the @emph{event-window} contains the final
12370
pointer position, the @emph{child} slot is set to that child; otherwise, the @emph{child} slot is @var{nil}.
12372
@item same-screen-p
12373
Type @var{boolean}.
12375
True if @emph{event-window} and root are on the same screen.
12381
@node Input Focus Events, Keyboard and Pointer State Events, Keyboard and Pointer Events, Event Types
12382
@subsection Input Focus Events
12385
The input focus events are @var{:focus-in} and @var{:focus-out}.
12387
@deftp {Event Type} :focus-in
12388
@deftpx {Event Type} :focus-out
12390
Selected by: @var{:focus-change}.
12392
@var{:focus-in} and @var{:focus-out} events are generated when the
12393
input focus changes. All @var{:focus-out} events caused by a window
12394
@var{:unmap} are generated after any @var{:unmap-notify} event,
12395
but the ordering of @var{:focus-out} with respect to generated
12396
@var{:enter-notify}, @var{:leave-notify},
12397
@var{:visibility-notify}, and @var{:expose} events is not
12402
@itemx event-window
12405
For @var{:focus-in}, the new input focus window. For @var{:focus-out}, the previous input
12409
Type @code{(member :normal :while-grabbed :grab :ungrab)}.
12411
Events generated by @var{set-input-focus} when the keyboard is not grabbed have
12412
mode @var{:normal}. Events generated by @var{set-input-focus} when the keyboard is
12413
grabbed have mode @var{:while-grabbed}. Events generated when a keyboard grab
12414
activates have mode @var{:grab}, and events generated when a keyboard grab
12415
deactivates have mode @var{:ungrab}.
12418
Type (@var{member :ancestor :virtual :inferior :nonlinear :nonlinear-virtual :pointer :pointer-root :none}).
12420
When the focus moves from window A to window B, and A is an inferior of B,
12421
with the pointer in window P:
12425
@var{:focus-out} with @emph{kind} @var{:ancestor} is
12429
@var{:focus-out} with @emph{kind} @var{:virtual} is
12430
generated on each window between A and B exclusive (in that
12434
@var{:focus-in} with @emph{kind} @var{:inferior} is
12438
If P is an inferior of B, but P is not A or an inferior of
12439
A or an ancestor of A, @var{:focus-in} with @emph{kind}
12440
@var{:pointer} is generated on each window below B down
12441
to and including P (in order)
12444
When the focus moves from window A to window B, and B is an inferior of A,
12445
with the pointer in window P:
12449
If P is an inferior of A, but P is not A or an inferior of
12450
B or an ancestor of B, @var{:focus-out} with @emph{kind}
12451
@var{:pointer} is generated on each window from P up to
12452
but not including A (in order)
12455
@var{:focus-out} with @emph{kind} @var{:inferior} is
12459
@var{:focus-in} with @emph{kind} @var{:virtual} is
12460
generated on each window between A and B exclusive (in
12464
@var{:focus-in} with @emph{kind} @var{:ancestor} is
12468
When the focus moves from window A to window B, with window C being
12469
their least common ancestor, and with the pointer in window P:
12473
If P is an inferior of A, @var{:focus-out} with
12474
@emph{kind} @var{:pointer} is generated on each window
12475
from P up to but not including A (in order)
12478
@var{:focus-out} with @emph{kind} @var{:nonlinear} is
12482
@var{:focus-out} with @emph{kind}
12483
@var{:nonlinear-virtual} is generated on each window
12484
between A and C exclusive (in that order)
12487
@var{:focus-in} with @emph{kind}
12488
@var{:nonlinear-virtual} is generated on each window
12489
between C and B exclusive (in that order)
12492
:focus-in with @emph{kind} @var{:nonlinear} is generated
12496
If P is an inferior of B, @var{:focus-in} with
12497
@emph{kind} @var{:pointer} is generated on each window
12498
below B down to and including P (in order)
12501
When the focus moves from window A to window B, on different
12502
screens, with the pointer in window P:
12506
If P is an inferior of A, @var{:focus-out} with
12507
@emph{kind} @var{:pointer} is generated on each window
12508
from P up to but not including A (in order)
12511
@var{:focus-out} with @emph{kind} @var{:nonlinear} is
12515
If A is not a root window, @var{:focus-out} with
12516
@emph{kind} @var{:nonlinear-virtual} is generated on each
12517
window above A up to and including its root (in order)
12520
If B is not a root window, @var{:focus-in} with
12521
@emph{kind} @var{:nonlinear-virtual} is generated on each
12522
window from B's root down to but not including B (in
12526
@var{:focus-in} with @emph{kind} @var{:nonlinear} is
12530
If P is an inferior of B, @var{:focus-in} with
12531
@emph{kind} @var{:pointer} is generated on each window
12532
below B down to and including P (in order)
12535
When the focus moves from window A to @var{:pointer-root}
12536
(or @var{:none}), with the pointer in window P:
12540
If P is an inferior of A, @var{:focus-out} with
12541
@emph{kind} @var{:pointer} is generated on each window
12542
from P up to but not including A (in order)
12545
@var{:focus-out} with @emph{kind} @var{:nonlinear} is
12549
If A is not a root window, @var{:focus-out} with
12550
@emph{kind} @var{:nonlinear-virtual} is generated on each
12551
window above A up to and including its root (in order)
12554
@var{:focus-in} with @emph{kind} @var{:pointer-root} (or
12555
@var{:none}) is generated on all root windows
12558
If the new focus is @var{:pointer-root}, @var{:focus-in}
12559
with @emph{kind} @var{:pointer} is generated on each
12560
window from P's root down to and including P (in order)
12563
When the focus moves from @var{:pointer-root} (or
12564
@var{:none}) to window A, with the pointer in window P:
12568
If the old focus is @var{:pointer-root},
12569
@var{:focus-out} with @emph{kind} @var{:pointer} is
12570
generated on each window from P up to and including P's
12574
@var{:focus-out} with @emph{kind} @var{:pointer-root}
12575
(or @var{:none}) is generated on all root windows
12578
If A is not a root window, @var{:focus-in} with
12579
@emph{kind} @var{:nonlinear-virtual} is generated on each
12580
window from A's root down to but not including A (in
12584
@var{:focus-in} with @emph{kind} @var{:nonlinear} is
12588
If P is an inferior of A, @var{:focus-in} with
12589
@emph{kind} @var{:pointer} is generated on each window
12590
below A down to and including P (in order)
12593
When the focus moves from @var{:pointer-root} to
12594
@var{:none} (or vice versa), with the pointer in window P:
12598
If the old focus is @var{:pointer-root},
12599
@var{:focus-out} with @emph{kind} @var{:pointer} is
12600
generated on each window from P up to and including P's
12604
@var{:focus-out} with @emph{kind} @var{:pointer-root}
12605
(or @var{:none}) is generated on all root windows
12608
@var{:focus-in} with @emph{kind} @var{:none} (or
12609
@var{:pointer-root}) is generated on all root windows
12612
If the new focus is @var{:pointer-root}, @var{:focus-in}
12613
with @emph{kind} @var{:pointer} is generated on each
12614
window from P's root down to and including P (in order)
12619
When a keyboard grab activates (but before generating any actual
12620
@var{:key-press} event that activates the grab), with @emph{G}
12621
the @var{grab-window} for the grab and @emph{F} the current
12622
focus, then @var{:focus-in} and @var{:focus-out} events with
12623
mode @var{:grab} are generated (as for @var{:normal} above) as
12624
if the focus were to change from @emph{F} to @emph{G}.
12626
When a keyboard grab deactivates (but after generating any
12627
actual @var{:key-release} event that deactivates the grab),
12628
with @emph{G} the @var{grab-window} for the grab and @emph{F}
12629
the current focus, then @var{:focus-in} and @var{:focus-out}
12630
events with mode @var{:ungrab} are generated (as for
12631
@var{:normal} above) as if the focus were to change from
12632
@emph{G} to @emph{F}.
12635
@node Keyboard and Pointer State Events, Exposure Events, Input Focus Events, Event Types
12636
@subsection Keyboard and Pointer State Events
12639
The keyboard and pointer state events are @var{:keymap-notify} and @var{:mapping-notify}.
12641
@deftp {Event Type} :keymap-notify
12644
Selected by: @var{:keymap-state}.
12646
The @var{:keymap-notify} event returns the current state of the
12647
keyboard. @var{:keymap-notify} is generated immediately after every
12648
@var{:enter-notify} and @var{:focus-in}.
12652
@itemx event-window
12655
The window receiving an @var{:enter-notify} or @var{:focus-in} event.
12658
Type (@var{bit-vector 256}).
12660
A bit-vector containing the logical state of the keyboard. Each bit set to 1
12661
indicates that the corresponding key is currently pressed. The vector is represented
12662
as 32 bytes. For @emph{n} from 0 to 7, byte @emph{n} (from 0) contains the bits for keys 8@emph{n} to
12663
8@emph{n}+7, with the least significant bit in the byte representing key 8@emph{n}.
12669
@deftp {Event Type} :mapping-notify
12671
The X server reports @var{:mapping-notify} events to all
12672
clients. There is no mechanism to express disinterest in this
12673
event. The X server generates this event type whenever a client
12674
application calls one of the following:
12678
@var{set-modifier-mapping} to indicate which keycodes to use as
12679
modifiers (the status reply must be @var{:mapping-success})
12682
@var{change-keyboard-mapping} to change the keyboard mapping
12685
@var{set-pointer-mapping} to set the pointer mapping (the status
12686
reply must be @var{:mapping-success})
12691
Type (@code{member :modifier :keyboard :pointer}).
12693
Indicates the kind of change that occurred--@var{:modifier} for a successful
12694
@var{set-modifier-mapping}, @var{:keyboard} for a successful @var{change-keyboard-mapping},
12695
and @var{:pointer} for a successful @var{set-pointer-mapping}.
12700
If request is @var{:keyboard}, then @emph{start} and @emph{count} indicate the range of altered
12706
If request is @var{:keyboard}, then @emph{start} and @emph{count} indicate the range of altered
12712
@node Exposure Events, Window State Events, Keyboard and Pointer State Events, Event Types
12713
@subsection Exposure Events
12716
The X server cannot guarantee that a window's content is preserved when
12717
the window is obscured or reconfigured. X requires client applications
12718
to be capable of restoring the contents of a previously-invisible window
12719
region whenever it is exposed. Therefore, the X server sends events
12720
describing the exposed window and its exposed region. For a simple
12721
window, a client can choose to redraw the entire content whenever any
12722
region is exposed. For a complex window, a client can redraw only the
12725
@deftp {Event Type} :exposure
12728
Selected by: @var{:exposure}.
12730
An @var{:exposure} event is sent when redisplay is needed for a
12731
window region whose content has been lost. Redisplay is needed
12732
when one of the following occurs:
12736
A region is exposed for a window and the X server has no backing
12737
store for the region
12740
A region of a viewable window is obscured and the X server
12741
begins to honor the window's backing-store attribute of
12742
@var{:always} or @var{:when-mapped}
12745
The X server begins to honor an unviewable window's
12746
backing-store attribute of @var{:always} or
12747
@var{:when-mapped}.
12750
The regions needing redisplay are decomposed into an arbitrary set
12751
of rectangles, and an @var{:exposure} event is generated for each
12752
rectangle. For a given action causing @var{:exposure} events, the
12753
set of events for a given window are guaranteed to be reported
12756
@var{:exposure} events are never generated for @var{:input-only}
12759
All @var{:exposure} events caused by a hierarchy change are
12760
generated after any hierarchy event (@var{:unmap-notify},
12762
@var{:configure-notify},@var{:gravity-notify}, or
12763
@var{:circulate-notify}) caused by that change. All
12764
@var{:exposure} events on a given window are generated after any
12765
@var{:visibility-notify} event on that window, but it is not
12766
required that all @var{:exposure} events on all windows be
12767
generated after all visibility events on all windows. The ordering
12768
of @var{:exposure} events with respect to @var{:focus-out},
12769
@var{:enter-notify}, and @var{:leave-notify} events is not
12774
@itemx event-window
12777
The window needing redisplay.
12782
The position of the left edge of the region to redisplay, relative to the
12783
@emph{event-window}.
12788
The position of the top edge of the region to redisplay, relative to the
12789
@emph{event-window}.
12794
The width of the region to redisplay.
12799
The height of the region to redisplay.
12804
If count is zero, then no more @var{:exposure} events for this window follow. If
12805
count is nonzero, then at least that many more @var{:exposure} events for this
12806
window follow (and possibly more).
12812
@deftp {Event Type} :graphics-exposure
12814
A @var{:graphics-exposure} event is generated by a call to
12815
@var{copy-area} or @var{copy-plane} when the exposures attribute
12816
of the graphics context is @var{:on}. A @var{:graphics-exposure}
12817
event reports a destination region whose content cannot be computed
12818
because the content of the corresponding source region has been
12819
lost. For example, the missing source region may be obscured or may
12820
lie outside the current source drawable size. For a given action
12821
causing @var{:graphics-exposure} events, the set of events for a
12822
given destination are guaranteed to be reported contiguously.
12826
@itemx event-window
12827
Type @var{drawable}.
12829
The destination drawable for the @var{copy-area} or @var{copy-plane} function.
12834
The position of the left edge of the destination region, relative to the @emph{drawable}.
12839
The position of the top edge of the destination region, relative to the @emph{drawable}.
12844
The width of the destination region.
12849
The height of the destination region.
12854
If count is zero then no more @var{:graphics-exposure} events for the @emph{drawable}
12855
follow. If count is nonzero then at least that many more @var{:graphics-exposure}
12856
events for the @emph{drawable} follow (and possibly more).
12861
The major opcode for the graphics request generating the event
12862
(62 for @var{copy-area}, 63 for @var{copy-plane}).
12867
The minor opcode for the graphics request generating the event
12868
(0 for both @var{copy-area} and @var{copy-plane}).
12874
@deftp {Event Type} :no-exposure
12876
A @var{:no-exposure} event is generated by a call to
12877
@var{copy-area} or @var{copy-plane} when the exposures attribute
12878
of the graphics context is @var{:on}. If no
12879
@var{:graphics-exposure} events are generated, then a single
12880
@var{:no-exposure} event is sent.
12884
@itemx event-window
12885
Type @var{drawable}.
12887
The destination drawable for the @var{copy-area} or @var{copy-plane} function.
12892
The major opcode for the graphics request generating the event
12893
(62 for @var{copy-area}, 63 for @var{copy-plane}).
12898
The minor opcode for the graphics request generating the event
12899
(0 for both @var{copy-area} and @var{copy-plane}).
12905
@node Window State Events, Structure Control Events, Exposure Events, Event Types
12906
@subsection Window State Events
12909
The following paragraphs describe the events that can be received when a
12934
@deftp {Event Type} :circulate-notify
12936
Selected by: @var{:structure-notify} on a window or @var{:substructure-notify} on its parent.
12938
A @var{:circulate-notify} event is generated whenever a window is
12939
actually restacked as a result of a client application calling
12940
@var{circulate-window-up} or @var{circulate-window-down}.
12946
The window receiving the event.
12951
The window that was restacked.
12954
Type (@var{member :top :bottom}).
12956
If place is @var{:top}, the @emph{window} is now on top of all siblings. Otherwise, it is below
12963
@deftp {Event Type} :configure-notify
12965
Selected by: @var{:structure-notify} on a window or
12966
@var{:substructure-notify} on its parent.
12969
The @var{:configure-notify} event is generated when the position or
12970
size of a window actually changes as a result of a client
12971
application setting its @emph{x}, @emph{y}, @emph{width},
12972
@emph{height}, or @emph{border-width} attributes.
12978
The window receiving the event.
12983
The window that was moved or resized.
12988
@emph{x} and @emph{y} specify the new upper-left corner position of the @emph{window} relative to its
12994
@emph{x} and @emph{y} specify the new upper-left corner position of the @emph{window} relative to its
13000
@emph{width} and @emph{height} specify the new size of the @emph{window} interior.
13005
@emph{width} and @emph{height} specify the new size of the @emph{window} interior.
13010
The new @emph{window} border width.
13012
@item above-sibling
13013
Type (@var{or null window}).
13015
The sibling immediately below the @emph{window}. If above-sibling is @var{nil}, then the
13016
@emph{window} is below all of its siblings.
13018
@item override-redirect-p
13019
Type @var{boolean}.
13021
@emph{override-redirect-p} is true if the override-redirect attribute of the @emph{window} is
13022
@var{:on}; otherwise, it is @var{nil}. See @var{window-override-redirect} in @ref{Window Attributes}.
13026
The X server can report @var{:create-notify} events to clients
13027
wanting information about creation of windows. The X server
13028
generates this event whenever a client application creates a window
13029
by calling @var{create-window}.
13031
To receive this event type in a client application, you @code{setf}
13032
the @var{:substructure-notify} as the event-mask in the parent
13033
window's event-mask slot.
13038
@deftp {Event Type} :create-notify
13040
Selected by: @var{:substructure-notify}.
13043
The @var{:create-notify} event is generated when a @emph{window} is
13044
created and is sent to the @emph{parent} window.
13048
@itemx event-window
13051
The parent window receiving the event.
13056
The new window created.
13061
@emph{x} and @emph{y} specify the initial upper-left corner position of the @emph{window} relative to
13067
@emph{x} and @emph{y} specify the initial upper-left corner position of the @emph{window} relative to
13073
@emph{width} and @emph{height} specify the initial size of the @emph{window} interior.
13078
@emph{width} and @emph{height} specify the initial size of the @emph{window} interior.
13083
The initial @emph{window} border width.
13085
@item override-redirect-p
13086
Type @var{boolean}.
13088
@emph{override-redirect-p} is true if the override-redirect attribute of the @emph{window} is
13089
@var{:on}; otherwise, it is @var{nil}. See @var{window-override-redirect} in @ref{Window Attributes}.
13096
@deftp {Event Type} :destroy-notify
13098
Selected by: @var{:structure-notify} on a window or @var{:substructure-notify} on its parent.
13100
The @var{:destroy-notify} event is generated when a @emph{window}
13101
is destroyed. The ordering of the @var{:destroy-notify} events is
13102
such that for any given window, @var{:destroy-notify} is generated
13103
on all inferiors of a window before @var{:destroy-notify} is
13104
generated on the @emph{window}. The ordering among siblings and
13105
across subhierarchies is not otherwise constrained.
13111
The window receiving the event.
13116
The window that was destroyed.
13122
@deftp {Event Type} :gravity-notify
13124
Selected by: @var{:structure-notify} on a window or @var{:substructure-notify} on its parent.
13126
The X server can report @var{:gravity-notify} events to clients
13127
wanting information about when a @emph{window} is moved because of a
13128
change in the size of its parent. The X server generates this event
13129
whenever a client application actually moves a child window as a
13130
result of resizing its parent by calling @var{with-state} with the
13131
appropriate arguments set.
13137
The window receiving the event.
13142
The window that was moved.
13147
x and y specify the new upper-left corner position of the @emph{window} relative to its
13153
x and y specify the new upper-left corner position of the @emph{window} relative to its
13160
@deftp {Event Type} :map-notify
13162
Selected by: @var{:structure-notify} on a window or @var{:substructure-notify} on its parent.
13164
The X server can report @var{:map-notify} events to clients wanting
13165
information about which windows are mapped. The X server generates
13166
this event type whenever a client application changes the
13167
@emph{window}'s state from unmapped to mapped by calling
13168
@var{map-window} or @var{map-subwindow}.
13170
To receive this event type, you @var{setf :structure-notify} as the
13171
event-mask on the @emph{window}'s @var{event-mask} slot. You can
13172
also receive this event type by @code{setf}ing the
13173
@var{:substructure-notify} event-mask on the parent window.
13179
The window receiving the event.
13184
The window that was mapped.
13186
@item override-redirect-p
13187
Type @var{boolean}.
13189
@emph{override-redirect-p} is true if the override-redirect attribute of the @emph{window} is
13190
@var{:on}; otherwise, it is @var{nil}. See @var{window-override-redirect} in @ref{Window Attributes}.
13196
@deftp {Event Type} :reparent-notify
13197
Selected by: @var{:structure-notify} on a window or @var{:substructure-notify} on its old or new parent.
13199
The @var{:reparent-notify} event is generated when a @emph{window}
13206
The window receiving the event.
13211
The window that was reparented.
13216
The new parent of the @emph{window}.
13221
x and y specify the upper-left corner position of the @emph{window} relative to its new
13227
x and y specify the upper-left corner position of the @emph{window} relative to its new
13230
@item override-redirect-p
13231
Type @var{boolean}.
13233
@emph{override-redirect-p} is true if the override-redirect attribute
13234
of the @emph{window} is @var{:on}; otherwise, it is @var{nil}. See
13235
@var{window-override-redirect} in @ref{Window Attributes}.
13241
@deftp {Event Type} :unmap-notify
13243
Selected by: @var{:structure-notify} on a window or @var{:substructure-notify} on its parent.
13245
The @var{:unmap-notify} event is generated when a mapped
13246
@emph{window} is unmapped.
13252
The window receiving the event.
13257
The window that was unmapped.
13260
Type @var{boolean}.
13262
@emph{configure-p} is true if the @emph{window} has a win-gravity
13263
attribute of @var{:unmap}, and the event was generated because
13264
@emph{window}'s parent was resized.
13270
@deftp {Event Type} :visibility-notify
13272
Selected by: @var{:visibility-change}.
13274
The @var{:visibility-notify} event is sent when the visibility of a
13275
@emph{window} changes. @var{:visibility-notify} events are never
13276
generated on @var{:input-only} windows. For the purposes of this
13277
event, the visibility of the @emph{window} is not affected by its
13280
All @var{:visibility-notify} events caused by a hierarchy change
13281
are generated after any hierarchy event caused by that change (for
13282
example, @var{:unmap-notify}, @var{:map-notify},
13283
@var{:configure-notify}, @var{:gravity-notify}, or
13284
@var{:circulate-notify}). Any @var{:visibility-notify} event on a
13285
given window is generated before any @var{:exposure} events on that
13286
window, but it is not required that all @var{:visibility-notify}
13287
events on all windows be generated before all @var{:exposure}
13288
events on all windows. The ordering of @var{:visibility-notify}
13289
events with respect to @var{:focus-out}, @var{:enter-notify}, and
13290
@var{:leave-notify} events is not constrained.
13294
@itemx event-window
13297
The window that changed in visibility.
13300
Type (@var{member :unobscured :partially-obscured} @var{:fully-obscured}).
13302
When the @emph{window} was either unviewable or it was viewable and at least
13303
partially obscured, and the @emph{window} changed to viewable and completely
13304
unobscured, then @emph{state} is @var{:unobscured}.
13306
When the @emph{window} was either unviewable or it was viewable and completely
13307
obscured, and the @emph{window} changed to viewable and partially obscured, then
13308
@emph{state} is @var{:partially-obscured}.
13310
When the @emph{window} was either unviewable or it was at least partially visible, and
13311
the @emph{window} changed to viewable and completely obscured, then @emph{state} is
13312
@var{:fully-obscured}.
13318
@node Structure Control Events, Client Communications Events, Window State Events, Event Types
13319
@subsection Structure Control Events
13322
The following paragraphs describe events used to @emph{redirect}
13323
client requests that reconfigure, restack, or map a window. Structure
13324
control events are typically used only by window managers and not by
13325
ordinary client applications. Structure control events report
13326
redirected requests, allowing a window manager to modify the requests
13327
before they are actually performed. However, if the override-redirect
13328
attribute of a window is @var{:on}, then no requests are redirected
13329
and no structure control events are generated.
13331
@deftp {Event Type} :circulate-request
13333
The @var{:circulate-request} event is generated when a client
13334
application calls @var{circulate-window-up} or
13335
@var{circulate-window-down} with a window that has the
13336
override-redirect attribute @var{:off}. The @emph{window} argument
13337
specifies the window to be restacked, and @emph{place} specifies
13338
what the new position in the stacking order should be (either
13339
@var{:top} or @var{:bottom}).
13341
Selected by: @var{:substructure-redirect} on @emph{parent}.
13345
@itemx event-window
13348
The window receiving the event. The receiving client must have selected
13349
@var{:substructure-redirect} on this window.
13354
The window to be restacked.
13357
Type @code{(member :top :bottom)}.
13359
The new stacking priority requested for @emph{window}.
13365
@deftp {Event Type} :colormap-notify
13366
Selected by: @var{:colormap-change}.
13368
The @var{:colormap-notify} event is generated with @emph{new-p}
13369
@var{t} when the @emph{colormap} associated with a @emph{window} is
13370
changed, installed, or uninstalled.
13374
@itemx event-window
13377
The window receiving the event.
13380
Type @code{(or null colormap)}.
13382
The colormap attribute of the window.
13385
Type @var{boolean}.
13387
If @emph{new-p} is true, then the @emph{window}'s colormap attribute has changed to the given
13388
@emph{colormap}. Otherwise, the @emph{window}'s colormap attribute has not, but the
13389
@emph{colormap} has been installed or uninstalled.
13392
Type @var{boolean}.
13394
If @emph{installed-p} is true, then the @emph{colormap} is currently installed.
13400
@deftp {Event Type} :configure-request
13402
Selected by:@var{:substructure-redirect} on parent.
13404
The @var{:configure-request} event is generated when a client
13405
program sets the @emph{x}, @emph{y}, @emph{width}, @emph{heigh}t,
13406
@emph{border-width} or stacking priority attributes of a window that
13407
has the override-redirect attribute @var{:off}.
13411
@itemx event-window
13414
The window receiving the event. The receiving client must have selected
13415
@var{:substructure-redirect} on this window.
13420
The window to be reconfigured.
13425
@emph{x} and @emph{y} specify the requested upper-left corner position of the @emph{window} relative
13426
to the parent. If either @emph{x} or @emph{y} is not specified in the value-mask, then it is set to
13427
the current window position.
13432
@emph{x} and @emph{y} specify the requested upper-left corner position of the @emph{window} relative
13433
to the @emph{parent}. If either @emph{x} or @emph{y} is not specified in the @emph{value-mask}, then it is set to
13434
the current window position.
13440
@emph{width} and @emph{height} specify the requested size of the @emph{window} interior. If either
13441
@emph{width} or @emph{height} is not specified in the @emph{value-mask}, then it is set to the current
13447
The requested @emph{window} border width. If @emph{border-width} is not specified in the
13448
@emph{value-mask}, then it is set to the current window @emph{border-width}.
13451
Type @code{(member :above :below :top-if :bottom-if :opposite)}.
13453
@emph{stack-mode} and @emph{above-sibling} specify the requested stacking priority of the
13454
@emph{window}. If @emph{stack-mode} is not specified in the @emph{value-mask}, then it is set to
13457
@item above-sibling
13458
Type (@var{or null window}).
13460
@emph{stack-mode} and @emph{above-sibling} specify the requested stacking priority of the
13461
@emph{window}. If @emph{above-sibling} is not specified in the @emph{value-mask}, then it is set to @var{nil}.
13466
Specifies the changed @emph{window} attributes contained in the redirected client
13467
request. Each 1 bit specifies that the corresponding attribute was changed.
13473
@deftp {Event Type} :map-request
13475
Selected by: @var{:substructure-redirect} on parent.
13477
The @var{:map-request} event is generated when a client application
13478
maps a @emph{window} that has the override-redirect attribute
13483
@itemx event-window
13486
The window receiving the event. The receiving client must have selected
13487
@var{:substructure-redirect} on this window.
13492
The window to be mapped.
13498
@deftp {Event Type} :resize-request
13500
Selected by: @var{:resize-redirect}.
13502
The @var{:resize-request} event is generated when a client program
13503
sets the @emph{width} or @emph{height} attributes of a @emph{window}
13504
that has the override-redirect attribute @var{:off}.
13508
@itemx event-window
13511
The window to be resized.
13517
@emph{width} and @emph{height} specify the requested size of the wi@emph{ndow} interior. If either
13518
@emph{width} or @emph{height} was unchanged in the client request, then it is set to the current
13525
@node Client Communications Events, Declaring Event Types, Structure Control Events, Event Types
13526
@subsection Client Communications Events
13529
The client communications events discussed in the following paragraphs
13530
are: @var{:client-message}, @var{:property-notify},
13531
@var{:selection-clear}, @var{:selection-request}, and
13532
@var{:selection-notify}.
13534
@deftp {Event Type} :client-message
13536
The @var{:client-message} event is generated exclusively by client
13537
calls to @var{send-event}. The X server places no interpretation on
13538
the @emph{type} or content of @emph{data} sent in a
13539
@var{:client-message}. A client can neither select
13540
@var{:client-message} events nor avoid receiving them.
13544
@itemx event-window
13547
The window receiving the event.
13550
Type @var{keyword}.
13552
An xatom keyword that specifies the type of client message. Interpretation of
13553
the type is determined solely by agreement between the sending and receiving
13557
Type (@var{member 8 16 32}).
13559
An integer that specifies whether @emph{data} should be viewed as a sequence of 8-bit,
13560
16-bit, or 32-bit quantities.
13563
Type @code{(sequence integer)}.
13565
The data content of the client message. @emph{data} always consists of 160 bytes --
13566
depending on format, either 20 8-bit values, 10 16-bit values or 5 32-bit values.
13567
The amount of this data actually used by a particular client message depends on
13574
@deftp {Event Type} :property-notify
13575
Selected by: @var{:property-change}.
13577
The @var{:property-notify} event is generated when a window
13578
property is changed or deleted.
13582
@itemx event-window
13585
The window receiving the event.
13588
Type @var{keyword}.
13590
The property that was changed or deleted.
13593
Type @code{(member :new-value :deleted)}.
13595
@emph{state} is @var{:new-value} if the property was changed using @var{change-property} or
13596
@var{rotate-properties}, even if zero-length data was added or if all or part of the
13597
property was replaced with identical data. @emph{state} is @var{:deleted} if the property was
13598
deleted using @var{delete-property} or @var{get-property}.
13601
Type @var{timestamp}.
13603
The server time when the property was changed or deleted.
13609
@deftp {Event Type} :selection-clear
13611
The @var{:selection-clear} event is reported to the previous owner
13612
of a @emph{selection} when the owner of the @emph{selection} is
13613
changed. The selection owner is changed by a client using
13614
@code{setf}. A client can neither select @var{:selection-clear}
13615
events nor avoid receiving them.
13618
@itemx event-window
13621
The window losing ownership of the @emph{selection}.
13624
Type @var{keyword}.
13626
The name of the selection.
13629
Type @var{timestamp}.
13631
The last-change time recorded for the @emph{selection}.
13636
@deftp {Event Type} :selection-notify
13638
The @var{:selection-notify} event is sent to a client calling
13639
@var{convert-selection}. @var{:selection-notify} reports the
13640
result of the client request to return the current value of a
13641
@emph{selection} into a particular form. @var{:selection-notify} is
13642
sent using @var{send-event} by the owner of the selection or (if no
13643
owner exists) by the X server. A client can neither select
13644
@var{:selection-notify} events nor avoid receiving them.
13646
@var{NOTE:} Standard conventions for inter-client communication require the following
13647
additional steps in processing a @var{:selection-notify} event:
13652
The client receiving this event should call @var{get-property} to
13653
return the converted selection value.
13656
After receiving the selection value, the property should then be
13657
deleted (either by using the @var{:delete-p} argument to
13658
@var{get-property} or by calling @var{delete-property}).
13663
@itemx event-window
13666
The requestor window given in the call to @var{convert-selection}.
13669
Type @var{keyword}.
13671
The selection to be converted.
13674
Type @var{keyword}.
13676
An @var{xatom} specifying the type of the converted selection value. This is the same
13677
target type given in the call to @var{convert-selection}.
13680
Type @code{(or null keyword)}.
13682
The window property containing the converted selection. If the property is @var{nil},
13683
then either the @emph{selection} has no owner or the owner could not perform the
13684
conversion to the @emph{target} type.
13687
Type @var{timestamp}.
13689
The timestamp from the client call to @var{convert-selection}.
13695
@deftp {Event Type} :selection-request
13697
The @var{:selection-request} event is reported to the owner of a
13698
selection when a client calls @var{convert-selection}. This event
13699
requests the selection owner to convert the current value of a
13700
@emph{selection} into a specified form and to return it to the
13701
requestor. A client can neither select @var{:selection-request}
13702
events nor avoid receiving them.
13704
The selection owner should respond to a @var{:selection-request} event by performing the
13710
Convert the current @emph{selection} value to the @emph{target}
13714
Store the converted selection value in the @emph{property}. If
13715
@emph{property} is @var{nil}, then the owner should choose the
13719
Call @var{send-event} to send a @var{:selection-notify} event to
13720
the @emph{requestor} containing the @emph{property} with the
13721
converted value. If the @emph{selection} could not be converted to
13722
the @emph{target} type, then a @var{nil} @emph{property} should
13723
be sent. The @var{:selection}, @var{:target}, and @var{:time}
13724
arguments to @var{send-event} should be the same as those
13725
received in the @var{:selection-request} event. The event-mask
13726
argument to @var{send-event} should be @var{nil}; that is, the
13727
@var{:selection-notify} event should be sent to client that
13728
created the @emph{requestor}.
13732
@var{NOTE:} Standard conventions for inter-client communication
13733
require the following additional steps in processing a
13734
@var{:selection-request} event:
13739
The property used to store the selection value must belong to the
13743
If the property is @var{nil}, the target type @var{atom} should
13744
be used as the property name.
13747
If the window did not actually own the selection at the given
13748
time, the request should be refused, just as if it could not be
13749
converted to the target type.
13754
@itemx event-window
13757
The selection owner receiving the event.
13762
The window requesting the converted @emph{selection}.
13765
Type @var{keyword}.
13767
The selection to be converted.
13770
Type @var{keyword}.
13772
An @var{xatom} specifying the type of the converted @emph{selection} value.
13775
Type @code{(or null keyword)}.
13777
A requestor window property.
13780
Type @var{timestamp}.
13782
The timestamp sent in the client @var{convert-selection} request.
13788
@node Declaring Event Types, , Client Communications Events, Event Types
13789
@subsection Declaring Event Types
13792
CLX uses the @var{declare-event} macro to define the event slot symbols
13793
that access the contents of X events. Most client applications do not
13794
need to use @var{declare-event} because the declarations for all core X
13795
events are already defined by CLX. Programmers using extensions to the
13796
X protocol can use @var{declare-event} to allow CLX to handle new event
13797
types returned by an extended X server.
13799
@defmac declare-event event-codes &rest slot-declarations
13801
Defines a mapping between event slot symbols and the data items in
13802
event messages received from an X server.
13804
The @emph{event-codes} argument gives the event type keyword for the
13805
event described. If several event types share the same slots, then
13806
@emph{event-codes} can be a list of event type
13807
keywords. @emph{slot-declarations} is a list containing an element
13808
for each event data item. The order of @emph{slot-declarations}
13809
corresponds to the order of event data items defined by the X
13812
Each element of @emph{slot-declarations} is a list of the form
13813
(@emph{type slot-name}*), where @emph{type} is a Common Lisp type
13814
specifier and @emph{slot-name} is a slot name symbol. The effect of
13815
such a list is to declare that the next data items in the event have
13816
the given data @emph{type} and are associated with the given
13817
@emph{slot-name} symbols. @emph{slot-name} can also be a list of
13818
slot name symbols; in this case, each symbol in the list is an alias
13819
that refers to the same event data item.
13823
An event type keyword or a list of event type keywords.
13824
@item slot-declarations
13825
A list of clauses defining event slot symbols.
13831
@node Releasing Queued Events, , Event Types, Events and Input
13832
@section Releasing Queued Events
13835
A client grabbing the keyboard or pointer can freeze the reporting of
13836
events on that device. When an input device is thus frozen, the server
13837
queues events until explicitly requested to release them by the grabbing
13838
client. CLX programs can use the @var{allow-events} function to release
13839
queued events from a frozen input device.
13841
@defun allow-events display mode &optional time
13848
One of: @var{:async-pointer}, @var{:sync-pointer},
13849
@var{:reply-pointer}, @var{:async-keyboard}, @var{:sync-keyboard},
13850
@var{:replay-keyboard}, @var{:async-both}, @var{:sync-both}.
13856
Releases some queued events if the client has caused a device to
13857
freeze. The request has no effect if the @emph{time} is earlier than
13858
the last-grab time of the most recent active grab for the client, or
13859
if the @emph{time} is later than the current server time. If
13860
@emph{time} is @var{nil}, the current server time is used. The
13861
effect of this function depends on the specified @emph{mode}.
13865
@var{:async-pointer} -- If the pointer is frozen by the client,
13866
pointer event processing continues normally. If the pointer is
13867
frozen twice by the client on behalf of two separate grabs,
13868
@var{:async-pointer} releases events for both
13869
grab@emph{s}. @var{:async-pointer} has no effect if the pointer
13870
is not frozen by the client, but the pointer need not be grabbed
13874
@var{:sync-pointer} -- If the pointer is frozen and actively
13875
grabbed by the client, pointer event processing continues normally
13876
until the next @var{:button-press} or @var{:button-release}
13877
event is reported to the client, at which time the pointer again
13878
appears to freeze. However, if the reported event causes the
13879
pointer grab to be released, the pointer does not
13880
freeze. @var{:sync-pointer} has no effect if the pointer is not
13881
frozen by the client, or if the pointer is not grabbed by the
13885
@var{:replay-pointer} -- If the pointer is actively grabbed by
13886
the client and is frozen as the result of an event having been
13887
sent to the client (either from the activation of a
13888
@var{grab-button}, or from a previous @var{allow-events} with
13889
mode @var{:sync-pointer}, but not from a @var{grab-pointer}),
13890
the pointer grab is released and that event is completely
13891
reprocessed, but this time ignoring any passive grabs at or above
13892
(towards the root) the @var{grab-window} of the grab just
13893
released. The request has no effect if the pointer is not grabbed
13894
by the client, or if the pointer is not frozen as the result of an
13898
@var{:async-keyboard} -- If the keyboard is frozen by the client,
13899
keyboard event processing continues normally. If the keyboard is
13900
frozen twice by the client on behalf of two separate grabs,
13901
@var{:async-keyboard} releases events for both grabs.
13902
@var{:async-keyboard} has no effect if the keyboard is not frozen
13903
by the client, but the keyboard need not be grabbed by the client.
13906
@var{:sync-keyboard} -- If the keyboard is frozen and actively
13907
grabbed by the client, keyboard event processing continues
13908
normally until the next @var{:key-press} or @var{:key-release}
13909
event is reported to the client, at which time the keyboard again
13910
appears to freeze. However if the reported event causes the
13911
keyboard grab to be released, the keyboard does not
13912
freeze. @var{:sync-keyboard} has no effect if the keyboard is not
13913
frozen by the client, or if the keyboard is not grabbed by the
13917
@var{:replay-keyboard} -- If the keyboard is actively grabbed by
13918
the client and is frozen as the result of an event having been
13919
sent to the client (either from the activation of a grab-key, or
13920
from a previous @var{allow-events} with mode
13921
@var{:sync-keyboard}, but not from a @var{grab-keyboard}), the
13922
keyboard grab is released and that event is completely
13923
reprocessed, but this time ignoring any passive grabs at or above
13924
(towards the root) the @var{grab-window} of the grab just
13925
released. The request has no effect if the keyboard is not grabbed
13926
by the client, or if the keyboard is not frozen as the result of
13930
@var{:sync-both} -- If both pointer and keyboard are frozen by
13931
the client, event processing (for both devices) continues normally
13932
until the next @var{:button-press}, @var{:button-release},
13933
@var{:key-press}, or @var{:key-release} event is reported to the
13934
client for a grabbed device (button event for the pointer, key
13935
event for the keyboard). At this time, the devices again appear to
13936
freeze. If the reported event causes the grab to be released, the
13937
devices do not freeze. However, if the other device is still
13938
grabbed, then a subsequent event for it will still cause both
13939
devices to freeze. @var{:sync-both} has no effect unless both
13940
pointer and keyboard are frozen by the client. If the pointer of
13941
keyboard is frozen twice by the client on behalf of two separate
13942
grabs, @var{:sync-both} @emph{thaws} for both, but a subsequent
13943
freeze for @var{:sync-both} will only freeze each device once.
13946
@var{:async-both} -- If the pointer and the keyboard are frozen
13947
by the client, event processing for both devices continues
13948
normally. If a device is frozen twice by the client on behalf of
13949
two separate grabs, @var{:async-both} @emph{thaws} for
13950
both. @var{:async-both} has no effect unless both pointer and
13951
keyboard are frozen by the client.
13954
@var{:async-pointer}, @var{:sync-pointer}, and
13955
@var{:replay-pointer} have no effect on processing of keyboard
13956
events. @var{:async-keyboard}, @var{:sync-keyboard}, and
13957
@var{:replay-keyboard} have no effect on processing of pointer
13960
It is possible for both a pointer grab and a keyboard grab to be
13961
active simultaneously by the same or different clients. When a
13962
device is frozen on behalf of either grab, no event processing is
13963
performed for the device. It is possible for a single device to be
13964
frozen due to both grabs. In this case, the freeze must be released
13965
on behalf of both grabs before events can again be processed.
13971
@node Resources, Control Functions, Events and Input, Top
13974
Users need a way to specify preferences for various user interface
13975
values (for example, colors, fonts, title strings, and so
13976
forth). Applications need a consistent method for determining the
13977
default interface values that are specific to them. It is also useful if
13978
application interface values can be modified by users without changes to
13979
the program code. For example, this capability can make it easy to
13980
change the color scheme of a user interface. In CLX, such interface
13981
values are referred to as @emph{resources}. CLX defines functions for
13982
storing and retrieving interface resources from a resource database. A
13983
user can store various user interface values as resources in a resource
13984
database; a CLX application can then read these resource values and
13985
modify its user interface accordingly.
13987
@var{NOTE:} The general term @emph{resource} refers to any application
13988
user interface value stored in a resource database. The term @emph{server
13989
resource} is used more specifically to refer to the types of objects
13990
allocated by an X server and referenced by clients (for example,
13991
windows, fonts, graphics contexts, and so forth).
13994
* Resource Binings::
13995
* Basic Resource Database Functions::
13996
* Accessing Resource Values::
13997
* Resource Database Files::
14000
@node Resource Binings, Basic Resource Database Functions, Resources, Resources
14001
@section Resource Binings
14004
Conceptually, a resource database is a set of resource name-value pairs
14005
(or @emph{resource bindings}). The name in a resource binding is a list
14006
that is the concatenation of a @emph{path list} and an @emph{attribute
14009
A path list is a list of symbols (or strings) that corresponds to a path
14010
through a tree-structured hierarchy. For example, the path:
14013
'(top middle bottom)
14017
corresponds to a three-level hierarchy in which @code{middle} is
14018
the child of @code{top}, and @code{bottom} is the child of
14021
Typically, the path of a resource name corresponds to a path in a
14022
hierarchy of windows, and each symbol/string names a window in the
14023
hierarchy. However, the first element of the path can also represent the
14024
overall name of the entire program, and subsequent path elements can
14025
refer to an application-specific hierarchy of resource names not
14026
strictly related to windows. In addition, a resource name can contain a
14027
partially-specified path list. The asterisk symbol (*) is a wildcard
14028
that can correspond to any sequence of levels in the hierarchy
14029
(including the null sequence). For example, the path:
14036
corresponds to a hierarchy of two or more levels in which
14037
@code{top} is at the top level and @code{bot-}
14038
@code{tom} is at the bottom level. An element of a path list can
14039
be the name of an individual window or the name of a class of windows.
14041
The final element of a resource name list is an attribute name. This
14042
symbol (or string) identifies a specific attribute of the object(s)
14043
named by the preceding path list. The attribute name can also be the
14044
symbol * or the string "*", in which case the resource name refers to
14045
all attributes of the path object(s). However, this form of resource
14046
name is rarely useful.
14048
Some examples of resource bindings are shown below. In these examples,
14049
assume that @code{mail} is the resource name of a mail reading
14050
application. @code{mail} uses a window of the class
14051
@code{button} whose name is @code{reply}.
14053
@multitable {Resource Name} {Resource Value}
14054
@item @code{(mail screen-1 reply background)} @tab @code{'green}
14055
@item @code{(mail * background)} @tab @code{'red}
14056
@item @code{(* button background)} @tab @code{'blue}
14059
These resource bindings specify the following:
14063
The @code{background} attribute resource of @code{mail}
14064
application@emph{'}s @code{reply} button has the value of
14065
@code{green} on @code{screen-1}.
14068
The @code{background} attribute for the rest of the
14069
@code{mail} application is always @code{red} on all
14073
In general, the @code{background} attribute for all
14074
@code{button} windows is @code{blue}.
14077
@node Basic Resource Database Functions, Accessing Resource Values, Resource Binings, Resources
14078
@section Basic Resource Database Functions
14081
A @var{resource-database} structure is a CLX object that represents a
14082
set of resource bindings. The following paragraphs describe the CLX
14086
@item Create a resource database
14088
@item Add a resource binding
14090
@item Remove a resource binding
14092
@item Merge two resource databases
14094
@item Map a function over the contents of a resource database
14097
@defun make-resource-database
14100
@item resource-database
14101
Type @var{resource-database}.
14104
Returns an empty resource database.
14108
@defun add-resource database name-list value
14112
The @var{resource-database} for the new resource binding.
14114
A list containing strings or symbols specifying the name for the resource binding.
14116
The value associated with the @emph{name-list} in the resource binding. This can be an object of any type.
14119
Adds the resource binding specified by @emph{name-list} and
14120
@emph{value} to the given @emph{database}. Only one value can be
14121
associated with the @emph{name-list} in the @emph{database}. This
14122
function replaces any value previously associated with the
14130
@defun delete-resource database name-list
14134
The @var{resource-database} containing the resource binding.
14136
A list containing strings or symbols specifying the name for the deleted resource binding.
14139
Removes the resource binding specified by @emph{name-list} from the given @emph{database}.
14146
@defun map-resource database function &rest args
14150
A @var{resource-database}.
14152
A @var{function} object or function symbol.
14154
A list of arguments to the @emph{function}.
14157
Calls the function for each resource binding in the
14158
@emph{database}. For each resource binding consisting of a
14159
@emph{name-list} and a @emph{value}, the form
14160
(@var{apply} @emph{function name-list value args})
14168
@defun merge-resources from-database to-database
14171
@item from-database
14172
The @var{resource-database} from which resource bindings are read.
14174
The @var{resource-database} to which resource bindings are added.
14178
Merges the contents of the @emph{from-database} with the
14179
@emph{to-database}. @var{map-resource} invokes @var{add-resource}
14180
in order to add each resource binding in the @emph{from-database} to
14181
the @emph{to-database}. The updated @emph{to-database} is returned.
14185
Type @var{resource-database}.
14191
@node Accessing Resource Values, Resource Database Files, Basic Resource Database Functions, Resources
14192
@section Accessing Resource Values
14195
The power and flexibility of resource management is the result of the
14196
way resource values in a resource database are accessed. A resource
14197
binding binding stored in the database generally contains only a partial
14198
resource name consisting of a mixture of name and class identifiers and
14199
wildcard elements (that is, *). To look up a resource value, an
14200
application program starts with two resource name lists of the same
14201
length containing no wildcard elements -- a @emph{complete resource
14202
name} and a @emph{complete} @emph{resource class}. The lookup
14203
algorithm returns the value for the resource binding whose resource name
14204
is the closest match to the complete name and class given. The
14205
definition of @emph{closest match} takes into account the top-down,
14206
parent-child hierarchy of resource names and also the distinction
14207
between individual names and class names.
14210
* Complete Names and Classes::
14211
* Matching Resource Names::
14212
* Resource Access Functions::
14215
@node Complete Names and Classes, Matching Resource Names, Accessing Resource Values, Accessing Resource Values
14216
@subsection Complete Names and Classes
14218
A resource binding contains a resource name list that can contain names,
14219
class names, or a mixture of both. A class name is a symbol or string
14220
that represents a group of related objects. The set of names used as
14221
class names are not specified by CLX. Instead, class names are defined
14222
by agreement between those who use class names when creating resource
14223
bindings (that is, users) and those who use class names when accessing
14224
resource values (that is, application programmers).
14226
In order to access a value in a resource database, an application uses a
14227
key consisting of two items: a @emph{complete resource name} and a
14228
@emph{complete resource class}. A complete resource name is a resource
14229
name list containing no wildcard elements. A complete resource class is
14230
a list of exactly the same form. The distinction between a complete
14231
resource name and a complete resource class lies in how they are used to
14232
access resource bindings. The elements of a complete resource name are
14233
interpreted as names of individual objects; the elements of a complete
14234
resource class are interpreted as names of object classes. The complete
14235
resource name and class lists used in a resource database access must
14236
have the same length.
14238
Like any resource name list, a complete resource name consists of a path
14239
list and an attribute name. The first path list element is typically a
14240
symbol (or string) identifying the application as a whole. The second
14241
element can be a screen root identifier. Subsequent elements can be
14242
identifiers for each ancestor window of an application window. Thus, a
14243
path list typically identifies a specific window by tracing a path to it
14244
through the application window hierarchy. The final element of a
14245
complete resource name (its attribute name) is typically the name of a
14246
specific attribute of the window given by the path list (for example,
14247
@code{'background}). An attribute name can refer to a feature
14248
associated with the window by the application but not by the X server
14249
(for example, a font identifier). Similarly, a complete resource class
14250
typically represents a path to a window in the application window
14251
hierarchy and a specific window attribute. However, a complete resource
14252
class contains the class name for each window and for the window
14255
For instance, in the previous example, the @code{mail} application
14256
can attempt to look up the value of the @code{background} resource
14257
for the @code{reply button} window by using the following complete
14261
(mail screen-1 reply background)
14264
and the following complete resource class:
14267
(application root button fill)
14271
This complete resource name contains a path list identifying the reply
14272
button window -- @code{(mail screen-1 reply)} -- and an attribute
14273
name for the window background. The corresponding resource class
14274
contains the class names for the same path list and window attribute.
14276
@node Matching Resource Names, Resource Access Functions, Complete Names and Classes, Accessing Resource Values
14277
@subsection Matching Resource Names
14280
The resource lookup algorithm searches a specified resource data base
14281
and returns the value for the resource binding whose resource name is
14282
the closest match to a given complete resource name and class. The
14283
intent of the lookup algorithm is to formalize an intuitive notion of
14286
Precedence is given to a match which begins @emph{higher} in the
14287
parent-child contact hierarchy. This allows a resource binding with a
14288
partial name to define a resource value shared by all members of a
14289
window subtree. For example, suppose the resource database contained the
14290
following resource bindings:
14292
@multitable {Resource Name} {Resource Value}
14293
@item @code{(mail * background)} @tab @code{'red}
14294
@item @code{(* reply background)} @tab @code{'blue}
14298
Suppose an application program searched by using the following complete
14302
(mail screen-1 reply background)
14306
then the closest matching value returned would be @code{'red}.
14308
Precedence is given to the more specific match. A name match is more
14309
specific than a class match. Either a name or class match is more
14310
specific than a wildcard match. For example, suppose the resource
14311
database contained the following resource bindings:
14313
@multitable {Resource Name} {Resource Value}
14314
@item @code{(mail * background)} @tab @code{'red}
14315
@item @code{(mail * fill)} @tab @code{'blue}
14319
Suppose an application program searched by using the following complete
14320
resource name and complete resource class:
14323
(mail screen-1 reply background)
14324
(application root button fill)
14328
then the closest matching value returned would be
14329
@code{'red}. However, suppose the resource database contained the
14330
following resource bindings:
14332
@multitable {Resource Name} {Resource Value}
14333
@item @code{(mail * background)} @tab @code{'red}
14334
@item @code{(mail * button background)} @tab @code{'blue}
14338
then the closest matching value returned would be @code{'blue}.
14340
@node Resource Access Functions, , Matching Resource Names, Accessing Resource Values
14341
@subsection Resource Access Functions
14344
The following paragraphs describe the CLX functions used to return a
14345
value from a resource database.
14347
@defun get-resource database attribute-name attribute-class path-name path-class
14351
A @var{resource-database}.
14352
@item attribute-name
14353
A string or symbol giving an attribute name from a complete resource name.
14354
@item attribute-class
14355
A string or symbol giving an attribute class name from a complete resource class.
14357
The path list from a complete resource name. @emph{path-name} and @emph{path-class} must have the same length.
14359
The path list from a complete resource class. @emph{path-name} and @emph{path-class} must have the same length.
14363
Returns the value of the resource binding in the @emph{database}
14364
whose resource name most closely matches the complete resource
14365
name/class given by the @emph{path-name}, @emph{path-class},
14366
@emph{attribute-name}, and @emph{attribute-class}. The lookup
14367
algorithm implements the precedence rules described previously to
14368
determine the closest match. When comparing name elements, case is
14369
significant only if both elements are strings; otherwise, element
14370
matching is case-insensitive.
14383
@defun get-search-table database path-name path-class
14387
A @var{resource-database}.
14389
The path list from a complete resource name. @emph{path-name} and @emph{path-class}must have the same length.
14391
The path list from a complete resource class. @emph{path-name} and @emph{path-class} must have the same length.
14395
Returns a table containing the subset of the @emph{database} that
14396
matches the @emph{path-name} and @emph{path-class}. Resources using
14397
the same @emph{path-name} and @emph{path-class} can be accessed much
14398
more efficiently by using this table as an argument to
14399
@var{get-search-resource}.
14409
@defun get-search-resource table attribute-name attribute-class
14413
A search table returned by @var{get-search-table}.
14414
@item attribute-name
14415
A string or symbol giving an attribute name from a complete resource name.
14416
@item attribute-class
14417
A string or symbol giving an attribute class name from a complete resource class.
14421
Returns the value of the resource binding in the search @emph{table}
14422
that most closely matches the @emph{attribute-name} and
14423
@emph{attribute-class}. The @emph{table} is computed by
14424
@var{get-search-table} and represents a set of resource
14425
bindings. The closest match is determined by the same algorithm used
14426
in @var{get-resource}.
14428
The following two forms are functionally equivalent:
14432
database attribute-name attribute-class path-name path-class)
14434
(get-search-resource
14435
(get-search-table database path-name path-class)
14436
attribute-name attribute-class)
14440
However, the hard part of the search is done by
14441
@var{get-search-table}. Looking up values for several resource
14442
attributes that share the same path list can be done much more
14443
efficiently with calls to @var{get-search-resource}.
14451
@node Resource Database Files, , Accessing Resource Values, Resources
14452
@section Resource Database Files
14455
X users and application programs can save resource bindings in a file,
14456
using a standard file format shared by all X clients. The following
14457
paragraphs describe the CLX functions used to convert between the
14458
standard external format of resource files and the internal
14459
resource-database format used by application programs.
14461
@defun read-resources database pathname &key :key :test :test-not
14465
The @var{resource-database} to merge.
14467
A pathname for the resource file to read.
14469
A function used to convert a value from the resource file into a resource binding value.
14472
Functions used to select which resource bindings from the resource file are merged with the @emph{database}.
14478
Reads resource bindings from a resource file in standard X11 format
14479
and merges them with the given resource @emph{database}. The
14480
@var{:key} function is called to convert a file resource value into
14481
the value stored in the @emph{database}. By default, @var{:key} is
14482
@var{#'identity}. The @var{:test} and @var{:test-not} functions
14483
are predicates that select resource bindings to merge, based on the
14484
result of the @var{:key} function. For each file resource binding
14485
consisting of a @emph{resource-name} and a @emph{resource-value},
14486
the @var{:test} (or @var{:test-not}) function is called with the
14487
arguments @emph{resource-name} and (@var{funcall} @emph{key
14492
Type @var{resource-database}.
14498
@defun write-resources database pathname &key :write :test :test-not
14502
The @var{resource-database} to write.
14504
A pathname of the file to write.
14506
A function for writing resource values.
14509
Functions used to select which resource bindings from the resource file are merged with the @emph{database}.
14512
Writes resource bindings found in the @emph{database} to the file
14513
given by the @emph{pathname}. The output file is written in the
14514
standard X11 format. The @var{:write} function is used for writing
14515
resource values; the default is @var{#'princ}. The @var{:write}
14516
function is passed two arguments: a @emph{resource-value} and a
14517
@emph{stream}. The @var{:test} and @var{:test-not} functions are
14518
predicates which select resource bindings to write. For each
14519
resource binding consisting of a @emph{resource-name} and a
14520
@emph{resource-value}, the @var{:test} (or @var{:test-not})
14521
function is called with the arguments @emph{resource-name} and
14522
@emph{resource-value}.
14528
@node Control Functions, Extensions, Resources, Top
14529
@chapter Control Functions
14532
* Grabbing the Server::
14533
* Pointer Control::
14534
* Keyboard Control::
14535
* Keyboard Encodings::
14536
* Client Termination::
14537
* Managing Host Access::
14541
@node Grabbing the Server, Pointer Control, Control Functions, Control Functions
14542
@section Grabbing the Server
14545
Certain cases may require that a client demand exclusive access to the
14546
server, causing the processing for all other clients to be
14547
suspended. Such exclusive access is referred to as @emph{grabbing the
14548
server}. CLX provides functions to grab and release exclusive access
14549
to the server. These function should be used rarely and always with
14550
extreme caution, since they have the potential to disrupt the entire
14551
window system for all clients.
14553
@defun grab-server display
14560
Disables processing of requests and close-downs on all connections
14561
other than the one on which this request arrived.
14566
@defun ungrab-server display
14573
Restarts processing of requests and close-downs on other
14580
@defmac with-server-grabbed display &body body
14582
Grabs the @emph{display} server only within the dynamic extent of
14583
the @emph{body}. @var{ungrab-server} is automatically called upon
14584
exit from the @emph{body}. This macro provides the most reliable way
14585
for CLX clients to grab the server.
14591
The forms to execute while the server is grabbed.
14597
@node Pointer Control, Keyboard Control, Grabbing the Server, Control Functions
14598
@section Pointer Control
14601
The following paragraphs describe the CLX functions used to:
14604
@item Return or change the pointer acceleration and acceleration threshold
14606
@item Return or change the mapping of pointer button numbers
14609
@defun change-pointer-control display &key :acceleration :threshold
14614
@item :acceleration
14615
A number for the acceleration ratio.
14617
The number of pixels required for acceleration to take effect.
14620
Changes the acceleration and/or the acceleration threshold of the
14621
pointer for the @emph{display}. The @var{:acceleration} number is
14622
used as a multiplier, typically specified as a rational number of
14623
the form @emph{C/P}, where @emph{C} is the number of pixel positions
14624
of cursor motion displayed for @emph{P} units of pointer device
14625
motion. The acceleration only occurs if the pointer moves more that
14626
@var{:threshold} pixels at once, and only applies to the motion
14627
beyond the @var{:threshold}. Either @var{:acceleration} or
14628
@var{:threshold} can be set to @var{:default}, that restores the
14629
default settings of the server.
14635
@defun pointer-control display
14643
Returns the acceleration and threshold for the @emph{display}
14654
@defun pointer-mapping display &key (:result-type 'list)
14660
The type of sequence to return.
14664
Returns or (with @code{setf}) changes the mapping of button numbers
14665
for the @emph{display} pointer. The @var{:result-type} is not used
14666
when changing the mapping. If element @emph{i} of the mapping
14667
sequence is @emph{j}, then the events from pointer button @emph{j}
14668
are reported by the server as events for button @emph{i}+1. (Note
14669
that pointer buttons are numbered beginning with one, while the
14670
mapping sequence itself is indexed normally from zero.) If element
14671
@emph{i} of the mapping sequence is zero, then button @emph{i}+1 is
14672
disabled and can no longer generate input events. No two elements of
14673
the mapping can have the same non-zero value.
14675
The length of the mapping sequence indicates the actual number of
14676
buttons on the device. When changing the mapping, the new mapping
14677
must have this same length.
14680
Type @var{sequence} or @var{card8}@emph{.}
14686
@node Keyboard Control, Keyboard Encodings, Pointer Control, Control Functions
14687
@section Keyboard Control
14690
The following paragraphs describe the CLX functions used to:
14693
@item Return or change keyboard controls
14695
@item Ring the keyboard bell
14697
@item Return or change the mapping of modifiers
14699
@item Return the current up/down state of all keys
14702
@defun bell display &optional (percent-from-normal 0)
14707
@item percent-from-normal
14708
An integer (-100 through 100).
14711
Rings the bell on the keyboard at a volume relative to the base volume for the keyboard,
14712
if possible. Percent can range from -100 to 100 inclusive, or else a Value error occurs.
14713
The following is the bell volume when percent is non-negative:
14716
(- (+ @emph{base percent}) (@var{quotient} (* @emph{base percent}) 100))
14719
and when percent is negative:
14722
(+ @emph{base} (@var{quotient} (* @emph{base percent}) 100))
14730
@defun change-keyboard-control display &key :key-click-percent :bell-percent :bell-pitch :bell-duration :led :led-mode :key :auto-repeat-mode
14735
@item :key-click-percent
14736
An integer (0 100).
14737
@item :bell-percent
14738
An integer (0 100).
14741
@item :bell-duration
14746
Either @var{:on} or @var{:off}.
14748
A @var{card8} keycode.
14749
@item :auto-repeat-mode
14750
Either @var{:on}, @var{:off}, or @var{:default}.
14753
Changes the various aspects of the keyboard. The keyword arguments
14754
specify which controls to change.
14756
The @var{:key-click-percent} keyword sets the volume for key
14757
clicks, if possible. A value of 0 implies off, while a value of 100
14758
implies loud. Setting @var{:key-click-percent} to @var{:default}
14759
restores the default value.
14761
The @var{:bell-percent} sets the base volume for the bell between 0
14762
(off) and 100 (loud) if possible. Setting @var{:bell-percent} to
14763
@var{:default} restores the default value.
14765
The @var{:bell-pitch} sets the pitch (specified in Hz) of the bell,
14766
if possible. Setting the @var{:bell-pitch} to @var{:default}
14767
restores the default value. The @var{:bell-duration} sets the
14768
duration ( specified in milliseconds) of the bell, if
14769
possible. Setting @var{:bell-pitch} to @var{:default} restores the
14770
default. Note that a bell generator connected with the console but
14771
not directly on the keyboard is treated as if it were part of the
14774
If both @var{:led-mode} and @var{:led} are specified, then the
14775
state of that LED is changed, if possible. If only @var{:led-mode}
14776
is specified, the state of all LEDs are changed, if possible. At
14777
most 32 LEDs are supported, numbered from one. No standard
14778
interpretation of the LEDs are defined.
14780
If both @var{:auto-repeat-mode} and @var{:key} are specified, the
14781
auto-repeat mode of that key is changed, if possible. If only
14782
@var{:auto-repeat-mode} is specified, the global auto-repeat mode
14783
for the entire keyboard is changed, if possible, without affecting
14784
the per-key settings. An error occurs if @var{:key} is specified
14785
without @var{:auto-repeat-mode}.
14791
@defun keyboard-control display
14799
Returns the current control values for the keyboard. For the LEDs,
14800
the least significant bit of @emph{led-mask} corresponds to LED one,
14801
and each one bit in @emph{led-mask} indicates an LED that is
14802
lit. @emph{auto-repeats} is a bit vector; each one bit indicates
14803
that auto-repeat is enabled for the corresponding key. The vector is
14804
represented as 32 bytes. Byte @emph{n} (from 0) contains the bits
14805
for keys 8@emph{n} to 8@emph{n}+7, with the least significant bit in
14806
the byte representing key 8@emph{n}.
14808
@item key-click-percent
14809
@itemx bell-percent
14812
@itemx bell-duration
14816
@item global-auto-repeat
14817
Either @var{:on} or @var{:off}.
14819
Type @var{bit-vector}.
14825
@defun modifier-mapping display
14833
Returns the set of keycodes used for each modifier on the
14834
@emph{display} keyboard. Each return value is a list of the
14835
@var{card8} keycodes used for each modifier key. The order of
14836
keycodes within each list is server-dependent.
14838
@item shift-keycodes
14839
@itemx lock-keycodes
14840
@itemx control-keycodes
14841
@itemx mod1-keycodes
14842
@itemx mod2-keycodes
14843
@itemx mod3-keycodes
14844
@itemx mod4-keycodes
14845
@itemx mod5-keycodes
14846
Type @var{list} of @var{card8}.
14852
@defun query-keymap display
14859
Returns a bit vector that describes the state of the keyboard. Each
14860
one bit indicates that the corresponding key is currently
14861
pressed. The vector is represented as 32 bytes. Byte @emph{n} (from
14862
0) contains the bits for keys 8@emph{n} to 8@emph{n}+7, with the
14863
least significant bit in the byte representing key 8@emph{n}.
14866
Type @var{bit-vector} 256.
14872
@defun set-modifier-mapping display &key :shift :lock :control :mod1 :mod2 :mod3 :mod4 :mod5
14885
A sequence of @var{card8} keycodes for the given modifier.
14889
Changes the set of keycodes mapped to the specified modifier keys on
14890
the @emph{display} keyboard. Each keyword argument contains a
14891
sequence of new @var{card8} keycodes for a specific modifier. The
14892
return value indicates whether the change was completed
14895
A status of @var{:failed} is returned if hardware limitations
14896
prevent the requested change. For example, multiple keycodes per
14897
modifier may not be supported, up transitions on a given keycode may
14898
not be supported, or autorepeat may be mandatory for a given
14899
keycode. If @var{:failed} is returned, the mappings for all
14900
modifiers remain unchanged.
14902
A status of @var{:device-busy} is returned if a new keycode given
14903
for a modifier was not previously mapped to that modifier and is
14904
currently in the down state. In this case, the mappings for all
14905
modifiers remain unchanged.
14908
One of @var{:success}, @var{:failed}, or @var{:device-busy}.
14914
@node Keyboard Encodings, Client Termination, Keyboard Control, Control Functions
14915
@section Keyboard Encodings
14918
Handling the great diversity of keyboard devices and international
14919
language character encodings is a difficult problem for interactive
14920
programs that need to receive text input but must also be portable. The
14921
X Window System solves this problem by using different sets of encodings
14922
for device keys (@emph{keycodes}) and for character symbols
14923
(@emph{keysyms}). Each X server maintains a @emph{keyboard mapping} that
14924
associates keycodes and keysyms, and which can be returned or changed by
14927
To handle text input, a CLX client program must follow these steps:
14931
Receive a @var{:key-press} (or @var{:key-release}) event containing
14935
Convert the keycode into its corresponding keysym, based on the
14936
current keyboard mapping. See @var{keycode->keysym}.
14939
Convert the keysym into the corresponding Common Lisp character. See
14940
@var{keysym->character}.
14944
* Keycodes and Keysyms::
14945
* Keyboard Mapping::
14946
* Using Keycodes and Keysyms::
14949
@node Keycodes and Keysyms, Keyboard Mapping, Keyboard Encodings, Keyboard Encodings
14950
@subsection Keycodes and Keysyms
14953
A @emph{keycode} represents a physical (or logical) key. In CLX,
14954
keycodes are values of type (@var{integer} 8 255). A keycode value
14955
carries no intrinsic information, although server implementors may
14956
attempt to encode geometry (for example, matrix) information in some
14957
fashion so it can be interpreted in a server- dependent fashion. The
14958
mapping between keys and keycodes cannot be changed.
14960
A @emph{keysym} is an encoding of a symbol on the cap of a key. In CLX,
14961
keysyms are values of type @var{card32}. The set of defined keysyms
14962
include the ISO Latin character sets (1-4), Katakana, Arabic, Cyrillic,
14963
Greek, Technical, Special, Publishing, APL, Hebrew, and miscellaneous
14964
keys found on keyboards (RETURN, HELP, TAB, and so on). The encoding of
14965
keysyms is defined by the X Protocol.
14967
A list of keysyms is associated with each keycode. The length of the
14968
list can vary with each keycode. The list is intended to convey the set
14969
of symbols on the corresponding key. By convention, if the list contains
14970
a single keysym and if that keysym is alphabetic and case distinction is
14971
relevant, then it should be treated as equivalent to a two-element list
14972
of the lowercase and uppercase keysyms. For example, if the list
14973
contains the single keysym for uppercase A, the client should treat it
14974
as if it were a pair with lowercase as the first keysym and uppercase A
14975
as the second keysym.
14977
For any keycode, the first keysym in the list should be chosen as the
14978
interpretation of a key press when no modifier keys are down. The second
14979
keysym in the list normally should be chosen when the @var{:shift}
14980
modifier is on, or when the @var{:lock} modifier is on and @var{:lock}
14981
is interpreted as @var{:shift-lock}. When the @var{:lock} modifier is
14982
on and is interpreted as @var{:caps-lock}, it is suggested that the
14983
@var{:shift} modifier first be applied to choose a keysym, but if that
14984
keysym is lowercase alphabetic, the corresponding uppercase keysym
14985
should be used instead.
14987
Other interpretations of @var{:caps-lock} are possible; for example, it
14988
may be viewed as equivalent to @var{:shift-lock}, but only applying
14989
when the first keysym is lowercase alphabetic and the second keysym is
14990
the corresponding uppercase alphabetic. No interpretation of keysyms
14991
beyond the first two in a list is suggested here. No spatial geometry of
14992
the symbols on the key is defined by their order in the keysym list,
14993
although a geometry might be defined on a vendor-specific basis. The X
14994
server does not use the mapping between keycodes and keysyms. Rather,
14995
the X server stores the mapping merely for reading and writing by
14998
@node Keyboard Mapping, Using Keycodes and Keysyms, Keycodes and Keysyms, Keyboard Encodings
14999
@subsection Keyboard Mapping
15001
The X server maintains a keyboard mapping that associates each keycode
15002
with one or more keysyms. The following paragraphs describe the CLX
15003
functions used to return or change the mapping of keycodes.
15005
@defun change-keyboard-mapping display keysyms &key (:start 0) :end
15011
A two-dimensional array of keysym (@var{card32}) values.
15014
Indexes for the subsequence of @emph{keysyms} used.
15015
@item :first-keycode
15016
A @var{card8} defining the first keycode mapping changed.
15019
(@var{:first-keycode :start})
15021
Changes the mapping of keycodes to @emph{keysyms}. A
15022
@var{:mapping-notify} event is generated for all clients.
15024
The new @emph{keysyms} are specified as a two-dimensional array in
15027
(@var{aref} @emph{keysyms} (+ @var{:start} @emph{i}) @emph{j})
15029
is @emph{keysym j} associated with keycode (+ @var{:first-keycode}
15030
@emph{i}). The maximum number of @emph{keysyms} associated with any
15031
one keycode is given by:
15033
(@var{array-dimension} @emph{keysyms} 1)
15035
@emph{keysyms} should contain @var{nil} elements to represent those
15036
keysyms that are undefined for a given keycode. @var{:start} and
15037
@var{:end} define the subsequence of the @emph{keysyms} array that
15038
defines the new mapping, and the number of keycode mappings
15039
changed. By default, @var{:end} is given by:
15041
(@var{array-dimension} @emph{keysyms} 0)
15043
The keycodes whose mappings are changed are given by
15044
@var{:first-keycode} through the following:
15046
(+ @var{:first-keycode} (- @var{:end :start}) -1)
15048
keycodes outside this range of are not
15049
affected. @var{:first-keycode} must not be less than
15050
(@var{display-min-keycode} @emph{display}), and the last keycode
15051
modified must not be greater than (@var{display-max-keycode}
15059
@defun keyboard-mapping display &key :first-keycode :start :end :data
15064
@item :first-keycode
15065
A @var{card8} defining the first keycode mapping returned.
15068
Indexes for the subsequence of the returned array which is modified.
15070
If given, a two-dimensional array to receive the returned keysyms.
15072
Returns the keysyms mapped to the given range of keycodes for the
15073
@emph{display} keyboard. The mappings are returned in the form of a
15074
two-dimensional array of @var{card32} keysym values. The
15075
@var{:data} argument, if given, must be a two-dimensional array in
15076
which the returned mappings will be stored. In this case:
15078
(@var{array-dimension :data} 1)
15080
defines the maximum number of keysyms returned for any
15081
keycode. Otherwise, a new array is created and returned.
15085
(@var{aref} @emph{mappings} (+ @emph{:start i}) @emph{j})
15087
will contain keysym @emph{j} associated with keycode (+
15088
@var{:first-keycode i}) (or @var{nil}, if keysym @emph{j} is
15089
undefined for that keycode).
15091
@var{:first-keycode} specifies the first keycode whose mapping is
15092
returned; by default, @var{:first-keycode} is
15093
(@var{display-min-keycode} @emph{display}). @var{:start} and
15094
@var{:end} define the subsequence of the returned array in which
15095
the returned mappings are stored. By default, @var{:start} is given
15096
by @var{:first-keycode} and @var{:end} is given by:
15098
(1+ (@var{display-max-keycode} @emph{display}))
15100
@var{:first-keycode} must not be less than
15101
(@var{display-min-keycode} @emph{display}), and the last keycode
15102
returned must not be greater than (@var{display-max-keycode}
15106
Type (@var{array card32} (* *)).
15112
@node Using Keycodes and Keysyms, , Keyboard Mapping, Keyboard Encodings
15113
@subsection Using Keycodes and Keysyms
15116
The following paragraphs describe the CLX functions used to:
15119
@item Convert a keycode into a keysym
15121
@item Convert a keysym into a character
15124
@defun keycode->keysym display keycode keysym-index
15136
Returns the @emph{keysym} at the given @emph{keysym-index} from the
15137
keysym list for the @emph{keycode} in the current keyboard mapping
15138
for the @emph{display} server.
15139
@emph{This function was called keycode-keysym in X11R4 and older versions of CLX.}
15148
@defun keysym->character display keysym &optional (state 0)
15159
Returns the @emph{character} associated with the @emph{keysym} and
15160
the @emph{state}. The @emph{state} is a @var{mask16} bit mask
15161
representing the state of the @emph{display} modifier keys and
15162
pointer buttons. See @var{state-mask-key} in @ref{Data Types}. If the @emph{keysym} does not represent a Common Lisp
15163
character, then @var{nil} is returned.
15164
@emph{This function was called keysym-character in X11R4 and older versions of CLX.}
15166
The @emph{state} determines the bits attribute of the returned
15167
@emph{character}, as follows:
15170
@var{char-control-bit}
15172
@var{char-meta-bit}
15174
@var{char-super-bit}
15176
@var{char-hyper-bit}
15179
@c Of course *we* know that this mapping is bull shit!
15182
Type @var{character} or @var{null}.
15188
@node Client Termination, Managing Host Access, Keyboard Encodings, Control Functions
15189
@section Client Termination
15192
The CLX functions affecting client termination are discussed in the
15193
following paragraphs.
15195
When a display connection to an X server is closed, whether by an
15196
explicit call to @var{close-display} or by some external condition, the
15197
server automatically performs a sequence of operations to clean up
15198
server state information associated with the closed connection. The
15199
effect of these operations depends the @emph{close-down mode} and the
15200
@emph{save-set} that the client has specified for the closed display
15201
connection. The close-down mode of a display determines whether server
15202
resources allocated by the connection are freed or not. The save-set
15203
identifies windows that will remain after the connection is closed.
15205
The display save-set is used primarily by window managers that reparent
15206
the top-level windows of other clients. For example, such a window
15207
manager can automatically create a frame window that encloses a
15208
top-level client window, along with a set of controls used for window
15209
management. Ordinarily, termination of the window manager client would
15210
then destroy all client windows! However, the window manager can prevent
15211
this by adding to its save-set those windows created by other clients
15212
that should be preserved.
15214
When a display connection closes, an X server performs the following
15219
For each selection owned by a window created on the connection, the
15220
selection owner is set to @var{nil}.
15223
An active or passive grab established for a window created on the
15224
connection is released.
15227
If the connection has grabbed the server, the server is ungrabbed.
15230
Server resources and colormap cells allocated by the connection are
15231
freed and destroyed, depending on the close-down mode, as follows:
15235
@var{:retain-permanent} -- All resources are marked
15236
@emph{permanent}, and no resources are destroyed. These resources
15237
can later be destroyed by a call to @var{kill-client}.
15240
@var{:retain-temporary} -- All resources are marked
15241
@emph{temporary}, and no resources are destroyed. These resources
15242
can later be destroyed by a call to @var{kill-client} or
15243
@var{kill-temporary-clients}.
15246
@var{:destroy} -- All resources are destroyed.
15250
When server resources allocated by a display connection are destroyed --
15251
whether by closing the connection with close-down mode @var{:destroy}
15252
or by later calling @var{kill-client} or @var{kill-temporary-clients}
15253
-- then an X server performs the following operations on each member of
15254
the save-set before actually destroying resources.
15258
If the save-set window is a descendant of a window created on the
15259
connection, the save-set window is reparented. The new parent is the
15260
closest ancestor such that the save-set window is no longer a
15261
descendant of any window created on the connection. The position of
15262
the reparented window with respect to its parent remains unchanged.
15265
If the save-set window is unmapped, then it is mapped.
15268
If the last connection open to an X server is closed with close-down
15269
mode @var{:destroy}, the server resets its state to restore all initial
15270
defaults. The server state after reset is the same as its initial state
15271
when first started. When an X server resets, it performs the following
15276
All permanent and temporary server resources from previously-closed
15277
connections are destroyed.
15280
All but the predefined atoms are deleted.
15283
All root window properties are deleted.
15286
All device control attributes and mappings are restored to their
15287
original default values.
15290
The default background and cursor for all root windows are restored.
15293
The default font path is restored.
15296
The input focus is set to @var{:pointer-root}.
15299
The access control list is reset.
15302
The following paragraphs describe the CLX functions used to:
15306
Add or remove a window from a display save-set.
15309
Return or change the display close-down mode.
15312
Force a connection to be closed or all its server resources to be
15316
Force a connection to be closed and all temporary resources to be
15320
@defun add-to-save-set window
15327
Adds the specified @emph{window} to the save-set of the
15328
@emph{window} display. The @emph{window} must have been created by
15329
some other display. Windows are removed automatically from the
15330
save-set when they are destroyed.
15336
@defun close-down-mode display
15342
Returns and (with @code{setf}) sets the close-down mode of the
15343
client's resources at connection close.
15346
One of @var{:destroy}, @var{:retain-permanent}, or @var{:retain-temporary}.
15352
@defun kill-client display resource-id
15358
A valid @var{card29} resource ID.
15361
Closes the display connection which created the given
15362
@emph{resource-id}. The @emph{resource-id} must be valid, but need
15363
not belong to the given @emph{display}.
15365
If the closed connection was previously open, the connection is
15366
closed according to its close-down mode. Otherwise, if the
15367
connection had been previously terminated with close-down mode
15368
@var{:retain-permanent} or @var{:retain-temporary}, then all its
15369
retained server resources -- both permanent and temporary -- are
15376
@defun kill-temporary-clients display
15383
Closes the @emph{display} connection and destroys all retained
15384
temporary server resources for this and all previously-terminated
15387
If the @emph{display} connection was previously open, the connection
15388
is closed according to its close-down mode. Otherwise, if the
15389
@emph{display} connection had been previously terminated with
15390
close-down mode @var{:retain-permanent} or
15391
@var{:retain-temporary}, then all its retained server resources --
15392
both permanent and temporary -- are destroyed.
15398
@defun remove-from-save-set window
15405
Removes the specified @emph{window} from the save-set of the
15406
@emph{window} display. The @emph{window} must have been created by
15407
some other display. Windows are removed automatically from the
15408
save-set when they are destroyed.
15414
@node Managing Host Access, Screen Saver, Client Termination, Control Functions
15415
@section Managing Host Access
15418
An X server maintains a list of hosts from which client programs can be
15419
run. Only clients executing on hosts that belong to this @emph{access
15420
control list} are allowed to open a connection to the
15421
server. Typically, the access control list can be changed by clients
15422
running on the same host as the server. Some server implementations can
15423
also implement other authorization mechanisms in addition to, or in
15424
place of, this mechanism. The action of this mechanism can be
15425
conditional based on the authorization protocol name and data received
15426
by the server at connection setup.
15428
The following paragraphs describe the CLX functions used to:
15431
@item Add or remove hosts on the access control list.
15433
@item Return the hosts on the access control list.
15435
@item Return or change the state of the access control list mechanism
15438
@defun access-control display
15444
Returns and (with @code{setf}) changes the state of the access
15445
control list mechanism for the @emph{display} server. Returns true
15446
if access control is enabled; otherwise, @var{nil} is returned. If
15447
enabled, the access control list is used to validate each client
15448
during connection setup.
15450
Only a client running on the same host as the server is allowed to
15451
enable or disable the access control list mechanism.
15454
Type @var{boolean}.
15460
@defun access-hosts display &key (:result-type 'list)
15466
The type of hosts sequence to return.
15468
Returns a sequence containing the @emph{hosts} that belong to the
15469
access control list of the @emph{display} server. Elements of the
15470
returned @emph{hosts} sequence are either strings or some other type
15471
of object recognized as a host name by @var{add-access-host} and
15472
@var{remove-access-host}. The second returned value specifies
15473
whether the access control list mechanism is currently enabled or
15474
disabled (see @var{access-control}).
15477
@var{sequence} of @var{string}.
15479
Type @var{boolean}.
15485
@defun add-access-host display host
15491
A host name. Either a string or some other implementation-dependent type.
15494
Adds the specified @emph{host} to the access control list. Only a
15495
client running on the same host as the server can change the access
15502
@defun remove-access-host display host
15508
A host name. Either a string or some other implementation-dependent type.
15511
Removes the specified @emph{host} from the access control list. Only
15512
a client running on the same host as the server can change the
15513
access control list.
15519
@node Screen Saver, , Managing Host Access, Control Functions
15520
@section Screen Saver
15523
To prevent monitor damage, an X server implements a screen saver
15524
function which blanks screens during periods of unuse. The screen saver
15525
can be in one of three states:
15529
Disabled -- No screen blanking is done and screen content remains unchanged.
15532
Deactivated -- The server is being used. When the server input devices
15533
are unused for a specific amount of time, the screen saver becomes
15537
Activated -- The server input devices are unused. The screen saver
15538
blanks all server screens or displays a server-dependent image. As
15539
soon as an input event from either the pointer or the keyboard occurs,
15540
the screen saver is deactivated and its timer is reset.
15543
The following paragraphs describe the CLX functions used to:
15547
Return or change screen saver control values.
15550
Activate or reset the screen saver
15553
@defun activate-screen-saver display
15560
Activates the screen saver for the @emph{display} server.
15566
@defun reset-screen-saver display
15573
Deactivates the screen saver for the @emph{display} server (if
15574
necessary) and resets its timer, just as if a pointer or keyboard
15575
event had occurred.
15581
@defun screen-saver display
15587
Returns the current control values for the @emph{display} server
15588
screen saver. See @var{set-screen-saver}.
15595
One of @var{:yes} or @var{:no}.
15601
@defun set-screen-saver display timeout period blanking exposures
15607
Specifies the delay until timeout takes over.
15609
Specifies the periodic change interval, if used.
15611
Specifies whether the blanking option is available.
15613
Specifies whether exposures are allowed during blanking.
15616
Changes the current control values for the @emph{display} server
15617
screen saver. The screen saver is reset. The screen saver is also
15622
@emph{timeout} is zero, or
15625
Both @emph{blanking} and @emph{exposures} are disabled and the
15626
server cannot regenerate the screen contents without sending
15627
@var{:exposure} events.
15630
The @emph{timeout} specifies the (non-negative) number of seconds of
15631
input device inactivity that must elapse before the screen saver is
15632
activated. The @emph{timeout} can be set to @var{:default} to
15633
restore the server default timeout interval.
15635
If @emph{blanking} is @var{:yes} and the screen hardware supports
15636
blanking, blanking is enabled; that is, the screen saver will simply
15637
blank all screens when it is activated. @emph{blanking} can be set
15638
to @var{:default} to restore the server default state for blanking.
15640
If @emph{exposures} is @var{:yes}, exposures are enabled. If
15641
exposures are enabled, or if the server is capable of regenerating
15642
screen contents without sending @var{:exposure} events, the screen
15643
saver will display some server-dependent image when
15644
activated. Frequently, this image will consist of a repeating
15645
animation sequence, in which case @emph{period} specifies the (
15646
non-negative) number of seconds for each repetition. A @emph{period}
15647
of zero is a hint that no repetition should occur.
15654
@node Extensions, Errors, Control Functions, Top
15655
@chapter Extensions
15657
* Extensions (Extensions)::
15658
* SHAPE - The X11 Nonrectangular Window Shape Extension::
15659
* RENDER - A new rendering system for X11::
15662
@node Extensions (Extensions), SHAPE - The X11 Nonrectangular Window Shape Extension, Extensions, Extensions
15663
@section Extensions
15666
The X Window System is based on a core protocol which can be extended to
15667
provide new functionality. An extension is generally represented by an
15668
additional set of requests or event types that are implemented by an X
15669
server supporting the extension. By definition, a client program using
15670
an extension may not be portable to other servers. However, extensions
15671
allow different server implementations and different sites to add their
15672
own special features to X, without disrupting clients that rely only on
15675
Extensions are identified by assigning them unique name strings and
15676
major protocol numbers. A client program can request an X server to use
15677
a protocol extension by furnishing the extension protocol number as an
15678
argument to @var{open-display}. The X Consortium maintains a registry
15679
of standard extension names and protocol numbers.
15681
The following paragraphs describe the CLX functions used to:
15684
@item List all supported extensions.
15686
@item Find out if a given extension is supported.
15690
@defun list-extensions display &key (:result-type 'list)
15696
The type of name sequence to return.
15698
Returns a sequence containing the @emph{names} of all extensions
15699
supported by the @emph{display} server.
15702
Type @var{sequence} of @var{string}.
15708
@defun query-extension display name
15714
An extension name string.
15718
Returns the @emph{major-opcode} for the given extension @emph{name}
15719
support by the @emph{display} server. If the extension is not
15720
supported, only @var{nil} values are returned. The extension
15721
@emph{name} must contain only ISO Latin-1 characters; case is
15724
If the extension involves additional event types, the
15725
@emph{first-event} returned is the base event type code for new
15726
events; otherwise, the @emph{first-event} is @var{nil}. If the
15727
extension involves additional error codes, the @emph{first-error}
15728
returned is the base code for new errors; otherwise, the
15729
@emph{first-error} is @var{nil}. The formats of error and event
15730
messages sent by the server are completely defined by the extension.
15735
Type @var{card8} or @var{null}.
15741
@node SHAPE - The X11 Nonrectangular Window Shape Extension, RENDER - A new rendering system for X11, Extensions (Extensions), Extensions
15742
@section SHAPE - The X11 Nonrectangular Window Shape Extension
15745
This documentation is yet to be written.
15747
@node RENDER - A new rendering system for X11, , SHAPE - The X11 Nonrectangular Window Shape Extension, Extensions
15748
@section RENDER - A new rendering system for X11
15751
XRENDER is an experimental step in building a newer and modern graphics rendering
15752
system that can keep up with the demands of visual appearance on current user
15755
The X Rendering Extension (Render) introduces digital image composition as
15756
the foundation of a new rendering model within the X Window System.
15757
Rendering geometric figures is accomplished by client-side tesselation into
15758
either triangles or trapezoids. Text is drawn by loading glyphs into the
15759
server and rendering sets of them.
15762
* Picture formats::
15763
* The picture object::
15764
* Glyphs and Glyphsets::
15766
* Errors (Extensions)::
15769
@node Picture formats, The picture object, RENDER - A new rendering system for X11, RENDER - A new rendering system for X11
15770
@subsection Picture formats
15772
The following is what the X protocol rendering spec has to say about picture formats.
15773
@url{http://www.xfree86.org/~keithp/render/protocol.html}
15776
The @var{picture-format} object holds information needed to translate pixel values
15777
into red, green, blue and alpha channels. The server has a list of picture
15778
formats corresponding to the various visuals on the screen. There are two
15779
classes of formats, Indexed and Direct. Indexed picture-formats hold a list of
15780
pixel values and RGBA values while Direct picture-formats hold bit masks for each
15784
The server must support a direct @var{picture-format} with 8 bits each of red, green,
15785
blue and alpha as well as a direct @var{picture-format} with 8 bits of red, green and
15786
blue and 0 bits of alpha. The server must also support direct @var{picture-format}s
15787
with 1, 4 and 8 bits of alpha and 0 bits of r, g and b.
15790
Pixel component values lie in the closed range [0,1]. These values are
15791
encoded in a varying number of bits. Values are encoded in a straight
15792
forward manner. For a component encoded in m bits, a binary encoding b
15793
is equal to a component value of b/(2^m-1).
15796
A direct @var{picture-format} with zero bits of alpha component is declared to have
15797
alpha == 1 everywhere. A direct @var{picture-format} with zero bits of red, green and
15798
blue is declared to have red, green, blue == 0 everywhere. If any of red,
15799
green or blue components are of zero size, all are of zero size. Direct
15800
@var{picture-format}s never have colormaps and are therefore screen independent.
15803
Indexed @var{picture-format}s never have alpha channels and the direct component is all
15804
zeros. Indexed @var{picture-format}s always have a colormap in which the specified
15805
colors are allocated read- only and are therefore screen dependent.
15807
These are valid accessors for picture-format objects.
15810
@item picture-format-display
15812
@item picture-format-id
15813
The X protocol @var{resource-id}
15814
@item picture-format-type
15815
@code{(member :indexed :direct)}
15816
@item picture-format-depth
15817
Bitdepth as @var{card8}
15818
@item picture-format-red-byte
15820
@item picture-format-green-byte
15821
@itemx picture-format-blue-byte
15822
@itemx picture-format-alpha-byte
15823
@itemx picture-format-colormap
15824
A @var{colormap} or nil
15827
@node The picture object, Glyphs and Glyphsets, Picture formats, RENDER - A new rendering system for X11
15828
@subsection The picture object
15831
The @var{picture} object contains a @var{drawable}, a @var{picture-format} and some
15832
rendering state. More than one @var{picture} can refer to the same @var{drawable}.
15835
A @var{picture} is almost like a @var{gcontext}, except that it is tied in use to
15836
a single @var{drawable}. Another similarity it has with @var{gcontext} is that it is
15837
a cached object. Updates are not processed until the @var{picture} is used. This also
15838
makes it possible to query state, as there is no such request in XRENDER to do so.
15841
The @var{picture} object is also a lot like a @var{drawable}, in that it is used as a
15842
target for graphics operations. Or at least that it occurs where you would expect a
15843
drawable in XRENDER requests.
15845
@defun render-create-picture drawable &key format picture ...
15851
A @var{picture-format}
15853
An existing @var{picture} object to use,
15854
one is created if not specified.
15856
@code{(member :off :on)}
15858
A @var{picture} or @var{:none}
15859
@item alpha-x-origin
15861
@item alpha-y-origin
15863
@item clip-x-origin
15865
@item clip-y-origin
15868
A @var{Pixmap} or @var{:none}
15869
@item graphics-exposures
15870
@code{(member :off :on)}
15871
@item subwindow-mode
15872
@code{(member :clip-by-children :include-inferiors)}
15874
@code{(member :sharp :smooth)}
15876
@code{(member :precise :imprecise)}
15878
@var{xatom} or @var{:none}
15879
@item component-alpha
15880
@code{(member :off :on)}
15882
This request creates a Picture object. If the @emph{drawable} is a Window
15883
then the Red, Green and Blue masks must match those in the visual for the
15884
window else a Match error is generated.
15895
@defun render-free-picture picture This request deletes all server resources associated with the picture object.
15899
The @var{picture} object to free
15906
@node Glyphs and Glyphsets, Using glyphs, The picture object, RENDER - A new rendering system for X11
15907
@subsection Glyphs and Glyphsets
15910
A glyph in XRENDER is an alpha mask and an associated orgin, advancement and numeric id. The application refers to them
15913
Glyphs are stored in a glyph-set. The client is responsible for making sure the glyphs it uses are stored in
15914
the glyph-set, or there will be a Glyph-error.
15916
@defun render-create-glyph-set format &key glyph-set
15920
A @var{picture-format} for the alpha masks that this font will use.
15922
An optional @var{glyph-set} object to initialize with a server side glyphset resource.
15927
Creates an initially empty glyph-set for the client to use.
15928
@emph{Format} must be a Direct format. When it contains RGB values, the glyphs are composited using
15929
component-alpha True, otherwise they are composited using component-alpha False.
15933
@defun render-reference-glyph-set existing-glyph-set &key glyph-set
15936
@item existing-glyph-set
15937
An existing @var{glyph-set}
15939
An optional @var{glyph-set}, just like in @var{render-create-glyph-set}
15944
Creates a new id refering to the existing-glyph-set. The glyph-set itself will not be freed until all
15945
ids has been removed.
15948
@defun render-free-glyph-set glyph-set
15952
A glyphset resource to free
15955
Removes an id to a glyph-set. When all ids have been removed the glyph-set itself is removed.
15961
@defun render-add-glyph glyph-set id &key x-origin y-origin x-advance y-advance data
15977
An @var{array} of @var{card8} bytes.
15980
Associates id with the given description of a glyph. An existing glyph
15981
with the same id is replaced.
15983
At the time of writing, only 8bit alpha masks are
15984
supported. Experimentation with glyph-sets in other pict-formats
15991
@defun render-add-glyph-from-picture glyph-set picture &key x-origin y-origin x-advance y-advance width height
16018
This request add a glyph to @emph{glyph-set} by copying it from the @emph{x,y} location in the @emph{picture}.
16020
Existing glyphs with the same names are replaced.
16021
The source @emph{picture} may be in a different @var{picture-format} than @emph{glyph-set}, in which case the images are converted to the glyph-set's format.
16024
@defun render-free-glyphs glyph-set glyphs
16030
sequence of @var{card32}
16036
This request removes @emph{glyphs} from @emph{glyph-set}.
16037
Each glyph must exist in @emph{glyph-set} (else a @var{Match} error results).
16040
@node Using glyphs, Errors (Extensions), Glyphs and Glyphsets, RENDER - A new rendering system for X11
16041
@subsection Using glyphs
16043
@defun render-composite-glyph dest glyph-set source dest-x dest-y sequence &key op src-x src-y mask-format start end
16059
(member clear :src :dst :over :over-reverse :in :in-reverse :out :out-reverse :atop :atop-reverse :xor :add :saturate :maximum)
16075
Requests the sequence of glyphs to be drawn with the glyph-set.
16080
@node Errors (Extensions), , Using glyphs, RENDER - A new rendering system for X11
16083
What new errors Xrender defines...
16085
@node Errors, Undocumented, Extensions, Top
16089
* Introduction (Errors)::
16092
@node Introduction (Errors), , Errors, Errors
16093
@section Introduction
16095
CLX error conditions are hierarchial. The base error condition is
16096
@var{x-error}, and all other conditions are built on top of
16097
@var{x-error}. @var{x-error} can be built on a lower-level condition
16098
that is implementation dependent (this is probably the @var{error}
16101
@defmac define-condition name (parent-types*) [({slot-specifier*}) {option*}]
16103
Any new condition type must be defined with the
16104
@var{define-condition} macro. A condition type has a name, parent
16105
types, report message, and any number of slot items. See the
16106
@emph{Lisp} @emph{Reference} manual for further information
16107
regarding @var{define-condition}.
16109
The following are the predefined error conditions that can occur in CLX.
16113
@deftp {Condition} access-error
16115
An @var{access-error} can occur for several reasons:
16119
A client attempted to grab a key/button combination already
16120
grabbed by another client
16123
A client attempted to free a colormap entry that it did not already allocate
16126
A client attempted to store into a read-only colormap entry
16129
A client attempted to modify the access control list from other
16130
than the local (or otherwise authorized) host
16133
A client attempted to select an event type that another client
16134
has already selected, and, that at most, one client can select
16138
An @var{access-error} is a special case of the more general
16139
@var{request-error} (@pxref{request-error}).
16143
@deftp {Condition} alloc-error
16145
The server failed to allocate the requested resource or server memory.
16147
An @var{alloc-error} is a special case of the more general
16148
@var{request-error} (@pxref{request-error}).
16152
@deftp {Condition} atom-error
16154
A value for an @emph{atom} argument does not name a defined atom.
16156
An @var{atom-error} is a special case of the more general
16157
@var{request-error} (@pxref{request-error}).
16161
@deftp {Condition} closed-display
16163
The @var{closed-display} condition is signaled when trying to read
16164
or write a closed display (that is, @var{close-display} has been
16165
called on the @var{display} object, or a server-disconnect
16166
occurred). The @var{closed-display} object is reported with the
16169
A @var{closed-display} condition is a special case of the more
16170
general @var{x-error} (@pxref{x-error}).
16174
@deftp {Condition} colormap-error
16176
A value for a @emph{colormap} argument does not name a defined
16179
A @var{colormap-error} is a special case of the more general
16180
@var{resource-error} (@pxref{resource-error}).
16184
@deftp {Condition} connection-failure
16186
Signaled when an X11 server refuses a connection. The following
16187
items are reported along with the error:
16190
@item @emph{major-version} -- The major version of the X server code.
16192
@item @emph{minor-version} -- The minor version of the X server code.
16194
@item @emph{host} -- The host name for the X server.
16196
@item @emph{display} -- The display on which the error occurred.
16198
@item @emph{reason} -- A string indicating why the connection failed.
16201
A @var{connection-failure} is a special case of the more general
16202
@var{x-error} (@pxref{x-error}).
16206
@deftp {Condition} cursor-error
16208
A value for a @emph{cursor} argument does not name a defined cursor.
16210
A @var{cursor-error} is a special case of the more general
16211
@var{resource-error} (@pxref{resource-error}).
16215
@deftp {Condition} device-busy
16217
Signaled by (@code{setf} (@var{pointer-mapping} @emph{display})
16218
@var{mapping}) when the @var{set-pointer-mapping} request returns
16219
a busy status. A similar condition occurs in
16220
@var{set-modifier-mapping}, but in this case, it returns a boolean
16221
indicating success, rather than signaling an error. The
16222
@var{device-busy} condition returns the display object as part of
16225
A @var{device-busy} condition is a special case of the more general
16226
@var{x-error} (@pxref{x-error}).
16230
@deftp {Condition} drawable-error
16232
A value for a @emph{drawable} argument does not name a defined window or pixmap.
16234
A @var{drawable-error} is a special case of the more general @var{resource-error} (@pxref{resource-error}).
16238
@deftp {Condition} font-error
16240
A value for a @emph{font} or @emph{gcontext} argument does not name a defined font.
16242
A @var{font-error} is a special case of the more general
16243
@var{resource-error} (@pxref{resource-error}).
16247
@deftp {Condition} gcontext-error
16249
A value for a @emph{gcontext} argument does not name a defined GContext.
16251
A @var{gcontext-error} is a special case of the more general
16252
@var{resource-error} (@pxref{resource-error}).
16256
@deftp {Condition} id-choice-error
16258
The value chosen for a resource identifier is either not included in
16259
the range assigned to the client or is already in use. Under normal
16260
circumstances, this cannot occur and should be considered a server
16261
or CLX library error.
16263
An @var{id-choice-error} is a special case of the more general
16264
@var{resource-error} (@pxref{resource-error}).
16268
@deftp {Condition} implementation-error
16270
The server does not implement some aspect of the request. A server
16271
that generates this error for a core request is deficient. As such,
16272
this error is not listed for any of the requests. However, clients
16273
should be prepared to receive such errors and either handle or
16276
An @var{implementation-error} is a special case of the more general
16277
@var{resource-error} (@pxref{resource-error}).
16281
@deftp {Condition} length-error
16283
The length of a request is shorter or longer than that minimally
16284
required to contain the arguments. This usually means an internal
16287
A @var{length-error} is a special case of the more general
16288
@var{resource-error} (@pxref{resource-error}).
16292
@deftp {Condition} lookup-error
16294
CLX has the option of caching different resource types (see
16295
@var{*clx-cached-types*}) in a hash table by resource ID. When
16296
looking up an object in the hash table, if the type of the object is
16297
wrong, a @var{lookup-error} is signaled.
16299
For example: The cursor with ID 123 is interned in the hash
16300
table. An event is received with a field for window 123. When 123 is
16301
looked up in the hash table, a cursor is found. Since a window was
16302
expected, a @var{lookup-error} is signaled. This error indicates a
16303
problem with the extension code being used. The following items are
16304
reported along with the error:
16307
@item @emph{id} -- The resource ID.
16309
@item @emph{display} -- The display being used.
16311
@item @emph{type} -- The resource type.
16313
@item @emph{object} -- The @var{resource} object.
16316
A @var{lookup-error} is a special case of the more general
16317
@var{x-error} (@pxref{x-error}).
16321
@deftp {Condition} match-error
16323
In a graphics request, the root and depth of the GContext does not
16324
match that of the drawable. An @var{:input-only} window is used as
16325
a drawable. Some argument or pair of arguments has the correct type
16326
and range but fails to match in some other way required by the
16327
request. An @var{:input-only} window locks this attribute. The
16328
values do not exist for an @var{:input-only} window.
16330
A @var{match-error} is a special case of the more general
16331
@var{request-error} (@pxref{request-error}).
16335
@deftp {Condition} missing-parameter
16337
One or more of the required keyword parameters is missing or
16338
@var{nil}. The missing parameters are reported along with the
16341
A @var{missing-parameter} condition is a special case of the more
16342
general @var{x-error} (@pxref{x-error}).
16346
@deftp {Condition} name-error
16348
A font or color of the specified name does not exist.
16350
A @var{name-error} is a special case of the more general
16351
@var{request-error} (@pxref{request-error}).
16355
@deftp {Condition} pixmap-error
16357
A value for a @emph{pixmap} argument does not name a defined pixmap.
16359
A @var{pixmap-error} is a special case of the more general
16360
@var{resource-error}. (@pxref{resource-error}.)
16364
@deftp {Condition} reply-length-error (x-error) (slots*)
16366
The reply to a request has an unexpected length. The following items
16367
are reported along with the error:
16370
@item @emph{reply-length} -- The actual reply length.
16372
@item @emph{expected-length} -- The expected reply length.
16374
@item @emph{display} -- The display on which the error occurred.
16377
A @var{reply-length-error} is a special case of the more general
16378
@var{x-error} (@pxref{x-error}).
16382
@deftp {Condition} reply-timeout
16384
The @var{*reply-timeout*} parameter specifies the maximum number of
16385
seconds to wait for a request reply, or @var{nil} to wait forever
16386
(the default). When a reply has not been received after
16387
*@var{reply-timeout}* seconds, the @var{reply-timeout} condition
16388
is signaled. The @emph{timeout} @emph{period} and @emph{display} are
16389
reported along with the error.
16391
A @var{reply-timeout} condition is a special case of the more
16392
general @var{x-error} (@pxref{x-error}).
16396
@deftp {Condition} request-error
16397
@anchor{request-error}
16399
The following items are reported along with the error:
16401
The major or minor opcode does not specify a valid request.
16404
@item @emph{display} -- The display on which the error occurred.
16406
@item @emph{error-key} -- The error (sub)type.
16408
@item @emph{major} -- The major opcode.
16410
@item @emph{minor} -- The minor opcode.
16412
@item @emph{sequence} -- The actual sequence number.
16414
@item @emph{current-sequence} -- The current sequence number.
16417
A @var{request-error} condition is a special case of the more
16418
general @var{x-error} (@pxref{x-error}).
16421
@deftp {Condition} resource-error
16422
@anchor{resource-error}
16424
All X11 errors for incorrect resource IDs are built on top of
16425
@var{resource-error}. These are @var{colormap-error},
16426
@var{cursor-error}, @var{drawable-error}, @var{font-error},
16427
@var{gcontext-error}, @var{id-choice-error}, @var{pixmap-error}
16428
and @var{window-error}. @var{resource-error} is never signaled
16431
A @var{resource-error} is a special case of the more general
16432
@var{request-error} (@pxref{request-error}).
16436
@deftp {Condition} sequence-error
16438
All X11 request replies contain the sequence number of their
16439
request. If a reply's sequence does not match the request count, a
16440
@var{sequence-error} is signaled. A @var{sequence-error} usually
16441
indicates a locking problem with a multi-processing Lisp. The
16442
following items are reported along with the error:
16445
@item @emph{display} -- The display on which the error occurred.
16447
@item @emph{req-sequence} -- The sequence number in the reply.
16449
@item @emph{msg-sequence} -- The current sequence number.
16452
A @var{sequence-error} condition is a special case of the more
16453
general @var{x-error}. (@pxref{x-error})
16457
@deftp {Condition} server-disconnect
16459
The connection to the server was lost. The display on which the
16460
error occurred is reported along with the error.
16462
A @var{server-disconnect} condition is a special case of the more
16463
general @var{x-error}. (@pxref{x-error})
16467
@deftp {Condition} unexpected-reply
16469
A reply was found when none was expected. This indicates a problem
16470
with the extension code. The following items are reported along with
16475
The display on which the error occurred.
16478
The sequence number in the reply.
16481
The current sequence number.
16484
The message length of the reply.
16488
An @var{unexpected-reply} condition is a special case of the more general
16489
@var{x-error}. (@pxref{x-error}.)
16493
@deftp {Condition} unknown-error (request-error) (error-code)
16495
An error was received from the server with an unknown error
16496
code. This indicates a problem with the extension code. The
16497
undefined error code is reported.
16499
An @var{unknown-error} is a special case of the more general
16500
@var{request-error}. (@pxref{request-error})
16504
@deftp {Condition} value-error (request-error) (value)
16506
Some numeric value falls outside the range of values accepted by the
16507
request. Unless a specific range is specified for an argument, the
16508
full range defined by the argument's type is accepted. Any argument
16509
defined as a set of alternatives can generate this error. The
16510
erroneous value is reported.
16512
A @var{value-error} is a special case of the more general
16513
@var{request-error}. (@pxref{request-error})
16517
@deftp {Condition} window-error (resource-error)
16520
A value for a @emph{window} argument does not name a defined window.
16522
A @var{window-error} is a special case of the more general
16523
@var{resource-error}. (@pxref{resource-error}.)
16527
@deftp {Condition} x-error
16530
This is the most general error condition upon which all other conditions are defined.
16536
@var{PROTOCOL VS. CLX FUNCTIONAL}
16538
@var{CROSS-REFERENCE LISTING}
16540
@var{X11 Request Name CLX Function Name}
16542
AllocColor @var{alloc-color}
16543
AllocColorCells @var{alloc-color-cells}
16544
AllocColorPlanes@var{alloc-color-planes}
16545
AllocNamedColor @var{alloc-color}
16546
AllowEvents @var{allow-events}
16548
ChangeAccessControl (@code{setf} (@var{access-control} @emph{display})
16549
ChangeActivePointerGrab @var{change-active-pointer-grab}
16550
ChangeCloseDownMode (@code{setf} (@var{close-down-mode} @emph{display}))
16551
ChangeGC @var{force-gcontext-changes}
16552
(See @var{with-gcontext})
16553
(@code{setf} (@var{gcontext-function} @emph{gc}))
16554
(@code{setf} (@var{gcontext-plane-mask} @emph{gc}))
16555
(@code{setf} (@var{gcontext-foreground} @emph{gc}))
16556
(@code{setf} (@var{gcontext-background} @emph{gc}))
16557
(@code{setf} (@var{gcontext-line-width} @emph{gc}))
16558
(@code{setf} (@var{gcontext-line-style} @emph{gc}))
16559
(@code{setf} (@var{gcontext-cap-style} @emph{gc}))
16560
(@code{setf} (@var{gcontext-join-style} @emph{gc}))
16561
(@code{setf} (@var{gcontext-fill-style} @emph{gc}))
16562
(@code{setf} (@var{gcontext-fill-rule} @emph{gc}))
16563
(@code{setf} (@var{gcontext-tile} @emph{gc}))
16564
(@code{setf} (@var{gcontext-stipple} @emph{gc}))
16565
(@code{setf} (@var{gcontext-ts-x} @emph{gc}))
16566
(@code{setf} (@var{gcontext-ts-y} @emph{gc}))
16567
(@code{setf} (@var{gcontext-font} @emph{gc} &optional
16569
(@code{setf} (@var{gcontext-subwindow-mode} @emph{gc}))
16570
(@code{setf} (@var{gcontext-exposures} @emph{gc})))
16571
(@code{setf} (@var{gcontext-clip-x} @emph{gc}))
16572
(@code{setf} (@var{gcontext-clip-y} @emph{gc}))
16573
(@code{setf} (@var{gcontext-clip-mask} @emph{gc}
16574
&optional @var{ordering}))
16575
(@code{setf} (@var{gcontext-dash-offset} @emph{gc}))
16576
(@code{setf} (@var{gcontext-dashes} @emph{gc}))
16577
(@code{setf} (@var{gcontext-arc-mode} @emph{gc}))
16578
(@code{setf} (@var{gcontext-clip-ordering} @emph{gc}))
16580
@var{X11 Request Name CLX Function Name}
16582
ChangeHosts @var{add-access-host}
16583
ChangeHosts @var{remove-access-host}
16584
ChangeKeyboardControl @var{change-keyboard-control}
16585
ChangePointerControl @var{change-pointer-control}
16586
ChangeProperty @var{change-property}
16587
ChangeSaveSet @var{remove-from-save-set}
16588
ChangeSaveSet @var{add-to-save-set}
16589
ChangeWindowAttributes (See @var{with-state})
16590
(@code{setf} (@var{window-background} @emph{window}))
16591
(@code{setf} (@var{window-border} @emph{window}))
16592
(@code{setf} (@var{window-bit-gravity} @emph{window}))
16593
(@code{setf} (@var{window-gravity} @emph{window}))
16594
(@code{setf} (@var{window-backing-store} @emph{window}))
16595
(@code{setf} (@var{window-backing-planes} @emph{window}))
16596
(@code{setf} (@var{window-backing-pixel} @emph{window}))
16597
(@code{setf} (@var{window-override-redirect} @emph{window})
16598
@code{(setf (window-save-under} @emph{window}@var{))}
16599
(@code{setf} (@var{window-colormap} @emph{window}))
16600
(@code{setf} (@var{window-cursor} @emph{window}))
16601
(@code{setf} (@var{window-event-mask} @emph{window}))
16602
(@code{setf} (@var{window-do-not-propagate-mask}
16604
CirculateWindow @var{circulate-window-down}
16605
CirculateWindow @var{circulate-window-up}
16606
ClearToBackground @var{clear-area}
16607
CloseFont @var{close-font}
16608
ConfigureWindow (See @var{with-state})
16609
(@code{setf} (@var{drawable-x} @emph{drawable}))
16610
(@code{setf} (@var{drawable-y} @emph{drawabl}e))
16611
(@code{setf} (@var{drawable-width} @emph{drawable}))
16612
(@code{setf} (@var{drawable-height} @emph{drawable}))
16613
(@code{setf} (@var{drawable-depth} @emph{drawable}))
16614
(@code{setf} (@var{drawable-border-width} @emph{drawable}))
16615
(@code{setf} (@var{window-priority} @emph{window} &optional
16617
ConvertSelection@var{convert-selection}
16618
CopyArea @var{copy-area}
16619
CopyColormapAndFree @var{copy-colormap-and-free}
16620
CopyGC@var{copy-gcontext}
16621
CopyGC@var{copy-gcontext-components}
16622
CopyPlane @var{copy-plane}
16623
CreateColormap @var{create-colormap}
16624
CreateCursor @var{create-cursor}
16625
CreateGC @var{create-gcontext}
16626
CreateGlyphCursor @var{create-glyph-cursor}
16627
CreatePixmap @var{create-pixmap}
16628
CreateWindow @var{create-window}
16629
DeleteProperty @var{delete-property}
16630
DestroySubwindows @var{destroy-subwindows}
16631
DestroyWindow @var{destroy-window}
16632
FillPoly @var{draw-lines}
16633
ForceScreenSaver@var{reset-screen-saver}
16634
ForceScreenSaver@var{activate-screen-saver}
16635
FreeColormap @var{free-colormap}
16636
FreeColors @var{free-colors}
16637
FreeCursor @var{free-cursor}
16639
@var{X11 Request Name CLX Function Name}
16641
FreeGC@var{free-gcontext}
16642
FreePixmap @var{free-pixmap}
16643
GetAtomName @var{atom-name}
16644
GetFontPath @var{font-path}
16645
GetGeometry (See @var{with-state})
16646
@var{drawable-root}
16649
@var{drawable-width}
16650
@var{drawable-height}
16651
@var{drawable-depth}
16652
@var{drawable-border-width}
16653
GetImage @var{get-raw-image}
16654
GetInputFocus @var{input-focus}
16655
GetKeyboardControl @var{keyboard-control}
16656
GetKeyboardMapping @var{keyboard-mapping}
16657
GetModifierMapping @var{modifier-mapping}
16658
GetMotionEvents @var{motion-events}
16659
GetPointerControl @var{pointer-control}
16660
GetPointerMapping @var{pointer-mapping}
16661
GetProperty @var{get-property}
16662
GetScreenSaver @var{screen-saver}
16663
GetSelectionOwner @var{selection-owner}
16664
GetWindowAttributes (See @var{with-state})
16665
@var{window-visual}
16667
@var{window-bit-gravity}
16668
@var{window-gravity}
16669
@var{window-backing-store}
16670
@var{window-backing-planes}
16671
@var{window-backing-pixel}
16672
@var{window-save-under}
16673
@var{window-override-redirect}
16674
@var{window-event-mask}
16675
@var{window-do-not-propagate-mask}
16676
@var{window-colormap}
16677
@var{window-colormap-installed-p}
16678
@var{window-all-event-masks}
16679
@var{window-map-state}
16680
GrabButton @var{grab-button}
16681
GrabKey @var{grab-key}
16682
GrabKeyboard @var{grab-keyboard}
16683
GrabPointer @var{grab-pointer}
16684
GrabServer @var{grab-server}
16685
ImageText16 @var{draw-image-glyphs}
16686
ImageText16 @var{draw-image-glyph}
16687
ImageText8 @var{draw-image-glyphs}
16688
InstallColormap @var{install-colormap}
16689
InternAtom @var{find-atom}
16690
InternAtom @var{intern-atom}
16691
KillClient @var{kill-temporary-clients}
16692
KillClient @var{kill-client}
16693
ListExtensions @var{list-extensions}
16694
ListFonts @var{list-font-names}
16695
ListFontsWithInfo @var{list-fonts}
16696
ListHosts @var{access-control}
16698
@var{X11 Request Name CLX Function Name}
16700
ListHosts @var{access-hosts}
16701
ListInstalledColormaps @var{installed-colormaps}
16702
ListProperties @var{list-properties}
16703
LookupColor @var{lookup-color}
16704
MapSubwindows @var{map-subwindows}
16705
MapWindow @var{map-window}
16706
OpenFont @var{open-font}
16707
PolyArc @var{draw-arc}
16708
PolyArc @var{draw-arcs}
16709
PolyFillArc @var{draw-arc}
16710
PolyFillArc @var{draw-arcs}
16711
PolyFillRectangle @var{draw-rectangle}
16712
PolyFillRectangle @var{draw-rectangles}
16713
PolyLine @var{draw-line}
16714
PolyLine @var{draw-lines}
16715
PolyPoint @var{draw-point}
16716
PolyPoint @var{draw-points}
16717
PolyRectangle @var{draw-rectangle}
16718
PolyRectangle @var{draw-rectangles}
16719
PolySegment @var{draw-segments}
16720
PolyText16 @var{draw-glyph}
16721
PolyText16 @var{draw-glyphs}
16722
PolyText8 @var{draw-glyphs}
16723
PutImage @var{put-raw-image}
16724
QueryBestSize @var{query-best-cursor}
16725
QueryBestSize @var{query-best-stipple}
16726
QueryBestSize @var{query-best-tile}
16727
QueryColors @var{query-colors}
16728
QueryExtension @var{query-extension}
16729
QueryFont @var{font-name}
16731
@var{font-direction}
16732
@var{font-min-char}
16733
@var{font-max-char}
16734
@var{font-min-byte1}
16735
@var{font-max-byte1}
16736
@var{font-min-byte2}
16737
@var{font-max-byte2}
16738
@var{font-all-chars-exist-p}
16739
@var{font-default-char}
16742
@var{font-properties}
16743
@var{font-property}
16744
@var{char-left-bearing}
16745
@var{char-right-bearing}
16749
@var{char-attributes}
16750
@var{min-char-left-bearing}
16751
@var{min-char-right-bearing}
16752
@var{min-char-width}
16753
@var{min-char-ascent}
16754
@var{min-char-descent}
16755
@var{min-char-attributes}
16757
@var{X11 Request Name CLX Function Name}
16759
@var{max-char-left-bearing}
16760
@var{max-char-right-bearing}
16761
@var{max-char-width}
16762
@var{max-char-ascent}
16763
@var{max-char-descent}
16764
@var{max-char-attributes}
16765
QueryKeymap @var{query-keymap}
16766
QueryPointer @var{global-pointer-position}
16767
QueryPointer @var{pointer-position}
16768
QueryPointer @var{query-pointer}
16769
QueryTextExtents@var{text-extents}
16770
QueryTextExtents@var{text-width}
16771
QueryTree @var{query-tree}
16772
RecolorCursor @var{recolor-cursor}
16773
ReparentWindow @var{reparent-window}
16774
RotateProperties@var{rotate-properties}
16775
SendEvent @var{send-event}
16776
SetClipRectangles @var{force-gcontext-changes}
16777
(See @var{with-gcontext})
16778
(@code{setf} (@var{gcontext-clip-x} @emph{gc}))
16779
(@code{setf} (@var{gcontext-clip-y} @emph{gc}))
16780
(@code{setf} (@var{gcontext-clip-mask} @emph{gc} &optional
16782
(@code{setf} (@var{gcontext-clip-ordering} @emph{gc}))
16783
SetDashes @var{force-gcontext-changes}
16784
(See @var{with-gcontext})
16785
(@code{setf} (@var{gcontext-dash-offset} @emph{gc}))
16786
(@code{setf} (@var{gcontext-dashes} @emph{gc}))
16787
SetFontPath (@code{setf} (@var{font-path} @emph{font})
16788
SetInputFocus @var{set-input-focus}
16789
SetKeyboardMapping @var{change-keyboard-mapping}
16790
SetModifierMapping @var{set-modifier-mapping}
16791
SetPointerMapping @var{set-pointer-mapping}
16792
SetScreenSaver @var{set-screen-saver}
16793
SetSelectionOwner @var{set-selection-owner}
16794
StoreColors @var{store-color}
16795
StoreColors @var{store-colors}
16796
StoreNamedColor @var{store-color}
16797
StoreNamedColor @var{store-colors}
16798
TranslateCoords @var{translate-coordinates}
16799
UngrabButton @var{ungrab-button}
16800
UngrabKey @var{ungrab-key}
16801
UngrabKeyboard @var{ungrab-keyboard}
16802
UngrabPointer @var{ungrab-pointer}
16803
UngrabServer @var{ungrab-server}
16804
UninstallColormap @var{uninstall-colormap}
16805
UnmapSubwindows @var{unmap-subwindows}
16806
UnmapWindow @var{unmap-window}
16807
WarpPointer @var{warp-pointer}
16808
WarpPointer @var{warp-pointer-if-inside}
16809
WarpPointer @var{warp-pointer-relative}
16810
WarpPointer @var{warp-pointer-relative-if-inside}
16811
ListHosts @var{access-control}
16812
ListHosts @var{access-hosts}
16813
ForceScreenSaver@var{activate-screen-saver}
16814
ChangeHosts @var{add-access-host}
16816
@var{X11 Request Name CLX Function Name}
16818
ChangeSaveSet @var{add-to-save-set}
16819
AllocColor @var{alloc-color}
16820
AllocNamedColor @var{alloc-color}
16821
AllocColorCells @var{alloc-color-cells}
16822
AllocColorPlanes@var{alloc-color-planes}
16823
AllowEvents @var{allow-events}
16824
GetAtomName @var{atom-name}
16826
ChangeActivePointerGrab @var{change-active-pointer-grab}
16827
ChangeKeyboardControl @var{change-keyboard-control}
16828
SetKeyboardMapping @var{change-keyboard-mapping}
16829
ChangePointerControl @var{change-pointer-control}
16830
ChangeProperty @var{change-property}
16831
QueryFont @var{char-ascent}
16832
QueryFont @var{char-attributes}
16833
QueryFont @var{char-descent}
16834
QueryFont @var{char-left-bearing}
16835
QueryFont @var{char-right-bearing}
16836
QueryFont @var{char-width}
16837
CirculateWindow @var{circulate-window-down}
16838
CirculateWindow @var{circulate-window-up}
16839
ClearToBackground @var{clear-area}
16840
CloseFont @var{close-font}
16841
ConvertSelection@var{convert-selection}
16842
CopyArea @var{copy-area}
16843
CopyColormapAndFree @var{copy-colormap-and-free}
16844
CopyGC@var{copy-gcontext}
16845
CopyGC@var{copy-gcontext-components}
16846
CopyPlane @var{copy-plane}
16847
CreateColormap @var{create-colormap}
16848
CreateCursor @var{create-cursor}
16849
CreateGC @var{create-gcontext}
16850
CreateGlyphCursor @var{create-glyph-cursor}
16851
CreatePixmap @var{create-pixmap}
16852
CreateWindow @var{create-window}
16853
DeleteProperty @var{delete-property}
16854
DestroySubwindows @var{destroy-subwindows}
16855
DestroyWindow @var{destroy-window}
16856
PolyArc @var{draw-arc}
16857
PolyArc @var{draw-arcs}
16858
PolyText16 @var{draw-glyph}
16859
PolyText16 @var{draw-glyphs}
16860
PolyText8 @var{draw-glyphs}
16861
ImageText16 @var{draw-image-glyph}
16862
ImageText16 @var{draw-image-glyphs}
16863
ImageText8 @var{draw-image-glyphs}
16864
PolyLine @var{draw-line}
16865
PolyLine @var{draw-lines}
16866
PolyPoint @var{draw-point}
16867
PolyPoint @var{draw-points}
16868
PolyFillRectangle @var{draw-rectangle}
16869
PolyRectangle @var{draw-rectangle}
16870
PolyFillRectangle @var{draw-rectangles}
16871
PolyRectangle @var{draw-rectangles}
16872
PolySegment @var{draw-segments}
16873
GetGeometry @var{drawable-border-width}
16875
@var{X11 Request Name CLX Function Name}
16877
GetGeometry @var{drawable-depth}
16878
GetGeometry @var{drawable-height}
16879
GetGeometry @var{drawable-root}
16880
GetGeometry @var{drawable-width}
16881
GetGeometry @var{drawable-x}
16882
GetGeometry @var{drawable-y}
16883
FillPoly @var{fill-polygon}
16884
InternAtom @var{find-atom}
16885
QueryFont @var{font-all-chars-exist-p}
16886
QueryFont @var{font-ascent}
16887
QueryFont @var{font-default-char}
16888
QueryFont @var{font-descent}
16889
QueryFont @var{font-direction}
16890
QueryFont @var{font-max-byte1}
16891
QueryFont @var{font-max-byte2}
16892
QueryFont @var{font-max-char}
16893
QueryFont @var{font-min-byte1}
16894
QueryFont @var{font-min-byte2}
16895
QueryFont @var{font-min-char}
16896
QueryFont @var{font-name}
16897
QueryFont @var{font-name}
16898
GetFontPath @var{font-path}
16899
QueryFont @var{font-properties}
16900
QueryFont @var{font-property}
16901
ChangeGC @var{force-gcontext-changes}
16902
SetClipRectangles @var{force-gcontext-changes}
16903
SetDashes @var{force-gcontext-changes}
16904
FreeColormap @var{free-colormap}
16905
FreeColors @var{free-colors}
16906
FreeCursor @var{free-cursor}
16907
FreeGC@var{free-gcontext}
16908
FreePixmap @var{free-pixmap}
16909
GetProperty @var{get-property}
16910
GetImage @var{get-raw-image}
16911
QueryPointer @var{global-pointer-position}
16912
GrabButton @var{grab-button}
16913
GrabKey @var{grab-key}
16914
GrabKeyboard @var{grab-keyboard}
16915
GrabPointer @var{grab-pointer}
16916
GrabServer @var{grab-server}
16917
GrabServer @var{with-server-grabbed}
16918
GetInputFocus @var{input-focus}
16919
InstallColormap @var{install-colormap}
16920
ListInstalledColormaps @var{installed-colormaps}
16921
InternAtom @var{intern-atom}
16922
GetKeyboardControl @var{keyboard-control}
16923
GetKeyboardMapping @var{keyboard-mapping}
16924
KillClient @var{kill-client}
16925
KillClient @var{kill-temporary-clients}
16926
ListExtensions @var{list-extensions}
16927
ListFonts @var{list-font-names}
16928
ListFontsWithInfo @var{list-fonts}
16929
ListProperties @var{list-properties}
16930
LookupColor @var{lookup-color}
16931
MapSubwindows @var{map-subwindows}
16932
MapWindow @var{map-window}
16934
@var{X11 Request Name CLX Function Name}
16936
QueryFont @var{max-char-ascent}
16937
QueryFont @var{max-char-attributes}
16938
QueryFont @var{max-char-descent}
16939
QueryFont @var{max-char-left-bearing}
16940
QueryFont @var{max-char-right-bearing}
16941
QueryFont @var{max-char-width}
16942
QueryFont @var{min-char-ascent}
16943
QueryFont @var{min-char-attributes}
16944
QueryFont @var{min-char-descent}
16945
QueryFont @var{min-char-left-bearing}
16946
QueryFont @var{min-char-right-bearing}
16947
QueryFont @var{min-char-width}
16948
GetModifierMapping @var{modifier-mapping}
16949
GetMotionEvents @var{motion-events}
16950
OpenFont @var{open-font}
16951
GetPointerControl @var{pointer-control}
16952
GetPointerMapping @var{pointer-mapping}
16953
QueryPointer @var{pointer-position}
16954
PutImage @var{put-raw-image}
16955
QueryBestSize @var{query-best-cursor}
16956
QueryBestSize @var{query-best-stipple}
16957
QueryBestSize @var{query-best-tile}
16958
QueryColors @var{query-colors}
16959
QueryExtension @var{query-extension}
16960
QueryKeymap @var{query-keymap}
16961
QueryPointer @var{query-pointer}
16962
QueryTree @var{query-tree}
16963
RecolorCursor @var{recolor-cursor}
16964
ChangeHosts @var{remove-access-host}
16965
ChangeSaveSet @var{remove-from-save-set}
16966
ReparentWindow @var{reparent-window}
16967
ForceScreenSaver@var{reset-screen-saver}
16968
RotateProperties@var{rotate-properties}
16969
GetScreenSaver @var{screen-saver}
16970
GetSelectionOwner @var{selection-owner}
16971
SendEvent @var{send-event}
16972
ChangeAccessControl @var{set-access-control}
16973
ChangeCloseDownMode @var{set-close-down-mode}
16974
SetInputFocus @var{set-input-focus}
16975
SetModifierMapping @var{set-modifier-mapping}
16976
SetPointerMapping @var{set-pointer-mapping}
16977
SetScreenSaver @var{set-screen-saver}
16978
SetSelectionOwner @var{set-selection-owner}
16979
StoreColors @var{store-color}
16980
StoreColors @var{store-colors}
16981
StoreNamedColor @var{store-color}
16982
StoreNamedColor @var{store-colors}
16983
QueryTextExtents@var{text-extents}
16984
QueryTextExtents@var{text-width}
16985
TranslateCoords @var{translate-coordinates}
16986
UngrabButton @var{ungrab-button}
16987
UngrabKey @var{ungrab-key}
16988
UngrabKeyboard @var{ungrab-keyboard}
16989
UngrabPointer @var{ungrab-pointer}
16990
UngrabServer @var{ungrab-server}
16991
UngrabServer @var{with-server-grabbed}
16993
@var{X11 Request Name CLX Function Name}
16995
UninstallColormap @var{uninstall-colormap}
16996
UnmapSubwindows @var{unmap-subwindows}
16997
UnmapWindow @var{unmap-window}
16998
WarpPointer @var{warp-pointer}
16999
WarpPointer @var{warp-pointer-if-inside}
17000
WarpPointer @var{warp-pointer-relative}
17001
WarpPointer @var{warp-pointer-relative-if-inside}
17002
GetWindowAttributes @var{window-all-event-masks}
17003
GetWindowAttributes @var{window-backing-pixel}
17004
GetWindowAttributes @var{window-backing-planes}
17005
GetWindowAttributes @var{window-backing-store}
17006
GetWindowAttributes @var{window-bit-gravity}
17007
GetWindowAttributes @var{window-class}
17008
GetWindowAttributes @var{window-colormap}
17009
GetWindowAttributes @var{window-colormap-installed-p}
17010
GetWindowAttributes @var{window-do-not-propagate-mask}
17011
GetWindowAttributes @var{window-event-mask}
17012
GetWindowAttributes @var{window-gravity}
17013
GetWindowAttributes @var{window-map-state}
17014
GetWindowAttributes @var{window-override-redirect}
17015
GetWindowAttributes @var{window-save-under}
17016
GetWindowAttributes @var{window-visual}
17017
ConfigureWindow (@code{setf} (@var{drawable-border-width} @emph{drawable}))
17018
ConfigureWindow (@code{setf} (@var{drawable-depth} @emph{drawable}))
17019
ConfigureWindow (@code{setf} (@var{drawable-height} @emph{drawable}))
17020
ConfigureWindow (@code{setf} (@var{drawable-width} @emph{drawabl}e))
17021
ConfigureWindow (@code{setf} (@var{drawable-x} @emph{drawable}))
17022
ConfigureWindow (@code{setf} (@var{drawable-y} @emph{drawable}))
17023
SetFontPath (@code{setf} (@var{font-path} @emph{font}) @var{paths})
17024
ChangeGC (@code{setf} (@var{gcontext-arc-mode} @emph{gc}))
17025
ChangeGC (@code{setf} (@var{gcontext-background} @emph{gc}))
17026
ChangeGC (@code{setf} (@var{gcontext-cap-style} @emph{gc}))
17027
SetClipRectangles (@code{setf} (@var{gcontext-clip-mask} @emph{gc} &optional
17029
SetClipRectangles (@code{setf} (@var{gcontext-clip-ordering} @emph{gc}))
17030
SetClipRectangles (@code{setf} (@var{gcontext-clip-x} @emph{gc}))
17031
SetClipRectangles (@code{setf} (@var{gcontext-clip-y} @emph{gc}))
17032
SetDashes (@code{setf} (@var{gcontext-dash-offset} @emph{gc}))
17033
SetDashes (@code{setf} (@var{gcontext-dashes} @emph{gc}))
17034
ChangeGC (@code{setf} (@var{gcontext-exposures} @emph{gc}))
17035
ChangeGC (@code{setf} (@var{gcontext-fill-rule} @emph{gc}) @var{keyword})
17036
ChangeGC (@code{setf} (@var{gcontext-fill-style} @emph{gc}) @var{keyword})
17037
ChangeGC (@code{setf} (@var{gcontext-font} @emph{gc} &optional
17039
ChangeGC (@code{setf} (@var{gcontext-foreground} @emph{gc}) @var{card32})
17040
ChangeGC (@code{setf} (@var{gcontext-function} @emph{gc}))
17041
ChangeGC (@code{setf} (@var{gcontext-join-style} @emph{gc}) @var{keyword})
17042
ChangeGC (@code{setf} (@var{gcontext-line-style} @emph{gc}) @var{keyword})
17043
ChangeGC (@code{setf} (@var{gcontext-line-width} @emph{gc}) @var{card16})
17044
ChangeGC (@code{setf} (@var{gcontext-plane-mask} @emph{gc}) @var{card32})
17045
ChangeGC (@code{setf} (@var{gcontext-stipple} @emph{gc}) @var{pixmap})
17046
ChangeGC (@code{setf} (@var{gcontext-subwindow-mode} @emph{gc}))
17047
ChangeGC (@code{setf} (@var{gcontext-tile} @emph{gc}))
17048
ChangeGC (@code{setf} (@var{gcontext-ts-x} @emph{gc}))
17049
ChangeGC (@code{setf} (@var{gcontext-ts-y} @emph{gc}))
17050
ChangeWindowAttributes (@code{setf} (@var{window-background} @emph{window}))
17052
@var{X11 Request Name CLX Function Name}
17054
ChangeWindowAttributes (@code{setf} (@var{window-backing-pixel} @emph{window}))
17055
ChangeWindowAttributes (@code{setf} (@var{window-backing-planes} @emph{window}))
17056
ChangeWindowAttributes (@code{setf} (@var{window-backing-store} @emph{window}))
17057
ChangeWindowAttributes (@code{setf} (@var{window-bit-gravity} @emph{window}))
17058
ChangeWindowAttributes (@code{setf} (@var{window-border} @emph{window}))
17059
ChangeWindowAttributes (@code{setf} (@var{window-colormap} @emph{window}))
17060
ChangeWindowAttributes (@code{setf} (@var{window-cursor} @emph{window}))
17061
ChangeWindowAttributes (@code{setf} (@var{window-do-not-propagate-mask}
17063
ChangeWindowAttributes (@code{setf} (@var{window-event-mask} @emph{window}))
17064
ChangeWindowAttributes (@code{setf} (@var{window-gravity} @emph{window}))
17065
ChangeWindowAttributes (@code{setf} (@var{window-override-redirect} @emph{window}))
17066
ConfigureWindow (@code{setf} (@var{window-priority} @emph{window} &optional
17068
ChangeWindowAttributes (@code{setf} (@var{window-save-under} @emph{window}))
17071
@node Undocumented, Glossary, Errors, Top
17072
@chapter Undocumented
17074
This section just lists all symbols exported from the
17075
@var{XLIB} package but not documented in this manual.
17077
@defun bitmap-image &optional plist &rest patterns
17081
@defun character->keysyms character &optional display
17085
@defun character-in-map-p display character keymap
17094
@defun decode-core-error display event &optional arg
17097
@defun default-error-handler display error-key &rest key-vals &key asynchronous &allow-other-keys
17100
@defun default-keysym-index display keycode state
17103
@defun default-keysym-translate display state object
17106
@defun define-keysym object keysym &key lowercase translate modifiers mask display
17109
@defun define-keysym-set set first-keysym last-keysym
17112
@defun display-invoke-after-function display
17115
Explicitly invokes the @emph{after-function} of the display.
17116
(see @var{display-after-function}). This function is
17117
internally called after every request.
17120
@defun display-nscreens display
17123
@defun display-release-number object
17126
@defun event-handler handlers event-key
17129
@defun get-external-event-code display event
17132
@defun get-standard-colormap window property
17135
@defun get-wm-class window
17138
@defun icon-sizes window
17141
@defun iconify-window window screen
17144
@defun keysym->keycodes display keysym
17147
@defun keysym-in-map-p display keysym keymap
17150
@defun keysym-set keysym
17153
@defun mapping-notify display request start count
17155
Called on a @var{:mapping-notify} event to update
17156
the keyboard-mapping cache in @emph{display}.
17159
@defun no-operation display
17162
@defun parse-color colormap spec
17165
@defun resource-database-timestamp database
17168
@defun resource-key stringable
17171
@defun rgb-colormaps window property
17174
@defun root-resources screen &key database key test test-not
17176
Returns a resource database containing the contents of the
17177
root window @var{RESOURCE_MANAGER} property for the given
17178
@emph{screen}. If @emph{screen} is a display, then its
17179
default screen is used. If an existing @emph{database} is
17180
given, then resource values are merged with the
17181
@emph{database} and the modified @emph{database} is
17184
@emph{test} and @emph{test-not} are predicates for selecting
17185
which resources are read. Arguments are a resource name list
17186
and a resource value. The @emph{key} function, if given, is
17187
called to convert a resource value string to the value given
17188
to @emph{test} or @emph{test-not}.
17191
@defun rotate-cut-buffers display &optional (delta 1) (careful-p t)
17194
@defun set-access-control display enabled-p
17197
@defun set-close-down-mode display mode
17198
@anchor{set-close-down-mode}
17201
@defun set-pointer-mapping display map
17204
@defun set-selection-owner display selection owner &optional time
17207
@defun set-standard-colormap window property colormap base-pixel max-color mult-color
17210
@defun set-standard-properties window &rest options
17213
@defun set-wm-class window resource-name resource-class
17216
@defun set-wm-properties window &rest options &key name icon-name resource-name resource-class command client-machine hints normal-hints zoom-hints (user-specified-position-p nil usppp) (user-specified-size-p nil usspp) (program-specified-position-p nil psppp) (program-specified-size-p nil psspp) x y width height min-width min-height max-width max-height width-inc height-inc min-aspect max-aspect base-width base-height win-gravity input initial-state icon-pixmap icon-window icon-x icon-y icon-mask window-group
17219
@defun set-wm-resources database window &key write test test-not
17222
@defun transient-for window
17225
@defun translate-default src src-start src-end font dst dst-start
17228
@defun undefine-keysym object keysym &key display modifiers &allow-other-keys
17231
@defun visual-info-blue-mask object
17234
@defun visual-info-green-mask object
17237
@defun visual-info-red-mask object
17240
@defun window-cursor window
17243
@defun window-visual-info window
17246
@defun withdraw-window window screen
17249
@defun wm-client-machine window
17252
@defun wm-colormap-windows window
17255
@defun wm-command window
17258
@defun wm-hints window
17261
@defun wm-hints-flags object
17264
@defun wm-icon-name window
17267
@defun wm-name window
17270
@defun wm-normal-hints window
17273
@defun wm-protocols window
17276
@defun wm-resources database window &key key test test-not
17279
@defun wm-zoom-hints window
17283
XLIB:STATE-KEYSYM-P is undocumented.
17284
XLIB:*VERSION* is undocumented.
17285
XLIB:BITMAP-FORMAT-LSB-FIRST-P ??? [Function]
17286
XLIB:BITMAP-FORMAT-P ??? [Function]
17287
XLIB:BITMAP-FORMAT-PAD ???[Function]
17288
XLIB:BITMAP-FORMAT-UNIT ??? [Function]
17289
XLIB:CARD8->CHAR (card8) [Function]
17290
XLIB:CHAR->CARD8 (char) [Function]
17291
XLIB:COLORMAP-VISUAL-INFO ??? [Function]
17292
XLIB:CUT-BUFFER (display &key (buffer 0) (type :string) (result-type 'string)
17293
(transform #'card8->char) (start 0) end) [Function]
17294
XLIB:DEFINE-ERROR ??? [Function]
17295
XLIB:DEFINE-EXTENSION ??? [Function]
17296
XLIB:DEFINE-GCONTEXT-ACCESSOR ??? [Function]
17297
XLIB:DISPLAY-DEFAULT-SCREEN ??? [Function]
17298
XLIB:DISPLAY-HOST ??? [Function]
17299
XLIB:DISPLAY-REPORT-ASYNCHRONOUS-ERRORS ??? [Function]
17300
XLIB:DISPLAY-XDEFAULTS ???[Function]
17301
XLIB:EXTENSION-OPCODE ??? [Function]
17302
XLIB:GCONTEXT-CLIP-ORDERING is undocumented.
17303
XLIB:GENERALIZED-BOOLEAN is undocumented.
17304
XLIB:ILLEGAL-REQUEST-ERROR is undocumented.
17305
XLIB:IMAGE is undocumented.
17306
XLIB:IMAGE-PIXMAP (drawable image &key gcontext width height depth) [Function]
17307
XLIB:IMAGE-X is undocumented.
17308
XLIB:IMAGE-X-P ??? [Function]
17309
XLIB:IMAGE-XY is undocumented.
17310
XLIB:IMAGE-XY-P ??? [Function]
17311
XLIB:IMAGE-Z is undocumented.
17312
XLIB:IMAGE-Z-P ??? [Function]
17313
XLIB:INVALID-FONT is undocumented.
17314
XLIB:KEYCODE->CHARACTER (display keycode state &key keysym-index
17315
(keysym-index-function #'default-keysym-index)) [Function]
17316
XLIB:MAKE-EVENT-HANDLERS (&key (type 'array) default) [Function]
17317
XLIB:MAKE-WM-HINTS (&key ((:input #:g0) nil) ((:initial-state #:g1) nil) ((:icon-pixmap #:g2) nil)
17318
((:icon-window #:g3) nil) ((:icon-x #:g4) nil) ((:icon-y #:g5) nil)
17319
((:icon-mask #:g6) nil) ((:window-group #:g7) nil) ((:flags #:g8) 0)) [Function]
17320
XLIB:MAKE-WM-SIZE-HINTS (&key ((:user-specified-position-p #:g0) nil)
17321
((:user-specified-size-p #:g1) nil) ((:x #:g2) nil) ((:y #:g3) nil)
17322
((:width #:g4) nil) ((:height #:g5) nil) ((:min-width #:g6) nil)
17323
((:min-height #:g7) nil) ((:max-width #:g8) nil) ((:max-height #:g9) nil)
17324
((:width-inc #:g10) nil) ((:height-inc #:g11) nil) ((:min-aspect #:g12) nil)
17325
((:max-aspect #:g13) nil) ((:base-width #:g14) nil) ((:base-height #:g15) nil)
17326
((:win-gravity #:g16) nil) ((:program-specified-position-p #:g17) nil)
17327
((:program-specified-size-p #:g18) nil)) [Function]
17328
XLIB:PIXMAP-FORMAT-BITS-PER-PIXEL ??? [Function]
17329
XLIB:PIXMAP-FORMAT-DEPTH ??? [Function]
17330
XLIB:PIXMAP-FORMAT-P ??? [Function]
17331
XLIB:PIXMAP-FORMAT-SCANLINE-PAD ??? [Function]
17332
XLIB:RESOURCE-DATABASE is undocumented.
17333
XLIB:SCREEN-ROOT-VISUAL-INFO ??? [Function]
17334
XLIB:TRANSLATION-FUNCTION is undocumented.
17335
XLIB:VISUAL-INFO-BITS-PER-RGB ??? [Function]
17336
XLIB:VISUAL-INFO-CLASS ???[Function]
17337
XLIB:VISUAL-INFO-COLORMAP-ENTRIES ??? [Function]
17338
XLIB:VISUAL-INFO-DISPLAY ??? [Function]
17339
XLIB:VISUAL-INFO-ID ??? [Function]
17340
XLIB:VISUAL-INFO-P ??? [Function]
17341
XLIB:VISUAL-INFO-PLIST ???[Function]
17342
XLIB:WINDOW-BACKGROUND is undocumented.
17343
XLIB:WINDOW-BORDER is undocumented.
17344
XLIB:WINDOW-PRIORITY is undocumented.
17345
XLIB:WM-HINTS-ICON-MASK ??? [Function]
17346
XLIB:WM-HINTS-ICON-PIXMAP ??? [Function]
17347
XLIB:WM-HINTS-ICON-WINDOW ??? [Function]
17348
XLIB:WM-HINTS-ICON-X ??? [Function]
17349
XLIB:WM-HINTS-ICON-Y ??? [Function]
17350
XLIB:WM-HINTS-INITIAL-STATE ??? [Function]
17351
XLIB:WM-HINTS-INPUT ??? [Function]
17352
XLIB:WM-HINTS-P ??? [Function]
17353
XLIB:WM-HINTS-WINDOW-GROUP ??? [Function]
17354
XLIB:WM-SIZE-HINTS is undocumented.
17355
XLIB:WM-SIZE-HINTS-BASE-HEIGHT ??? [Function]
17356
XLIB:WM-SIZE-HINTS-BASE-WIDTH ??? [Function]
17357
XLIB:WM-SIZE-HINTS-HEIGHT ??? [Function]
17358
XLIB:WM-SIZE-HINTS-HEIGHT-INC ??? [Function]
17359
XLIB:WM-SIZE-HINTS-MAX-ASPECT ??? [Function]
17360
XLIB:WM-SIZE-HINTS-MAX-HEIGHT ??? [Function]
17361
XLIB:WM-SIZE-HINTS-MAX-WIDTH ??? [Function]
17362
XLIB:WM-SIZE-HINTS-MIN-ASPECT ??? [Function]
17363
XLIB:WM-SIZE-HINTS-MIN-HEIGHT ??? [Function]
17364
XLIB:WM-SIZE-HINTS-MIN-WIDTH ??? [Function]
17365
XLIB:WM-SIZE-HINTS-P ??? [Function]
17366
XLIB:WM-SIZE-HINTS-USER-SPECIFIED-POSITION-P ??? [Function]
17367
XLIB:WM-SIZE-HINTS-USER-SPECIFIED-SIZE-P ??? [Function]
17368
XLIB:WM-SIZE-HINTS-WIDTH ??? [Function]
17369
XLIB:WM-SIZE-HINTS-WIDTH-INC ??? [Function]
17370
XLIB:WM-SIZE-HINTS-WIN-GRAVITY ??? [Function]
17371
XLIB:WM-SIZE-HINTS-X ??? [Function]
17372
XLIB:WM-SIZE-HINTS-Y ??? [Function]
17375
@node Glossary, Function Index, Undocumented, Top
17379
@item access control list
17380
X maintains a list of hosts from which client programs can be run. By
17381
default, only programs on the local host can use the display, plus any
17382
hosts specified in an initial list read by the server. This @emph{access
17383
control list} can be changed by clients on the local host. Some
17384
server implementations can also implement other authorization
17385
mechanisms in addition to or in place of this mechanism. The action of
17386
this mechanism can be conditional based on the authorization protocol
17387
name and data received by the server at connection setup.
17390
A function that is designed to handle an input event. CLUE input
17391
processing consists of matching an event with an event specification
17392
found in a contact's @var{event-translations} slot and then calling
17393
actions associated with the matching event specification.
17396
A grab is @emph{active} when the pointer or keyboard is actually owned
17397
by the single grabbing client.
17400
If W is an inferior of A, then A is an @emph{ancestor} of W.
17403
A unique ID corresponding to a string name. Atoms are used to identify
17404
properties, types, and selections.
17406
@item backing store
17407
When a server maintains the contents of a window, the off-screen saved
17408
pixels are known as a @emph{backing store}.
17410
@item before action
17411
An action of a @var{contact-display} that is called when an event is
17412
dispatched to a contact, but before any other contact input processing
17416
When a window is resized, the contents of the window are not
17417
necessarily discarded. It is possible to request the server to
17418
relocate the previous contents to some region of the window. This
17419
attraction of window contents for some location of a window is known
17420
as @emph{bit} @emph{gravity}.
17423
A pixmap of depth one.
17425
@item button grabbing
17426
Buttons on the pointer can be passively @emph{grabbed} by a
17427
client. When the button is pressed, the pointer is then actively
17428
grabbed by the client.
17431
For image (pixmap/bitmap) data, byte order is defined by the server,
17432
and clients with different native byte ordering must swap bytes as
17433
necessary. For all other parts of the protocol, the byte order is
17434
defined by the client, and the server swaps bytes as necessary.
17437
A function that represents a connection between a contact and the rest
17438
of an application program. A contact calls a callback function in
17439
order to report the results of the user interface component that it
17443
First-level subwindows of a window.
17446
Event translations that belong to all instances of a contact class. A
17447
class event @var{translations} translation is created by the
17448
@var{defevent} macro.
17450
@item class resources
17451
Resources defined for each instance of a contact class. Also see
17452
constraint resources.
17455
A @var{:button-press} event followed immediately by a
17456
@var{:button-release} event for the same button, with no intervening
17457
change in pointer position or modifier key state.
17460
An application program connects to the window system server by some
17461
interprocess communication (IPC) path, such as a TCP connection or a
17462
shared memory buffer. This program is referred to as a @emph{client}
17463
of the window system server. More precisely, the client is the IPC
17464
path itself. A program with multiple paths open to the server is
17465
viewed as multiple clients by the protocol. Resource lifetimes are
17466
controlled by connection lifetimes, not by program lifetimes.
17468
@item clipping regions
17469
In a graphics context, a bitmap or list of rectangles can be specified
17470
to restrict output to a particular region of the window. The image
17471
defined by the bitmap or rectangles is called a @emph{clipping
17475
A set of entries defining color values. The colormap associated with a
17476
window is used to display the contents of the window. Each pixel value
17477
indexes the colormap to produce RGB values that drive the guns of a
17478
monitor. Depending on hardware limitations, one or more colormaps can
17479
be installed at one time, such that windows associated with those maps
17480
display with correct colors.
17483
A subclass of @var{contact} representing contacts that are the
17484
parents of other contacts. A composite provides geometry management
17485
and input focus management services for the contacts that are its
17488
@item complete resource class
17489
A list of symbols containing the class of the contact, the class of
17490
the contact's @var{parent} (and so on), and the class of the
17491
@var{contact-display} to which the contact belongs. The complete
17492
resource class is one of the two items used as a key by a CLUE
17493
application in order to access a contact resource value in a resource
17496
@item complete resource name
17497
A list of symbols containing the @var{name} of the contact, the
17498
@var{name} of the contact's @var{parent} (and so on), and the name
17499
of the @var{contact-display} to which the contact belongs. The
17500
complete resource name is one of the two items used as a key by a CLUE
17501
application in order to access a contact resource value in a resource
17505
The IPC path between the server and client program. A client program
17506
typically has one connection to the server over which requests and
17509
@item constraint resources
17510
Resources defined for each child belonging to a member of a composite
17511
class. Constraint resources are typically used to control the
17512
parent's geometry management policy. Also see class resources.
17515
The basic CLUE object for programming a user interface.
17517
@item contact-display
17518
The CLUE object type that represents a connection to an X server and
17519
that supports an event loop for application input.
17521
@item contact initialization
17522
The process of collecting initial values for all contact
17523
attributes. No server resources (windows and so on) are actually
17524
allocated until contact realization.
17526
@item contact realization
17527
The process of allocating contact resources. This process completes
17531
A window contains the pointer if the window is viewable and the hot
17532
spot of the cursor is within a visible region of the window or a
17533
visible region of one of its inferiors. The border of the window is
17534
included as part of the window for containment. The pointer is in a
17535
window if the window contains the pointer but no inferior contains the
17539
The single child of a shell. The basic geometry management policy
17540
implemented by the @var{shell} class constrains a shell and its
17541
content to have the same width and height; size changes to one are
17542
automatically applied to the other.
17544
@item coordinate system
17545
The coordinate system has x horizontal and y vertical, with the origin
17546
[0, 0] at the upper left. Coordinates are discrete and are in terms of
17547
pixels. Each window and pixmap has its own coordinate system. For a
17548
window, the origin is at the inside upper left, inside the border.
17551
The visible shape of the pointer on a screen. It consists of a
17552
hot-spot, a source bitmap, a shape bitmap, and a pair of colors. The
17553
cursor defined for a window controls the visible appearance when the
17554
pointer is in that window.
17557
The depth of a window or pixmap is number of bits per pixel it
17558
has. The depth of a graphics context is the depth of the drawables it
17559
can be used in conjunction with for graphics output.
17562
If W is an inferior of A, then W is a @emph{descendant} of A.
17565
Keyboards, mice, tablets, track-balls, button boxes, and so forth, are
17566
all collectively known as input @emph{devices}. The core protocol only
17567
deals with two devices: the keyboard and the pointer.
17570
A class of colormap in which a pixel value is decomposed into three
17571
separate subfields for indexing. One subfield indexes an array to
17572
produce red intensity values, the second subfield indexes a second
17573
array to produce blue intensity values, and the third subfield indexes
17574
a third array to produce green intensity values. The RGB values can be
17575
changed dynamically.
17577
@item dispatching an event
17578
The process of finding the appropriate contact and its actions.
17581
A sequence of two clicks of the same button in rapid succession.
17584
Both windows and pixmaps can be used as sources and destinations in
17585
graphics operations. These are collectively known as
17586
@emph{drawables}. However, an @var{:input-only} window cannot be used
17587
as a source or destination in a graphics operation.
17590
Clients receive information asynchronously via @emph{events}. These
17591
events can be either asynchronously generated from devices, or
17592
generated as side effects of client requests. Events are grouped into
17593
types; events are never sent to a client by the server unless the
17594
client has specifically asked to be informed of that type of event,
17595
but clients can force events to be sent to other clients. Events are
17596
typically reported relative to a window.
17598
@item event compression
17599
Ignoring (or compressing) certain redundant input events. Compression
17600
of redundant events is controlled by the class slots
17601
@var{compress-exposures} and @var{compress-motion}, which are shared
17602
by all instances of a contact class.
17605
The fundamental application control structure: wait for an event,
17606
figure out how to handle it, process the event, then go back and wait
17607
for the next one. In CLUE, the event loop is implemented using the
17608
@var{process-next-event} function.
17611
Events are requested relative to a window. The set of event types a
17612
client requests relative to a window are described using an @emph{event
17615
@item event propagation
17616
Device-related events @emph{propagate} from the source window to
17617
ancestor windows until some client has expressed interest in handling
17618
that type of event, or until the event is discarded explicitly.
17620
@item event specification
17621
A notation for describing a certain sort of event. CLUE input
17622
processing consists of matching an event with an event specification
17623
found in a contact's @var{event-translations} slot and then calling
17624
actions associated with the matching event specification.
17626
@item event synchronization
17627
Certain race conditions are possible when demultiplexing device events
17628
to clients (in particular deciding where pointer and keyboard events
17629
should be sent when in the middle of window management
17630
operations). The event synchronization mechanism allows synchronous
17631
processing of device events.
17634
The smallest window containing the pointer is the @emph{source} of a
17635
device related event.
17637
@item event translation
17638
The process of determining which contact action functions will be
17639
executed. An event translation is a list found in a contact's
17640
@var{event-translations} slot associating an event specification with
17641
one or more action names. Also see class event translations.
17643
@item exposure event
17644
Servers do not guarantee to preserve the contents of windows when
17645
windows are obscured or reconfigured. @emph{Exposure} events are sent
17646
to clients to inform them when contents of regions of windows have
17650
Named @emph{extensions} to the core protocol can be defined to extend
17651
the system. Extension to output requests, resources, and event types
17652
are all possible, and expected.
17655
Another term for the input focus.
17658
A matrix of glyphs (typically characters). The protocol does no
17659
translation or interpretation of character sets. The client simply
17660
indicates values used to index the glyph array. A font contains
17661
additional metric information to determine inter-glyph and inter-line
17664
@item geometry management
17665
The process whereby a composite controls the geometrical properties of
17666
its child contacts; the composite is referred to as the geometry
17670
An image, typically of a character, in a font.
17673
Keyboard keys, the keyboard, pointer buttons, the pointer, and the
17674
server can be @emph{grabbed} for exclusive use by a client. In
17675
general, these facilities are not intended to be used by normal
17676
applications but are intended for various input and window managers to
17677
implement various styles of user interfaces.
17680
Shorthand for graphics context.
17682
@item graphics context
17683
Various information for graphics output is stored in a @emph{graphics
17684
context} (or gcontext), such as foreground pixel, background pixel,
17685
line width, clipping region, and so forth. A graphics context can only
17686
be used with drawables that have the same root and the same depth as
17687
the graphics context.
17690
A degenerate case of pseudo color, in which the red, green, and blue
17691
values in any given colormap entry are equal, thus producing shades of
17692
gray. The gray values can be changed dynamically.
17695
A cursor has an associated @emph{hot spot} that defines a point in the
17696
cursor that corresponds to the coordinates reported for the pointer.
17699
Each resource has an @emph{identifier}, a unique value associated with
17700
it that clients use to name the resource. An identifier can be used
17701
over any connection to name the resource.
17704
All of the subwindows nested below a window: the children, the
17705
children's children, and so on.
17707
@item initialization
17708
See contact initialization.
17714
Normally a window defining the scope for processing of keyboard
17715
input. If a generated keyboard event would normally be reported to
17716
this window or one of its inferiors, the event is reported normally;
17717
otherwise, the event is reported with respect to the focus window. The
17718
input focus also can be set such that all keyboard events are
17719
discarded and that the focus window is dynamically taken to be the
17720
root window of whatever screen the pointer is on at each keyboard
17723
@item input-only window
17724
A window that cannot be used for graphics requests. @emph{input-only}
17725
windows are invisible, and can be used to control such things as
17726
cursors, input event generation, and grabbing. @emph{input-only}
17727
windows cannot have @emph{input/output} windows as inferiors.
17729
@item input/output window
17730
The normal kind of opaque window, used for both input and
17731
output. Input/output windows can have both @emph{input/output} and
17732
input-only windows as inferiors.
17734
@item insensitivity
17737
@item interactive-stream
17738
A contact subclass designed to integrate CLUE with the conventional
17739
stream-based I/O of Common Lisp.
17742
Keys on the keyboard can be passively @emph{grabbed} by a client. When
17743
the key is pressed, the keyboard is then actively grabbed by the
17746
@item keyboard grabbing
17747
A client can actively @emph{grab} control of the keyboard, and key
17748
events will be sent to that client rather than the client to which the
17749
events would normally have been sent.
17752
An encoding of a symbol on a keycap on a keyboard.
17755
A contact under geometry management control.
17758
A window is said to be @emph{mapped} if a map call has been performed
17759
on it. Unmapped windows and their inferiors are never viewable or
17762
@item modifier keys
17763
SHIFT, CONTROL, META, SUPER, HYPER, ALT, Compose, Apple, CAPS LOCK,
17764
Shift Lock, and similar keys are called @emph{modifier keys}.
17767
A special case of static gray, in which there are only two colormap
17771
A window is @emph{obscured} if some other window obscures it. For
17772
example, window A obscures window B if:
17775
@item Both windows are viewable @var{:input-output} windows
17777
@item Window A is higher in the global stacking order than window B
17779
@item The rectangle defined by the outside edges of window A intersects the rectangle
17780
defined by the outside edges of window B
17783
Notice that window borders are included in the calculation, and that a window can be
17784
obscured and yet still have visible regions. See occlude (there is a fine distinction
17785
between obscure and occlude).
17788
A window is @emph{occluded} if some other window occludes it. For
17789
example, window A occludes window B if:
17792
@item Both windows are mapped
17794
@item Window A is higher in the global stacking order than window B
17796
@item The rectangle defined by the outside edges of window A intersects the rectangle
17797
defined by the outside edges of window B
17800
Notice that window borders are included in the calculation. See
17801
obscure (there is a fine distinction between occlude and obscure).
17803
@item override-shell
17804
A subclass of @var{shell} used to override the window manager. This
17805
subclass contains pop-up menus and other temporary objects that the
17806
user can never resize and so on.
17809
Some padding bytes are inserted in the data stream to maintain
17810
alignment of the protocol requests on natural boundaries. This
17811
increases ease of portability to some machine architectures.
17813
@item parent window
17814
If C is a child of P, then P is the @emph{parent} of C.
17817
Grabbing a key or button is a @emph{passive grab}. The grab activates
17818
when the key or button is actually pressed.
17821
An @emph{n}-bit value, where @emph{n} is the number of bit planes used
17822
in (that is, the depth of) a particular window or pixmap. For a
17823
window, a pixel value indexes a colormap to derive an actual color to
17827
A three dimensional array of bits. A pixmap is normally thought of as
17828
a two dimensional array of pixels, where each pixel can be a value
17829
from 0 to (2@emph{n})-1, where @emph{n} is the depth (z axis) of
17830
the pixmap. A pixmap can also be thought of as a stack of @emph{n}
17834
When a pixmap or window is thought of as a stack of bitmaps, each
17835
bitmap is called a @emph{plane} or @emph{bit plane}.
17838
Graphics operations can be restricted to only affect a subset of bit
17839
planes of a destination. A @emph{plane mask} is a bit mask describing
17840
which planes are to be modified, and it is stored in a graphics
17844
The pointing device attached to the cursor and tracked on the screens.
17846
@item pointer grabbing
17847
A client can actively @emph{grab} control of the pointer, and button
17848
and motion events will be sent to that client rather than the client
17849
to which the events would normally have been sent.
17851
@item pointing device
17852
Typically a mouse or tablet, or some other device with effective
17853
dimensional motion. There is only one visible cursor defined by the
17854
core protocol, and it tracks whatever pointing device is attached as
17858
One of the uses of a top-level shell (for example, a menu that pops up
17859
when a command button contact is activated). Setting the @var{state}
17860
of a shell to @var{:mapped} is sometimes referred to as
17861
@emph{mapping} or @emph{popping up} the shell. Setting the
17862
@var{state} of a shell to @var{:withdrawn} or @var{:iconic} is
17863
sometimes referred to as @emph{unmapping} or @emph{popping down} the
17867
Windows can have associated @emph{properties}, consisting of a name, a
17868
type, a data format, and some data. The protocol places no
17869
interpretation on properties; they are intended as a general-purpose
17870
naming mechanism for clients. For example, clients might share
17871
information such as resize hints, program names, and icon formats with
17872
a window manager via properties.
17874
@item property list
17875
The list of properties that have been defined for a window.
17878
A class of colormap in which a pixel value indexes the colormap to
17879
produce independent red, green, and blue values. That is, the colormap
17880
is viewed as an array of triples (RGB values). The RGB values can be
17881
changed dynamically.
17884
See contact realization.
17886
@item redirecting control
17887
Window managers (or client programs) may choose to enforce window
17888
layout policy in various ways. When a client attempts to change the
17889
size or position of a window, the operation can be @emph{redirected}
17890
to a specified client, rather than the operation actually being
17894
Information requested by a client program is sent back to the client
17895
with a @emph{reply}. Both events and replies are multiplexed on the
17896
same connection. Most requests do not generate replies. However, some
17897
requests generate multiple replies.
17899
@item representation type
17900
The type of representation of a resource value. For example, a color
17901
value might be represented either as a namestring ("red"), a pixel
17902
value, an RGB triplet, an HSV triplet, and so on.
17905
A command to the server is called a @emph{request}. It is a single
17906
block of data sent over a connection.
17909
A value of the user interface that can be changed by the user in a
17910
resource database via CLX functions @var{add-resource},
17911
@var{get-resource}, and so forth. See server resource.
17913
@item resource class, complete
17914
See complete resource class.
17916
@item resource database
17917
Conceptually, a set of resource name/value pairs (or resource
17918
bindings). CLX defines functions for storing and retrieving interface
17919
resources from a resource database.
17921
@item resource name, complete
17922
See complete resource name.
17925
@emph{Red}, @emph{green}, and @emph{blue} intensity values used to
17926
define color. These values are always represented as 16-bit unsigned
17927
numbers, with zero being the minimum intensity and 65535 being the
17928
maximum intensity. The values are scaled by the server to match the
17932
A special composite contact used to represent an entire display
17936
Each screen has a @emph{root window} covering it. It cannot be
17937
reconfigured or unmapped, but otherwise acts as a full-fledged
17938
window. A root window has no parent.
17941
The @emph{save set} of a client is a list of other client's windows
17942
that, if they are inferiors of one of the client's windows at
17943
connection close, should not be destroyed and that should be remapped
17944
if it is unmapped. Save sets are typically used by window managers to
17945
avoid lost windows if the manager should terminate abnormally.
17948
A list of pixel or bit values viewed as a horizontal row (all values
17949
having the same y coordinate) of an image, with the values ordered by
17950
increasing x coordinate.
17952
@item scanline order
17953
An image represented in @emph{scanline order} contains scanlines
17954
ordered by increasing y coordinate.
17957
A server can provide several independent @emph{screens}, which
17958
typically have physically independent monitors. This would be the
17959
expected configuration when there is only a single keyboard and
17960
pointer shared among the screens.
17964
A @emph{selection} can be thought of as an indirect property with
17965
dynamic type. That is, rather than having the property stored in the
17966
server, it is maintained by some client (the @emph{owner}). A
17967
selection is global in nature, being thought of as belonging to the
17968
user (but maintained by clients), rather than being private to a
17969
particular window subhierarchy or a particular set of clients. When
17970
a client asks for the contents of a selection, it specifies a
17971
selection @emph{target type}. This target type can be used to
17972
control the transmitted representation of the contents.
17974
For example, if the selection is "the last thing the user clicked
17975
on" and that is currently an image, then the target type might
17976
specify whether the contents of the image should be sent in XY
17977
Format or Z Format. The target type can also be used to control the
17978
class of contents transmitted; that is, asking for the looks (fonts,
17979
line spacing, indentation, and so forth) of a paragraph selection,
17980
rather than the text of the paragraph. The target type can also be
17981
used for other purposes; the semantics is not constrained by the
17985
A condition in which a user interface component of an application will
17986
accept input. Conversely, when a contact is insensitive, events of
17987
particular types are not dispatched to the contact and are ignored.
17990
The @emph{server} provides the basic windowing mechanism. It handles
17991
IPC connections from clients, demultiplexes graphics requests onto the
17992
screens, and multiplexes input back to the appropriate clients.
17994
@item server grabbing
17995
The server can be @emph{grabbed} by a single client for exclusive
17996
use. This prevents processing of any requests from other client
17997
connections until the grab is complete. This is typically only a
17998
transient state for such things as rubber-banding and pop-up menus, or
17999
to execute requests indivisibly.
18001
@item server resource
18002
Windows, pixmaps, cursors, fonts, gcontexts, and colormaps are known
18003
as resources. They all have unique identifiers associated with them
18004
for naming purposes. The lifetime of a resource is bounded by the
18005
lifetime of the connection over which the resource was created. See
18009
A composite that handles the duties required by standard conventions
18010
for top-level X windows.
18013
Children of the same parent window are known as @emph{sibling}
18017
A degenerate case of pseudo color in which the RGB values are
18018
predefined and read-only.
18021
A degenerate case of gray scale in which the gray values are
18022
predefined and read-only. The values are typically (near-)linear
18025
@item stacking order
18026
Sibling windows can @emph{stack} on top of each other. Windows above
18027
both obscure and occlude lower windows. This is similar to paper on a
18028
desk. The relationship between sibling windows is known as the
18029
@emph{stacking order}.
18032
A slot of @var{contact} that controls the visual effect of the
18036
A bitmap that is used to tile a region to serve as an additional clip
18037
mask for a fill operation with the foreground color.
18040
A pixmap can be replicated in two dimensions to @emph{tile} a
18041
region. The pixmap itself is also known as a tile.
18044
A CLUE object that provides support for animation and other types of
18045
time-sensitive user interfaces. A timer causes @var{:timer} events to
18046
be dispatched to a specific contact for processing.
18049
A time value, expressed in milliseconds, typically since the last
18050
server reset. Timestamp values wrap around (after about 49.7
18051
days). The server, given its current time is represented by timestamp
18052
T, always interprets timestamps from clients by treating half of the
18053
timestamp space as being earlier in time than T and half of the
18054
timestamp space as being later in time than T. One timestamp value
18055
(named CurrentTime) is never generated by the server; this value is
18056
reserved for use in requests to represent the current server time.
18058
@item top-level contact
18059
A contact whose parent is a root. A top-level contact is usually a
18060
composite at the top of a hierarchy of other contacts created by an
18061
application program.
18063
@item top-level-session
18064
A subclass of @var{shell} that is used to communicate with a session
18067
@item top-level-shell
18068
A subclass of @var{shell} that provides full window manager
18071
@item transient-shell
18072
A subclass of @var{shell} that a window manager typically will unmap
18073
when its owner becomes unmapped or iconified and will not allow to be
18074
individually iconified.
18077
A degenerate case of direct color in which the subfields in the pixel
18078
value directly encode the corresponding RGB values. That is, the
18079
colormap has predefined read-only RGB values. The values are typically
18080
(near-)linear increasing ramps.
18083
An arbitrary atom used to identify the interpretation of property
18084
data. Types are completely uninterpreted by the server; they are
18085
solely for the benefit of clients.
18088
A contact that is not under geometry management control.
18090
@item user interface
18091
A set of abstract interface objects used to control the dialog between
18092
an application and its human user.
18095
A window is @emph{viewable} if it and all of its ancestors are
18096
mapped. This does not imply that any portion of the window is actually
18097
visible. Graphics requests can be performed on a window when it is not
18098
viewable, but output will not be retained unless the server is
18099
maintaining backing store.
18102
A region of a window is @emph{visible} if someone looking at the screen
18103
can actually see it; that is, the window is viewable and the region is
18104
not occluded by any other window.
18106
@item window gravity
18107
When windows are resized, subwindows can be repositioned automatically
18108
relative to some position in the window. This attraction of a subwindow
18109
to some part of its parent is known as @emph{window gravity}.
18111
@item window manager
18112
Manipulation of windows on the screen, and much of the user interface
18113
(policy) is typically provided by a @emph{window manager} client.
18115
@item window manager shell
18116
A subclass of @var{shell} called @var{wm-shell} that interacts with
18117
the window manager.
18120
The data for a pixmap is said to be in @emph{XY Format} if it is
18121
organized as a set of bitmaps representing individual bit planes, with
18122
the planes appearing from most to least significant in bit order.
18125
The data for a pixmap is said to be in @emph{Z Format} if it is
18126
organized as a set of pixel values in scanline order.
18129
@node Function Index, Type Index, Glossary, Top
18130
@appendix Function Index
18134
@node Type Index, , Function Index, Top
18135
@appendix Type Index