annotate src/xterm.h @ 1788:aaccd635fb71

Make scrollbar structures into lisp objects, so that they can be GC'd; this allows windows and scrollbars can refer to each other without worrying about dangling pointers. * xterm.h (struct x_display): vertical_scrollbars and judge_timestamp members deleted. (struct scrollbar): Redesigned to be a template for a Lisp_Vector. (SCROLLBAR_VEC_SIZE, XSCROLLBAR, SCROLLBAR_PACK, SCROLLBAR_UNPACK, SCROLLBAR_X_WINDOW, SET_SCROLLBAR_X_WINDOW, VERTICAL_SCROLLBAR_INSIDE_WIDTH, VERTICAL_SCROLLBAR_TOP_RANGE, VERTICAL_SCROLLBAR_INSIDE_HEIGHT, VERTICAL_SCROLLBAR_MIN_HANDLE): New macros, to help deal with the lispy structures, and deal with the graphics. * frame.h (WINDOW_VERTICAL_SCROLLBAR): Macro deleted. (struct frame): New fields `scrollbars' and `condemned_scrollbars', for use by the scrollbar implementation. [MULTI_FRAME and not MULTI_FRAME] (FRAME_SCROLLBARS, FRAME_CONDEMNED_SCROLLBARS): Accessors for the new field. * window.h (struct window): Doc fix for vertical_scrollbar field. * frame.c (make_frame): Initialize the `scrollbars' and `condemned_scrollbars' fields of the new frame. * alloc.c (mark_object): Mark the `scrollbars' and `condemned_scrollbars' slots of frames. * xterm.c (x_window_to_scrollbar): Scrollbars are chained on frames' scrollbar field, not their x.display->vertical_scrollbars field. (x_scrollbar_create, x_scrollbar_set_handle, x_scrollbar_move, x_scrollbar_remove, XTset_vertical_scrollbar, XTcondemn_scrollbars, XTredeem_scrollbar, XTjudge_scrollbars, x_scrollbar_expose, x_scrollbar_handle_click, x_scrollbar_handle_motion): Substantially rewritten to correct typos and brainos, and to accomodate the lispy structures. * xterm.h (CHAR_TO_PIXEL_WIDTH, CHAR_TO_PIXEL_HEIGHT, PIXEL_TO_CHAR_WIDTH, PIXEL_TO_CHAR_HEIGHT): Rewritten, using: (CHAR_TO_PIXEL_ROW, CHAR_TO_PIXEL_COL, PIXEL_TO_CHAR_ROW, PIXEL_TO_CHAR_COL): New macros. * xfns.c [not HAVE_X11] (Fx_create_frame): Use the PIXEL_TO_CHAR_{HEIGHT,WIDTH} macros to figure the frame's character size, and the CHAR_TO_PIXEL* macros for vice versa. * xterm.c (XTwrite_glyphs, XTclear_end_of_line, stufflines, scraplines, dumprectangle, pixel_to_glyph_coords, x_draw_box, clear_cursor, x_display_bar_cursor, x_draw_single_glyph, x_set_mouse_position): Use the CHAR_TO_PIXEL_* macros.
author Jim Blandy <jimb@redhat.com>
date Thu, 14 Jan 1993 15:34:59 +0000
parents 6ba3bca4c3de
children 04fb1d3d6992
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
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
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4 This file is part of GNU Emacs.
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
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
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9 any later version.
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14 GNU General Public License for more details.
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 along with GNU Emacs; see the file COPYING. If not, write to
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20 #ifdef HAVE_X11
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21 #include <X11/Xlib.h>
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22 #include <X11/cursorfont.h>
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23 #include <X11/Xutil.h>
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24 #include <X11/keysym.h>
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25 #include <X11/Xatom.h>
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26 #include <X11/Xresource.h>
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27 #else
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28 #include <X/Xlib.h>
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29 #endif /* HAVE_X11 */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 /* Define a queue for X-events. One such queue is used for mouse clicks.
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32 Another is used for expose events. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 #define EVENT_BUFFER_SIZE 64
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 /* Max and Min sizes in character columns. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37 #define MINWIDTH 10
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 #define MINHEIGHT 10
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39 #define MAXWIDTH 300
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 #define MAXHEIGHT 80
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 #ifdef HAVE_X11
999
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 771
diff changeset
43
1040
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
44 /* HAVE_X11R4 is defined if we have the features of X11R4. It should
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
45 be defined when we're using X11R5, since X11R5 has the features of
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
46 X11R4. If, in the future, we find we need more of these flags
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
47 (HAVE_X11R5, for example), code should always be written to test
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
48 the most recent flag first:
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
49
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
50 #ifdef HAVE_X11R5
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
51 ...
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
52 #elif HAVE_X11R4
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
53 ...
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
54 #elif HAVE_X11
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
55 ...
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
56 #endif
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
57
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
58 If you ever find yourself writing a "#ifdef HAVE_FOO" clause that
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
59 looks a lot like another one, consider moving the text into a macro
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
60 whose definition is configuration-dependent, but whose usage is
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
61 universal - like the stuff in systime.h.
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
62
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
63 It turns out that we can auto-detect whether we're being compiled
999
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 771
diff changeset
64 with X11R3 or X11R4 by looking for the flag macros for R4 structure
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 771
diff changeset
65 members that R3 doesn't have. */
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 771
diff changeset
66 #ifdef PBaseSize
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 771
diff changeset
67 #define HAVE_X11R4
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 771
diff changeset
68 #endif
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 771
diff changeset
69
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 #define PIX_TYPE unsigned long
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 #define XDISPLAY x_current_display,
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 #define XFlushQueue() XFlush(x_current_display)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73 #define BLACK_PIX_DEFAULT BlackPixel (x_current_display, \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 XDefaultScreen (x_current_display))
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 #define WHITE_PIX_DEFAULT WhitePixel (x_current_display, \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 XDefaultScreen (x_current_display))
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 #define DISPLAY_SCREEN_ARG x_current_display, \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 XDefaultScreen (x_current_display)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
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
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 #define FONT_TYPE XFontStruct
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82 #define Color XColor
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84 #define XExposeRegionEvent XExposeEvent
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 #define Bitmap Pixmap /* In X11, Bitmaps are are kind of
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 Pixmap. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 #define WINDOWINFO_TYPE XWindowAttributes
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88 #define XGetWindowInfo(w, i) XGetWindowAttributes (x_current_display, \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 (w), (i))
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 #define XGetFont(f) XLoadQueryFont (x_current_display, (f))
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91 #define XLoseFont(f) XFreeFont (x_current_display, (f))
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 #define XStuffPending() XPending (x_current_display)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 #define XClear(w) XClearWindow (x_current_display, (w))
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94 #define XWarpMousePointer(w,x,y) XWarpPointer (x_current_display, None, w, \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95 0,0,0,0, x, y)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96 #define XHandleError XSetErrorHandler
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97 #define XHandleIOError XSetIOErrorHandler
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99 #define XChangeWindowSize(w,x,y) XResizeWindow(x_current_display,w,x,y)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101 #define FONT_WIDTH(f) ((f)->max_bounds.width)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
102 #define FONT_HEIGHT(f) ((f)->ascent + (f)->descent)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
103 #define FONT_BASE(f) ((f)->ascent)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
105 /* The mask of events that text windows always want to receive. This
424
a9b60e014edd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 348
diff changeset
106 does not include mouse movement events. It is used when the window
a9b60e014edd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 348
diff changeset
107 is created (in x_window) and when we ask/unask for mouse movement
a9b60e014edd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 348
diff changeset
108 events (in XTmouse_tracking_enable).
a9b60e014edd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 348
diff changeset
109
a9b60e014edd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 348
diff changeset
110 We do include ButtonReleases in this set because elisp isn't always
a9b60e014edd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 348
diff changeset
111 fast enough to catch them when it wants them, and they're rare
a9b60e014edd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 348
diff changeset
112 enough that they don't use much processor time. */
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
113
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
114 #define STANDARD_EVENT_SET \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
115 (KeyPressMask \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
116 | ExposureMask \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117 | ButtonPressMask \
424
a9b60e014edd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 348
diff changeset
118 | ButtonReleaseMask \
a9b60e014edd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 348
diff changeset
119 | PointerMotionMask \
a9b60e014edd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 348
diff changeset
120 | PointerMotionHintMask \
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121 | StructureNotifyMask \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122 | FocusChangeMask \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
123 | LeaveWindowMask \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
124 | EnterWindowMask \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
125 | VisibilityChangeMask)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 #else /* X10 */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129 #define ConnectionNumber(dpy) dpyno()
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
130 #define PIX_TYPE int
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131 #define XDISPLAY
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
132 #define XFlushQueue() XFlush()
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
133 #define BLACK_PIX_DEFAULT BlackPixel
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134 #define WHITE_PIX_DEFAULT WhitePixel
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
135 #define DISPLAY_SCREEN_ARG
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
136 #define DISPLAY_CELLS DisplayCells ()
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
137 #define ROOT_WINDOW RootWindow
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138 #define XFree free
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
139 #define FONT_TYPE FontInfo
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141 #define WINDOWINFO_TYPE WindowInfo
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142 #define XGetWindowInfo(w, i) XQueryWindow ((w), (i))
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143 #define XGetFont(f) XOpenFont ((f))
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144 #define XLoseFont(f) XCloseFont ((f))
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145 #define XStuffPending() XPending ()
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146 #define XWarpMousePointer(w,x,y) XWarpMouse (w,x,y)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147 #define XHandleError XErrorHandler
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148 #define XHandleIOError XIOErrorHandler
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
150 #define FONT_WIDTH(f) ((f)->width)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
151 #define FONT_HEIGHT(f) ((f)->height)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
152 #define FONT_BASE(f) ((f)->base)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
153
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
154 #define XChangeWindowSize(w,x,y) XChangeWindow(w,x,y)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
155
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
156 #endif /* X10 */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
157
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
158 struct event_queue
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
159 {
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
160 int rindex; /* Index at which to fetch next. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
161 int windex; /* Index at which to store next. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162 XEvent xrep[EVENT_BUFFER_SIZE];
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
163 };
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
165 /* Queue for mouse clicks. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
166 extern struct event_queue x_mouse_queue;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
167
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
168 /* Mechanism for interlocking between main program level
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
169 and input interrupt level. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
170
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
171 /* Nonzero during a critical section. At such a time, an input interrupt
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
172 does nothing but set `x_pending_input'. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
173 extern int x_input_blocked;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
174
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
175 /* Nonzero means an input interrupt has arrived
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
176 during the current critical section. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
177 extern int x_pending_input;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
178
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
179 /* Begin critical section. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
180 #define BLOCK_INPUT (x_input_blocked++)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
181
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182 /* End critical section. */
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 424
diff changeset
183 #define UNBLOCK_INPUT \
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 424
diff changeset
184 (x_input_blocked--, (x_input_blocked < 0 ? (abort (), 0) : 0))
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
185
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
186 #define TOTALLY_UNBLOCK_INPUT (x_input_blocked = 0)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
187 #define UNBLOCK_INPUT_RESIGNAL UNBLOCK_INPUT
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
188
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
189 /* This is the X connection that we are using. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
190
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
191 extern Display *x_current_display;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
192
771
538c0bcb418e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 642
diff changeset
193 extern struct frame *x_window_to_frame ();
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
194
771
538c0bcb418e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 642
diff changeset
195 /* The frame (if any) which has the X window that has keyboard focus.
538c0bcb418e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 642
diff changeset
196 Zero if none. This is examined by Ffocus_frame in xfns.c */
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
197
771
538c0bcb418e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 642
diff changeset
198 struct frame *x_focus_frame;
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
199
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
200 #ifdef HAVE_X11
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
201 /* Variables associated with the X display screen this emacs is using. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
202
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
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
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
205
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
206 /* The vendor supporting this X server. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
207 extern Lisp_Object Vx_vendor;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
208
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
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
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
211
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
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
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
214
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
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
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
217
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
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
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
220
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
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
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
223
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
224 /* Does this X screen do backing store? */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
225 extern Lisp_Object Vx_backing_store;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
226
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
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
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
229
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
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
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
232
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
233 /* X Visual type of this screen. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
234 extern Lisp_Object Vx_screen_visual;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
235
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
236 #endif /* HAVE_X11 */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
237
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
238 enum text_cursor_kinds {
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
239 filled_box_cursor, hollow_box_cursor, bar_cursor
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
240 };
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
241
1721
6ba3bca4c3de * frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents: 1531
diff changeset
242 #define PIXEL_WIDTH(f) ((f)->display.x->pixel_width)
6ba3bca4c3de * frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents: 1531
diff changeset
243 #define PIXEL_HEIGHT(f) ((f)->display.x->pixel_height)
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
244
771
538c0bcb418e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 642
diff changeset
245 /* Each X frame object points to its own struct x_display object
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
246 in the display.x field. The x_display structure contains all
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
247 the information that is specific to X windows. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
248
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
249 struct x_display
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
250 {
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
251 /* Position of the X window (x and y offsets in root window). */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
252 int left_pos;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
253 int top_pos;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
254
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
255 /* Border width of the X window as known by the X window system. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
256 int border_width;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
257
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
258 /* Size of the X window in pixels. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
259 int pixel_height, pixel_width;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
260
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
261 #ifdef HAVE_X11
771
538c0bcb418e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 642
diff changeset
262 /* The tiled border used when the mouse is out of the frame. */
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
263 Pixmap border_tile;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
264
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
265 /* Here are the Graphics Contexts for the default font. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
266 GC normal_gc; /* Normal video */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
267 GC reverse_gc; /* Reverse video */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
268 GC cursor_gc; /* cursor drawing */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
269 #endif /* HAVE_X11 */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
270
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
271 /* Width of the internal border. This is a line of background color
771
538c0bcb418e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 642
diff changeset
272 just inside the window's border. When the frame is selected,
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
273 a highlighting is displayed inside the internal border. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
274 int internal_border_width;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
275
771
538c0bcb418e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 642
diff changeset
276 /* The X window used for this frame.
538c0bcb418e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 642
diff changeset
277 May be zero while the frame object is being created
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
278 and the X window has not yet been created. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
279 Window window_desc;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
280
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
281 /* The X window used for the bitmap icon;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
282 or 0 if we don't have a bitmap icon. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
283 Window icon_desc;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
284
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
285 /* The X window that is the parent of this X window.
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
286 Usually but not always RootWindow. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
287 Window parent_desc;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
288
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
289 /* 1 for bitmap icon, 0 for text icon. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
290 int icon_bitmap_flag;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
291
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
292 FONT_TYPE *font;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
293
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
294 /* Pixel values used for various purposes.
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
295 border_pixel may be -1 meaning use a gray tile. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
296 PIX_TYPE background_pixel;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
297 PIX_TYPE foreground_pixel;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
298 PIX_TYPE cursor_pixel;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
299 PIX_TYPE border_pixel;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
300 PIX_TYPE mouse_pixel;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
301
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
302 /* Descriptor for the cursor in use for this window. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
303 #ifdef HAVE_X11
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
304 Cursor text_cursor;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
305 Cursor nontext_cursor;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
306 Cursor modeline_cursor;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
307 #else
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
308 Cursor cursor;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
309 #endif
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
310
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
311 /* The name that was associated with the icon, the last time
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
312 it was refreshed. Usually the same as the name of the
771
538c0bcb418e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 642
diff changeset
313 buffer in the currently selected window in the frame */
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
314 char *icon_label;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
315
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
316 /* Flag to set when the X window needs to be completely repainted. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
317 int needs_exposure;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
318
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
319 /* What kind of text cursor is drawn in this window right now? (If
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
320 there is no cursor (phys_cursor_x < 0), then this means nothing. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
321 enum text_cursor_kinds text_cursor_kind;
999
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 771
diff changeset
322
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 771
diff changeset
323 /* These are the current window manager hints. It seems that
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 771
diff changeset
324 XSetWMHints, when presented with an unset bit in the `flags'
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 771
diff changeset
325 member of the hints structure, does not leave the corresponding
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 771
diff changeset
326 attribute unchanged; rather, it resets that attribute to its
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 771
diff changeset
327 default value. For example, unless you set the `icon_pixmap'
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 771
diff changeset
328 field and the `IconPixmapHint' bit, XSetWMHints will forget what
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 771
diff changeset
329 your icon pixmap was. This is rather troublesome, since some of
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 771
diff changeset
330 the members (for example, `input' and `icon_pixmap') want to stay
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 771
diff changeset
331 the same throughout the execution of Emacs. So, we keep this
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 771
diff changeset
332 structure around, just leaving values in it and adding new bits
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 771
diff changeset
333 to the mask as we go. */
d8d503897aa5 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 771
diff changeset
334 XWMHints wm_hints;
1721
6ba3bca4c3de * frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents: 1531
diff changeset
335
6ba3bca4c3de * frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents: 1531
diff changeset
336 /* 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
337 scrollbars, in pixels. */
6ba3bca4c3de * frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents: 1531
diff changeset
338 int vertical_scrollbar_extra;
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
339 };
1040
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
340
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
341 /* Return the window associated with the frame F. */
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
342 #define FRAME_X_WINDOW(f) ((f)->display.x->window_desc)
eb7ebe86e885 entered into RCS
Jim Blandy <jimb@redhat.com>
parents: 999
diff changeset
343
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
344
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
345 /* When X windows are used, a glyf may be a 16 bit unsigned datum.
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
346 The high order byte is the face number and is used as an index
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
347 in the face table. A face is a font plus:
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
348 1) the unhighlighted foreground color,
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
349 2) the unhighlighted background color.
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
350 For highlighting, the two colors are exchanged.
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
351 Face number 0 is unused. The low order byte of a glyf gives
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
352 the character within the font. All fonts are assumed to be
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
353 fixed width, and to have the same height and width. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
354
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
355 #ifdef HAVE_X11
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
356
1408
b8e32247c590 * xterm.h: Declaration of struct face removed.
Joseph Arceneaux <jla@gnu.org>
parents: 1258
diff changeset
357 /* Face declared in dispextern.h */
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
358
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
359 #else /* X10 */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
360
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
361 struct face
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
362 {
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
363 FONT_TYPE *font; /* Font info for specified font. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
364 int fg; /* Unhighlighted foreground. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
365 int bg; /* Unhighlighted background. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
366 };
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
367 #endif /* X10 */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
368
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
369 #define MAX_FACES_AND_GLYPHS 256
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
370 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
371
6ba3bca4c3de * frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents: 1531
diff changeset
372
6ba3bca4c3de * frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents: 1531
diff changeset
373 /* X-specific scrollbar stuff. */
6ba3bca4c3de * frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents: 1531
diff changeset
374
1788
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
375 /* 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
376 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
377 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
378 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
379
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
380 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
381 vector. */
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
382
1721
6ba3bca4c3de * frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents: 1531
diff changeset
383 struct scrollbar {
6ba3bca4c3de * frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents: 1531
diff changeset
384
1788
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
385 /* 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
386 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
387 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
388
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
389 /* 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
390 Lisp_Object window;
1721
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 /* 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
393 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
394
1788
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
395 /* 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
396 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
397 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
398
6ba3bca4c3de * frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents: 1531
diff changeset
399 /* 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
400 frame. */
1788
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
401 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
402
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
403 /* 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
404 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
405 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
406 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
407
1788
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
408 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
409 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
410 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
411 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
412 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
413 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
414 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
415
6ba3bca4c3de * frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents: 1531
diff changeset
416 /* 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
417 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
418 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
419 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
420 Lisp_Object dragging;
1721
6ba3bca4c3de * frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents: 1531
diff changeset
421 };
6ba3bca4c3de * frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents: 1531
diff changeset
422
1788
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
423 /* 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
424 #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
425 ((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
426 / sizeof (Lisp_Object))
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
427
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
428 /* 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
429 #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
430
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
431
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
432 /* 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
433 #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
434
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
435 /* 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
436 #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
437 (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
438 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
439
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
440
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
441 /* 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
442 #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
443 ((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
444
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
445 /* 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
446 #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
447 (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
448
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
449
1721
6ba3bca4c3de * frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents: 1531
diff changeset
450 /* 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
451 #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
452
6ba3bca4c3de * frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents: 1531
diff changeset
453 /* 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
454 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
455 #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
456 ((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
457
1788
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
458 /* 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
459 width. */
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
460 #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
461 ((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
462
1788
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
463 /* 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
464 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
465 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
466
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
467 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
468 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
469 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
470 #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
471 (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
472
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
473 /* 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
474 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
475 #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
476 ((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
477
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
478
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
479 /* 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
480
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
481 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
482 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
483 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
484 (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
485 (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
486
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
487 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
488 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
489 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
490 #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
491 #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
492 #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
493 #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
494
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
495 /* 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
496 #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
497
6ba3bca4c3de * frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents: 1531
diff changeset
498
6ba3bca4c3de * frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents: 1531
diff changeset
499 /* 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
500 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
501 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
502
1788
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
503 /* 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
504 at ROW/COL. */
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
505 #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
506 ((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
507 + (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
508 #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
509 ((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
510 + (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
511
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
512 /* 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
513 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
514 #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
515 (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
516 + (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
517 + (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
518 #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
519 (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
520 + (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
521
1721
6ba3bca4c3de * frame.h (struct frame): New fields `can_have_scrollbars' and
Jim Blandy <jimb@redhat.com>
parents: 1531
diff changeset
522
1788
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
523 /* 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
524 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
525 #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
526 (((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
527 / 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
528 #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
529 (((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
530 / 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
531
1788
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
532 /* 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
533 frame F? */
aaccd635fb71 Make scrollbar structures into lisp objects, so that they can be
Jim Blandy <jimb@redhat.com>
parents: 1721
diff changeset
534 #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
535 (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
536 - (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
537 - (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
538 #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
539 (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
540 - (f)->display.x->internal_border_width)))