Mercurial > emacs
annotate src/xterm.h @ 1911:d9fc49956cd8
* bytecode.c (Fbyte_code): Pass the correct number of arguments to
temp_output_buffer_show.
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Mon, 22 Feb 1993 14:23:26 +0000 |
parents | 04fb1d3d6992 |
children | 73ce9dd21093 |
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 | |
259 | 70 #define PIX_TYPE unsigned long |
71 #define XDISPLAY x_current_display, | |
72 #define XFlushQueue() XFlush(x_current_display) | |
73 #define BLACK_PIX_DEFAULT BlackPixel (x_current_display, \ | |
74 XDefaultScreen (x_current_display)) | |
75 #define WHITE_PIX_DEFAULT WhitePixel (x_current_display, \ | |
76 XDefaultScreen (x_current_display)) | |
77 #define DISPLAY_SCREEN_ARG x_current_display, \ | |
78 XDefaultScreen (x_current_display) | |
79 #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
|
80 #define ROOT_WINDOW RootWindow (x_current_display, DefaultScreen (x_current_display)) |
259 | 81 #define FONT_TYPE XFontStruct |
82 #define Color XColor | |
83 | |
84 #define XExposeRegionEvent XExposeEvent | |
85 #define Bitmap Pixmap /* In X11, Bitmaps are are kind of | |
86 Pixmap. */ | |
87 #define WINDOWINFO_TYPE XWindowAttributes | |
88 #define XGetWindowInfo(w, i) XGetWindowAttributes (x_current_display, \ | |
89 (w), (i)) | |
90 #define XGetFont(f) XLoadQueryFont (x_current_display, (f)) | |
91 #define XLoseFont(f) XFreeFont (x_current_display, (f)) | |
92 #define XStuffPending() XPending (x_current_display) | |
93 #define XClear(w) XClearWindow (x_current_display, (w)) | |
94 #define XWarpMousePointer(w,x,y) XWarpPointer (x_current_display, None, w, \ | |
95 0,0,0,0, x, y) | |
96 #define XHandleError XSetErrorHandler | |
97 #define XHandleIOError XSetIOErrorHandler | |
98 | |
99 #define XChangeWindowSize(w,x,y) XResizeWindow(x_current_display,w,x,y) | |
100 | |
101 #define FONT_WIDTH(f) ((f)->max_bounds.width) | |
102 #define FONT_HEIGHT(f) ((f)->ascent + (f)->descent) | |
103 #define FONT_BASE(f) ((f)->ascent) | |
104 | |
105 /* The mask of events that text windows always want to receive. This | |
424 | 106 does not include mouse movement events. It is used when the window |
107 is created (in x_window) and when we ask/unask for mouse movement | |
108 events (in XTmouse_tracking_enable). | |
109 | |
110 We do include ButtonReleases in this set because elisp isn't always | |
111 fast enough to catch them when it wants them, and they're rare | |
112 enough that they don't use much processor time. */ | |
259 | 113 |
114 #define STANDARD_EVENT_SET \ | |
115 (KeyPressMask \ | |
116 | ExposureMask \ | |
117 | ButtonPressMask \ | |
424 | 118 | ButtonReleaseMask \ |
119 | PointerMotionMask \ | |
120 | PointerMotionHintMask \ | |
259 | 121 | StructureNotifyMask \ |
122 | FocusChangeMask \ | |
123 | LeaveWindowMask \ | |
124 | EnterWindowMask \ | |
125 | VisibilityChangeMask) | |
126 | |
127 #else /* X10 */ | |
128 | |
129 #define ConnectionNumber(dpy) dpyno() | |
130 #define PIX_TYPE int | |
131 #define XDISPLAY | |
132 #define XFlushQueue() XFlush() | |
133 #define BLACK_PIX_DEFAULT BlackPixel | |
134 #define WHITE_PIX_DEFAULT WhitePixel | |
135 #define DISPLAY_SCREEN_ARG | |
136 #define DISPLAY_CELLS DisplayCells () | |
137 #define ROOT_WINDOW RootWindow | |
138 #define XFree free | |
139 #define FONT_TYPE FontInfo | |
140 | |
141 #define WINDOWINFO_TYPE WindowInfo | |
142 #define XGetWindowInfo(w, i) XQueryWindow ((w), (i)) | |
143 #define XGetFont(f) XOpenFont ((f)) | |
144 #define XLoseFont(f) XCloseFont ((f)) | |
145 #define XStuffPending() XPending () | |
146 #define XWarpMousePointer(w,x,y) XWarpMouse (w,x,y) | |
147 #define XHandleError XErrorHandler | |
148 #define XHandleIOError XIOErrorHandler | |
149 | |
150 #define FONT_WIDTH(f) ((f)->width) | |
151 #define FONT_HEIGHT(f) ((f)->height) | |
152 #define FONT_BASE(f) ((f)->base) | |
153 | |
154 #define XChangeWindowSize(w,x,y) XChangeWindow(w,x,y) | |
155 | |
156 #endif /* X10 */ | |
157 | |
158 struct event_queue | |
159 { | |
160 int rindex; /* Index at which to fetch next. */ | |
161 int windex; /* Index at which to store next. */ | |
162 XEvent xrep[EVENT_BUFFER_SIZE]; | |
163 }; | |
164 | |
165 /* Queue for mouse clicks. */ | |
166 extern struct event_queue x_mouse_queue; | |
167 | |
168 /* Mechanism for interlocking between main program level | |
169 and input interrupt level. */ | |
170 | |
171 /* Nonzero during a critical section. At such a time, an input interrupt | |
172 does nothing but set `x_pending_input'. */ | |
173 extern int x_input_blocked; | |
174 | |
175 /* Nonzero means an input interrupt has arrived | |
176 during the current critical section. */ | |
177 extern int x_pending_input; | |
178 | |
179 /* Begin critical section. */ | |
180 #define BLOCK_INPUT (x_input_blocked++) | |
181 | |
182 /* End critical section. */ | |
485 | 183 #define UNBLOCK_INPUT \ |
184 (x_input_blocked--, (x_input_blocked < 0 ? (abort (), 0) : 0)) | |
259 | 185 |
186 #define TOTALLY_UNBLOCK_INPUT (x_input_blocked = 0) | |
187 #define UNBLOCK_INPUT_RESIGNAL UNBLOCK_INPUT | |
188 | |
189 /* This is the X connection that we are using. */ | |
190 | |
191 extern Display *x_current_display; | |
192 | |
771 | 193 extern struct frame *x_window_to_frame (); |
259 | 194 |
771 | 195 /* The frame (if any) which has the X window that has keyboard focus. |
196 Zero if none. This is examined by Ffocus_frame in xfns.c */ | |
259 | 197 |
771 | 198 struct frame *x_focus_frame; |
259 | 199 |
200 #ifdef HAVE_X11 | |
201 /* Variables associated with the X display screen this emacs is using. */ | |
202 | |
203 /* 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
|
204 extern int x_screen_count; |
259 | 205 |
206 /* The vendor supporting this X server. */ | |
207 extern Lisp_Object Vx_vendor; | |
208 | |
209 /* 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
|
210 extern int x_release; |
259 | 211 |
212 /* 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
|
213 extern int x_screen_height; |
259 | 214 |
215 /* 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
|
216 extern int x_screen_height_mm; |
259 | 217 |
218 /* 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
|
219 extern int x_screen_width; |
259 | 220 |
221 /* 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
|
222 extern int x_screen_width_mm; |
259 | 223 |
224 /* Does this X screen do backing store? */ | |
225 extern Lisp_Object Vx_backing_store; | |
226 | |
227 /* 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
|
228 extern int x_save_under; |
259 | 229 |
230 /* 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
|
231 extern int x_screen_planes; |
259 | 232 |
233 /* X Visual type of this screen. */ | |
234 extern Lisp_Object Vx_screen_visual; | |
235 | |
236 #endif /* HAVE_X11 */ | |
237 | |
238 enum text_cursor_kinds { | |
239 filled_box_cursor, hollow_box_cursor, bar_cursor | |
240 }; | |
241 | |
771 | 242 /* Each X frame object points to its own struct x_display object |
259 | 243 in the display.x field. The x_display structure contains all |
244 the information that is specific to X windows. */ | |
245 | |
246 struct x_display | |
247 { | |
248 /* Position of the X window (x and y offsets in root window). */ | |
249 int left_pos; | |
250 int top_pos; | |
251 | |
252 /* Border width of the X window as known by the X window system. */ | |
253 int border_width; | |
254 | |
255 /* Size of the X window in pixels. */ | |
256 int pixel_height, pixel_width; | |
257 | |
258 #ifdef HAVE_X11 | |
771 | 259 /* The tiled border used when the mouse is out of the frame. */ |
259 | 260 Pixmap border_tile; |
261 | |
262 /* Here are the Graphics Contexts for the default font. */ | |
263 GC normal_gc; /* Normal video */ | |
264 GC reverse_gc; /* Reverse video */ | |
265 GC cursor_gc; /* cursor drawing */ | |
266 #endif /* HAVE_X11 */ | |
267 | |
268 /* Width of the internal border. This is a line of background color | |
771 | 269 just inside the window's border. When the frame is selected, |
259 | 270 a highlighting is displayed inside the internal border. */ |
271 int internal_border_width; | |
272 | |
771 | 273 /* The X window used for this frame. |
274 May be zero while the frame object is being created | |
259 | 275 and the X window has not yet been created. */ |
276 Window window_desc; | |
277 | |
278 /* The X window used for the bitmap icon; | |
279 or 0 if we don't have a bitmap icon. */ | |
280 Window icon_desc; | |
281 | |
282 /* The X window that is the parent of this X window. | |
283 Usually but not always RootWindow. */ | |
284 Window parent_desc; | |
285 | |
286 /* 1 for bitmap icon, 0 for text icon. */ | |
287 int icon_bitmap_flag; | |
288 | |
289 FONT_TYPE *font; | |
290 | |
291 /* Pixel values used for various purposes. | |
292 border_pixel may be -1 meaning use a gray tile. */ | |
293 PIX_TYPE background_pixel; | |
294 PIX_TYPE foreground_pixel; | |
295 PIX_TYPE cursor_pixel; | |
296 PIX_TYPE border_pixel; | |
297 PIX_TYPE mouse_pixel; | |
298 | |
299 /* Descriptor for the cursor in use for this window. */ | |
300 #ifdef HAVE_X11 | |
301 Cursor text_cursor; | |
302 Cursor nontext_cursor; | |
303 Cursor modeline_cursor; | |
304 #else | |
305 Cursor cursor; | |
306 #endif | |
307 | |
308 /* The name that was associated with the icon, the last time | |
309 it was refreshed. Usually the same as the name of the | |
771 | 310 buffer in the currently selected window in the frame */ |
259 | 311 char *icon_label; |
312 | |
313 /* Flag to set when the X window needs to be completely repainted. */ | |
314 int needs_exposure; | |
315 | |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1788
diff
changeset
|
316 /* 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
|
317 (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
|
318 enum text_cursor_kinds current_cursor; |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1788
diff
changeset
|
319 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1788
diff
changeset
|
320 /* 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
|
321 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
|
322 enum text_cursor_kinds desired_cursor; |
999 | 323 |
324 /* These are the current window manager hints. It seems that | |
325 XSetWMHints, when presented with an unset bit in the `flags' | |
326 member of the hints structure, does not leave the corresponding | |
327 attribute unchanged; rather, it resets that attribute to its | |
328 default value. For example, unless you set the `icon_pixmap' | |
329 field and the `IconPixmapHint' bit, XSetWMHints will forget what | |
330 your icon pixmap was. This is rather troublesome, since some of | |
331 the members (for example, `input' and `icon_pixmap') want to stay | |
332 the same throughout the execution of Emacs. So, we keep this | |
333 structure around, just leaving values in it and adding new bits | |
334 to the mask as we go. */ | |
335 XWMHints wm_hints; | |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
336 |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
337 /* The size of the extra width currently allotted for vertical |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
338 scrollbars, in pixels. */ |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
339 int vertical_scrollbar_extra; |
259 | 340 }; |
1040 | 341 |
342 /* Return the window associated with the frame F. */ | |
343 #define FRAME_X_WINDOW(f) ((f)->display.x->window_desc) | |
344 | |
1821
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1788
diff
changeset
|
345 /* 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
|
346 #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
|
347 #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
|
348 |
04fb1d3d6992
JimB's changes since January 18th
Jim Blandy <jimb@redhat.com>
parents:
1788
diff
changeset
|
349 #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
|
350 |
259 | 351 |
352 /* When X windows are used, a glyf may be a 16 bit unsigned datum. | |
353 The high order byte is the face number and is used as an index | |
354 in the face table. A face is a font plus: | |
355 1) the unhighlighted foreground color, | |
356 2) the unhighlighted background color. | |
357 For highlighting, the two colors are exchanged. | |
358 Face number 0 is unused. The low order byte of a glyf gives | |
359 the character within the font. All fonts are assumed to be | |
360 fixed width, and to have the same height and width. */ | |
361 | |
362 #ifdef HAVE_X11 | |
363 | |
1408
b8e32247c590
* xterm.h: Declaration of struct face removed.
Joseph Arceneaux <jla@gnu.org>
parents:
1258
diff
changeset
|
364 /* Face declared in dispextern.h */ |
259 | 365 |
366 #else /* X10 */ | |
367 | |
368 struct face | |
369 { | |
370 FONT_TYPE *font; /* Font info for specified font. */ | |
371 int fg; /* Unhighlighted foreground. */ | |
372 int bg; /* Unhighlighted background. */ | |
373 }; | |
374 #endif /* X10 */ | |
375 | |
376 #define MAX_FACES_AND_GLYPHS 256 | |
377 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
|
378 |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
379 |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
380 /* X-specific scrollbar stuff. */ |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
381 |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
382 /* We represent scrollbars as lisp vectors. This allows us to place |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
383 references to them in windows without worrying about whether we'll |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
384 end up with windows referring to dead scrollbars; the garbage |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
385 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
|
386 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
387 We use struct scrollbar as a template for accessing fields of the |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
388 vector. */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
389 |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
390 struct scrollbar { |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
391 |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
392 /* 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
|
393 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
|
394 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
|
395 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
396 /* The window we're a scrollbar for. */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
397 Lisp_Object window; |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
398 |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
399 /* The next and previous in the chain of scrollbars in this frame. */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
400 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
|
401 |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
402 /* The X window representing this scrollbar. Since this is a full |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
403 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
|
404 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
|
405 |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
406 /* The position and size of the scrollbar in pixels, relative to the |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
407 frame. */ |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
408 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
|
409 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
410 /* 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
|
411 handle area (i.e. zero is the top position, not |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
412 SCROLLBAR_TOP_BORDER). If they're equal, that means the handle |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
413 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
|
414 |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
415 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
|
416 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
|
417 editing large files, we establish a minimum height by always |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
418 drawing handle bottoms VERTICAL_SCROLLBAR_MIN_HANDLE pixels below |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
419 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
|
420 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
|
421 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
|
422 |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
423 /* If the scrollbar handle is currently being dragged by the user, |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
424 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
|
425 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
|
426 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
|
427 Lisp_Object dragging; |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
428 }; |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
429 |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
430 /* The number of elements a vector holding a struct scrollbar needs. */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
431 #define SCROLLBAR_VEC_SIZE \ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
432 ((sizeof (struct scrollbar) - sizeof (int) - sizeof (struct Lisp_Vector *)) \ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
433 / sizeof (Lisp_Object)) |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
434 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
435 /* Turning a lisp vector value into a pointer to a struct scrollbar. */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
436 #define XSCROLLBAR(vec) ((struct scrollbar *) XPNTR (vec)) |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
437 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
438 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
439 /* Building a 32-bit C integer from two 16-bit lisp integers. */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
440 #define SCROLLBAR_PACK(low, high) (XINT (high) << 16 | XINT (low)) |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
441 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
442 /* Setting two lisp integers to the low and high words of a 32-bit C int. */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
443 #define SCROLLBAR_UNPACK(low, high, int32) \ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
444 (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
|
445 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
|
446 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
447 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
448 /* Extract the X window id of the scrollbar from a struct scrollbar. */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
449 #define SCROLLBAR_X_WINDOW(ptr) \ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
450 ((Window) SCROLLBAR_PACK ((ptr)->x_window_low, (ptr)->x_window_high)) |
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 /* Store a window id in a struct scrollbar. */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
453 #define SET_SCROLLBAR_X_WINDOW(ptr, id) \ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
454 (SCROLLBAR_UNPACK ((ptr)->x_window_low, (ptr)->x_window_high, (int) id)) |
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 |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
457 /* Return the outside pixel width for a vertical scrollbar on frame F. */ |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
458 #define VERTICAL_SCROLLBAR_PIXEL_WIDTH(f) (2*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
|
459 |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
460 /* Return the outside pixel height for a vertical scrollbar HEIGHT |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
461 rows high on frame F. */ |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
462 #define VERTICAL_SCROLLBAR_PIXEL_HEIGHT(f, height) \ |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
463 ((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
|
464 |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
465 /* Return the inside width of a vertical scrollbar, given the outside |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
466 width. */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
467 #define VERTICAL_SCROLLBAR_INSIDE_WIDTH(width) \ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
468 ((width) - VERTICAL_SCROLLBAR_LEFT_BORDER - VERTICAL_SCROLLBAR_RIGHT_BORDER) |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
469 |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
470 /* 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
|
471 handle must stay. This isn't equivalent to the inside height, |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
472 because the scrollbar handle has a minimum height. |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
473 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
474 This is the real range of motion for the scrollbar, so when we're |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
475 scaling buffer positions to scrollbar positions, we use this, not |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
476 VERTICAL_SCROLLBAR_INSIDE_HEIGHT. */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
477 #define VERTICAL_SCROLLBAR_TOP_RANGE(height) \ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
478 (VERTICAL_SCROLLBAR_INSIDE_HEIGHT (height) - VERTICAL_SCROLLBAR_MIN_HANDLE) |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
479 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
480 /* Return the inside height of vertical scrollbar, given the outside |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
481 height. See VERTICAL_SCROLLBAR_TOP_RANGE too. */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
482 #define VERTICAL_SCROLLBAR_INSIDE_HEIGHT(height) \ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
483 ((height) - VERTICAL_SCROLLBAR_TOP_BORDER - VERTICAL_SCROLLBAR_BOTTOM_BORDER) |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
484 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
485 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
486 /* Border widths for scrollbars. |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
487 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
488 Scrollbar windows don't have any X borders; their border width is |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
489 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
|
490 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
|
491 (used when relating to the rest of the screen) and inside width |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
492 (used when sizing and drawing the scrollbar window itself). |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
493 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
494 The handle moves up and down/back and forth in a rectange inset |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
495 from the edges of the scrollbar. These are widths by which we |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
496 inset the handle boundaries from the scrollbar edges. */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
497 #define VERTICAL_SCROLLBAR_LEFT_BORDER (2) |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
498 #define VERTICAL_SCROLLBAR_RIGHT_BORDER (3) |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
499 #define VERTICAL_SCROLLBAR_TOP_BORDER (2) |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
500 #define VERTICAL_SCROLLBAR_BOTTOM_BORDER (2) |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
501 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
502 /* Minimum lengths for scrollbar handles, in pixels. */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
503 #define VERTICAL_SCROLLBAR_MIN_HANDLE (5) |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
504 |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
505 |
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
506 /* 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
|
507 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
|
508 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
|
509 |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
510 /* 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
|
511 at ROW/COL. */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
512 #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
|
513 ((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
|
514 + (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
|
515 #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
|
516 ((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
|
517 + (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
|
518 |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
519 /* 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
|
520 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
|
521 #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
|
522 (CHAR_TO_PIXEL_COL (f, width) \ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
523 + (f)->display.x->vertical_scrollbar_extra \ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
524 + (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
|
525 #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
|
526 (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
|
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 |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
529 |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
530 /* 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
|
531 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
|
532 #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
|
533 (((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
|
534 / 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
|
535 #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
|
536 (((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
|
537 / 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
|
538 |
1788
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
539 /* 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
|
540 frame F? */ |
aaccd635fb71
Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents:
1721
diff
changeset
|
541 #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
|
542 (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
|
543 - (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
|
544 - (f)->display.x->vertical_scrollbar_extra))) |
1721
6ba3bca4c3de
* frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents:
1531
diff
changeset
|
545 #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
|
546 (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
|
547 - (f)->display.x->internal_border_width))) |