Put interrupt input blocking in a separate file from xterm.h.
[bpt/emacs.git] / src / xterm.h
CommitLineData
3f930d20 1/* Definitions and headers for communication with X protocol.
4e027793 2 Copyright (C) 1989, 1993 Free Software Foundation, Inc.
3f930d20
JB
3
4This file is part of GNU Emacs.
5
6GNU Emacs is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
4e027793 8the Free Software Foundation; either version 2, or (at your option)
3f930d20
JB
9any later version.
10
11GNU Emacs is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Emacs; see the file COPYING. If not, write to
18the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
19
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 */
30
31/* Define a queue for X-events. One such queue is used for mouse clicks.
32 Another is used for expose events. */
33
34#define EVENT_BUFFER_SIZE 64
35
3f930d20
JB
36/* Max and Min sizes in character columns. */
37#define MINWIDTH 10
38#define MINHEIGHT 10
39#define MAXWIDTH 300
40#define MAXHEIGHT 80
41
42#ifdef HAVE_X11
ef15f270 43
d2729198
JB
44/* HAVE_X11R4 is defined if we have the features of X11R4. It should
45 be defined when we're using X11R5, since X11R5 has the features of
46 X11R4. If, in the future, we find we need more of these flags
47 (HAVE_X11R5, for example), code should always be written to test
48 the most recent flag first:
49
50 #ifdef HAVE_X11R5
51 ...
52 #elif HAVE_X11R4
53 ...
54 #elif HAVE_X11
55 ...
56 #endif
57
58 If you ever find yourself writing a "#ifdef HAVE_FOO" clause that
59 looks a lot like another one, consider moving the text into a macro
60 whose definition is configuration-dependent, but whose usage is
61 universal - like the stuff in systime.h.
62
63 It turns out that we can auto-detect whether we're being compiled
ef15f270
JB
64 with X11R3 or X11R4 by looking for the flag macros for R4 structure
65 members that R3 doesn't have. */
66#ifdef PBaseSize
67#define HAVE_X11R4
68#endif
69
6bde6341
JB
70#ifdef XlibSpecificationRelease
71#if XlibSpecificationRelease >= 5
72#define HAVE_X11R5
73#endif
74#endif
75
3f930d20
JB
76#define PIX_TYPE unsigned long
77#define XDISPLAY x_current_display,
78#define XFlushQueue() XFlush(x_current_display)
79#define BLACK_PIX_DEFAULT BlackPixel (x_current_display, \
80 XDefaultScreen (x_current_display))
81#define WHITE_PIX_DEFAULT WhitePixel (x_current_display, \
82 XDefaultScreen (x_current_display))
83#define DISPLAY_SCREEN_ARG x_current_display, \
84 XDefaultScreen (x_current_display)
85#define DISPLAY_CELLS DisplayCells (x_current_display, XDefaultScreen (x_current_display))
bbe42033 86#define ROOT_WINDOW RootWindow (x_current_display, DefaultScreen (x_current_display))
3f930d20
JB
87#define FONT_TYPE XFontStruct
88#define Color XColor
89
90#define XExposeRegionEvent XExposeEvent
91#define Bitmap Pixmap /* In X11, Bitmaps are are kind of
92 Pixmap. */
93#define WINDOWINFO_TYPE XWindowAttributes
94#define XGetWindowInfo(w, i) XGetWindowAttributes (x_current_display, \
95 (w), (i))
96#define XGetFont(f) XLoadQueryFont (x_current_display, (f))
97#define XLoseFont(f) XFreeFont (x_current_display, (f))
98#define XStuffPending() XPending (x_current_display)
99#define XClear(w) XClearWindow (x_current_display, (w))
100#define XWarpMousePointer(w,x,y) XWarpPointer (x_current_display, None, w, \
101 0,0,0,0, x, y)
102#define XHandleError XSetErrorHandler
103#define XHandleIOError XSetIOErrorHandler
104
105#define XChangeWindowSize(w,x,y) XResizeWindow(x_current_display,w,x,y)
106
107#define FONT_WIDTH(f) ((f)->max_bounds.width)
108#define FONT_HEIGHT(f) ((f)->ascent + (f)->descent)
109#define FONT_BASE(f) ((f)->ascent)
110
3f930d20 111/* The mask of events that text windows always want to receive. This
8828b393
JB
112 does not include mouse movement events. It is used when the window
113 is created (in x_window) and when we ask/unask for mouse movement
114 events (in XTmouse_tracking_enable).
115
116 We do include ButtonReleases in this set because elisp isn't always
117 fast enough to catch them when it wants them, and they're rare
118 enough that they don't use much processor time. */
3f930d20
JB
119
120#define STANDARD_EVENT_SET \
121 (KeyPressMask \
122 | ExposureMask \
123 | ButtonPressMask \
8828b393
JB
124 | ButtonReleaseMask \
125 | PointerMotionMask \
126 | PointerMotionHintMask \
3f930d20
JB
127 | StructureNotifyMask \
128 | FocusChangeMask \
129 | LeaveWindowMask \
130 | EnterWindowMask \
131 | VisibilityChangeMask)
132
133#else /* X10 */
134
135#define ConnectionNumber(dpy) dpyno()
136#define PIX_TYPE int
137#define XDISPLAY
138#define XFlushQueue() XFlush()
139#define BLACK_PIX_DEFAULT BlackPixel
140#define WHITE_PIX_DEFAULT WhitePixel
141#define DISPLAY_SCREEN_ARG
142#define DISPLAY_CELLS DisplayCells ()
143#define ROOT_WINDOW RootWindow
144#define XFree free
145#define FONT_TYPE FontInfo
146
147#define WINDOWINFO_TYPE WindowInfo
148#define XGetWindowInfo(w, i) XQueryWindow ((w), (i))
149#define XGetFont(f) XOpenFont ((f))
150#define XLoseFont(f) XCloseFont ((f))
151#define XStuffPending() XPending ()
152#define XWarpMousePointer(w,x,y) XWarpMouse (w,x,y)
153#define XHandleError XErrorHandler
154#define XHandleIOError XIOErrorHandler
155
156#define FONT_WIDTH(f) ((f)->width)
157#define FONT_HEIGHT(f) ((f)->height)
158#define FONT_BASE(f) ((f)->base)
159
160#define XChangeWindowSize(w,x,y) XChangeWindow(w,x,y)
161
162#endif /* X10 */
163
164struct event_queue
165 {
166 int rindex; /* Index at which to fetch next. */
167 int windex; /* Index at which to store next. */
168 XEvent xrep[EVENT_BUFFER_SIZE];
169 };
170
171/* Queue for mouse clicks. */
172extern struct event_queue x_mouse_queue;
173
3f930d20
JB
174/* This is the X connection that we are using. */
175
176extern Display *x_current_display;
177
f676886a 178extern struct frame *x_window_to_frame ();
3f930d20 179
f676886a
JB
180/* The frame (if any) which has the X window that has keyboard focus.
181 Zero if none. This is examined by Ffocus_frame in xfns.c */
3f930d20 182
f802f8e0 183extern struct frame *x_focus_frame;
3f930d20
JB
184
185#ifdef HAVE_X11
186/* Variables associated with the X display screen this emacs is using. */
187
188/* How many screens this X display has. */
259c5af9 189extern int x_screen_count;
3f930d20
JB
190
191/* The vendor supporting this X server. */
192extern Lisp_Object Vx_vendor;
193
194/* The vendor's release number for this X server. */
259c5af9 195extern int x_release;
3f930d20
JB
196
197/* Height of this X screen in pixels. */
259c5af9 198extern int x_screen_height;
3f930d20
JB
199
200/* Height of this X screen in millimeters. */
259c5af9 201extern int x_screen_height_mm;
3f930d20
JB
202
203/* Width of this X screen in pixels. */
259c5af9 204extern int x_screen_width;
3f930d20
JB
205
206/* Width of this X screen in millimeters. */
259c5af9 207extern int x_screen_width_mm;
3f930d20
JB
208
209/* Does this X screen do backing store? */
210extern Lisp_Object Vx_backing_store;
211
212/* Does this X screen do save-unders? */
259c5af9 213extern int x_save_under;
3f930d20
JB
214
215/* Number of planes for this screen. */
259c5af9 216extern int x_screen_planes;
3f930d20
JB
217
218/* X Visual type of this screen. */
219extern Lisp_Object Vx_screen_visual;
220
221#endif /* HAVE_X11 */
222\f
223enum text_cursor_kinds {
224 filled_box_cursor, hollow_box_cursor, bar_cursor
225};
226
f676886a 227/* Each X frame object points to its own struct x_display object
3f930d20
JB
228 in the display.x field. The x_display structure contains all
229 the information that is specific to X windows. */
230
231struct x_display
232{
233 /* Position of the X window (x and y offsets in root window). */
234 int left_pos;
235 int top_pos;
236
237 /* Border width of the X window as known by the X window system. */
238 int border_width;
239
240 /* Size of the X window in pixels. */
241 int pixel_height, pixel_width;
242
243#ifdef HAVE_X11
f676886a 244 /* The tiled border used when the mouse is out of the frame. */
3f930d20
JB
245 Pixmap border_tile;
246
247 /* Here are the Graphics Contexts for the default font. */
248 GC normal_gc; /* Normal video */
249 GC reverse_gc; /* Reverse video */
250 GC cursor_gc; /* cursor drawing */
251#endif /* HAVE_X11 */
252
253 /* Width of the internal border. This is a line of background color
f676886a 254 just inside the window's border. When the frame is selected,
3f930d20
JB
255 a highlighting is displayed inside the internal border. */
256 int internal_border_width;
257
f676886a
JB
258 /* The X window used for this frame.
259 May be zero while the frame object is being created
3f930d20
JB
260 and the X window has not yet been created. */
261 Window window_desc;
262
263 /* The X window used for the bitmap icon;
264 or 0 if we don't have a bitmap icon. */
265 Window icon_desc;
266
267 /* The X window that is the parent of this X window.
268 Usually but not always RootWindow. */
269 Window parent_desc;
270
271 /* 1 for bitmap icon, 0 for text icon. */
272 int icon_bitmap_flag;
273
274 FONT_TYPE *font;
275
276 /* Pixel values used for various purposes.
277 border_pixel may be -1 meaning use a gray tile. */
278 PIX_TYPE background_pixel;
279 PIX_TYPE foreground_pixel;
280 PIX_TYPE cursor_pixel;
281 PIX_TYPE border_pixel;
282 PIX_TYPE mouse_pixel;
283
3f930d20
JB
284 /* Descriptor for the cursor in use for this window. */
285#ifdef HAVE_X11
286 Cursor text_cursor;
287 Cursor nontext_cursor;
288 Cursor modeline_cursor;
289#else
290 Cursor cursor;
291#endif
292
293 /* The name that was associated with the icon, the last time
294 it was refreshed. Usually the same as the name of the
f676886a 295 buffer in the currently selected window in the frame */
3f930d20
JB
296 char *icon_label;
297
298 /* Flag to set when the X window needs to be completely repainted. */
299 int needs_exposure;
300
dbc4e1c1
JB
301 /* What kind of text cursor is drawn in this window right now?
302 (If there is no cursor (phys_cursor_x < 0), then this means nothing.) */
303 enum text_cursor_kinds current_cursor;
304
305 /* What kind of text cursor should we draw in the future?
306 This should always be filled_box_cursor or bar_cursor. */
307 enum text_cursor_kinds desired_cursor;
ef15f270
JB
308
309 /* These are the current window manager hints. It seems that
310 XSetWMHints, when presented with an unset bit in the `flags'
311 member of the hints structure, does not leave the corresponding
312 attribute unchanged; rather, it resets that attribute to its
313 default value. For example, unless you set the `icon_pixmap'
314 field and the `IconPixmapHint' bit, XSetWMHints will forget what
315 your icon pixmap was. This is rather troublesome, since some of
316 the members (for example, `input' and `icon_pixmap') want to stay
317 the same throughout the execution of Emacs. So, we keep this
318 structure around, just leaving values in it and adding new bits
319 to the mask as we go. */
320 XWMHints wm_hints;
c8e3cbe0 321
c8e3cbe0 322 /* The size of the extra width currently allotted for vertical
a3c87d4e
JB
323 scroll bars, in pixels. */
324 int vertical_scroll_bar_extra;
13bd51a5
RS
325
326 /* Table of faces for this frame. */
327 struct face **faces;
328 /* Length of that table. */
329 int n_faces;
3f930d20 330};
d2729198 331
13bd51a5
RS
332/* Get at the faces of an X window frame. */
333#define FRAME_FACES(f) ((f)->display.x->faces)
334#define FRAME_N_FACES(f) ((f)->display.x->n_faces)
335#define FRAME_DEFAULT_FACE(f) ((f)->display.x->faces[0])
336#define FRAME_MODE_LINE_FACE(f) ((f)->display.x->faces[1])
337
d2729198
JB
338/* Return the window associated with the frame F. */
339#define FRAME_X_WINDOW(f) ((f)->display.x->window_desc)
340
dbc4e1c1
JB
341/* These two really ought to be called FRAME_PIXEL_{WIDTH,HEIGHT}. */
342#define PIXEL_WIDTH(f) ((f)->display.x->pixel_width)
343#define PIXEL_HEIGHT(f) ((f)->display.x->pixel_height)
344
345#define FRAME_DESIRED_CURSOR(f) ((f)->display.x->desired_cursor)
346
3f930d20 347\f
13bd51a5 348/* When X windows are used, a glyph may be a 16 bit unsigned datum.
3f930d20
JB
349 The high order byte is the face number and is used as an index
350 in the face table. A face is a font plus:
351 1) the unhighlighted foreground color,
352 2) the unhighlighted background color.
353 For highlighting, the two colors are exchanged.
13bd51a5 354 Face number 0 is unused. The low order byte of a glyph gives
3f930d20
JB
355 the character within the font. All fonts are assumed to be
356 fixed width, and to have the same height and width. */
357
358#ifdef HAVE_X11
3f930d20 359
9d46c2e6 360/* Face declared in dispextern.h */
3f930d20
JB
361
362#else /* X10 */
363
364struct face
365{
366 FONT_TYPE *font; /* Font info for specified font. */
367 int fg; /* Unhighlighted foreground. */
368 int bg; /* Unhighlighted background. */
369};
370#endif /* X10 */
371
372#define MAX_FACES_AND_GLYPHS 256
373extern struct face *x_face_table[];
c8e3cbe0
JB
374
375\f
a3c87d4e 376/* X-specific scroll bar stuff. */
c8e3cbe0 377
a3c87d4e 378/* We represent scroll bars as lisp vectors. This allows us to place
4e027793 379 references to them in windows without worrying about whether we'll
a3c87d4e 380 end up with windows referring to dead scroll bars; the garbage
4e027793
JB
381 collector will free it when its time comes.
382
a3c87d4e 383 We use struct scroll_bar as a template for accessing fields of the
4e027793
JB
384 vector. */
385
a3c87d4e 386struct scroll_bar {
c8e3cbe0 387
4e027793
JB
388 /* These fields are shared by all vectors. */
389 int size_from_Lisp_Vector_struct;
390 struct Lisp_Vector *next_from_Lisp_Vector_struct;
391
a3c87d4e 392 /* The window we're a scroll bar for. */
4e027793 393 Lisp_Object window;
c8e3cbe0 394
a3c87d4e 395 /* The next and previous in the chain of scroll bars in this frame. */
4e027793 396 Lisp_Object next, prev;
c8e3cbe0 397
a3c87d4e 398 /* The X window representing this scroll bar. Since this is a full
4e027793
JB
399 32-bit quantity, we store it split into two 32-bit values. */
400 Lisp_Object x_window_low, x_window_high;
c8e3cbe0 401
a3c87d4e 402 /* The position and size of the scroll bar in pixels, relative to the
c8e3cbe0 403 frame. */
4e027793 404 Lisp_Object top, left, width, height;
c8e3cbe0 405
4e027793
JB
406 /* The starting and ending positions of the handle, relative to the
407 handle area (i.e. zero is the top position, not
a3c87d4e 408 SCROLL_BAR_TOP_BORDER). If they're equal, that means the handle
4e027793 409 hasn't been drawn yet.
c8e3cbe0 410
4e027793
JB
411 These are not actually the locations where the beginning and end
412 are drawn; in order to keep handles from becoming invisible when
413 editing large files, we establish a minimum height by always
a3c87d4e 414 drawing handle bottoms VERTICAL_SCROLL_BAR_MIN_HANDLE pixels below
4e027793
JB
415 where they would be normally; the bottom and top are in a
416 different co-ordinate system. */
417 Lisp_Object start, end;
c8e3cbe0 418
a3c87d4e 419 /* If the scroll bar handle is currently being dragged by the user,
c8e3cbe0
JB
420 this is the number of pixels from the top of the handle to the
421 place where the user grabbed it. If the handle isn't currently
4e027793
JB
422 being dragged, this is Qnil. */
423 Lisp_Object dragging;
c8e3cbe0
JB
424};
425
a3c87d4e
JB
426/* The number of elements a vector holding a struct scroll_bar needs. */
427#define SCROLL_BAR_VEC_SIZE \
428 ((sizeof (struct scroll_bar) - sizeof (int) - sizeof (struct Lisp_Vector *)) \
4e027793
JB
429 / sizeof (Lisp_Object))
430
a3c87d4e
JB
431/* Turning a lisp vector value into a pointer to a struct scroll_bar. */
432#define XSCROLL_BAR(vec) ((struct scroll_bar *) XPNTR (vec))
4e027793
JB
433
434
435/* Building a 32-bit C integer from two 16-bit lisp integers. */
a3c87d4e 436#define SCROLL_BAR_PACK(low, high) (XINT (high) << 16 | XINT (low))
4e027793
JB
437
438/* Setting two lisp integers to the low and high words of a 32-bit C int. */
a3c87d4e 439#define SCROLL_BAR_UNPACK(low, high, int32) \
4e027793
JB
440 (XSET ((low), Lisp_Int, (int32) & 0xffff), \
441 XSET ((high), Lisp_Int, ((int32) >> 16) & 0xffff))
442
443
a3c87d4e
JB
444/* Extract the X window id of the scroll bar from a struct scroll_bar. */
445#define SCROLL_BAR_X_WINDOW(ptr) \
446 ((Window) SCROLL_BAR_PACK ((ptr)->x_window_low, (ptr)->x_window_high))
4e027793 447
a3c87d4e
JB
448/* Store a window id in a struct scroll_bar. */
449#define SET_SCROLL_BAR_X_WINDOW(ptr, id) \
450 (SCROLL_BAR_UNPACK ((ptr)->x_window_low, (ptr)->x_window_high, (int) id))
4e027793
JB
451
452
a3c87d4e
JB
453/* Return the outside pixel width for a vertical scroll bar on frame F. */
454#define VERTICAL_SCROLL_BAR_PIXEL_WIDTH(f) (2*FONT_WIDTH ((f)->display.x->font))
c8e3cbe0 455
a3c87d4e 456/* Return the outside pixel height for a vertical scroll bar HEIGHT
c8e3cbe0 457 rows high on frame F. */
a3c87d4e 458#define VERTICAL_SCROLL_BAR_PIXEL_HEIGHT(f, height) \
c8e3cbe0
JB
459 ((height) * FONT_HEIGHT ((f)->display.x->font))
460
a3c87d4e 461/* Return the inside width of a vertical scroll bar, given the outside
4e027793 462 width. */
a3c87d4e
JB
463#define VERTICAL_SCROLL_BAR_INSIDE_WIDTH(width) \
464 ((width) - VERTICAL_SCROLL_BAR_LEFT_BORDER - VERTICAL_SCROLL_BAR_RIGHT_BORDER)
c8e3cbe0 465
4e027793
JB
466/* Return the length of the rectangle within which the top of the
467 handle must stay. This isn't equivalent to the inside height,
a3c87d4e 468 because the scroll bar handle has a minimum height.
4e027793 469
a3c87d4e
JB
470 This is the real range of motion for the scroll bar, so when we're
471 scaling buffer positions to scroll bar positions, we use this, not
472 VERTICAL_SCROLL_BAR_INSIDE_HEIGHT. */
473#define VERTICAL_SCROLL_BAR_TOP_RANGE(height) \
474 (VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (height) - VERTICAL_SCROLL_BAR_MIN_HANDLE)
4e027793 475
a3c87d4e
JB
476/* Return the inside height of vertical scroll bar, given the outside
477 height. See VERTICAL_SCROLL_BAR_TOP_RANGE too. */
478#define VERTICAL_SCROLL_BAR_INSIDE_HEIGHT(height) \
479 ((height) - VERTICAL_SCROLL_BAR_TOP_BORDER - VERTICAL_SCROLL_BAR_BOTTOM_BORDER)
4e027793
JB
480
481
a3c87d4e 482/* Border widths for scroll bars.
4e027793 483
a3c87d4e 484 Scroll bar windows don't have any X borders; their border width is
4e027793
JB
485 set to zero, and we redraw borders ourselves. This makes the code
486 a bit cleaner, since we don't have to convert between outside width
487 (used when relating to the rest of the screen) and inside width
a3c87d4e 488 (used when sizing and drawing the scroll bar window itself).
4e027793
JB
489
490 The handle moves up and down/back and forth in a rectange inset
a3c87d4e
JB
491 from the edges of the scroll bar. These are widths by which we
492 inset the handle boundaries from the scroll bar edges. */
493#define VERTICAL_SCROLL_BAR_LEFT_BORDER (2)
494#define VERTICAL_SCROLL_BAR_RIGHT_BORDER (3)
495#define VERTICAL_SCROLL_BAR_TOP_BORDER (2)
496#define VERTICAL_SCROLL_BAR_BOTTOM_BORDER (2)
4e027793 497
a3c87d4e
JB
498/* Minimum lengths for scroll bar handles, in pixels. */
499#define VERTICAL_SCROLL_BAR_MIN_HANDLE (5)
c8e3cbe0
JB
500
501\f
502/* Manipulating pixel sizes and character sizes.
503 Knowledge of which factors affect the overall size of the window should
504 be hidden in these macros, if that's possible.
505
4e027793
JB
506/* Return the upper/left pixel position of the character cell on frame F
507 at ROW/COL. */
508#define CHAR_TO_PIXEL_ROW(f, row) \
509 ((f)->display.x->internal_border_width \
510 + (row) * FONT_HEIGHT ((f)->display.x->font))
511#define CHAR_TO_PIXEL_COL(f, col) \
512 ((f)->display.x->internal_border_width \
513 + (col) * FONT_WIDTH ((f)->display.x->font))
514
515/* Return the pixel width/height of frame F if it has
516 WIDTH columns/HEIGHT rows. */
c8e3cbe0 517#define CHAR_TO_PIXEL_WIDTH(f, width) \
4e027793 518 (CHAR_TO_PIXEL_COL (f, width) \
a3c87d4e 519 + (f)->display.x->vertical_scroll_bar_extra \
4e027793 520 + (f)->display.x->internal_border_width)
c8e3cbe0 521#define CHAR_TO_PIXEL_HEIGHT(f, height) \
4e027793
JB
522 (CHAR_TO_PIXEL_ROW (f, height) \
523 + (f)->display.x->internal_border_width)
c8e3cbe0 524
c8e3cbe0 525
4e027793
JB
526/* Return the row/column (zero-based) of the character cell containing
527 the pixel on FRAME at ROW/COL. */
528#define PIXEL_TO_CHAR_ROW(frame, row) \
529 (((row) - (f)->display.x->internal_border_width) \
c8e3cbe0 530 / FONT_HEIGHT ((f)->display.x->font))
4e027793
JB
531#define PIXEL_TO_CHAR_COL(frame, col) \
532 (((col) - (f)->display.x->internal_border_width) \
533 / FONT_WIDTH ((f)->display.x->font))
c8e3cbe0 534
4e027793
JB
535/* How many columns/rows of text can we fit in WIDTH/HEIGHT pixels on
536 frame F? */
537#define PIXEL_TO_CHAR_WIDTH(f, width) \
538 (PIXEL_TO_CHAR_COL (f, ((width) \
539 - (f)->display.x->internal_border_width \
a3c87d4e 540 - (f)->display.x->vertical_scroll_bar_extra)))
4e027793
JB
541#define PIXEL_TO_CHAR_HEIGHT(f, height) \
542 (PIXEL_TO_CHAR_ROW (f, ((height) \
543 - (f)->display.x->internal_border_width)))
c352056c
RS
544\f
545/* If a struct input_event has a kind which is selection_request_event
546 or selection_clear_event, then its contents are really described
547 by this structure. */
548
549/* For an event of kind selection_request_event,
550 this structure really describes the contents. */
551struct selection_input_event
552{
553 int kind;
554 Display *display;
555 Window requestor;
556 Atom selection, target, property;
557 Time time;
558};
559
560#define SELECTION_EVENT_DISPLAY(eventp) \
561 (((struct selection_input_event *) (eventp))->display)
562#define SELECTION_EVENT_REQUESTOR(eventp) \
563 (((struct selection_input_event *) (eventp))->requestor)
564#define SELECTION_EVENT_SELECTION(eventp) \
565 (((struct selection_input_event *) (eventp))->selection)
566#define SELECTION_EVENT_TARGET(eventp) \
567 (((struct selection_input_event *) (eventp))->target)
568#define SELECTION_EVENT_PROPERTY(eventp) \
569 (((struct selection_input_event *) (eventp))->property)
570#define SELECTION_EVENT_TIME(eventp) \
571 (((struct selection_input_event *) (eventp))->time)