annotate src/xterm.h @ 823:746ebe6cc4c8

*** empty log message ***
author Roland McGrath <roland@gnu.org>
date Mon, 20 Jul 1992 22:30:14 +0000
parents 538c0bcb418e
children d8d503897aa5
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.
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2 Copyright (C) 1989 Free Software Foundation, Inc.
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
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 the Free Software Foundation; either version 1, or (at your option)
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
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43 #define PIX_TYPE unsigned long
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44 #define XDISPLAY x_current_display,
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45 #define XFlushQueue() XFlush(x_current_display)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 #define BLACK_PIX_DEFAULT BlackPixel (x_current_display, \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47 XDefaultScreen (x_current_display))
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48 #define WHITE_PIX_DEFAULT WhitePixel (x_current_display, \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 XDefaultScreen (x_current_display))
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50 #define DISPLAY_SCREEN_ARG x_current_display, \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 XDefaultScreen (x_current_display)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52 #define DISPLAY_CELLS DisplayCells (x_current_display, XDefaultScreen (x_current_display))
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53 #define ROOT_WINDOW RootWindow (x_current_display, XDefaultScreen (x_current_display))
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54 #define FONT_TYPE XFontStruct
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55 #define Color XColor
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57 #define XExposeRegionEvent XExposeEvent
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58 #define Bitmap Pixmap /* In X11, Bitmaps are are kind of
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59 Pixmap. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60 #define WINDOWINFO_TYPE XWindowAttributes
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61 #define XGetWindowInfo(w, i) XGetWindowAttributes (x_current_display, \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 (w), (i))
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63 #define XGetFont(f) XLoadQueryFont (x_current_display, (f))
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 #define XLoseFont(f) XFreeFont (x_current_display, (f))
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65 #define XStuffPending() XPending (x_current_display)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66 #define XClear(w) XClearWindow (x_current_display, (w))
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67 #define XWarpMousePointer(w,x,y) XWarpPointer (x_current_display, None, w, \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68 0,0,0,0, x, y)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69 #define XHandleError XSetErrorHandler
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 #define XHandleIOError XSetIOErrorHandler
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 #define XChangeWindowSize(w,x,y) XResizeWindow(x_current_display,w,x,y)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 #define FONT_WIDTH(f) ((f)->max_bounds.width)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 #define FONT_HEIGHT(f) ((f)->ascent + (f)->descent)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 #define FONT_BASE(f) ((f)->ascent)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 /* GC values used for drawing non-standard (other face) text. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79 extern XGCValues face_gc_values;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 /* 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
82 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
83 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
84 events (in XTmouse_tracking_enable).
a9b60e014edd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 348
diff changeset
85
a9b60e014edd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 348
diff changeset
86 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
87 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
88 enough that they don't use much processor time. */
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 #define STANDARD_EVENT_SET \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91 (KeyPressMask \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 | ExposureMask \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 | ButtonPressMask \
424
a9b60e014edd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 348
diff changeset
94 | ButtonReleaseMask \
a9b60e014edd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 348
diff changeset
95 | PointerMotionMask \
a9b60e014edd *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 348
diff changeset
96 | PointerMotionHintMask \
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97 | StructureNotifyMask \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98 | FocusChangeMask \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99 | LeaveWindowMask \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100 | EnterWindowMask \
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101 | VisibilityChangeMask)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
102
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
103 #else /* X10 */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
105 #define ConnectionNumber(dpy) dpyno()
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106 #define PIX_TYPE int
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
107 #define XDISPLAY
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
108 #define XFlushQueue() XFlush()
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
109 #define BLACK_PIX_DEFAULT BlackPixel
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
110 #define WHITE_PIX_DEFAULT WhitePixel
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
111 #define DISPLAY_SCREEN_ARG
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112 #define DISPLAY_CELLS DisplayCells ()
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
113 #define ROOT_WINDOW RootWindow
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
114 #define XFree free
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
115 #define FONT_TYPE FontInfo
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
116
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117 #define WINDOWINFO_TYPE WindowInfo
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
118 #define XGetWindowInfo(w, i) XQueryWindow ((w), (i))
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
119 #define XGetFont(f) XOpenFont ((f))
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
120 #define XLoseFont(f) XCloseFont ((f))
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121 #define XStuffPending() XPending ()
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122 #define XWarpMousePointer(w,x,y) XWarpMouse (w,x,y)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
123 #define XHandleError XErrorHandler
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
124 #define XHandleIOError XIOErrorHandler
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
125
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126 #define FONT_WIDTH(f) ((f)->width)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 #define FONT_HEIGHT(f) ((f)->height)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128 #define FONT_BASE(f) ((f)->base)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
130 #define XChangeWindowSize(w,x,y) XChangeWindow(w,x,y)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
132 #endif /* X10 */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
133
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134 struct event_queue
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
135 {
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
136 int rindex; /* Index at which to fetch next. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
137 int windex; /* Index at which to store next. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138 XEvent xrep[EVENT_BUFFER_SIZE];
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
139 };
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141 /* Queue for mouse clicks. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142 extern struct event_queue x_mouse_queue;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144 /* Mechanism for interlocking between main program level
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145 and input interrupt level. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147 /* Nonzero during a critical section. At such a time, an input interrupt
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148 does nothing but set `x_pending_input'. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149 extern int x_input_blocked;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
150
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
151 /* Nonzero means an input interrupt has arrived
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
152 during the current critical section. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
153 extern int x_pending_input;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
154
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
155 /* Begin critical section. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
156 #define BLOCK_INPUT (x_input_blocked++)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
157
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
158 /* End critical section. */
485
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 424
diff changeset
159 #define UNBLOCK_INPUT \
8c615e453683 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 424
diff changeset
160 (x_input_blocked--, (x_input_blocked < 0 ? (abort (), 0) : 0))
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
161
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162 #define TOTALLY_UNBLOCK_INPUT (x_input_blocked = 0)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
163 #define UNBLOCK_INPUT_RESIGNAL UNBLOCK_INPUT
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
165 /* This is the X connection that we are using. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
166
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
167 extern Display *x_current_display;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
168
771
538c0bcb418e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 642
diff changeset
169 extern struct frame *x_window_to_frame ();
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
170
771
538c0bcb418e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 642
diff changeset
171 /* 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
172 Zero if none. This is examined by Ffocus_frame in xfns.c */
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
173
771
538c0bcb418e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 642
diff changeset
174 struct frame *x_focus_frame;
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
175
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
176 #ifdef HAVE_X11
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
177 /* Variables associated with the X display screen this emacs is using. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
178
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
179 /* How many screens this X display has. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
180 extern Lisp_Object x_screen_count;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
181
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182 /* The vendor supporting this X server. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
183 extern Lisp_Object Vx_vendor;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
184
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
185 /* The vendor's release number for this X server. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
186 extern Lisp_Object x_release;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
187
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
188 /* Height of this X screen in pixels. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
189 extern Lisp_Object x_screen_height;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
190
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
191 /* Height of this X screen in millimeters. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
192 extern Lisp_Object x_screen_height_mm;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
193
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
194 /* Width of this X screen in pixels. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
195 extern Lisp_Object x_screen_width;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
196
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
197 /* Width of this X screen in millimeters. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
198 extern Lisp_Object x_screen_width_mm;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
199
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
200 /* Does this X screen do backing store? */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
201 extern Lisp_Object Vx_backing_store;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
202
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
203 /* Does this X screen do save-unders? */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
204 extern Lisp_Object x_save_under;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
205
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
206 /* Number of planes for this screen. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
207 extern Lisp_Object x_screen_planes;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
208
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
209 /* X Visual type of this screen. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
210 extern Lisp_Object Vx_screen_visual;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
211
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
212 #endif /* HAVE_X11 */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
213
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
214 enum text_cursor_kinds {
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
215 filled_box_cursor, hollow_box_cursor, bar_cursor
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
216 };
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
217
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
218 #define PIXEL_WIDTH(s) ((s)->display.x->pixel_width)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
219 #define PIXEL_HEIGHT(s) ((s)->display.x->pixel_height)
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
220
771
538c0bcb418e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 642
diff changeset
221 /* Each X frame object points to its own struct x_display object
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
222 in the display.x field. The x_display structure contains all
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
223 the information that is specific to X windows. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
224
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
225 struct x_display
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
226 {
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
227 /* Position of the X window (x and y offsets in root window). */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
228 int left_pos;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
229 int top_pos;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
230
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
231 /* Border width of the X window as known by the X window system. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
232 int border_width;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
233
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
234 /* Size of the X window in pixels. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
235 int pixel_height, pixel_width;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
236
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
237 #ifdef HAVE_X11
771
538c0bcb418e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 642
diff changeset
238 /* The tiled border used when the mouse is out of the frame. */
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
239 Pixmap border_tile;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
240
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
241 /* Here are the Graphics Contexts for the default font. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
242 GC normal_gc; /* Normal video */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
243 GC reverse_gc; /* Reverse video */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
244 GC cursor_gc; /* cursor drawing */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
245 #endif /* HAVE_X11 */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
246
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
247 /* 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
248 just inside the window's border. When the frame is selected,
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
249 a highlighting is displayed inside the internal border. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
250 int internal_border_width;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
251
771
538c0bcb418e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 642
diff changeset
252 /* The X window used for this frame.
538c0bcb418e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 642
diff changeset
253 May be zero while the frame object is being created
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
254 and the X window has not yet been created. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
255 Window window_desc;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
256
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
257 /* The X window used for the bitmap icon;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
258 or 0 if we don't have a bitmap icon. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
259 Window icon_desc;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
260
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
261 /* The X window that is the parent of this X window.
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
262 Usually but not always RootWindow. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
263 Window parent_desc;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
264
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
265 /* 1 for bitmap icon, 0 for text icon. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
266 int icon_bitmap_flag;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
267
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
268 FONT_TYPE *font;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
269
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
270 /* Pixel values used for various purposes.
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
271 border_pixel may be -1 meaning use a gray tile. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
272 PIX_TYPE background_pixel;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
273 PIX_TYPE foreground_pixel;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
274 PIX_TYPE cursor_pixel;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
275 PIX_TYPE border_pixel;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
276 PIX_TYPE mouse_pixel;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
277
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
278 /* Windows for scrollbars */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
279 Window v_scrollbar;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
280 Window v_thumbup;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
281 Window v_thumbdown;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
282 Window v_slider;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
283
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
284 Window h_scrollbar;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
285 Window h_thumbleft;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
286 Window h_thumbright;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
287 Window h_slider;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
288
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
289 /* Scrollbar info */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
290
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
291 int v_scrollbar_width;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
292 int h_scrollbar_height;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
293
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
294 /* Descriptor for the cursor in use for this window. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
295 #ifdef HAVE_X11
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
296 Cursor text_cursor;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
297 Cursor nontext_cursor;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
298 Cursor modeline_cursor;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
299 #else
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
300 Cursor cursor;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
301 #endif
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
302
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
303 /* The name that was associated with the icon, the last time
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
304 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
305 buffer in the currently selected window in the frame */
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
306 char *icon_label;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
307
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
308 /* Flag to set when the X window needs to be completely repainted. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
309 int needs_exposure;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
310
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
311 /* What kind of text cursor is drawn in this window right now? (If
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
312 there is no cursor (phys_cursor_x < 0), then this means nothing. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
313 enum text_cursor_kinds text_cursor_kind;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
314 };
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
315
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
316 /* 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
317 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
318 in the face table. A face is a font plus:
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
319 1) the unhighlighted foreground color,
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
320 2) the unhighlighted background color.
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
321 For highlighting, the two colors are exchanged.
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
322 Face number 0 is unused. The low order byte of a glyf gives
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
323 the character within the font. All fonts are assumed to be
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
324 fixed width, and to have the same height and width. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
325
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
326 #ifdef HAVE_X11
771
538c0bcb418e *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 642
diff changeset
327 /* Table of GC's used for this frame. */
259
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
328 GC *gc_table;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
329
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
330 /* How many GCs are in the table. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
331 int gcs_in_use;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
332
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
333 struct face
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
334 {
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
335 GC face_gc;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
336 unsigned int foreground;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
337 unsigned int background;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
338 Pixmap stipple;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
339 XFontStruct *font;
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
340 };
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
341
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
342 #else /* X10 */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
343
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
344 struct face
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
345 {
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
346 FONT_TYPE *font; /* Font info for specified font. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
347 int fg; /* Unhighlighted foreground. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
348 int bg; /* Unhighlighted background. */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
349 };
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
350 #endif /* X10 */
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
351
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
352 #define MAX_FACES_AND_GLYPHS 256
470231fe99be Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
353 extern struct face *x_face_table[];