vc-parse-buffer: arrange for old properties to get cleared when their
[emacs.git] / src / xterm.h
blobd508eb431ba406cb4e1f09ab1b328dc0c9fa0f99
1 /* Definitions and headers for communication with X protocol.
2 Copyright (C) 1989, 1993 Free Software Foundation, Inc.
4 This file is part of GNU Emacs.
6 GNU Emacs is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
11 GNU Emacs is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with GNU Emacs; see the file COPYING. If not, write to
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
20 #ifdef HAVE_X11
21 #include <X11/Xlib.h>
22 #include <X11/cursorfont.h>
23 #include <X11/Xutil.h>
24 #include <X11/keysym.h>
25 #include <X11/Xatom.h>
26 #include <X11/Xresource.h>
27 #else
28 #include <X/Xlib.h>
29 #endif /* HAVE_X11 */
31 #ifdef USE_X_TOOLKIT
32 #include <X11/StringDefs.h>
33 #include <X11/IntrinsicP.h> /* CoreP.h needs this */
34 #include <X11/CoreP.h> /* foul, but we need this to use our own
35 window inside a widget instead of one
36 that Xt creates... */
37 #include <X11/StringDefs.h>
38 #endif
40 /* Define a queue for X-events. One such queue is used for mouse clicks.
41 Another is used for expose events. */
43 #define EVENT_BUFFER_SIZE 64
45 /* Max and Min sizes in character columns. */
46 #define MINWIDTH 10
47 #define MINHEIGHT 10
48 #define MAXWIDTH 300
49 #define MAXHEIGHT 80
51 #ifdef HAVE_X11
53 /* HAVE_X11R4 is defined if we have the features of X11R4. It should
54 be defined when we're using X11R5, since X11R5 has the features of
55 X11R4. If, in the future, we find we need more of these flags
56 (HAVE_X11R5, for example), code should always be written to test
57 the most recent flag first:
59 #ifdef HAVE_X11R5
60 ...
61 #elif HAVE_X11R4
62 ...
63 #elif HAVE_X11
64 ...
65 #endif
67 If you ever find yourself writing a "#ifdef HAVE_FOO" clause that
68 looks a lot like another one, consider moving the text into a macro
69 whose definition is configuration-dependent, but whose usage is
70 universal - like the stuff in systime.h.
72 It turns out that we can auto-detect whether we're being compiled
73 with X11R3 or X11R4 by looking for the flag macros for R4 structure
74 members that R3 doesn't have. */
75 #ifdef PBaseSize
76 /* AIX 3.1's X is somewhere between X11R3 and X11R4. It has
77 PBaseSize, but not XWithdrawWindow, XSetWMName, XSetWMNormalHints,
78 XSetWMIconName. */
79 #ifndef AIX
80 #define HAVE_X11R4
81 #endif
82 #endif
84 #ifdef XlibSpecificationRelease
85 #if XlibSpecificationRelease >= 5
86 #define HAVE_X11R5
87 #endif
88 #endif
90 #define PIX_TYPE unsigned long
91 #define XDISPLAY x_current_display,
92 #define XFlushQueue() XFlush(x_current_display)
93 #define BLACK_PIX_DEFAULT BlackPixel (x_current_display, \
94 XDefaultScreen (x_current_display))
95 #define WHITE_PIX_DEFAULT WhitePixel (x_current_display, \
96 XDefaultScreen (x_current_display))
97 #define DISPLAY_SCREEN_ARG x_current_display, \
98 XDefaultScreen (x_current_display)
99 #define DISPLAY_CELLS DisplayCells (x_current_display, XDefaultScreen (x_current_display))
100 #define ROOT_WINDOW RootWindow (x_current_display, DefaultScreen (x_current_display))
101 #define FONT_TYPE XFontStruct
102 #define Color XColor
104 #define XExposeRegionEvent XExposeEvent
105 #define Bitmap Pixmap /* In X11, Bitmaps are are kind of
106 Pixmap. */
107 #define WINDOWINFO_TYPE XWindowAttributes
108 #define XGetWindowInfo(w, i) XGetWindowAttributes (x_current_display, \
109 (w), (i))
110 #define XGetFont(f) XLoadQueryFont (x_current_display, (f))
111 #define XLoseFont(f) XFreeFont (x_current_display, (f))
112 #define XStuffPending() XPending (x_current_display)
113 #define XClear(w) XClearWindow (x_current_display, (w))
114 #define XWarpMousePointer(w,x,y) XWarpPointer (x_current_display, None, w, \
115 0,0,0,0, x, y)
116 #define XHandleError XSetErrorHandler
117 #define XHandleIOError XSetIOErrorHandler
119 #define XChangeWindowSize(w,x,y) XResizeWindow(x_current_display,w,x,y)
121 #define FONT_WIDTH(f) ((f)->max_bounds.width)
122 #define FONT_HEIGHT(f) ((f)->ascent + (f)->descent)
123 #define FONT_BASE(f) ((f)->ascent)
125 /* The mask of events that text windows always want to receive. This
126 does not include mouse movement events. It is used when the window
127 is created (in x_window) and when we ask/unask for mouse movement
128 events (in XTmouse_tracking_enable).
130 We do include ButtonReleases in this set because elisp isn't always
131 fast enough to catch them when it wants them, and they're rare
132 enough that they don't use much processor time. */
134 #define STANDARD_EVENT_SET \
135 (KeyPressMask \
136 | ExposureMask \
137 | ButtonPressMask \
138 | ButtonReleaseMask \
139 | PointerMotionMask \
140 | PointerMotionHintMask \
141 | StructureNotifyMask \
142 | FocusChangeMask \
143 | LeaveWindowMask \
144 | EnterWindowMask \
145 | VisibilityChangeMask)
147 #else /* X10 */
149 #define ConnectionNumber(dpy) dpyno()
150 #define PIX_TYPE int
151 #define XDISPLAY
152 #define XFlushQueue() XFlush()
153 #define BLACK_PIX_DEFAULT BlackPixel
154 #define WHITE_PIX_DEFAULT WhitePixel
155 #define DISPLAY_SCREEN_ARG
156 #define DISPLAY_CELLS DisplayCells ()
157 #define ROOT_WINDOW RootWindow
158 #define XFree free
159 #define FONT_TYPE FontInfo
161 #define WINDOWINFO_TYPE WindowInfo
162 #define XGetWindowInfo(w, i) XQueryWindow ((w), (i))
163 #define XGetFont(f) XOpenFont ((f))
164 #define XLoseFont(f) XCloseFont ((f))
165 #define XStuffPending() XPending ()
166 #define XWarpMousePointer(w,x,y) XWarpMouse (w,x,y)
167 #define XHandleError XErrorHandler
168 #define XHandleIOError XIOErrorHandler
170 #define FONT_WIDTH(f) ((f)->width)
171 #define FONT_HEIGHT(f) ((f)->height)
172 #define FONT_BASE(f) ((f)->base)
174 #define XChangeWindowSize(w,x,y) XChangeWindow(w,x,y)
176 #endif /* X10 */
178 struct event_queue
180 int rindex; /* Index at which to fetch next. */
181 int windex; /* Index at which to store next. */
182 XEvent xrep[EVENT_BUFFER_SIZE];
185 /* Queue for mouse clicks. */
186 extern struct event_queue x_mouse_queue;
188 /* This is the X connection that we are using. */
190 extern Display *x_current_display;
192 extern struct frame *x_window_to_frame ();
194 #ifdef USE_X_TOOLKIT
195 extern struct frame *x_any_window_to_frame ();
196 #endif
198 /* The frame (if any) which has the X window that has keyboard focus.
199 Zero if none. This is examined by Ffocus_frame in xfns.c */
201 extern struct frame *x_focus_frame;
203 #ifdef HAVE_X11
204 /* Variables associated with the X display screen this emacs is using. */
206 /* How many screens this X display has. */
207 extern int x_screen_count;
209 /* The vendor supporting this X server. */
210 extern Lisp_Object Vx_vendor;
212 /* The vendor's release number for this X server. */
213 extern int x_release;
215 /* Height of this X screen in pixels. */
216 extern int x_screen_height;
218 /* Height of this X screen in millimeters. */
219 extern int x_screen_height_mm;
221 /* Width of this X screen in pixels. */
222 extern int x_screen_width;
224 /* Width of this X screen in millimeters. */
225 extern int x_screen_width_mm;
227 /* Does this X screen do backing store? */
228 extern Lisp_Object Vx_backing_store;
230 /* Does this X screen do save-unders? */
231 extern int x_save_under;
233 /* Number of planes for this screen. */
234 extern int x_screen_planes;
236 /* X Visual type of this screen. */
237 extern Lisp_Object Vx_screen_visual;
239 #endif /* HAVE_X11 */
241 enum text_cursor_kinds {
242 filled_box_cursor, hollow_box_cursor, bar_cursor
245 /* Each X frame object points to its own struct x_display object
246 in the display.x field. The x_display structure contains all
247 the information that is specific to X windows. */
249 struct x_display
251 /* Position of the X window (x and y offsets in root window). */
252 int left_pos;
253 int top_pos;
255 /* Border width of the X window as known by the X window system. */
256 int border_width;
258 /* Size of the X window in pixels. */
259 int pixel_height, pixel_width;
261 #ifdef HAVE_X11
262 /* The tiled border used when the mouse is out of the frame. */
263 Pixmap border_tile;
265 /* Here are the Graphics Contexts for the default font. */
266 GC normal_gc; /* Normal video */
267 GC reverse_gc; /* Reverse video */
268 GC cursor_gc; /* cursor drawing */
269 #endif /* HAVE_X11 */
271 /* Width of the internal border. This is a line of background color
272 just inside the window's border. When the frame is selected,
273 a highlighting is displayed inside the internal border. */
274 int internal_border_width;
276 /* The X window used for this frame.
277 May be zero while the frame object is being created
278 and the X window has not yet been created. */
279 Window window_desc;
281 /* The X window used for the bitmap icon;
282 or 0 if we don't have a bitmap icon. */
283 Window icon_desc;
285 /* The X window that is the parent of this X window.
286 Usually but not always RootWindow. */
287 Window parent_desc;
289 #ifdef USE_X_TOOLKIT
290 /* The widget of this screen. This is the window of a "shell" widget. */
291 Widget widget;
292 /* The XmPanedWindows... */
293 Widget column_widget;
294 /* The widget of the edit portion of this screen; the window in
295 "window_desc" is inside of this. */
296 Widget edit_widget;
298 Widget menubar_widget;
299 #endif
301 /* 1 for bitmap icon, 0 for text icon. */
302 int icon_bitmap_flag;
304 FONT_TYPE *font;
306 /* Pixel values used for various purposes.
307 border_pixel may be -1 meaning use a gray tile. */
308 PIX_TYPE background_pixel;
309 PIX_TYPE foreground_pixel;
310 PIX_TYPE cursor_pixel;
311 PIX_TYPE border_pixel;
312 PIX_TYPE mouse_pixel;
313 PIX_TYPE cursor_foreground_pixel;
315 /* Descriptor for the cursor in use for this window. */
316 #ifdef HAVE_X11
317 Cursor text_cursor;
318 Cursor nontext_cursor;
319 Cursor modeline_cursor;
320 #else
321 Cursor cursor;
322 #endif
324 /* The name that was associated with the icon, the last time
325 it was refreshed. Usually the same as the name of the
326 buffer in the currently selected window in the frame */
327 char *icon_label;
329 /* Flag to set when the X window needs to be completely repainted. */
330 int needs_exposure;
332 /* What kind of text cursor is drawn in this window right now?
333 (If there is no cursor (phys_cursor_x < 0), then this means nothing.) */
334 enum text_cursor_kinds current_cursor;
336 /* What kind of text cursor should we draw in the future?
337 This should always be filled_box_cursor or bar_cursor. */
338 enum text_cursor_kinds desired_cursor;
340 /* These are the current window manager hints. It seems that
341 XSetWMHints, when presented with an unset bit in the `flags'
342 member of the hints structure, does not leave the corresponding
343 attribute unchanged; rather, it resets that attribute to its
344 default value. For example, unless you set the `icon_pixmap'
345 field and the `IconPixmapHint' bit, XSetWMHints will forget what
346 your icon pixmap was. This is rather troublesome, since some of
347 the members (for example, `input' and `icon_pixmap') want to stay
348 the same throughout the execution of Emacs. So, we keep this
349 structure around, just leaving values in it and adding new bits
350 to the mask as we go. */
351 XWMHints wm_hints;
353 /* The size of the extra width currently allotted for vertical
354 scroll bars, in pixels. */
355 int vertical_scroll_bar_extra;
357 /* Table of parameter faces for this frame. Any X resources (pixel
358 values, fonts) referred to here have been allocated explicitly
359 for this face, and should be freed if we change the face. */
360 struct face **param_faces;
361 int n_param_faces;
363 /* Table of computed faces for this frame. These are the faces
364 whose indexes go into the upper bits of a glyph, computed by
365 combining the parameter faces specified by overlays, text
366 properties, and what have you. The X resources mentioned here
367 are all shared with parameter faces. */
368 struct face **computed_faces;
369 int n_computed_faces; /* How many are valid */
370 int size_computed_faces; /* How many are allocated */
373 /* Get at the computed faces of an X window frame. */
374 #define FRAME_PARAM_FACES(f) ((f)->display.x->param_faces)
375 #define FRAME_N_PARAM_FACES(f) ((f)->display.x->n_param_faces)
376 #define FRAME_DEFAULT_PARAM_FACE(f) (FRAME_PARAM_FACES (f)[0])
377 #define FRAME_MODE_LINE_PARAM_FACE(f) (FRAME_PARAM_FACES (f)[1])
379 #define FRAME_COMPUTED_FACES(f) ((f)->display.x->computed_faces)
380 #define FRAME_N_COMPUTED_FACES(f) ((f)->display.x->n_computed_faces)
381 #define FRAME_SIZE_COMPUTED_FACES(f) ((f)->display.x->size_computed_faces)
382 #define FRAME_DEFAULT_FACE(f) ((f)->display.x->computed_faces[0])
383 #define FRAME_MODE_LINE_FACE(f) ((f)->display.x->computed_faces[1])
385 /* Return the window associated with the frame F. */
386 #define FRAME_X_WINDOW(f) ((f)->display.x->window_desc)
388 /* These two really ought to be called FRAME_PIXEL_{WIDTH,HEIGHT}. */
389 #define PIXEL_WIDTH(f) ((f)->display.x->pixel_width)
390 #define PIXEL_HEIGHT(f) ((f)->display.x->pixel_height)
392 #define FRAME_DESIRED_CURSOR(f) ((f)->display.x->desired_cursor)
395 /* When X windows are used, a glyph may be a 16 bit unsigned datum.
396 The high order byte is the face number and is used as an index
397 in the face table. A face is a font plus:
398 1) the unhighlighted foreground color,
399 2) the unhighlighted background color.
400 For highlighting, the two colors are exchanged.
401 Face number 0 is unused. The low order byte of a glyph gives
402 the character within the font. All fonts are assumed to be
403 fixed width, and to have the same height and width. */
405 #ifdef HAVE_X11
407 /* Face declared in dispextern.h */
409 #else /* X10 */
411 struct face
413 FONT_TYPE *font; /* Font info for specified font. */
414 int fg; /* Unhighlighted foreground. */
415 int bg; /* Unhighlighted background. */
417 #endif /* X10 */
419 #define MAX_FACES_AND_GLYPHS 256
420 extern struct face *x_face_table[];
423 /* X-specific scroll bar stuff. */
425 /* We represent scroll bars as lisp vectors. This allows us to place
426 references to them in windows without worrying about whether we'll
427 end up with windows referring to dead scroll bars; the garbage
428 collector will free it when its time comes.
430 We use struct scroll_bar as a template for accessing fields of the
431 vector. */
433 struct scroll_bar {
435 /* These fields are shared by all vectors. */
436 int size_from_Lisp_Vector_struct;
437 struct Lisp_Vector *next_from_Lisp_Vector_struct;
439 /* The window we're a scroll bar for. */
440 Lisp_Object window;
442 /* The next and previous in the chain of scroll bars in this frame. */
443 Lisp_Object next, prev;
445 /* The X window representing this scroll bar. Since this is a full
446 32-bit quantity, we store it split into two 32-bit values. */
447 Lisp_Object x_window_low, x_window_high;
449 /* The position and size of the scroll bar in pixels, relative to the
450 frame. */
451 Lisp_Object top, left, width, height;
453 /* The starting and ending positions of the handle, relative to the
454 handle area (i.e. zero is the top position, not
455 SCROLL_BAR_TOP_BORDER). If they're equal, that means the handle
456 hasn't been drawn yet.
458 These are not actually the locations where the beginning and end
459 are drawn; in order to keep handles from becoming invisible when
460 editing large files, we establish a minimum height by always
461 drawing handle bottoms VERTICAL_SCROLL_BAR_MIN_HANDLE pixels below
462 where they would be normally; the bottom and top are in a
463 different co-ordinate system. */
464 Lisp_Object start, end;
466 /* If the scroll bar handle is currently being dragged by the user,
467 this is the number of pixels from the top of the handle to the
468 place where the user grabbed it. If the handle isn't currently
469 being dragged, this is Qnil. */
470 Lisp_Object dragging;
473 /* The number of elements a vector holding a struct scroll_bar needs. */
474 #define SCROLL_BAR_VEC_SIZE \
475 ((sizeof (struct scroll_bar) - sizeof (int) - sizeof (struct Lisp_Vector *)) \
476 / sizeof (Lisp_Object))
478 /* Turning a lisp vector value into a pointer to a struct scroll_bar. */
479 #define XSCROLL_BAR(vec) ((struct scroll_bar *) XPNTR (vec))
482 /* Building a 32-bit C integer from two 16-bit lisp integers. */
483 #define SCROLL_BAR_PACK(low, high) (XINT (high) << 16 | XINT (low))
485 /* Setting two lisp integers to the low and high words of a 32-bit C int. */
486 #define SCROLL_BAR_UNPACK(low, high, int32) \
487 (XSET ((low), Lisp_Int, (int32) & 0xffff), \
488 XSET ((high), Lisp_Int, ((int32) >> 16) & 0xffff))
491 /* Extract the X window id of the scroll bar from a struct scroll_bar. */
492 #define SCROLL_BAR_X_WINDOW(ptr) \
493 ((Window) SCROLL_BAR_PACK ((ptr)->x_window_low, (ptr)->x_window_high))
495 /* Store a window id in a struct scroll_bar. */
496 #define SET_SCROLL_BAR_X_WINDOW(ptr, id) \
497 (SCROLL_BAR_UNPACK ((ptr)->x_window_low, (ptr)->x_window_high, (int) id))
500 /* Return the outside pixel width for a vertical scroll bar on frame F. */
501 #define VERTICAL_SCROLL_BAR_PIXEL_WIDTH(f) (2*FONT_WIDTH ((f)->display.x->font))
503 /* Return the outside pixel height for a vertical scroll bar HEIGHT
504 rows high on frame F. */
505 #define VERTICAL_SCROLL_BAR_PIXEL_HEIGHT(f, height) \
506 ((height) * FONT_HEIGHT ((f)->display.x->font))
508 /* Return the inside width of a vertical scroll bar, given the outside
509 width. */
510 #define VERTICAL_SCROLL_BAR_INSIDE_WIDTH(width) \
511 ((width) - VERTICAL_SCROLL_BAR_LEFT_BORDER - VERTICAL_SCROLL_BAR_RIGHT_BORDER)
513 /* Return the length of the rectangle within which the top of the
514 handle must stay. This isn't equivalent to the inside height,
515 because the scroll bar handle has a minimum height.
517 This is the real range of motion for the scroll bar, so when we're
518 scaling buffer positions to scroll bar positions, we use this, not
519 VERTICAL_SCROLL_BAR_INSIDE_HEIGHT. */
520 #define VERTICAL_SCROLL_BAR_TOP_RANGE(height) \
521 (VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (height) - VERTICAL_SCROLL_BAR_MIN_HANDLE)
523 /* Return the inside height of vertical scroll bar, given the outside
524 height. See VERTICAL_SCROLL_BAR_TOP_RANGE too. */
525 #define VERTICAL_SCROLL_BAR_INSIDE_HEIGHT(height) \
526 ((height) - VERTICAL_SCROLL_BAR_TOP_BORDER - VERTICAL_SCROLL_BAR_BOTTOM_BORDER)
529 /* Border widths for scroll bars.
531 Scroll bar windows don't have any X borders; their border width is
532 set to zero, and we redraw borders ourselves. This makes the code
533 a bit cleaner, since we don't have to convert between outside width
534 (used when relating to the rest of the screen) and inside width
535 (used when sizing and drawing the scroll bar window itself).
537 The handle moves up and down/back and forth in a rectangle inset
538 from the edges of the scroll bar. These are widths by which we
539 inset the handle boundaries from the scroll bar edges. */
540 #define VERTICAL_SCROLL_BAR_LEFT_BORDER (2)
541 #define VERTICAL_SCROLL_BAR_RIGHT_BORDER (3)
542 #define VERTICAL_SCROLL_BAR_TOP_BORDER (2)
543 #define VERTICAL_SCROLL_BAR_BOTTOM_BORDER (2)
545 /* Minimum lengths for scroll bar handles, in pixels. */
546 #define VERTICAL_SCROLL_BAR_MIN_HANDLE (5)
549 /* Manipulating pixel sizes and character sizes.
550 Knowledge of which factors affect the overall size of the window should
551 be hidden in these macros, if that's possible.
553 /* Return the upper/left pixel position of the character cell on frame F
554 at ROW/COL. */
555 #define CHAR_TO_PIXEL_ROW(f, row) \
556 ((f)->display.x->internal_border_width \
557 + (row) * FONT_HEIGHT ((f)->display.x->font))
558 #define CHAR_TO_PIXEL_COL(f, col) \
559 ((f)->display.x->internal_border_width \
560 + (col) * FONT_WIDTH ((f)->display.x->font))
562 /* Return the pixel width/height of frame F if it has
563 WIDTH columns/HEIGHT rows. */
564 #define CHAR_TO_PIXEL_WIDTH(f, width) \
565 (CHAR_TO_PIXEL_COL (f, width) \
566 + (f)->display.x->vertical_scroll_bar_extra \
567 + (f)->display.x->internal_border_width)
568 #define CHAR_TO_PIXEL_HEIGHT(f, height) \
569 (CHAR_TO_PIXEL_ROW (f, height) \
570 + (f)->display.x->internal_border_width)
573 /* Return the row/column (zero-based) of the character cell containing
574 the pixel on FRAME at ROW/COL. */
575 #define PIXEL_TO_CHAR_ROW(f, row) \
576 (((row) - (f)->display.x->internal_border_width) \
577 / FONT_HEIGHT ((f)->display.x->font))
578 #define PIXEL_TO_CHAR_COL(f, col) \
579 (((col) - (f)->display.x->internal_border_width) \
580 / FONT_WIDTH ((f)->display.x->font))
582 /* How many columns/rows of text can we fit in WIDTH/HEIGHT pixels on
583 frame F? */
584 #define PIXEL_TO_CHAR_WIDTH(f, width) \
585 (PIXEL_TO_CHAR_COL (f, ((width) \
586 - (f)->display.x->internal_border_width \
587 - (f)->display.x->vertical_scroll_bar_extra)))
588 #define PIXEL_TO_CHAR_HEIGHT(f, height) \
589 (PIXEL_TO_CHAR_ROW (f, ((height) \
590 - (f)->display.x->internal_border_width)))
592 /* If a struct input_event has a kind which is selection_request_event
593 or selection_clear_event, then its contents are really described
594 by this structure. */
596 /* For an event of kind selection_request_event,
597 this structure really describes the contents. */
598 struct selection_input_event
600 int kind;
601 Display *display;
602 Window requestor;
603 Atom selection, target, property;
604 Time time;
607 #define SELECTION_EVENT_DISPLAY(eventp) \
608 (((struct selection_input_event *) (eventp))->display)
609 #define SELECTION_EVENT_REQUESTOR(eventp) \
610 (((struct selection_input_event *) (eventp))->requestor)
611 #define SELECTION_EVENT_SELECTION(eventp) \
612 (((struct selection_input_event *) (eventp))->selection)
613 #define SELECTION_EVENT_TARGET(eventp) \
614 (((struct selection_input_event *) (eventp))->target)
615 #define SELECTION_EVENT_PROPERTY(eventp) \
616 (((struct selection_input_event *) (eventp))->property)
617 #define SELECTION_EVENT_TIME(eventp) \
618 (((struct selection_input_event *) (eventp))->time)
621 /* Interface to the face code functions. */
623 /* Create the first two computed faces for a frame -- the ones that
624 have GC's. */
625 extern void init_frame_faces (/* FRAME_PTR */);
627 /* Free the resources for the faces associated with a frame. */
628 extern void free_frame_faces (/* FRAME_PTR */);
630 /* Given a computed face, find or make an equivalent display face
631 in face_vector, and return a pointer to it. */
632 extern struct face *intern_face (/* FRAME_PTR, struct face * */);
634 /* Given a frame and a face name, return the face's ID number, or
635 zero if it isn't a recognized face name. */
636 extern int face_name_id_number (/* FRAME_PTR, Lisp_Object */);
638 /* Return non-zero if FONT1 and FONT2 have the same size bounding box.
639 We assume that they're both character-cell fonts. */
640 extern int same_size_fonts (/* XFontStruct *, XFontStruct * */);
642 /* Recompute the GC's for the default and modeline faces.
643 We call this after changing frame parameters on which those GC's
644 depend. */
645 extern void recompute_basic_faces (/* FRAME_PTR */);
647 /* Return the face ID associated with a buffer position POS. Store
648 into *ENDPTR the next position at which a different face is
649 needed. This does not take account of glyphs that specify their
650 own face codes. F is the frame in use for display, and W is a
651 window displaying the current buffer.
653 REGION_BEG, REGION_END delimit the region, so it can be highlighted. */
654 extern int compute_char_face (/* FRAME_PTR frame,
655 struct window *w,
656 int pos,
657 int region_beg, int region_end,
658 int *endptr */);
659 /* Return the face ID to use to display a special glyph which selects
660 FACE_CODE as the face ID, assuming that ordinarily the face would
661 be BASIC_FACE. F is the frame. */
662 extern int compute_glyph_face (/* FRAME_PTR, int */);