Mercurial > emacs
annotate src/xterm.h @ 2363:64dadcfcdf68
Fix typo in source for `configure.tmp.$$.c'.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Thu, 25 Mar 1993 03:57:51 +0000 |
parents | dcc756fba34f |
children | 6ec15e6b2a08 |
rev | line source |
---|---|
259 | 1 /* Definitions and headers for communication with X protocol. |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
2 Copyright (C) 1989, 1993 Free Software Foundation, Inc. |
259 | 3 |
4 This file is part of GNU Emacs. | |
5 | |
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 | |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
8 the Free Software Foundation; either version 2, or (at your option) |
259 | 9 any later version. |
10 | |
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. | |
15 | |
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. */ | |
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 | |
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 | |
999 | 43 |
1040 | 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 | |
999 | 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 | |
2300
dfef2f43f4bf
* xfns.c (Fx_open_connection): If we have X11R5, use
Jim Blandy <jimb@redhat.com>
parents:
2208
diff
changeset
|
70 #ifdef XlibSpecificationRelease |
dfef2f43f4bf
* xfns.c (Fx_open_connection): If we have X11R5, use
Jim Blandy <jimb@redhat.com>
parents:
2208
diff
changeset
|
71 #if XlibSpecificationRelease >= 5 |
dfef2f43f4bf
* xfns.c (Fx_open_connection): If we have X11R5, use
Jim Blandy <jimb@redhat.com>
parents:
2208
diff
changeset
|
72 #define HAVE_X11R5 |
dfef2f43f4bf
* xfns.c (Fx_open_connection): If we have X11R5, use
Jim Blandy <jimb@redhat.com>
parents:
2208
diff
changeset
|
73 #endif |
dfef2f43f4bf
* xfns.c (Fx_open_connection): If we have X11R5, use
Jim Blandy <jimb@redhat.com>
parents:
2208
diff
changeset
|
74 #endif |
dfef2f43f4bf
* xfns.c (Fx_open_connection): If we have X11R5, use
Jim Blandy <jimb@redhat.com>
parents:
2208
diff
changeset
|
75 |
259 | 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)) | |
1258
353663d81b11
* xterm.h (ROOT_WINDOW): Use the DefaultScreen macro, not the
Jim Blandy <jimb@redhat.com>
parents:
1040
diff
changeset
|
86 #define ROOT_WINDOW RootWindow (x_current_display, DefaultScreen (x_current_display)) |
259 | 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 | |
111 /* The mask of events that text windows always want to receive. This | |
424 | 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. */ | |
259 | 119 |
120 #define STANDARD_EVENT_SET \ | |
121 (KeyPressMask \ | |
122 | ExposureMask \ | |
123 | ButtonPressMask \ | |
424 | 124 | ButtonReleaseMask \ |
125 | PointerMotionMask \ | |
126 | PointerMotionHintMask \ | |
259 | 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 | |
164 struct 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. */ | |
172 extern struct event_queue x_mouse_queue; | |
173 | |
174 /* Mechanism for interlocking between main program level | |
175 and input interrupt level. */ | |
176 | |
177 /* Nonzero during a critical section. At such a time, an input interrupt | |
178 does nothing but set `x_pending_input'. */ | |
179 extern int x_input_blocked; | |
180 | |
181 /* Nonzero means an input interrupt has arrived | |
182 during the current critical section. */ | |
183 extern int x_pending_input; | |
184 | |
185 /* Begin critical section. */ | |
186 #define BLOCK_INPUT (x_input_blocked++) | |
187 | |
188 /* End critical section. */ | |
2208
10b84f28f6f2
[SIGIO] (UNBLOCK_INPUT): Resignal if x_pending_input.
Richard M. Stallman <rms@gnu.org>
parents:
2196
diff
changeset
|
189 #ifdef SIGIO |
10b84f28f6f2
[SIGIO] (UNBLOCK_INPUT): Resignal if x_pending_input.
Richard M. Stallman <rms@gnu.org>
parents:
2196
diff
changeset
|
190 /* If doing interrupt input, and an interrupt came in when input was blocked, |
10b84f28f6f2
[SIGIO] (UNBLOCK_INPUT): Resignal if x_pending_input.
Richard M. Stallman <rms@gnu.org>
parents:
2196
diff
changeset
|
191 reinvoke the interrupt handler now to deal with it. */ |
10b84f28f6f2
[SIGIO] (UNBLOCK_INPUT): Resignal if x_pending_input.
Richard M. Stallman <rms@gnu.org>
parents:
2196
diff
changeset
|
192 #define UNBLOCK_INPUT \ |
10b84f28f6f2
[SIGIO] (UNBLOCK_INPUT): Resignal if x_pending_input.
Richard M. Stallman <rms@gnu.org>
parents:
2196
diff
changeset
|
193 ((x_input_blocked--, (x_input_blocked < 0 ? (abort (), 0) : 0)), \ |
10b84f28f6f2
[SIGIO] (UNBLOCK_INPUT): Resignal if x_pending_input.
Richard M. Stallman <rms@gnu.org>
parents:
2196
diff
changeset
|
194 (x_input_blocked == 0 && x_pending_input != 0 ? (kill (0, SIGIO), 0) : 0)) |
10b84f28f6f2
[SIGIO] (UNBLOCK_INPUT): Resignal if x_pending_input.
Richard M. Stallman <rms@gnu.org>
parents:
2196
diff
changeset
|
195 #else |
485 | 196 #define UNBLOCK_INPUT \ |
197 (x_input_blocked--, (x_input_blocked < 0 ? (abort (), 0) : 0)) | |
2208
10b84f28f6f2
[SIGIO] (UNBLOCK_INPUT): Resignal if x_pending_input.
Richard M. Stallman <rms@gnu.org>
parents:
2196
diff
changeset
|
198 #endif |
259 | 199 |
200 #define TOTALLY_UNBLOCK_INPUT (x_input_blocked = 0) | |
201 #define UNBLOCK_INPUT_RESIGNAL UNBLOCK_INPUT | |
202 | |
203 /* This is the X connection that we are using. */ | |
204 | |
205 extern Display *x_current_display; | |
206 | |
771 | 207 extern struct frame *x_window_to_frame (); |
259 | 208 |
771 | 209 /* The frame (if any) which has the X window that has keyboard focus. |
210 Zero if none. This is examined by Ffocus_frame in xfns.c */ | |
259 | 211 |
2354
dcc756fba34f
* xterm.h (x_focus_frame): Add extern keyword to declaration.
Jim Blandy <jimb@redhat.com>
parents:
2300
diff
changeset
|
212 extern struct frame *x_focus_frame; |
259 | 213 |
214 #ifdef HAVE_X11 | |
215 /* Variables associated with the X display screen this emacs is using. */ | |
216 | |
217 /* How many screens this X display has. */ | |
1531
86202f01266d
* xterm.h (x_screen_count, x_release, x_screen_height,
Jim Blandy <jimb@redhat.com>
parents:
1408
diff
changeset
|
218 extern int x_screen_count; |
259 | 219 |
220 /* The vendor supporting this X server. */ | |
221 extern Lisp_Object Vx_vendor; | |
222 | |
223 /* The vendor's release number for this X server. */ | |
1531
86202f01266d
* xterm.h (x_screen_count, x_release, x_screen_height,
Jim Blandy <jimb@redhat.com>
parents:
1408
diff
changeset
|
224 extern int x_release; |
259 | 225 |
226 /* Height of this X screen in pixels. */ | |
1531
86202f01266d
* xterm.h (x_screen_count, x_release, x_screen_height,
Jim Blandy <jimb@redhat.com>
parents:
1408
diff
changeset
|
227 extern int x_screen_height; |
259 | 228 |
229 /* Height of this X screen in millimeters. */ | |
1531
86202f01266d
* xterm.h (x_screen_count, x_release, x_screen_height,
Jim Blandy <jimb@redhat.com>
parents:
1408
diff
changeset
|
230 extern int x_screen_height_mm; |
259 | 231 |
232 /* Width of this X screen in pixels. */ | |
1531
86202f01266d
* xterm.h (x_screen_count, x_release, x_screen_height,
Jim Blandy <jimb@redhat.com>
parents:
1408
diff
changeset
|
233 extern int x_screen_width; |
259 | 234 |
235 /* Width of this X screen in millimeters. */ | |
1531
86202f01266d
* xterm.h (x_screen_count, x_release, x_screen_height,
Jim Blandy <jimb@redhat.com>
parents:
1408
diff
changeset
|
236 extern int x_screen_width_mm; |
259 | 237 |
238 /* Does this X screen do backing store? */ | |
239 extern Lisp_Object Vx_backing_store; | |
240 | |
241 /* Does this X screen do save-unders? */ | |
1531
86202f01266d
* xterm.h (x_screen_count, x_release, x_screen_height,
Jim Blandy <jimb@redhat.com>
parents:
1408
diff
changeset
|
242 extern int x_save_under; |
259 | 243 |
244 /* Number of planes for this screen. */ | |
1531
86202f01266d
* xterm.h (x_screen_count, x_release, x_screen_height,
Jim Blandy <jimb@redhat.com>
parents:
1408
diff
changeset
|
245 extern int x_screen_planes; |
259 | 246 |
247 /* X Visual type of this screen. */ | |
248 extern Lisp_Object Vx_screen_visual; | |
249 | |
250 #endif /* HAVE_X11 */ | |
251 | |
252 enum text_cursor_kinds { | |
253 filled_box_cursor, hollow_box_cursor, bar_cursor | |
254 }; | |
255 | |
771 | 256 /* Each X frame object points to its own struct x_display object |
259 | 257 in the display.x field. The x_display structure contains all |
258 the information that is specific to X windows. */ | |
259 | |
260 struct x_display | |
261 { | |
262 /* Position of the X window (x and y offsets in root window). */ | |
263 int left_pos; | |
264 int top_pos; | |
265 | |
266 /* Border width of the X window as known by the X window system. */ | |
267 int border_width; | |
268 | |
269 /* Size of the X window in pixels. */ | |
270 int pixel_height, pixel_width; | |
271 | |
272 #ifdef HAVE_X11 | |
771 | 273 /* The tiled border used when the mouse is out of the frame. */ |
259 | 274 Pixmap border_tile; |
275 | |
276 /* Here are the Graphics Contexts for the default font. */ | |
277 GC normal_gc; /* Normal video */ | |
278 GC reverse_gc; /* Reverse video */ | |
279 GC cursor_gc; /* cursor drawing */ | |
280 #endif /* HAVE_X11 */ | |
281 | |
282 /* Width of the internal border. This is a line of background color | |
771 | 283 just inside the window's border. When the frame is selected, |
259 | 284 a highlighting is displayed inside the internal border. */ |
285 int internal_border_width; | |
286 | |
771 | 287 /* The X window used for this frame. |
288 May be zero while the frame object is being created | |
259 | 289 and the X window has not yet been created. */ |
290 Window window_desc; | |
291 | |
292 /* The X window used for the bitmap icon; | |
293 or 0 if we don't have a bitmap icon. */ | |
294 Window icon_desc; | |
295 | |
296 /* The X window that is the parent of this X window. | |
297 Usually but not always RootWindow. */ | |
298 Window parent_desc; | |
299 | |
300 /* 1 for bitmap icon, 0 for text icon. */ | |
301 int icon_bitmap_flag; | |
302 | |
303 FONT_TYPE *font; | |
304 | |
305 /* Pixel values used for various purposes. | |
306 border_pixel may be -1 meaning use a gray tile. */ | |
307 PIX_TYPE background_pixel; | |
308 PIX_TYPE foreground_pixel; | |
309 PIX_TYPE cursor_pixel; | |
310 PIX_TYPE border_pixel; | |
311 PIX_TYPE mouse_pixel; | |
312 | |
313 /* Descriptor for the cursor in use for this window. */ | |
314 #ifdef HAVE_X11 | |
315 Cursor text_cursor; | |
316 Cursor nontext_cursor; | |
317 Cursor modeline_cursor; | |
318 #else | |
319 Cursor cursor; | |
320 #endif | |
321 | |
322 /* The name that was associated with the icon, the last time | |
323 it was refreshed. Usually the same as the name of the | |
771 | 324 buffer in the currently selected window in the frame */ |
259 | 325 char *icon_label; |
326 | |
327 /* Flag to set when the X window needs to be completely repainted. */ | |
328 int needs_exposure; | |
329 | |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1788
diff
changeset
|
330 /* What kind of text cursor is drawn in this window right now? |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1788
diff
changeset
|
331 (If there is no cursor (phys_cursor_x < 0), then this means nothing.) */ |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1788
diff
changeset
|
332 enum text_cursor_kinds current_cursor; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1788
diff
changeset
|
333 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1788
diff
changeset
|
334 /* What kind of text cursor should we draw in the future? |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1788
diff
changeset
|
335 This should always be filled_box_cursor or bar_cursor. */ |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1788
diff
changeset
|
336 enum text_cursor_kinds desired_cursor; |
999 | 337 |
338 /* These are the current window manager hints. It seems that | |
339 XSetWMHints, when presented with an unset bit in the `flags' | |
340 member of the hints structure, does not leave the corresponding | |
341 attribute unchanged; rather, it resets that attribute to its | |
342 default value. For example, unless you set the `icon_pixmap' | |
343 field and the `IconPixmapHint' bit, XSetWMHints will forget what | |
344 your icon pixmap was. This is rather troublesome, since some of | |
345 the members (for example, `input' and `icon_pixmap') want to stay | |
346 the same throughout the execution of Emacs. So, we keep this | |
347 structure around, just leaving values in it and adding new bits | |
348 to the mask as we go. */ | |
349 XWMHints wm_hints; | |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
350 |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
351 /* The size of the extra width currently allotted for vertical |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
352 scroll bars, in pixels. */ |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
353 int vertical_scroll_bar_extra; |
259 | 354 }; |
1040 | 355 |
356 /* Return the window associated with the frame F. */ | |
357 #define FRAME_X_WINDOW(f) ((f)->display.x->window_desc) | |
358 | |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1788
diff
changeset
|
359 /* These two really ought to be called FRAME_PIXEL_{WIDTH,HEIGHT}. */ |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1788
diff
changeset
|
360 #define PIXEL_WIDTH(f) ((f)->display.x->pixel_width) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1788
diff
changeset
|
361 #define PIXEL_HEIGHT(f) ((f)->display.x->pixel_height) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1788
diff
changeset
|
362 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1788
diff
changeset
|
363 #define FRAME_DESIRED_CURSOR(f) ((f)->display.x->desired_cursor) |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1788
diff
changeset
|
364 |
259 | 365 |
366 /* When X windows are used, a glyf may be a 16 bit unsigned datum. | |
367 The high order byte is the face number and is used as an index | |
368 in the face table. A face is a font plus: | |
369 1) the unhighlighted foreground color, | |
370 2) the unhighlighted background color. | |
371 For highlighting, the two colors are exchanged. | |
372 Face number 0 is unused. The low order byte of a glyf gives | |
373 the character within the font. All fonts are assumed to be | |
374 fixed width, and to have the same height and width. */ | |
375 | |
376 #ifdef HAVE_X11 | |
377 | |
1408
b8e32247c590
* xterm.h: Declaration of struct face removed.
Joseph Arceneaux <jla@gnu.org>
parents:
1258
diff
changeset
|
378 /* Face declared in dispextern.h */ |
259 | 379 |
380 #else /* X10 */ | |
381 | |
382 struct face | |
383 { | |
384 FONT_TYPE *font; /* Font info for specified font. */ | |
385 int fg; /* Unhighlighted foreground. */ | |
386 int bg; /* Unhighlighted background. */ | |
387 }; | |
388 #endif /* X10 */ | |
389 | |
390 #define MAX_FACES_AND_GLYPHS 256 | |
391 extern struct face *x_face_table[]; | |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
392 |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
393 |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
394 /* X-specific scroll bar stuff. */ |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
395 |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
396 /* We represent scroll bars as lisp vectors. This allows us to place |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
397 references to them in windows without worrying about whether we'll |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
398 end up with windows referring to dead scroll bars; the garbage |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
399 collector will free it when its time comes. |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
400 |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
401 We use struct scroll_bar as a template for accessing fields of the |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
402 vector. */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
403 |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
404 struct scroll_bar { |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
405 |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
406 /* These fields are shared by all vectors. */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
407 int size_from_Lisp_Vector_struct; |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
408 struct Lisp_Vector *next_from_Lisp_Vector_struct; |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
409 |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
410 /* The window we're a scroll bar for. */ |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
411 Lisp_Object window; |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
412 |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
413 /* The next and previous in the chain of scroll bars in this frame. */ |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
414 Lisp_Object next, prev; |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
415 |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
416 /* The X window representing this scroll bar. Since this is a full |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
417 32-bit quantity, we store it split into two 32-bit values. */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
418 Lisp_Object x_window_low, x_window_high; |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
419 |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
420 /* The position and size of the scroll bar in pixels, relative to the |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
421 frame. */ |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
422 Lisp_Object top, left, width, height; |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
423 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
424 /* The starting and ending positions of the handle, relative to the |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
425 handle area (i.e. zero is the top position, not |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
426 SCROLL_BAR_TOP_BORDER). If they're equal, that means the handle |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
427 hasn't been drawn yet. |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
428 |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
429 These are not actually the locations where the beginning and end |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
430 are drawn; in order to keep handles from becoming invisible when |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
431 editing large files, we establish a minimum height by always |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
432 drawing handle bottoms VERTICAL_SCROLL_BAR_MIN_HANDLE pixels below |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
433 where they would be normally; the bottom and top are in a |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
434 different co-ordinate system. */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
435 Lisp_Object start, end; |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
436 |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
437 /* If the scroll bar handle is currently being dragged by the user, |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
438 this is the number of pixels from the top of the handle to the |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
439 place where the user grabbed it. If the handle isn't currently |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
440 being dragged, this is Qnil. */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
441 Lisp_Object dragging; |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
442 }; |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
443 |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
444 /* The number of elements a vector holding a struct scroll_bar needs. */ |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
445 #define SCROLL_BAR_VEC_SIZE \ |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
446 ((sizeof (struct scroll_bar) - sizeof (int) - sizeof (struct Lisp_Vector *)) \ |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
447 / sizeof (Lisp_Object)) |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
448 |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
449 /* Turning a lisp vector value into a pointer to a struct scroll_bar. */ |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
450 #define XSCROLL_BAR(vec) ((struct scroll_bar *) XPNTR (vec)) |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
451 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
452 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
453 /* Building a 32-bit C integer from two 16-bit lisp integers. */ |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
454 #define SCROLL_BAR_PACK(low, high) (XINT (high) << 16 | XINT (low)) |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
455 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
456 /* Setting two lisp integers to the low and high words of a 32-bit C int. */ |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
457 #define SCROLL_BAR_UNPACK(low, high, int32) \ |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
458 (XSET ((low), Lisp_Int, (int32) & 0xffff), \ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
459 XSET ((high), Lisp_Int, ((int32) >> 16) & 0xffff)) |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
460 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
461 |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
462 /* Extract the X window id of the scroll bar from a struct scroll_bar. */ |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
463 #define SCROLL_BAR_X_WINDOW(ptr) \ |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
464 ((Window) SCROLL_BAR_PACK ((ptr)->x_window_low, (ptr)->x_window_high)) |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
465 |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
466 /* Store a window id in a struct scroll_bar. */ |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
467 #define SET_SCROLL_BAR_X_WINDOW(ptr, id) \ |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
468 (SCROLL_BAR_UNPACK ((ptr)->x_window_low, (ptr)->x_window_high, (int) id)) |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
469 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
470 |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
471 /* Return the outside pixel width for a vertical scroll bar on frame F. */ |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
472 #define VERTICAL_SCROLL_BAR_PIXEL_WIDTH(f) (2*FONT_WIDTH ((f)->display.x->font)) |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
473 |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
474 /* Return the outside pixel height for a vertical scroll bar HEIGHT |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
475 rows high on frame F. */ |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
476 #define VERTICAL_SCROLL_BAR_PIXEL_HEIGHT(f, height) \ |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
477 ((height) * FONT_HEIGHT ((f)->display.x->font)) |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
478 |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
479 /* Return the inside width of a vertical scroll bar, given the outside |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
480 width. */ |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
481 #define VERTICAL_SCROLL_BAR_INSIDE_WIDTH(width) \ |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
482 ((width) - VERTICAL_SCROLL_BAR_LEFT_BORDER - VERTICAL_SCROLL_BAR_RIGHT_BORDER) |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
483 |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
484 /* Return the length of the rectangle within which the top of the |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
485 handle must stay. This isn't equivalent to the inside height, |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
486 because the scroll bar handle has a minimum height. |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
487 |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
488 This is the real range of motion for the scroll bar, so when we're |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
489 scaling buffer positions to scroll bar positions, we use this, not |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
490 VERTICAL_SCROLL_BAR_INSIDE_HEIGHT. */ |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
491 #define VERTICAL_SCROLL_BAR_TOP_RANGE(height) \ |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
492 (VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (height) - VERTICAL_SCROLL_BAR_MIN_HANDLE) |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
493 |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
494 /* Return the inside height of vertical scroll bar, given the outside |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
495 height. See VERTICAL_SCROLL_BAR_TOP_RANGE too. */ |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
496 #define VERTICAL_SCROLL_BAR_INSIDE_HEIGHT(height) \ |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
497 ((height) - VERTICAL_SCROLL_BAR_TOP_BORDER - VERTICAL_SCROLL_BAR_BOTTOM_BORDER) |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
498 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
499 |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
500 /* Border widths for scroll bars. |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
501 |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
502 Scroll bar windows don't have any X borders; their border width is |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
503 set to zero, and we redraw borders ourselves. This makes the code |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
504 a bit cleaner, since we don't have to convert between outside width |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
505 (used when relating to the rest of the screen) and inside width |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
506 (used when sizing and drawing the scroll bar window itself). |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
507 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
508 The handle moves up and down/back and forth in a rectange inset |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
509 from the edges of the scroll bar. These are widths by which we |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
510 inset the handle boundaries from the scroll bar edges. */ |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
511 #define VERTICAL_SCROLL_BAR_LEFT_BORDER (2) |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
512 #define VERTICAL_SCROLL_BAR_RIGHT_BORDER (3) |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
513 #define VERTICAL_SCROLL_BAR_TOP_BORDER (2) |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
514 #define VERTICAL_SCROLL_BAR_BOTTOM_BORDER (2) |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
515 |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
516 /* Minimum lengths for scroll bar handles, in pixels. */ |
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
517 #define VERTICAL_SCROLL_BAR_MIN_HANDLE (5) |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
518 |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
519 |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
520 /* Manipulating pixel sizes and character sizes. |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
521 Knowledge of which factors affect the overall size of the window should |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
522 be hidden in these macros, if that's possible. |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
523 |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
524 /* Return the upper/left pixel position of the character cell on frame F |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
525 at ROW/COL. */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
526 #define CHAR_TO_PIXEL_ROW(f, row) \ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
527 ((f)->display.x->internal_border_width \ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
528 + (row) * FONT_HEIGHT ((f)->display.x->font)) |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
529 #define CHAR_TO_PIXEL_COL(f, col) \ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
530 ((f)->display.x->internal_border_width \ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
531 + (col) * FONT_WIDTH ((f)->display.x->font)) |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
532 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
533 /* Return the pixel width/height of frame F if it has |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
534 WIDTH columns/HEIGHT rows. */ |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
535 #define CHAR_TO_PIXEL_WIDTH(f, width) \ |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
536 (CHAR_TO_PIXEL_COL (f, width) \ |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
537 + (f)->display.x->vertical_scroll_bar_extra \ |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
538 + (f)->display.x->internal_border_width) |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
539 #define CHAR_TO_PIXEL_HEIGHT(f, height) \ |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
540 (CHAR_TO_PIXEL_ROW (f, height) \ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
541 + (f)->display.x->internal_border_width) |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
542 |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
543 |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
544 /* Return the row/column (zero-based) of the character cell containing |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
545 the pixel on FRAME at ROW/COL. */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
546 #define PIXEL_TO_CHAR_ROW(frame, row) \ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
547 (((row) - (f)->display.x->internal_border_width) \ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
548 / FONT_HEIGHT ((f)->display.x->font)) |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
549 #define PIXEL_TO_CHAR_COL(frame, col) \ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
550 (((col) - (f)->display.x->internal_border_width) \ |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
551 / FONT_WIDTH ((f)->display.x->font)) |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
552 |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
553 /* How many columns/rows of text can we fit in WIDTH/HEIGHT pixels on |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
554 frame F? */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
555 #define PIXEL_TO_CHAR_WIDTH(f, width) \ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
556 (PIXEL_TO_CHAR_COL (f, ((width) \ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
557 - (f)->display.x->internal_border_width \ |
1994
73ce9dd21093
Use the term `scroll bar', instead of `scrollbar'.
Jim Blandy <jimb@redhat.com>
parents:
1821
diff
changeset
|
558 - (f)->display.x->vertical_scroll_bar_extra))) |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
559 #define PIXEL_TO_CHAR_HEIGHT(f, height) \ |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
560 (PIXEL_TO_CHAR_ROW (f, ((height) \ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
561 - (f)->display.x->internal_border_width))) |
2196
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
562 |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
563 /* If a struct input_event has a kind which is selection_request_event |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
564 or selection_clear_event, then its contents are really described |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
565 by this structure. */ |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
566 |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
567 /* For an event of kind selection_request_event, |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
568 this structure really describes the contents. */ |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
569 struct selection_input_event |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
570 { |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
571 int kind; |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
572 Display *display; |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
573 Window requestor; |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
574 Atom selection, target, property; |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
575 Time time; |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
576 }; |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
577 |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
578 #define SELECTION_EVENT_DISPLAY(eventp) \ |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
579 (((struct selection_input_event *) (eventp))->display) |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
580 #define SELECTION_EVENT_REQUESTOR(eventp) \ |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
581 (((struct selection_input_event *) (eventp))->requestor) |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
582 #define SELECTION_EVENT_SELECTION(eventp) \ |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
583 (((struct selection_input_event *) (eventp))->selection) |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
584 #define SELECTION_EVENT_TARGET(eventp) \ |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
585 (((struct selection_input_event *) (eventp))->target) |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
586 #define SELECTION_EVENT_PROPERTY(eventp) \ |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
587 (((struct selection_input_event *) (eventp))->property) |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
588 #define SELECTION_EVENT_TIME(eventp) \ |
75e1f1ee83ad
(SELECTION_EVENT_DISPLAY): New macro.
Richard M. Stallman <rms@gnu.org>
parents:
1994
diff
changeset
|
589 (((struct selection_input_event *) (eventp))->time) |