(x_term_init): Create a colormap if not using the
[bpt/emacs.git] / src / xterm.h
CommitLineData
3f930d20 1/* Definitions and headers for communication with X protocol.
a8cc2c53 2 Copyright (C) 1989, 1993, 1994, 1998, 1999 Free Software Foundation, Inc.
3f930d20
JB
3
4This file is part of GNU Emacs.
5
6GNU Emacs is free software; you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
4e027793 8the Free Software Foundation; either version 2, or (at your option)
3f930d20
JB
9any later version.
10
11GNU Emacs is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with GNU Emacs; see the file COPYING. If not, write to
3b7ad313
EN
18the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19Boston, MA 02111-1307, USA. */
3f930d20 20
3f930d20
JB
21#include <X11/Xlib.h>
22#include <X11/cursorfont.h>
23#include <X11/Xutil.h>
24#include <X11/keysym.h>
25#include <X11/Xatom.h>
26#include <X11/Xresource.h>
3f930d20 27
0be31d57
RS
28#ifdef USE_X_TOOLKIT
29#include <X11/StringDefs.h>
30#include <X11/IntrinsicP.h> /* CoreP.h needs this */
31#include <X11/CoreP.h> /* foul, but we need this to use our own
32 window inside a widget instead of one
33 that Xt creates... */
34#include <X11/StringDefs.h>
0be31d57
RS
35#endif
36
579dd4be
RS
37/* The class of this X application. */
38#define EMACS_CLASS "Emacs"
39\f
40/* Bookkeeping to distinguish X versions. */
ef15f270 41
d2729198
JB
42/* HAVE_X11R4 is defined if we have the features of X11R4. It should
43 be defined when we're using X11R5, since X11R5 has the features of
44 X11R4. If, in the future, we find we need more of these flags
45 (HAVE_X11R5, for example), code should always be written to test
46 the most recent flag first:
47
48 #ifdef HAVE_X11R5
49 ...
50 #elif HAVE_X11R4
51 ...
52 #elif HAVE_X11
53 ...
54 #endif
55
56 If you ever find yourself writing a "#ifdef HAVE_FOO" clause that
57 looks a lot like another one, consider moving the text into a macro
58 whose definition is configuration-dependent, but whose usage is
59 universal - like the stuff in systime.h.
60
61 It turns out that we can auto-detect whether we're being compiled
ef15f270
JB
62 with X11R3 or X11R4 by looking for the flag macros for R4 structure
63 members that R3 doesn't have. */
64#ifdef PBaseSize
3fe53836
RS
65/* AIX 3.1's X is somewhere between X11R3 and X11R4. It has
66 PBaseSize, but not XWithdrawWindow, XSetWMName, XSetWMNormalHints,
48508a3a
FP
67 XSetWMIconName.
68 AIX 3.2 is at least X11R4. */
69#if (!defined AIX) || (defined AIX3_2)
ef15f270
JB
70#define HAVE_X11R4
71#endif
3fe53836 72#endif
ef15f270 73
b1b57843 74#ifdef HAVE_X11R5
673fea7a
RS
75/* In case someone has X11R5 on AIX 3.1,
76 make sure HAVE_X11R4 is defined as well as HAVE_X11R5. */
77#define HAVE_X11R4
6bde6341 78#endif
cfc57cea
RS
79
80#ifdef HAVE_X11R5
81#define HAVE_X_I18N
82#include <X11/Xlocale.h>
83#endif
579dd4be
RS
84\f
85#define BLACK_PIX_DEFAULT(f) BlackPixel (FRAME_X_DISPLAY (f), \
86 XScreenNumberOfScreen (FRAME_X_SCREEN (f)))
87#define WHITE_PIX_DEFAULT(f) WhitePixel (FRAME_X_DISPLAY (f), \
88 XScreenNumberOfScreen (FRAME_X_SCREEN (f)))
3f930d20
JB
89
90#define FONT_WIDTH(f) ((f)->max_bounds.width)
91#define FONT_HEIGHT(f) ((f)->ascent + (f)->descent)
92#define FONT_BASE(f) ((f)->ascent)
93
3f930d20 94/* The mask of events that text windows always want to receive. This
d2f764d0
RS
95 includes mouse movement events, since handling the mouse-font text property
96 means that we must track mouse motion all the time. */
3f930d20
JB
97
98#define STANDARD_EVENT_SET \
99 (KeyPressMask \
100 | ExposureMask \
101 | ButtonPressMask \
8828b393
JB
102 | ButtonReleaseMask \
103 | PointerMotionMask \
3f930d20
JB
104 | StructureNotifyMask \
105 | FocusChangeMask \
106 | LeaveWindowMask \
107 | EnterWindowMask \
108 | VisibilityChangeMask)
109
3868b9ec
KH
110/* This checks to make sure we have a display. */
111extern void check_x ();
112
f676886a 113extern struct frame *x_window_to_frame ();
3f930d20 114
0be31d57
RS
115#ifdef USE_X_TOOLKIT
116extern struct frame *x_any_window_to_frame ();
72de3c00 117extern struct frame *x_non_menubar_window_to_frame ();
090cebb5 118extern struct frame *x_top_window_to_frame ();
0be31d57
RS
119#endif
120
579dd4be 121extern Visual *select_visual ();
b242af88 122
a8cc2c53
GM
123enum text_cursor_kinds
124{
125 NO_CURSOR = -1,
126 FILLED_BOX_CURSOR,
127 HOLLOW_BOX_CURSOR,
128 BAR_CURSOR
3f930d20 129};
e964ed22 130
e964ed22
RS
131/* Structure recording X pixmap and reference count.
132 If REFCOUNT is 0 then this record is free to be reused. */
133
134struct x_bitmap_record
135{
136 Pixmap pixmap;
137 char *file;
138 int refcount;
139 /* Record some info about this pixmap. */
140 int height, width, depth;
141};
b242af88
RS
142\f
143/* For each X display, we have a structure that records
144 information about it. */
3f930d20 145
579dd4be 146struct x_display_info
b242af88 147{
e964ed22 148 /* Chain of all x_display_info structures. */
579dd4be 149 struct x_display_info *next;
a8cc2c53 150
579dd4be
RS
151 /* Connection number (normally a file descriptor number). */
152 int connection;
a8cc2c53 153
b242af88 154 /* This says how to access this display in Xlib. */
579dd4be 155 Display *display;
a8cc2c53 156
e964ed22
RS
157 /* This is a cons cell of the form (NAME . FONT-LIST-CACHE).
158 The same cons cell also appears in x_display_name_list. */
159 Lisp_Object name_list_element;
a8cc2c53 160
b242af88
RS
161 /* Number of frames that are on this display. */
162 int reference_count;
a8cc2c53 163
579dd4be
RS
164 /* The Screen this connection is connected to. */
165 Screen *screen;
a8cc2c53
GM
166
167 /* Dots per inch of the screen. */
168 double resx, resy;
169
579dd4be
RS
170 /* The Visual being used for this display. */
171 Visual *visual;
7353f3a3
GM
172
173 /* THe colormap being used. */
174 Colormap cmap;
a8cc2c53 175
579dd4be
RS
176 /* Number of panes on this screen. */
177 int n_planes;
a8cc2c53 178
579dd4be
RS
179 /* Dimensions of this screen. */
180 int height, width;
a8cc2c53 181
579dd4be
RS
182 /* Mask of things that cause the mouse to be grabbed. */
183 int grabbed;
a8cc2c53 184
579dd4be
RS
185 /* Emacs bitmap-id of the default icon bitmap for this frame.
186 Or -1 if none has been allocated yet. */
187 int icon_bitmap_id;
a8cc2c53 188
579dd4be
RS
189 /* The root window of this screen. */
190 Window root_window;
a8cc2c53 191
e964ed22
RS
192 /* The cursor to use for vertical scroll bars. */
193 Cursor vertical_scroll_bar_cursor;
a8cc2c53 194
579dd4be
RS
195 /* X Resource data base */
196 XrmDatabase xrdb;
197
e964ed22
RS
198 /* A table of all the fonts we have already loaded. */
199 struct font_info *font_table;
200
201 /* The current capacity of x_font_table. */
202 int font_table_size;
203
a8cc2c53
GM
204 /* Minimum width over all characters in all fonts in font_table. */
205 int smallest_char_width;
206
207 /* Minimum font height over all fonts in font_table. */
208 int smallest_font_height;
209
e964ed22
RS
210 /* Reusable Graphics Context for drawing a cursor in a non-default face. */
211 GC scratch_cursor_gc;
212
a8cc2c53
GM
213 /* These variables describe the range of text currently shown in its
214 mouse-face, together with the window they apply to. As long as
215 the mouse stays within this range, we need not redraw anything on
216 its account. Rows and columns are glyph matrix positions in
217 MOUSE_FACE_WINDOW. */
e964ed22 218 int mouse_face_beg_row, mouse_face_beg_col;
a8cc2c53 219 int mouse_face_beg_x, mouse_face_beg_y;
e964ed22 220 int mouse_face_end_row, mouse_face_end_col;
a8cc2c53 221 int mouse_face_end_x, mouse_face_end_y;
e964ed22
RS
222 int mouse_face_past_end;
223 Lisp_Object mouse_face_window;
224 int mouse_face_face_id;
225
226 /* 1 if a mouse motion event came and we didn't handle it right away because
227 gc was in progress. */
228 int mouse_face_deferred_gc;
229
230 /* FRAME and X, Y position of mouse when last checked for
231 highlighting. X and Y can be negative or out of range for the frame. */
232 struct frame *mouse_face_mouse_frame;
233 int mouse_face_mouse_x, mouse_face_mouse_y;
234
235 /* Nonzero means defer mouse-motion highlighting. */
236 int mouse_face_defer;
237
a8cc2c53
GM
238 int mouse_face_image_state;
239
e964ed22
RS
240 char *x_id_name;
241
242 /* The number of fonts actually stored in x_font_table.
a8cc2c53
GM
243 font_table[n] is used and valid iff 0 <= n < n_fonts. 0 <=
244 n_fonts <= font_table_size and font_table[i].name != 0. */
e964ed22
RS
245 int n_fonts;
246
247 /* Pointer to bitmap records. */
248 struct x_bitmap_record *bitmaps;
249
250 /* Allocated size of bitmaps field. */
251 int bitmaps_size;
252
253 /* Last used bitmap index. */
254 int bitmaps_last;
255
579dd4be
RS
256 /* Which modifier keys are on which modifier bits?
257
258 With each keystroke, X returns eight bits indicating which modifier
259 keys were held down when the key was pressed. The interpretation
260 of the top five modifier bits depends on what keys are attached
261 to them. If the Meta_L and Meta_R keysyms are on mod5, then mod5
262 is the meta bit.
263
264 meta_mod_mask is a mask containing the bits used for the meta key.
265 It may have more than one bit set, if more than one modifier bit
266 has meta keys on it. Basically, if EVENT is a KeyPress event,
267 the meta key is pressed if (EVENT.state & meta_mod_mask) != 0.
268
269 shift_lock_mask is LockMask if the XK_Shift_Lock keysym is on the
270 lock modifier bit, or zero otherwise. Non-alphabetic keys should
271 only be affected by the lock modifier bit if XK_Shift_Lock is in
272 use; XK_Caps_Lock should only affect alphabetic keys. With this
273 arrangement, the lock modifier should shift the character if
274 (EVENT.state & shift_lock_mask) != 0. */
275 int meta_mod_mask, shift_lock_mask;
276
277 /* These are like meta_mod_mask, but for different modifiers. */
278 int alt_mod_mask, super_mod_mask, hyper_mod_mask;
279
280 /* Communication with window managers. */
281 Atom Xatom_wm_protocols;
a8cc2c53 282
579dd4be
RS
283 /* Kinds of protocol things we may receive. */
284 Atom Xatom_wm_take_focus;
285 Atom Xatom_wm_save_yourself;
286 Atom Xatom_wm_delete_window;
a8cc2c53 287
579dd4be
RS
288 /* Atom for indicating window state to the window manager. */
289 Atom Xatom_wm_change_state;
a8cc2c53 290
579dd4be
RS
291 /* Other WM communication */
292 Atom Xatom_wm_configure_denied; /* When our config request is denied */
293 Atom Xatom_wm_window_moved; /* When the WM moves us. */
a8cc2c53 294
579dd4be
RS
295 /* EditRes protocol */
296 Atom Xatom_editres;
297
298 /* More atoms, which are selection types. */
299 Atom Xatom_CLIPBOARD, Xatom_TIMESTAMP, Xatom_TEXT, Xatom_DELETE,
adb572fb 300 Xatom_COMPOUND_TEXT,
579dd4be
RS
301 Xatom_MULTIPLE, Xatom_INCR, Xatom_EMACS_TMP, Xatom_TARGETS, Xatom_NULL,
302 Xatom_ATOM_PAIR;
adb572fb 303
7b341ec2 304 /* More atoms for font properties. The last three are private
adb572fb
KH
305 properties, see the comments in src/fontset.h. */
306 Atom Xatom_PIXEL_SIZE,
7b341ec2
KH
307 Xatom_MULE_BASELINE_OFFSET, Xatom_MULE_RELATIVE_COMPOSE,
308 Xatom_MULE_DEFAULT_ASCENT;
adb572fb 309
a8cc2c53
GM
310 /* More atoms for Ghostscript support. */
311 Atom Xatom_DONE, Xatom_PAGE;
312
313 /* Atom used in toolkit scroll bar client messages. */
314 Atom Xatom_Scrollbar;
315
6909e850 316#ifdef MULTI_KBOARD
e47a168b 317 struct kboard *kboard;
6909e850 318#endif
256d5bf6 319 int cut_buffers_initialized; /* Whether we're sure they all exist */
2820e308
KH
320
321 /* The frame (if any) which has the X window that has keyboard focus.
322 Zero if none. This is examined by Ffocus_frame in xfns.c. Note
323 that a mere EnterNotify event can set this; if you need to know the
324 last frame specified in a FocusIn or FocusOut event, use
325 x_focus_event_frame. */
326 struct frame *x_focus_frame;
327
328 /* The last frame mentioned in a FocusIn or FocusOut event. This is
329 separate from x_focus_frame, because whether or not LeaveNotify
330 events cause us to lose focus depends on whether or not we have
331 received a FocusIn event for it. */
332 struct frame *x_focus_event_frame;
333
334 /* The frame which currently has the visual highlight, and should get
335 keyboard input (other sorts of input have the frame encoded in the
336 event). It points to the X focus frame's selected window's
337 frame. It differs from x_focus_frame when we're using a global
338 minibuffer. */
339 struct frame *x_highlight_frame;
adb572fb
KH
340
341 /* The null pixel used for filling a character background with
342 background color of a gc. */
343 Pixmap null_pixel;
a8cc2c53
GM
344
345 /* The gray pixmap. */
346 Pixmap gray;
347
348 /* Cache of images. */
349 struct image_cache *image_cache;
1c815a24
GM
350
351#ifdef HAVE_X_I18N
352 /* XIM (X Input method). */
353 XIM xim;
354 XIMStyles *xim_styles;
355#endif
b242af88 356};
579dd4be
RS
357
358/* This is a chain of structures for all the X displays currently in use. */
359extern struct x_display_info *x_display_list;
360
e964ed22
RS
361/* This is a list of cons cells, each of the form (NAME . FONT-LIST-CACHE),
362 one for each element of x_display_list and in the same order.
363 NAME is the name of the frame.
364 FONT-LIST-CACHE records previous values returned by x-list-fonts. */
365extern Lisp_Object x_display_name_list;
366
adb572fb
KH
367/* Regexp matching a font name whose width is the same as `PIXEL_SIZE'. */
368extern Lisp_Object Vx_pixel_size_width_font_regexp;
369
ee8ddc1c 370/* A flag to control how to display unibyte 8-bit character. */
e3c55541 371extern int unibyte_display_via_language_environment;
ee8ddc1c 372
a8cc2c53
GM
373struct x_display_info *x_display_info_for_display P_ ((Display *));
374struct x_display_info *x_display_info_for_name ();
579dd4be
RS
375
376extern struct x_display_info *x_term_init ();
adb572fb 377
a8cc2c53
GM
378extern Lisp_Object x_list_fonts P_ ((struct frame *, Lisp_Object, int, int));
379
adb572fb 380extern struct font_info *x_get_font_info(), *x_load_font (), *x_query_font ();
d7fcdd91 381extern void x_find_ccl_program();
b242af88 382\f
f39d1692
RS
383/* Each X frame object points to its own struct x_output object
384 in the output_data.x field. The x_output structure contains
3f930d20
JB
385 the information that is specific to X windows. */
386
f39d1692 387struct x_output
3f930d20
JB
388{
389 /* Position of the X window (x and y offsets in root window). */
390 int left_pos;
391 int top_pos;
392
393 /* Border width of the X window as known by the X window system. */
394 int border_width;
395
f3942238 396 /* Size of the X window in pixels. */
3f930d20
JB
397 int pixel_height, pixel_width;
398
ab6c5d93
KH
399 /* Height of menu bar widget, in pixels.
400 Zero if not using the X toolkit.
401 When using the toolkit, this value is not meaningful
402 if the menubar is turned off. */
403 int menubar_height;
404
2ba6876c
RS
405 /* Height of a line, in pixels. */
406 int line_height;
407
f3942238 408 /* The tiled border used when the mouse is out of the frame. */
3f930d20
JB
409 Pixmap border_tile;
410
f3942238 411 /* Here are the Graphics Contexts for the default font. */
3f930d20
JB
412 GC normal_gc; /* Normal video */
413 GC reverse_gc; /* Reverse video */
414 GC cursor_gc; /* cursor drawing */
3f930d20
JB
415
416 /* Width of the internal border. This is a line of background color
f676886a 417 just inside the window's border. When the frame is selected,
3f930d20
JB
418 a highlighting is displayed inside the internal border. */
419 int internal_border_width;
420
f676886a
JB
421 /* The X window used for this frame.
422 May be zero while the frame object is being created
3f930d20
JB
423 and the X window has not yet been created. */
424 Window window_desc;
425
426 /* The X window used for the bitmap icon;
427 or 0 if we don't have a bitmap icon. */
428 Window icon_desc;
429
430 /* The X window that is the parent of this X window.
dcc98b56
RS
431 Usually this is a window that was made by the window manager,
432 but it can be the root window, and it can be explicitly specified
433 (see the explicit_parent field, below). */
3f930d20
JB
434 Window parent_desc;
435
0be31d57
RS
436#ifdef USE_X_TOOLKIT
437 /* The widget of this screen. This is the window of a "shell" widget. */
438 Widget widget;
439 /* The XmPanedWindows... */
440 Widget column_widget;
441 /* The widget of the edit portion of this screen; the window in
442 "window_desc" is inside of this. */
443 Widget edit_widget;
444
445 Widget menubar_widget;
446#endif
447
78c3981d
RS
448 /* If >=0, a bitmap index. The indicated bitmap is used for the
449 icon. */
450 int icon_bitmap;
3f930d20 451
adb572fb 452 /* Default ASCII font of this frame. */
579dd4be 453 XFontStruct *font;
3f930d20 454
b6c3d034
KH
455 /* The baseline offset of the default ASCII font. */
456 int baseline_offset;
adb572fb
KH
457
458 /* If a fontset is specified for this frame instead of font, this
459 value contains an ID of the fontset, else -1. */
460 int fontset;
461
3f930d20
JB
462 /* Pixel values used for various purposes.
463 border_pixel may be -1 meaning use a gray tile. */
579dd4be
RS
464 unsigned long background_pixel;
465 unsigned long foreground_pixel;
466 unsigned long cursor_pixel;
467 unsigned long border_pixel;
468 unsigned long mouse_pixel;
469 unsigned long cursor_foreground_pixel;
3f930d20 470
a8cc2c53
GM
471 /* Foreground color for scroll bars. A value of -1 means use the
472 default (black for non-toolkit scroll bars). */
473 unsigned long scroll_bar_foreground_pixel;
474
475 /* Background color for scroll bars. A value of -1 means use the
476 default (background color of the frame for non-toolkit scroll
477 bars). */
478 unsigned long scroll_bar_background_pixel;
479
3f930d20 480 /* Descriptor for the cursor in use for this window. */
3f930d20
JB
481 Cursor text_cursor;
482 Cursor nontext_cursor;
483 Cursor modeline_cursor;
6bfbdaeb 484 Cursor cross_cursor;
a8cc2c53
GM
485 Cursor busy_cursor;
486
487 /* Window whose cursor is busy_cursor. This window is temporarily
488 mapped to display a busy-cursor. */
489 Window busy_window;
490
491 /* Non-zero means busy cursor is currently displayed. */
492 unsigned busy_p : 1;
3f930d20 493
f3942238 494 /* Flag to set when the X window needs to be completely repainted. */
3f930d20
JB
495 int needs_exposure;
496
dbc4e1c1
JB
497 /* What kind of text cursor is drawn in this window right now?
498 (If there is no cursor (phys_cursor_x < 0), then this means nothing.) */
499 enum text_cursor_kinds current_cursor;
500
501 /* What kind of text cursor should we draw in the future?
502 This should always be filled_box_cursor or bar_cursor. */
503 enum text_cursor_kinds desired_cursor;
ef15f270 504
e36a2711
RS
505 /* Width of bar cursor (if we are using that). */
506 int cursor_width;
507
ef15f270
JB
508 /* These are the current window manager hints. It seems that
509 XSetWMHints, when presented with an unset bit in the `flags'
510 member of the hints structure, does not leave the corresponding
511 attribute unchanged; rather, it resets that attribute to its
512 default value. For example, unless you set the `icon_pixmap'
513 field and the `IconPixmapHint' bit, XSetWMHints will forget what
514 your icon pixmap was. This is rather troublesome, since some of
515 the members (for example, `input' and `icon_pixmap') want to stay
516 the same throughout the execution of Emacs. So, we keep this
517 structure around, just leaving values in it and adding new bits
518 to the mask as we go. */
519 XWMHints wm_hints;
c8e3cbe0 520
c8e3cbe0 521 /* The size of the extra width currently allotted for vertical
a3c87d4e
JB
522 scroll bars, in pixels. */
523 int vertical_scroll_bar_extra;
13bd51a5 524
a8cc2c53
GM
525 /* The extra width currently allotted for the areas in which
526 truncation marks, continuation marks, and overlay arrows are
527 displayed. */
528 int flags_areas_extra;
379564d6
RS
529
530 /* This is the gravity value for the specified window position. */
531 int win_gravity;
f3942238
RS
532
533 /* The geometry flags for this window. */
534 int size_hint_flags;
b242af88
RS
535
536 /* This is the Emacs structure for the X display this frame is on. */
579dd4be 537 struct x_display_info *display_info;
dcc98b56 538
51057b1f 539 /* This is a button event that wants to activate the menubar.
ff0113e7
KH
540 We save it here until the command loop gets to think about it. */
541 XEvent *saved_menu_event;
51057b1f
RS
542
543 /* This is the widget id used for this frame's menubar in lwlib. */
544#ifdef USE_X_TOOLKIT
545 int id;
546#endif
547
dcc98b56
RS
548 /* Nonzero means our parent is another application's window
549 and was explicitly specified. */
550 char explicit_parent;
cbef58c0
KH
551
552 /* Nonzero means tried already to make this frame visible. */
553 char asked_for_visible;
7b8d4a3f 554
4fe2b2b6
RS
555 /* Nonzero if this frame was ever previously visible. */
556 char has_been_visible;
557
7b8d4a3f
RS
558#ifdef HAVE_X_I18N
559 /* Input context (currently, this means Compose key handler setup). */
560 XIC xic;
1c815a24
GM
561 XIMStyle xic_style;
562 XFontSet xic_xfs;
7b8d4a3f 563#endif
28f72798 564
a8cc2c53
GM
565 /* Relief GCs, colors etc. */
566 struct relief
567 {
568 GC gc;
569 unsigned long pixel;
570 int allocated_p;
571 }
572 black_relief, white_relief;
573
574 /* The background for which the above relief GCs were set up.
575 They are changed only when a different background is involved. */
576 unsigned long relief_background;
577};
13bd51a5 578
dca3296e 579/* Return the X window used for displaying data in frame F. */
f39d1692 580#define FRAME_X_WINDOW(f) ((f)->output_data.x->window_desc)
d2729198 581
dca3296e
RS
582/* Return the outermost X window associated with the frame F. */
583#ifdef USE_X_TOOLKIT
584#define FRAME_OUTER_WINDOW(f) (XtWindow ((f)->output_data.x->widget))
585#else
586#define FRAME_OUTER_WINDOW(f) (FRAME_X_WINDOW (f))
587#endif
588
f39d1692 589#define FRAME_FONT(f) ((f)->output_data.x->font)
adb572fb 590#define FRAME_FONTSET(f) ((f)->output_data.x->fontset)
5c9ee165 591#define FRAME_INTERNAL_BORDER_WIDTH(f) ((f)->output_data.x->internal_border_width)
1c815a24 592#define FRAME_MENUBAR_HEIGHT(f) ((f)->output_data.x->menubar_height)
5c9ee165 593#define FRAME_LINE_HEIGHT(f) ((f)->output_data.x->line_height)
8e533ff0 594
a8cc2c53
GM
595/* Width of the default font of frame F. Must be defined by each
596 terminal specific header. */
597#define FRAME_DEFAULT_FONT_WIDTH(F) FONT_WIDTH (FRAME_FONT (F))
598
579dd4be 599/* This gives the x_display_info structure for the display F is on. */
f39d1692 600#define FRAME_X_DISPLAY_INFO(f) ((f)->output_data.x->display_info)
b242af88
RS
601
602/* This is the `Display *' which frame F is on. */
579dd4be
RS
603#define FRAME_X_DISPLAY(f) (FRAME_X_DISPLAY_INFO (f)->display)
604
605/* This is the `Screen *' which frame F is on. */
606#define FRAME_X_SCREEN(f) (FRAME_X_DISPLAY_INFO (f)->screen)
b242af88 607
7353f3a3
GM
608/* This is the Visual which frame F is on. */
609#define FRAME_X_VISUAL(f) FRAME_X_DISPLAY_INFO (f)->visual
610
611/* This is the Colormap which frame F uses. */
612#define FRAME_X_COLORMAP(f) FRAME_X_DISPLAY_INFO (f)->cmap
613
adb572fb
KH
614/* This is the 'font_info *' which frame F has. */
615#define FRAME_X_FONT_TABLE(f) (FRAME_X_DISPLAY_INFO (f)->font_table)
616
dbc4e1c1 617/* These two really ought to be called FRAME_PIXEL_{WIDTH,HEIGHT}. */
f39d1692
RS
618#define PIXEL_WIDTH(f) ((f)->output_data.x->pixel_width)
619#define PIXEL_HEIGHT(f) ((f)->output_data.x->pixel_height)
dbc4e1c1 620
f39d1692 621#define FRAME_DESIRED_CURSOR(f) ((f)->output_data.x->desired_cursor)
dbc4e1c1 622
7afa6068 623#define FRAME_XIC(f) ((f)->output_data.x->xic)
1c815a24
GM
624#define FRAME_X_XIM(f) (FRAME_X_DISPLAY_INFO (f)->xim)
625#define FRAME_X_XIM_STYLES(f) (FRAME_X_DISPLAY_INFO (f)->xim_styles)
626#define FRAME_XIC_STYLE(f) ((f)->output_data.x->xic_style)
627#define FRAME_XIC_FONTSET(f) ((f)->output_data.x->xic_xfs)
a8cc2c53
GM
628
629/* Value is the smallest width of any character in any font on frame F. */
630
631#define FRAME_SMALLEST_CHAR_WIDTH(F) \
632 FRAME_X_DISPLAY_INFO(F)->smallest_char_width
633
634/* Value is the smallest height of any font on frame F. */
635
636#define FRAME_SMALLEST_FONT_HEIGHT(F) \
637 FRAME_X_DISPLAY_INFO(F)->smallest_font_height
638
639/* Return a pointer to the image cache of frame F. */
640
641#define FRAME_X_IMAGE_CACHE(F) FRAME_X_DISPLAY_INFO ((F))->image_cache
642
643\f
644/* Pixel width of the bitmaps drawn to indicate truncation,
645 continuation etc. */
646
647#define FRAME_FLAGS_BITMAP_WIDTH(f) 8
648#define FRAME_FLAGS_BITMAP_HEIGHT(f) 8
649
81fe0ce9 650/* Total width of a areas reserved for drawing truncation bitmaps,
a8cc2c53
GM
651 continuation bitmaps and alike. The width is in canonical char
652 units of the frame. This must currently be the case because window
653 sizes aren't pixel values. If it weren't the case, we wouldn't be
654 able to split windows horizontally nicely. */
655
81fe0ce9
GM
656#define FRAME_X_FLAGS_AREA_COLS(F) \
657 ((2 * FRAME_FLAGS_BITMAP_WIDTH ((F)) + CANON_X_UNIT ((F)) - 1) \
a8cc2c53
GM
658 / CANON_X_UNIT ((F)))
659
81fe0ce9
GM
660/* Total width of flags areas in pixels. */
661
a8cc2c53
GM
662#define FRAME_X_FLAGS_AREA_WIDTH(F) \
663 (FRAME_X_FLAGS_AREA_COLS ((F)) * CANON_X_UNIT ((F)))
664
81fe0ce9
GM
665/* Pixel-width of the left flags area. */
666
667#define FRAME_X_LEFT_FLAGS_AREA_WIDTH(F) \
668 (FRAME_X_FLAGS_AREA_WIDTH (F) / 2)
669
670/* Pixel-width of the right flags area. Note that we are doing
671 integer arithmetic here, so don't loose a pixel if the total
672 width is an odd number. */
673
674#define FRAME_X_RIGHT_FLAGS_AREA_WIDTH(F) \
675 (FRAME_X_FLAGS_AREA_WIDTH (F) - FRAME_X_FLAGS_AREA_WIDTH (F) / 2)
676
677
3f930d20 678\f
a3c87d4e 679/* X-specific scroll bar stuff. */
c8e3cbe0 680
a3c87d4e 681/* We represent scroll bars as lisp vectors. This allows us to place
4e027793 682 references to them in windows without worrying about whether we'll
a3c87d4e 683 end up with windows referring to dead scroll bars; the garbage
4e027793
JB
684 collector will free it when its time comes.
685
a3c87d4e 686 We use struct scroll_bar as a template for accessing fields of the
4e027793
JB
687 vector. */
688
a3c87d4e 689struct scroll_bar {
c8e3cbe0 690
4e027793 691 /* These fields are shared by all vectors. */
820b2ca2 692 EMACS_INT size_from_Lisp_Vector_struct;
4e027793
JB
693 struct Lisp_Vector *next_from_Lisp_Vector_struct;
694
a3c87d4e 695 /* The window we're a scroll bar for. */
4e027793 696 Lisp_Object window;
c8e3cbe0 697
a3c87d4e 698 /* The next and previous in the chain of scroll bars in this frame. */
4e027793 699 Lisp_Object next, prev;
c8e3cbe0 700
a3c87d4e 701 /* The X window representing this scroll bar. Since this is a full
4e027793
JB
702 32-bit quantity, we store it split into two 32-bit values. */
703 Lisp_Object x_window_low, x_window_high;
c8e3cbe0 704
a8cc2c53
GM
705 /* Same as above for the widget. */
706 Lisp_Object x_widget_low, x_widget_high;
707
a3c87d4e 708 /* The position and size of the scroll bar in pixels, relative to the
c8e3cbe0 709 frame. */
4e027793 710 Lisp_Object top, left, width, height;
c8e3cbe0 711
4e027793
JB
712 /* The starting and ending positions of the handle, relative to the
713 handle area (i.e. zero is the top position, not
a3c87d4e 714 SCROLL_BAR_TOP_BORDER). If they're equal, that means the handle
4e027793 715 hasn't been drawn yet.
c8e3cbe0 716
4e027793
JB
717 These are not actually the locations where the beginning and end
718 are drawn; in order to keep handles from becoming invisible when
719 editing large files, we establish a minimum height by always
a3c87d4e 720 drawing handle bottoms VERTICAL_SCROLL_BAR_MIN_HANDLE pixels below
4e027793
JB
721 where they would be normally; the bottom and top are in a
722 different co-ordinate system. */
723 Lisp_Object start, end;
c8e3cbe0 724
a3c87d4e 725 /* If the scroll bar handle is currently being dragged by the user,
c8e3cbe0
JB
726 this is the number of pixels from the top of the handle to the
727 place where the user grabbed it. If the handle isn't currently
4e027793
JB
728 being dragged, this is Qnil. */
729 Lisp_Object dragging;
c8e3cbe0
JB
730};
731
a3c87d4e 732/* The number of elements a vector holding a struct scroll_bar needs. */
35e5240a
KH
733#define SCROLL_BAR_VEC_SIZE \
734 ((sizeof (struct scroll_bar) \
735 - sizeof (EMACS_INT) - sizeof (struct Lisp_Vector *)) \
4e027793
JB
736 / sizeof (Lisp_Object))
737
a3c87d4e 738/* Turning a lisp vector value into a pointer to a struct scroll_bar. */
35e5240a 739#define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec))
4e027793
JB
740
741
742/* Building a 32-bit C integer from two 16-bit lisp integers. */
a3c87d4e 743#define SCROLL_BAR_PACK(low, high) (XINT (high) << 16 | XINT (low))
4e027793
JB
744
745/* Setting two lisp integers to the low and high words of a 32-bit C int. */
a3c87d4e 746#define SCROLL_BAR_UNPACK(low, high, int32) \
df0f379b
KH
747 (XSETINT ((low), (int32) & 0xffff), \
748 XSETINT ((high), ((int32) >> 16) & 0xffff))
4e027793
JB
749
750
a3c87d4e
JB
751/* Extract the X window id of the scroll bar from a struct scroll_bar. */
752#define SCROLL_BAR_X_WINDOW(ptr) \
753 ((Window) SCROLL_BAR_PACK ((ptr)->x_window_low, (ptr)->x_window_high))
4e027793 754
a3c87d4e
JB
755/* Store a window id in a struct scroll_bar. */
756#define SET_SCROLL_BAR_X_WINDOW(ptr, id) \
757 (SCROLL_BAR_UNPACK ((ptr)->x_window_low, (ptr)->x_window_high, (int) id))
4e027793 758
a8cc2c53
GM
759/* Extract the X widget of the scroll bar from a struct scroll_bar. */
760#define SCROLL_BAR_X_WIDGET(ptr) \
761 ((Widget) SCROLL_BAR_PACK ((ptr)->x_widget_low, (ptr)->x_widget_high))
762
763/* Store a widget id in a struct scroll_bar. */
764#define SET_SCROLL_BAR_X_WIDGET(ptr, w) \
765 (SCROLL_BAR_UNPACK ((ptr)->x_widget_low, (ptr)->x_widget_high, (int) w))
4e027793 766
c8e3cbe0 767
a3c87d4e 768/* Return the inside width of a vertical scroll bar, given the outside
4e027793 769 width. */
aa5abbc0
RS
770#define VERTICAL_SCROLL_BAR_INSIDE_WIDTH(f, width) \
771 ((width) \
772 - VERTICAL_SCROLL_BAR_LEFT_BORDER \
773 - VERTICAL_SCROLL_BAR_RIGHT_BORDER \
36fe2f9a 774 - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2)
c8e3cbe0 775
4e027793
JB
776/* Return the length of the rectangle within which the top of the
777 handle must stay. This isn't equivalent to the inside height,
a3c87d4e 778 because the scroll bar handle has a minimum height.
4e027793 779
a3c87d4e
JB
780 This is the real range of motion for the scroll bar, so when we're
781 scaling buffer positions to scroll bar positions, we use this, not
782 VERTICAL_SCROLL_BAR_INSIDE_HEIGHT. */
aa5abbc0
RS
783#define VERTICAL_SCROLL_BAR_TOP_RANGE(f, height) \
784 (VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (f, height) - VERTICAL_SCROLL_BAR_MIN_HANDLE)
4e027793 785
a3c87d4e
JB
786/* Return the inside height of vertical scroll bar, given the outside
787 height. See VERTICAL_SCROLL_BAR_TOP_RANGE too. */
aa5abbc0 788#define VERTICAL_SCROLL_BAR_INSIDE_HEIGHT(f, height) \
a3c87d4e 789 ((height) - VERTICAL_SCROLL_BAR_TOP_BORDER - VERTICAL_SCROLL_BAR_BOTTOM_BORDER)
4e027793
JB
790
791
a3c87d4e 792/* Border widths for scroll bars.
4e027793 793
a3c87d4e 794 Scroll bar windows don't have any X borders; their border width is
4e027793
JB
795 set to zero, and we redraw borders ourselves. This makes the code
796 a bit cleaner, since we don't have to convert between outside width
797 (used when relating to the rest of the screen) and inside width
a3c87d4e 798 (used when sizing and drawing the scroll bar window itself).
4e027793 799
eb8c3be9 800 The handle moves up and down/back and forth in a rectangle inset
a3c87d4e
JB
801 from the edges of the scroll bar. These are widths by which we
802 inset the handle boundaries from the scroll bar edges. */
803#define VERTICAL_SCROLL_BAR_LEFT_BORDER (2)
d68eb3a2 804#define VERTICAL_SCROLL_BAR_RIGHT_BORDER (2)
a3c87d4e
JB
805#define VERTICAL_SCROLL_BAR_TOP_BORDER (2)
806#define VERTICAL_SCROLL_BAR_BOTTOM_BORDER (2)
4e027793 807
a3c87d4e
JB
808/* Minimum lengths for scroll bar handles, in pixels. */
809#define VERTICAL_SCROLL_BAR_MIN_HANDLE (5)
c8e3cbe0 810
36fe2f9a 811/* Trimming off a few pixels from each side prevents
aa5abbc0 812 text from glomming up against the scroll bar */
056e4a0a 813#define VERTICAL_SCROLL_BAR_WIDTH_TRIM (0)
aa5abbc0 814
c8e3cbe0
JB
815\f
816/* Manipulating pixel sizes and character sizes.
817 Knowledge of which factors affect the overall size of the window should
818 be hidden in these macros, if that's possible.
819
0cabaf31 820 Return the upper/left pixel position of the character cell on frame F
4e027793
JB
821 at ROW/COL. */
822#define CHAR_TO_PIXEL_ROW(f, row) \
f39d1692
RS
823 ((f)->output_data.x->internal_border_width \
824 + (row) * (f)->output_data.x->line_height)
4e027793 825#define CHAR_TO_PIXEL_COL(f, col) \
f39d1692
RS
826 ((f)->output_data.x->internal_border_width \
827 + (col) * FONT_WIDTH ((f)->output_data.x->font))
4e027793
JB
828
829/* Return the pixel width/height of frame F if it has
830 WIDTH columns/HEIGHT rows. */
c8e3cbe0 831#define CHAR_TO_PIXEL_WIDTH(f, width) \
4e027793 832 (CHAR_TO_PIXEL_COL (f, width) \
f39d1692 833 + (f)->output_data.x->vertical_scroll_bar_extra \
a8cc2c53 834 + (f)->output_data.x->flags_areas_extra \
f39d1692 835 + (f)->output_data.x->internal_border_width)
c8e3cbe0 836#define CHAR_TO_PIXEL_HEIGHT(f, height) \
4e027793 837 (CHAR_TO_PIXEL_ROW (f, height) \
f39d1692 838 + (f)->output_data.x->internal_border_width)
c8e3cbe0 839
c8e3cbe0 840
4e027793
JB
841/* Return the row/column (zero-based) of the character cell containing
842 the pixel on FRAME at ROW/COL. */
cecfe612 843#define PIXEL_TO_CHAR_ROW(f, row) \
f39d1692
RS
844 (((row) - (f)->output_data.x->internal_border_width) \
845 / (f)->output_data.x->line_height)
cecfe612 846#define PIXEL_TO_CHAR_COL(f, col) \
f39d1692
RS
847 (((col) - (f)->output_data.x->internal_border_width) \
848 / FONT_WIDTH ((f)->output_data.x->font))
c8e3cbe0 849
4e027793
JB
850/* How many columns/rows of text can we fit in WIDTH/HEIGHT pixels on
851 frame F? */
852#define PIXEL_TO_CHAR_WIDTH(f, width) \
853 (PIXEL_TO_CHAR_COL (f, ((width) \
f39d1692 854 - (f)->output_data.x->internal_border_width \
a8cc2c53 855 - (f)->output_data.x->flags_areas_extra \
f39d1692 856 - (f)->output_data.x->vertical_scroll_bar_extra)))
4e027793
JB
857#define PIXEL_TO_CHAR_HEIGHT(f, height) \
858 (PIXEL_TO_CHAR_ROW (f, ((height) \
f39d1692 859 - (f)->output_data.x->internal_border_width)))
a8cc2c53 860
c352056c
RS
861\f
862/* If a struct input_event has a kind which is selection_request_event
863 or selection_clear_event, then its contents are really described
864 by this structure. */
865
866/* For an event of kind selection_request_event,
d601ce45
RS
867 this structure really describes the contents.
868 **Don't make this struct longer!**
869 If it overlaps the frame_or_window field of struct input_event,
870 that will cause GC to crash. */
c352056c
RS
871struct selection_input_event
872{
873 int kind;
874 Display *display;
beaff27b
RS
875 /* We spell it with an "o" here because X does. */
876 Window requestor;
c352056c
RS
877 Atom selection, target, property;
878 Time time;
879};
880
881#define SELECTION_EVENT_DISPLAY(eventp) \
882 (((struct selection_input_event *) (eventp))->display)
beaff27b
RS
883/* We spell it with an "o" here because X does. */
884#define SELECTION_EVENT_REQUESTOR(eventp) \
885 (((struct selection_input_event *) (eventp))->requestor)
c352056c
RS
886#define SELECTION_EVENT_SELECTION(eventp) \
887 (((struct selection_input_event *) (eventp))->selection)
888#define SELECTION_EVENT_TARGET(eventp) \
889 (((struct selection_input_event *) (eventp))->target)
890#define SELECTION_EVENT_PROPERTY(eventp) \
891 (((struct selection_input_event *) (eventp))->property)
892#define SELECTION_EVENT_TIME(eventp) \
893 (((struct selection_input_event *) (eventp))->time)
bf489d26
JB
894
895\f
ec5d8db7 896struct window;
a8cc2c53
GM
897struct glyph_matrix;
898struct frame;
ec5d8db7
AS
899struct input_event;
900
a8cc2c53
GM
901/* From xselect.c. */
902
903void x_handle_selection_notify P_ ((XSelectionEvent *));
904void x_handle_property_notify P_ ((XPropertyEvent *));
905
906/* From xfns.c. */
907
908void x_real_positions P_ ((struct frame *, int *, int *));
909void x_destroy_bitmap P_ ((struct frame *, int));
910int x_create_bitmap_from_file P_ ((struct frame *, Lisp_Object));
911int x_create_bitmap_from_data P_ ((struct frame *, char *, unsigned,
912 unsigned));
913void x_reference_bitmap P_ ((struct frame *, int));
914void x_sync P_ ((struct frame *));
915int x_bitmap_pixmap P_ ((struct frame *, int));
916void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
917int x_bitmap_height P_ ((struct frame *, int));
918int x_bitmap_width P_ ((struct frame *, int));
919int defined_color P_ ((struct frame *, char *, XColor *, int));
920Lisp_Object display_x_get_resource P_ ((struct x_display_info *,
921 Lisp_Object, Lisp_Object,
922 Lisp_Object, Lisp_Object));
923struct frame *check_x_frame P_ ((Lisp_Object));
924EXFUN (Fx_display_color_p, 1);
925EXFUN (Fx_display_grayscale_p, 1);
926
927/* From xrdb.c. */
928
929char *x_get_string_resource P_ ((XrmDatabase, char *, char *));
930char *x_get_customization_string P_ ((XrmDatabase, char *, char *));
931XrmDatabase x_load_resources P_ ((Display *, char *, char *, char *));
932int x_get_resource P_ ((XrmDatabase, char *, char *,
933 XrmRepresentation, XrmValue *));
934void x_delete_display P_ ((struct x_display_info *));
935void x_make_frame_visible P_ ((struct frame *));
936void x_iconify_frame P_ ((struct frame *));
937void x_wm_set_size_hint P_ ((struct frame *, long, int));
938void x_set_offset P_ ((struct frame *, int, int, int));
939void x_wm_set_icon_position P_ ((struct frame *, int, int));
940int x_catch_errors P_ ((Display *));
941int x_had_errors_p P_ ((Display *));
942void x_uncatch_errors P_ ((Display *, int));
943void x_check_errors P_ ((Display *, char *));
944int x_text_icon P_ ((struct frame *, char *));
945int x_bitmap_icon P_ ((struct frame *, Lisp_Object));
946void x_set_window_size P_ ((struct frame *, int, int, int));
947void x_wm_set_window_state P_ ((struct frame *, int));
55115f09 948int x_alloc_nearest_color P_ ((struct frame *, Colormap, XColor *));
a8cc2c53
GM
949
950extern void pixel_to_glyph_coords P_ ((struct frame *, int, int,
951 int *, int *, XRectangle *, int));
ec5d8db7
AS
952
953/* Defined in xterm.c */
954
a8cc2c53 955extern void clear_mouse_face P_ ((struct x_display_info *));
ec5d8db7
AS
956extern void cancel_mouse_face P_ ((struct frame *));
957extern void x_scroll_bar_clear P_ ((struct frame *));
958extern void x_start_queuing_selection_requests P_ ((Display *));
959extern void x_stop_queuing_selection_requests P_ ((Display *));
ec5d8db7
AS
960extern void x_update_cursor P_ ((struct frame *, int));
961extern int x_text_icon P_ ((struct frame *, char *));
962extern int x_bitmap_icon P_ ((struct frame *, Lisp_Object));
963extern int x_catch_errors P_ ((Display *));
964extern void x_check_errors P_ ((Display *, char *));
965extern int x_had_errors_p P_ ((Display *));
966extern void x_uncatch_errors P_ ((Display *, int));
967extern Lisp_Object x_new_font P_ ((struct frame *, char *));
968extern Lisp_Object x_new_fontset P_ ((struct frame *, char *));
969extern void x_set_offset P_ ((struct frame *, int, int, int));
970extern void x_set_window_size P_ ((struct frame *, int, int, int));
971extern void x_set_mouse_position P_ ((struct frame *, int, int));
972extern void x_set_mouse_pixel_position P_ ((struct frame *, int, int));
973extern void x_raise_frame P_ ((struct frame *));
974extern void x_lower_frame P_ ((struct frame *));
975extern void x_make_frame_visible P_ ((struct frame *));
976extern void x_make_frame_invisible P_ ((struct frame *));
977extern void x_iconify_frame P_ ((struct frame *));
978extern void x_destroy_window P_ ((struct frame *));
979extern void x_wm_set_size_hint P_ ((struct frame *, long, int));
980extern void x_wm_set_window_state P_ ((struct frame *, int));
981extern void x_wm_set_icon_pixmap P_ ((struct frame *, int));
982extern void x_wm_set_icon_position P_ ((struct frame *, int, int));
983extern void x_delete_display P_ ((struct x_display_info *));
984extern void x_initialize P_ ((void));
a8cc2c53
GM
985void x_display_cursor P_ ((struct window *, int, int, int, int, int));
986void x_update_cursor P_ ((struct frame *, int));
ec5d8db7
AS
987
988/* Defined in xselect.c */
989
990extern void x_handle_property_notify P_ ((XPropertyEvent *));
991extern void x_handle_selection_notify P_ ((XSelectionEvent *));
992extern void x_handle_selection_request P_ ((struct input_event *));
993extern void x_handle_selection_clear P_ ((struct input_event *));
994extern void x_clear_frame_selections P_ ((struct frame *));
995
996/* Defined in xfns.c */
997
998extern int have_menus_p P_ ((void));
999extern int x_bitmap_height P_ ((struct frame *, int));
1000extern int x_bitmap_width P_ ((struct frame *, int));
1001extern int x_bitmap_pixmap P_ ((struct frame *, int));
1002extern void x_reference_bitmap P_ ((struct frame *, int));
1003extern int x_create_bitmap_from_data P_ ((struct frame *, char *,
1004 unsigned int, unsigned int));
1005extern int x_create_bitmap_from_file P_ ((struct frame *, Lisp_Object));
1006extern void x_destroy_bitmap P_ ((struct frame *, int));
1007extern void x_set_frame_parameters P_ ((struct frame *, Lisp_Object));
1008extern void x_real_positions P_ ((struct frame *, int *, int *));
1009extern void x_report_frame_params P_ ((struct frame *, Lisp_Object *));
1010extern int defined_color P_ ((struct frame *, char *, XColor *, int));
1011extern void x_set_border_pixel P_ ((struct frame *, int));
1012extern void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
1013extern void x_implicitly_set_name P_ ((struct frame *, Lisp_Object, Lisp_Object));
1c815a24
GM
1014extern void create_frame_xic P_ ((struct frame *));
1015extern void destroy_frame_xic P_ ((struct frame *));
1016extern void xic_set_preeditarea P_ ((struct window *, int, int));
1017extern void xic_set_statusarea P_ ((struct frame *));
1018extern void xic_set_xfontset P_ ((struct frame *, char *));
ec5d8db7
AS
1019extern int x_pixel_width P_ ((struct frame *));
1020extern int x_pixel_height P_ ((struct frame *));
1021extern int x_char_width P_ ((struct frame *));
1022extern int x_char_height P_ ((struct frame *));
1023extern int x_screen_planes P_ ((struct frame *));
1024extern void x_sync P_ ((struct frame *));
1025
1026/* Defined in xfaces.c */
a8cc2c53 1027
ec5d8db7 1028extern int frame_update_line_height P_ ((struct frame *));
ec5d8db7
AS
1029extern int compute_glyph_face P_ ((struct frame *, int, int));
1030extern int compute_glyph_face_1 P_ ((struct frame *, Lisp_Object, int));
1031
1032/* Defined in xmenu.c */
a8cc2c53 1033
ec5d8db7
AS
1034extern void x_activate_menubar P_ ((struct frame *));
1035extern int popup_activated P_ ((void));
1036extern void initialize_frame_menubar P_ ((struct frame *));
1037
1038/* Defined in widget.c */
a8cc2c53 1039
09ba2aa0 1040#ifdef USE_X_TOOLKIT
ec5d8db7 1041extern void widget_store_internal_border P_ ((Widget));
09ba2aa0 1042#endif