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