]> code.delx.au - gnu-emacs/blob - src/xterm.h
Merge branch 'scratch/follow' of /home/acm/emacs/emacs.git/emacs-25 into scratch...
[gnu-emacs] / src / xterm.h
1 /* Definitions and headers for communication with X protocol.
2 Copyright (C) 1989, 1993-1994, 1998-2015 Free Software Foundation,
3 Inc.
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
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) 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. If not, see <http://www.gnu.org/licenses/>. */
19
20 #ifndef XTERM_H
21 #define XTERM_H
22
23 #include <X11/Xlib.h>
24 #include <X11/cursorfont.h>
25
26 /* Include Xutil.h after keysym.h to work around a bug that prevents
27 correct recognition of AltGr key in some X versions. */
28
29 #include <X11/keysym.h>
30 #include <X11/Xutil.h>
31
32 #include <X11/Xatom.h>
33 #include <X11/Xresource.h>
34
35 #ifdef USE_X_TOOLKIT
36 #include <X11/StringDefs.h>
37 #include <X11/IntrinsicP.h> /* CoreP.h needs this */
38 #include <X11/CoreP.h> /* foul, but we need this to use our own
39 window inside a widget instead of one
40 that Xt creates... */
41 typedef Widget xt_or_gtk_widget;
42 #endif
43
44 #ifdef USE_GTK
45 #include <gtk/gtk.h>
46 #include <gdk/gdkx.h>
47
48 /* Some definitions to reduce conditionals. */
49 typedef GtkWidget *xt_or_gtk_widget;
50 #undef XSync
51 #define XSync(d, b) do { gdk_window_process_all_updates (); \
52 XSync (d, b); } while (false)
53 #endif /* USE_GTK */
54
55 /* True iff GTK's version is at least I.J.K. */
56 #ifndef GTK_CHECK_VERSION
57 # ifdef USE_GTK
58 # define GTK_CHECK_VERSION(i, j, k) \
59 ((i) \
60 < GTK_MAJOR_VERSION + ((j) \
61 < GTK_MINOR_VERSION + ((k) \
62 <= GTK_MICRO_VERSION)))
63 # else
64 # define GTK_CHECK_VERSION(i, j, k) false
65 # endif
66 #endif
67
68 /* The GtkTooltip API came in 2.12, but gtk-enable-tooltips in 2.14. */
69 #if GTK_CHECK_VERSION (2, 14, 0)
70 #define USE_GTK_TOOLTIP
71 #endif
72
73 #ifdef USE_CAIRO
74 #include <cairo-xlib.h>
75 #ifdef CAIRO_HAS_PDF_SURFACE
76 #include <cairo-pdf.h>
77 #endif
78 #ifdef CAIRO_HAS_PS_SURFACE
79 #include <cairo-ps.h>
80 #endif
81 #ifdef CAIRO_HAS_SVG_SURFACE
82 #include <cairo-svg.h>
83 #endif
84 #endif
85
86 #ifdef HAVE_X_I18N
87 #include <X11/Xlocale.h>
88 #endif
89
90 #ifdef USE_XCB
91 #include <X11/Xlib-xcb.h>
92 #endif
93
94 #include "dispextern.h"
95 #include "termhooks.h"
96
97 INLINE_HEADER_BEGIN
98
99 /* Black and white pixel values for the screen which frame F is on. */
100 #define BLACK_PIX_DEFAULT(f) \
101 BlackPixel (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f))
102 #define WHITE_PIX_DEFAULT(f) \
103 WhitePixel (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f))
104
105 /* The mask of events that text windows always want to receive. This
106 includes mouse movement events, since handling the mouse-font text property
107 means that we must track mouse motion all the time. */
108
109 #define STANDARD_EVENT_SET \
110 (KeyPressMask \
111 | ExposureMask \
112 | ButtonPressMask \
113 | ButtonReleaseMask \
114 | PointerMotionMask \
115 | StructureNotifyMask \
116 | FocusChangeMask \
117 | LeaveWindowMask \
118 | EnterWindowMask \
119 | VisibilityChangeMask)
120
121 #ifdef HAVE_X11R6_XIM
122 /* Data structure passed to xim_instantiate_callback. */
123 struct xim_inst_t
124 {
125 struct x_display_info *dpyinfo;
126 char *resource_name;
127 };
128 #endif /* HAVE_X11R6_XIM */
129
130 /* Structure recording X pixmap and reference count.
131 If REFCOUNT is 0 then this record is free to be reused. */
132
133 struct x_bitmap_record
134 {
135 #ifdef USE_CAIRO
136 void *img;
137 #endif
138 Pixmap pixmap;
139 bool have_mask;
140 Pixmap mask;
141 char *file;
142 int refcount;
143 /* Record some info about this pixmap. */
144 int height, width, depth;
145 };
146 \f
147 #ifdef USE_CAIRO
148 struct x_gc_ext_data
149 {
150 #define MAX_CLIP_RECTS 2
151 /* Number of clipping rectangles. */
152 int n_clip_rects;
153
154 /* Clipping rectangles. */
155 XRectangle clip_rects[MAX_CLIP_RECTS];
156 };
157 #endif
158
159 \f
160 struct color_name_cache_entry
161 {
162 struct color_name_cache_entry *next;
163 XColor rgb;
164 char *name;
165 };
166
167 Status x_parse_color (struct frame *f, const char *color_name,
168 XColor *color);
169
170 \f
171 /* For each X display, we have a structure that records
172 information about it. */
173
174 struct x_display_info
175 {
176 /* Chain of all x_display_info structures. */
177 struct x_display_info *next;
178
179 /* The generic display parameters corresponding to this X display. */
180 struct terminal *terminal;
181
182 /* This says how to access this display in Xlib. */
183 Display *display;
184
185 /* A connection number (file descriptor) for the display. */
186 int connection;
187
188 /* This is a cons cell of the form (NAME . FONT-LIST-CACHE). */
189 Lisp_Object name_list_element;
190
191 /* Number of frames that are on this display. */
192 int reference_count;
193
194 /* The Screen this connection is connected to. */
195 Screen *screen;
196
197 /* Dots per inch of the screen. */
198 double resx, resy;
199
200 /* The Visual being used for this display. */
201 Visual *visual;
202
203 /* The colormap being used. */
204 Colormap cmap;
205
206 /* Number of planes on this screen. */
207 int n_planes;
208
209 /* Mask of things that cause the mouse to be grabbed. */
210 int grabbed;
211
212 /* Emacs bitmap-id of the default icon bitmap for this frame.
213 Or -1 if none has been allocated yet. */
214 ptrdiff_t icon_bitmap_id;
215
216 /* The root window of this screen. */
217 Window root_window;
218
219 /* Client leader window. */
220 Window client_leader_window;
221
222 /* The cursor to use for vertical scroll bars. */
223 Cursor vertical_scroll_bar_cursor;
224
225 /* The cursor to use for horizontal scroll bars. */
226 Cursor horizontal_scroll_bar_cursor;
227
228 /* The invisible cursor used for pointer blanking.
229 Unused if this display supports Xfixes extension. */
230 Cursor invisible_cursor;
231
232 /* Function used to toggle pointer visibility on this display. */
233 void (*toggle_visible_pointer) (struct frame *, bool);
234
235 #ifdef USE_GTK
236 /* The GDK cursor for scroll bars and popup menus. */
237 GdkCursor *xg_cursor;
238 #endif
239
240 /* X Resource data base */
241 XrmDatabase xrdb;
242
243 /* Minimum width over all characters in all fonts in font_table. */
244 int smallest_char_width;
245
246 /* Minimum font height over all fonts in font_table. */
247 int smallest_font_height;
248
249 /* Reusable Graphics Context for drawing a cursor in a non-default face. */
250 GC scratch_cursor_gc;
251
252 /* Information about the range of text currently shown in
253 mouse-face. */
254 Mouse_HLInfo mouse_highlight;
255
256 /* Logical identifier of this display. */
257 unsigned x_id;
258
259 /* Default name for all frames on this display. */
260 char *x_id_name;
261
262 /* The number of fonts opened for this display. */
263 int n_fonts;
264
265 /* Pointer to bitmap records. */
266 struct x_bitmap_record *bitmaps;
267
268 /* Allocated size of bitmaps field. */
269 ptrdiff_t bitmaps_size;
270
271 /* Last used bitmap index. */
272 ptrdiff_t bitmaps_last;
273
274 /* Which modifier keys are on which modifier bits?
275
276 With each keystroke, X returns eight bits indicating which modifier
277 keys were held down when the key was pressed. The interpretation
278 of the top five modifier bits depends on what keys are attached
279 to them. If the Meta_L and Meta_R keysyms are on mod5, then mod5
280 is the meta bit.
281
282 meta_mod_mask is a mask containing the bits used for the meta key.
283 It may have more than one bit set, if more than one modifier bit
284 has meta keys on it. Basically, if EVENT is a KeyPress event,
285 the meta key is pressed if (EVENT.state & meta_mod_mask) != 0.
286
287 shift_lock_mask is LockMask if the XK_Shift_Lock keysym is on the
288 lock modifier bit, or zero otherwise. Non-alphabetic keys should
289 only be affected by the lock modifier bit if XK_Shift_Lock is in
290 use; XK_Caps_Lock should only affect alphabetic keys. With this
291 arrangement, the lock modifier should shift the character if
292 (EVENT.state & shift_lock_mask) != 0. */
293 int meta_mod_mask, shift_lock_mask;
294
295 /* These are like meta_mod_mask, but for different modifiers. */
296 int alt_mod_mask, super_mod_mask, hyper_mod_mask;
297
298 /* Communication with window managers. */
299 Atom Xatom_wm_protocols;
300
301 /* Kinds of protocol things we may receive. */
302 Atom Xatom_wm_take_focus;
303 Atom Xatom_wm_save_yourself;
304 Atom Xatom_wm_delete_window;
305
306 /* Atom for indicating window state to the window manager. */
307 Atom Xatom_wm_change_state;
308
309 /* Other WM communication */
310 Atom Xatom_wm_configure_denied; /* When our config request is denied */
311 Atom Xatom_wm_window_moved; /* When the WM moves us. */
312 Atom Xatom_wm_client_leader; /* Id of client leader window. */
313
314 /* EditRes protocol */
315 Atom Xatom_editres;
316
317 /* More atoms, which are selection types. */
318 Atom Xatom_CLIPBOARD, Xatom_TIMESTAMP, Xatom_TEXT, Xatom_DELETE,
319 Xatom_COMPOUND_TEXT, Xatom_UTF8_STRING,
320 Xatom_MULTIPLE, Xatom_INCR, Xatom_EMACS_TMP, Xatom_TARGETS, Xatom_NULL,
321 Xatom_ATOM, Xatom_ATOM_PAIR, Xatom_CLIPBOARD_MANAGER;
322
323 /* More atoms for font properties. The last three are private
324 properties, see the comments in src/fontset.h. */
325 Atom Xatom_PIXEL_SIZE, Xatom_AVERAGE_WIDTH,
326 Xatom_MULE_BASELINE_OFFSET, Xatom_MULE_RELATIVE_COMPOSE,
327 Xatom_MULE_DEFAULT_ASCENT;
328
329 /* More atoms for Ghostscript support. */
330 Atom Xatom_DONE, Xatom_PAGE;
331
332 /* Atoms used in toolkit scroll bar client messages. */
333 Atom Xatom_Scrollbar, Xatom_Horizontal_Scrollbar;
334
335 /* Atom used in XEmbed client messages. */
336 Atom Xatom_XEMBED, Xatom_XEMBED_INFO;
337
338 /* The frame (if any) which has the X window that has keyboard focus.
339 Zero if none. This is examined by Ffocus_frame in xfns.c. Note
340 that a mere EnterNotify event can set this; if you need to know the
341 last frame specified in a FocusIn or FocusOut event, use
342 x_focus_event_frame. */
343 struct frame *x_focus_frame;
344
345 /* The last frame mentioned in a FocusIn or FocusOut event. This is
346 separate from x_focus_frame, because whether or not LeaveNotify
347 events cause us to lose focus depends on whether or not we have
348 received a FocusIn event for it. */
349 struct frame *x_focus_event_frame;
350
351 /* The frame which currently has the visual highlight, and should get
352 keyboard input (other sorts of input have the frame encoded in the
353 event). It points to the X focus frame's selected window's
354 frame. It differs from x_focus_frame when we're using a global
355 minibuffer. */
356 struct frame *x_highlight_frame;
357
358 /* The frame waiting to be auto-raised in XTread_socket. */
359 struct frame *x_pending_autoraise_frame;
360
361 /* The frame where the mouse was last time we reported a ButtonPress event. */
362 struct frame *last_mouse_frame;
363
364 /* The frame where the mouse was last time we reported a mouse position. */
365 struct frame *last_mouse_glyph_frame;
366
367 /* The frame where the mouse was last time we reported a mouse motion. */
368 struct frame *last_mouse_motion_frame;
369
370 /* The scroll bar in which the last X motion event occurred. */
371 struct scroll_bar *last_mouse_scroll_bar;
372
373 /* Time of last user interaction as returned in X events on this display. */
374 Time last_user_time;
375
376 /* Position where the mouse was last time we reported a motion.
377 This is a position on last_mouse_motion_frame. */
378 int last_mouse_motion_x;
379 int last_mouse_motion_y;
380
381 /* Where the mouse was last time we reported a mouse position.
382 This is a rectangle on last_mouse_glyph_frame. */
383 XRectangle last_mouse_glyph;
384
385 /* Time of last mouse movement on this display. This is a hack because
386 we would really prefer that XTmouse_position would return the time
387 associated with the position it returns, but there doesn't seem to be
388 any way to wrest the time-stamp from the server along with the position
389 query. So, we just keep track of the time of the last movement we
390 received, and return that in hopes that it's somewhat accurate. */
391 Time last_mouse_movement_time;
392
393 /* The gray pixmap. */
394 Pixmap gray;
395
396 #ifdef HAVE_X_I18N
397 /* XIM (X Input method). */
398 XIM xim;
399 XIMStyles *xim_styles;
400 struct xim_inst_t *xim_callback_data;
401 #endif
402
403 /* A cache mapping color names to RGB values. */
404 struct color_name_cache_entry *color_names;
405
406 /* If non-null, a cache of the colors in the color map. Don't
407 use this directly, call x_color_cells instead. */
408 XColor *color_cells;
409 int ncolor_cells;
410
411 /* Bits and shifts to use to compose pixel values on TrueColor visuals. */
412 int red_bits, blue_bits, green_bits;
413 int red_offset, blue_offset, green_offset;
414
415 /* The type of window manager we have. If we move FRAME_OUTER_WINDOW
416 to x/y 0/0, some window managers (type A) puts the window manager
417 decorations outside the screen and FRAME_OUTER_WINDOW exactly at 0/0.
418 Other window managers (type B) puts the window including decorations
419 at 0/0, so FRAME_OUTER_WINDOW is a bit below 0/0.
420 Record the type of WM in use so we can compensate for type A WMs. */
421 enum
422 {
423 X_WMTYPE_UNKNOWN,
424 X_WMTYPE_A,
425 X_WMTYPE_B
426 } wm_type;
427
428
429 /* Atoms that are drag and drop atoms */
430 Atom *x_dnd_atoms;
431 ptrdiff_t x_dnd_atoms_size;
432 ptrdiff_t x_dnd_atoms_length;
433
434 /* Extended window manager hints, Atoms supported by the window manager and
435 atoms for setting the window type. */
436 Atom Xatom_net_supported, Xatom_net_supporting_wm_check;
437 Atom *net_supported_atoms;
438 int nr_net_supported_atoms;
439 Window net_supported_window;
440 Atom Xatom_net_window_type, Xatom_net_window_type_tooltip;
441 Atom Xatom_net_active_window;
442
443 /* Atoms dealing with EWMH (i.e. _NET_...) */
444 Atom Xatom_net_wm_state, Xatom_net_wm_state_fullscreen,
445 Xatom_net_wm_state_maximized_horz, Xatom_net_wm_state_maximized_vert,
446 Xatom_net_wm_state_sticky, Xatom_net_wm_state_hidden,
447 Xatom_net_frame_extents,
448 Xatom_net_current_desktop, Xatom_net_workarea;
449
450 /* XSettings atoms and windows. */
451 Atom Xatom_xsettings_sel, Xatom_xsettings_prop, Xatom_xsettings_mgr;
452 Window xsettings_window;
453
454 /* Frame name and icon name */
455 Atom Xatom_net_wm_name, Xatom_net_wm_icon_name;
456 /* Frame opacity */
457 Atom Xatom_net_wm_window_opacity;
458
459 /* SM */
460 Atom Xatom_SM_CLIENT_ID;
461
462 #ifdef USE_CAIRO
463 XExtCodes *ext_codes;
464 #endif
465
466 #ifdef USE_XCB
467 xcb_connection_t *xcb_connection;
468 #endif
469 };
470
471 #ifdef HAVE_X_I18N
472 /* Whether or not to use XIM if we have it. */
473 extern bool use_xim;
474 #endif
475
476 /* This is a chain of structures for all the X displays currently in use. */
477 extern struct x_display_info *x_display_list;
478
479 extern struct x_display_info *x_display_info_for_display (Display *);
480 extern struct frame *x_top_window_to_frame (struct x_display_info *, int);
481 extern struct x_display_info *x_term_init (Lisp_Object, char *, char *);
482 extern bool x_display_ok (const char *);
483
484 extern void select_visual (struct x_display_info *);
485
486 /* Each X frame object points to its own struct x_output object
487 in the output_data.x field. The x_output structure contains
488 the information that is specific to X windows. */
489
490 struct x_output
491 {
492 #if defined (USE_X_TOOLKIT) || defined (USE_GTK)
493 /* Height of menu bar widget, in pixels. This value
494 is not meaningful if the menubar is turned off. */
495 int menubar_height;
496 #endif
497
498 /* Height of tool bar widget, in pixels. top_height is used if tool bar
499 at top, bottom_height if tool bar is at the bottom.
500 Zero if not using an external tool bar or if tool bar is vertical. */
501 int toolbar_top_height, toolbar_bottom_height;
502
503 /* Width of tool bar widget, in pixels. left_width is used if tool bar
504 at left, right_width if tool bar is at the right.
505 Zero if not using an external tool bar or if tool bar is horizontal. */
506 int toolbar_left_width, toolbar_right_width;
507
508 /* The tiled border used when the mouse is out of the frame. */
509 Pixmap border_tile;
510
511 /* Here are the Graphics Contexts for the default font. */
512 GC normal_gc; /* Normal video */
513 GC reverse_gc; /* Reverse video */
514 GC cursor_gc; /* cursor drawing */
515
516 /* The X window used for this frame.
517 May be zero while the frame object is being created
518 and the X window has not yet been created. */
519 Window window_desc;
520
521 /* The X window used for the bitmap icon;
522 or 0 if we don't have a bitmap icon. */
523 Window icon_desc;
524
525 /* The X window that is the parent of this X window.
526 Usually this is a window that was made by the window manager,
527 but it can be the root window, and it can be explicitly specified
528 (see the explicit_parent field, below). */
529 Window parent_desc;
530
531 #ifdef USE_X_TOOLKIT
532 /* The widget of this screen. This is the window of a "shell" widget. */
533 Widget widget;
534 /* The XmPanedWindows... */
535 Widget column_widget;
536 /* The widget of the edit portion of this screen; the window in
537 "window_desc" is inside of this. */
538 Widget edit_widget;
539
540 Widget menubar_widget;
541 #endif
542
543 #ifdef USE_GTK
544 /* The widget of this screen. This is the window of a top widget. */
545 GtkWidget *widget;
546 /* The widget of the edit portion of this screen; the window in
547 "window_desc" is inside of this. */
548 GtkWidget *edit_widget;
549 /* The widget used for laying out widgets vertically. */
550 GtkWidget *vbox_widget;
551 /* The widget used for laying out widgets horizontally. */
552 GtkWidget *hbox_widget;
553 /* The menubar in this frame. */
554 GtkWidget *menubar_widget;
555 /* The tool bar in this frame */
556 GtkWidget *toolbar_widget;
557 /* True if tool bar is packed into the hbox widget (i.e. vertical). */
558 bool_bf toolbar_in_hbox : 1;
559 bool_bf toolbar_is_packed : 1;
560
561 /* The last size hints set. */
562 GdkGeometry size_hints;
563 long hint_flags;
564
565 #ifdef USE_GTK_TOOLTIP
566 GtkTooltip *ttip_widget;
567 GtkWidget *ttip_lbl;
568 GtkWindow *ttip_window;
569 #endif /* USE_GTK_TOOLTIP */
570
571 #endif /* USE_GTK */
572
573 /* If >=0, a bitmap index. The indicated bitmap is used for the
574 icon. */
575 ptrdiff_t icon_bitmap;
576
577 /* Default ASCII font of this frame. */
578 struct font *font;
579
580 /* The baseline offset of the default ASCII font. */
581 int baseline_offset;
582
583 /* If a fontset is specified for this frame instead of font, this
584 value contains an ID of the fontset, else -1. */
585 int fontset;
586
587 unsigned long cursor_pixel;
588 unsigned long border_pixel;
589 unsigned long mouse_pixel;
590 unsigned long cursor_foreground_pixel;
591
592 /* Foreground color for scroll bars. A value of -1 means use the
593 default (black for non-toolkit scroll bars). */
594 unsigned long scroll_bar_foreground_pixel;
595
596 /* Background color for scroll bars. A value of -1 means use the
597 default (background color of the frame for non-toolkit scroll
598 bars). */
599 unsigned long scroll_bar_background_pixel;
600
601 #if defined (USE_LUCID) && defined (USE_TOOLKIT_SCROLL_BARS)
602 /* Top and bottom shadow colors for 3D Lucid scrollbars.
603 -1 means let the scroll compute them itself. */
604 unsigned long scroll_bar_top_shadow_pixel;
605 unsigned long scroll_bar_bottom_shadow_pixel;
606 #endif
607
608 /* Descriptor for the cursor in use for this window. */
609 Cursor text_cursor;
610 Cursor nontext_cursor;
611 Cursor modeline_cursor;
612 Cursor hand_cursor;
613 Cursor hourglass_cursor;
614 Cursor horizontal_drag_cursor;
615 Cursor vertical_drag_cursor;
616 Cursor current_cursor;
617
618 /* Window whose cursor is hourglass_cursor. This window is temporarily
619 mapped to display an hourglass cursor. */
620 Window hourglass_window;
621
622 /* These are the current window manager hints. It seems that
623 XSetWMHints, when presented with an unset bit in the `flags'
624 member of the hints structure, does not leave the corresponding
625 attribute unchanged; rather, it resets that attribute to its
626 default value. For example, unless you set the `icon_pixmap'
627 field and the `IconPixmapHint' bit, XSetWMHints will forget what
628 your icon pixmap was. This is rather troublesome, since some of
629 the members (for example, `input' and `icon_pixmap') want to stay
630 the same throughout the execution of Emacs. So, we keep this
631 structure around, just leaving values in it and adding new bits
632 to the mask as we go. */
633 XWMHints wm_hints;
634
635 /* This is the Emacs structure for the X display this frame is on. */
636 struct x_display_info *display_info;
637
638 /* This is a button event that wants to activate the menubar.
639 We save it here until the command loop gets to think about it. */
640 XEvent *saved_menu_event;
641
642 /* This is the widget id used for this frame's menubar in lwlib. */
643 #ifdef USE_X_TOOLKIT
644 int id;
645 #endif
646
647 /* True means hourglass cursor is currently displayed. */
648 bool_bf hourglass_p : 1;
649
650 /* True means our parent is another application's window
651 and was explicitly specified. */
652 bool_bf explicit_parent : 1;
653
654 /* True means tried already to make this frame visible. */
655 bool_bf asked_for_visible : 1;
656
657 /* True if this frame was ever previously visible. */
658 bool_bf has_been_visible : 1;
659
660 /* Xt waits for a ConfigureNotify event from the window manager in
661 EmacsFrameSetCharSize when the shell widget is resized. For some
662 window managers like fvwm2 2.2.5 and KDE 2.1 this event doesn't
663 arrive for an unknown reason and Emacs hangs in Xt. If this is
664 false, tell Xt not to wait. */
665 bool_bf wait_for_wm : 1;
666
667 #ifdef HAVE_X_I18N
668 /* Input context (currently, this means Compose key handler setup). */
669 XIC xic;
670 XIMStyle xic_style;
671 XFontSet xic_xfs;
672 #endif
673
674 /* Relief GCs, colors etc. */
675 struct relief
676 {
677 GC gc;
678 unsigned long pixel;
679 }
680 black_relief, white_relief;
681
682 /* The background for which the above relief GCs were set up.
683 They are changed only when a different background is involved. */
684 unsigned long relief_background;
685
686 /* Keep track of focus. May be EXPLICIT if we received a FocusIn for this
687 frame, or IMPLICIT if we received an EnterNotify.
688 FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */
689 int focus_state;
690
691 /* The offset we need to add to compensate for type A WMs. */
692 int move_offset_top;
693 int move_offset_left;
694
695 /* Extreme 'short' and 'long' values suitable for libX11. */
696 #define X_SHRT_MAX 0x7fff
697 #define X_SHRT_MIN (-1 - X_SHRT_MAX)
698 #define X_LONG_MAX 0x7fffffff
699 #define X_LONG_MIN (-1 - X_LONG_MAX)
700 #define X_ULONG_MAX 0xffffffffUL
701
702 #ifdef USE_CAIRO
703 /* Cairo drawing context. */
704 cairo_t *cr_context;
705 /* Cairo surface for double buffering */
706 cairo_surface_t *cr_surface;
707 #endif
708 };
709
710 #define No_Cursor (None)
711
712 enum
713 {
714 /* Values for focus_state, used as bit mask.
715 EXPLICIT means we received a FocusIn for the frame and know it has
716 the focus. IMPLICIT means we received an EnterNotify and the frame
717 may have the focus if no window manager is running.
718 FocusOut and LeaveNotify clears EXPLICIT/IMPLICIT. */
719 FOCUS_NONE = 0,
720 FOCUS_IMPLICIT = 1,
721 FOCUS_EXPLICIT = 2
722 };
723
724
725 /* Return the X output data for frame F. */
726 #define FRAME_X_OUTPUT(f) ((f)->output_data.x)
727
728 /* Return the X window used for displaying data in frame F. */
729 #define FRAME_X_WINDOW(f) ((f)->output_data.x->window_desc)
730
731 /* Return the outermost X window associated with the frame F. */
732 #ifdef USE_X_TOOLKIT
733 #define FRAME_OUTER_WINDOW(f) ((f)->output_data.x->widget ? \
734 XtWindow ((f)->output_data.x->widget) : \
735 FRAME_X_WINDOW (f))
736 #else
737 #ifdef USE_GTK
738 /* Functions not present in older Gtk+ */
739
740 #ifndef HAVE_GTK_WIDGET_GET_WINDOW
741 #define gtk_widget_get_window(w) ((w)->window)
742 #endif
743 #ifndef HAVE_GTK_WIDGET_GET_MAPPED
744 #define gtk_widget_get_mapped(w) (GTK_WIDGET_MAPPED (w))
745 #endif
746 #ifndef HAVE_GTK_ADJUSTMENT_GET_PAGE_SIZE
747 #define gtk_adjustment_get_page_size(w) ((w)->page_size)
748 #define gtk_adjustment_get_upper(w) ((w)->upper)
749 #endif
750
751 #ifdef HAVE_GTK3
752 #define DEFAULT_GDK_DISPLAY() \
753 gdk_x11_display_get_xdisplay (gdk_display_get_default ())
754 #else
755 #undef GDK_WINDOW_XID
756 #define GDK_WINDOW_XID(w) GDK_WINDOW_XWINDOW (w)
757 #define DEFAULT_GDK_DISPLAY() GDK_DISPLAY ()
758 #define gtk_widget_get_preferred_size(a, ign, b) \
759 gtk_widget_size_request (a, b)
760 #endif
761
762 #define GTK_WIDGET_TO_X_WIN(w) \
763 ((w) && gtk_widget_get_window (w) \
764 ? GDK_WINDOW_XID (gtk_widget_get_window (w)) : 0)
765
766 #define FRAME_GTK_OUTER_WIDGET(f) ((f)->output_data.x->widget)
767 #define FRAME_GTK_WIDGET(f) ((f)->output_data.x->edit_widget)
768 #define FRAME_OUTER_WINDOW(f) \
769 (FRAME_GTK_OUTER_WIDGET (f) ? \
770 GTK_WIDGET_TO_X_WIN (FRAME_GTK_OUTER_WIDGET (f)) : \
771 FRAME_X_WINDOW (f))
772
773 #else /* !USE_GTK */
774 #define FRAME_OUTER_WINDOW(f) (FRAME_X_WINDOW (f))
775 #endif /* !USE_GTK */
776 #endif
777
778 #if defined (USE_X_TOOLKIT) || defined (USE_GTK)
779 #define FRAME_MENUBAR_HEIGHT(f) ((f)->output_data.x->menubar_height)
780 #else
781 #define FRAME_MENUBAR_HEIGHT(f) ((void) f, 0)
782 #endif /* USE_X_TOOLKIT || USE_GTK */
783
784 #define FRAME_FONT(f) ((f)->output_data.x->font)
785 #define FRAME_FONTSET(f) ((f)->output_data.x->fontset)
786 #define FRAME_TOOLBAR_TOP_HEIGHT(f) ((f)->output_data.x->toolbar_top_height)
787 #define FRAME_TOOLBAR_BOTTOM_HEIGHT(f) \
788 ((f)->output_data.x->toolbar_bottom_height)
789 #define FRAME_TOOLBAR_HEIGHT(f) \
790 (FRAME_TOOLBAR_TOP_HEIGHT (f) + FRAME_TOOLBAR_BOTTOM_HEIGHT (f))
791 #define FRAME_TOOLBAR_LEFT_WIDTH(f) ((f)->output_data.x->toolbar_left_width)
792 #define FRAME_TOOLBAR_RIGHT_WIDTH(f) ((f)->output_data.x->toolbar_right_width)
793 #define FRAME_TOOLBAR_WIDTH(f) \
794 (FRAME_TOOLBAR_LEFT_WIDTH (f) + FRAME_TOOLBAR_RIGHT_WIDTH (f))
795 #define FRAME_BASELINE_OFFSET(f) ((f)->output_data.x->baseline_offset)
796
797 /* This gives the x_display_info structure for the display F is on. */
798 #define FRAME_DISPLAY_INFO(f) ((f)->output_data.x->display_info)
799
800 /* This is the `Display *' which frame F is on. */
801 #define FRAME_X_DISPLAY(f) (FRAME_DISPLAY_INFO (f)->display)
802
803 /* This is the `Screen *' which frame F is on. */
804 #define FRAME_X_SCREEN(f) (FRAME_DISPLAY_INFO (f)->screen)
805
806 /* This is the screen index number of screen which frame F is on. */
807 #define FRAME_X_SCREEN_NUMBER(f) XScreenNumberOfScreen (FRAME_X_SCREEN (f))
808
809 /* This is the Visual which frame F is on. */
810 #define FRAME_X_VISUAL(f) FRAME_DISPLAY_INFO (f)->visual
811
812 /* This is the Colormap which frame F uses. */
813 #define FRAME_X_COLORMAP(f) FRAME_DISPLAY_INFO (f)->cmap
814
815 #define FRAME_XIC(f) ((f)->output_data.x->xic)
816 #define FRAME_X_XIM(f) (FRAME_DISPLAY_INFO (f)->xim)
817 #define FRAME_X_XIM_STYLES(f) (FRAME_DISPLAY_INFO (f)->xim_styles)
818 #define FRAME_XIC_STYLE(f) ((f)->output_data.x->xic_style)
819 #define FRAME_XIC_FONTSET(f) ((f)->output_data.x->xic_xfs)
820
821 /* X-specific scroll bar stuff. */
822
823 /* We represent scroll bars as lisp vectors. This allows us to place
824 references to them in windows without worrying about whether we'll
825 end up with windows referring to dead scroll bars; the garbage
826 collector will free it when its time comes.
827
828 We use struct scroll_bar as a template for accessing fields of the
829 vector. */
830
831 struct scroll_bar
832 {
833 /* These fields are shared by all vectors. */
834 struct vectorlike_header header;
835
836 /* The window we're a scroll bar for. */
837 Lisp_Object window;
838
839 /* The next and previous in the chain of scroll bars in this frame. */
840 Lisp_Object next, prev;
841
842 /* Fields from `x_window' down will not be traced by the GC. */
843
844 /* The X window representing this scroll bar. */
845 Window x_window;
846
847 /* The position and size of the scroll bar in pixels, relative to the
848 frame. */
849 int top, left, width, height;
850
851 /* The starting and ending positions of the handle, relative to the
852 handle area (i.e. zero is the top position, not
853 SCROLL_BAR_TOP_BORDER). If they're equal, that means the handle
854 hasn't been drawn yet.
855
856 These are not actually the locations where the beginning and end
857 are drawn; in order to keep handles from becoming invisible when
858 editing large files, we establish a minimum height by always
859 drawing handle bottoms VERTICAL_SCROLL_BAR_MIN_HANDLE pixels below
860 where they would be normally; the bottom and top are in a
861 different co-ordinate system. */
862 int start, end;
863
864 /* If the scroll bar handle is currently being dragged by the user,
865 this is the number of pixels from the top of the handle to the
866 place where the user grabbed it. If the handle isn't currently
867 being dragged, this is -1. */
868 int dragging;
869
870 #if defined (USE_TOOLKIT_SCROLL_BARS) && defined (USE_LUCID)
871 /* Last scroll bar part seen in xaw_jump_callback and xaw_scroll_callback. */
872 enum scroll_bar_part last_seen_part;
873 #endif
874
875 #if defined (USE_TOOLKIT_SCROLL_BARS) && !defined (USE_GTK)
876 /* Last value of whole for horizontal scrollbars. */
877 int whole;
878 #endif
879
880 /* True if the scroll bar is horizontal. */
881 bool horizontal;
882 };
883
884 /* Turning a lisp vector value into a pointer to a struct scroll_bar. */
885 #define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec))
886
887 #ifdef USE_X_TOOLKIT
888
889 /* Extract the X widget of the scroll bar from a struct scroll_bar.
890 XtWindowToWidget should be fast enough since Xt uses a hash table
891 to map windows to widgets. */
892
893 #define SCROLL_BAR_X_WIDGET(dpy, ptr) \
894 XtWindowToWidget (dpy, ptr->x_window)
895
896 /* Store a widget id in a struct scroll_bar. */
897
898 #define SET_SCROLL_BAR_X_WIDGET(ptr, w) \
899 do { \
900 Window window = XtWindow (w); \
901 ptr->x_window = window; \
902 } while (false)
903
904 #endif /* USE_X_TOOLKIT */
905
906 /* Return the inside width of a vertical scroll bar, given the outside
907 width. */
908 #define VERTICAL_SCROLL_BAR_INSIDE_WIDTH(f, width) \
909 ((width) \
910 - VERTICAL_SCROLL_BAR_LEFT_BORDER \
911 - VERTICAL_SCROLL_BAR_RIGHT_BORDER)
912
913 /* Return the length of the rectangle within which the top of the
914 handle must stay. This isn't equivalent to the inside height,
915 because the scroll bar handle has a minimum height.
916
917 This is the real range of motion for the scroll bar, so when we're
918 scaling buffer positions to scroll bar positions, we use this, not
919 VERTICAL_SCROLL_BAR_INSIDE_HEIGHT. */
920 #define VERTICAL_SCROLL_BAR_TOP_RANGE(f, height) \
921 (VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (f, height) - VERTICAL_SCROLL_BAR_MIN_HANDLE)
922
923 /* Return the inside height of vertical scroll bar, given the outside
924 height. See VERTICAL_SCROLL_BAR_TOP_RANGE too. */
925 #define VERTICAL_SCROLL_BAR_INSIDE_HEIGHT(f, height) \
926 ((height) - VERTICAL_SCROLL_BAR_TOP_BORDER - VERTICAL_SCROLL_BAR_BOTTOM_BORDER)
927
928 /* Return the inside height of a horizontal scroll bar, given the outside
929 height. */
930 #define HORIZONTAL_SCROLL_BAR_INSIDE_HEIGHT(f, height) \
931 ((height) \
932 - HORIZONTAL_SCROLL_BAR_TOP_BORDER \
933 - HORIZONTAL_SCROLL_BAR_BOTTOM_BORDER)
934
935 /* Return the length of the rectangle within which the left part of the
936 handle must stay. This isn't equivalent to the inside width, because
937 the scroll bar handle has a minimum width.
938
939 This is the real range of motion for the scroll bar, so when we're
940 scaling buffer positions to scroll bar positions, we use this, not
941 HORIZONTAL_SCROLL_BAR_INSIDE_WIDTH. */
942 #define HORIZONTAL_SCROLL_BAR_LEFT_RANGE(f, width) \
943 (HORIZONTAL_SCROLL_BAR_INSIDE_WIDTH (f, width) - HORIZONTAL_SCROLL_BAR_MIN_HANDLE)
944
945 /* Return the inside width of horizontal scroll bar, given the outside
946 width. See HORIZONTAL_SCROLL_BAR_LEFT_RANGE too. */
947 #define HORIZONTAL_SCROLL_BAR_INSIDE_WIDTH(f, width) \
948 ((width) - HORIZONTAL_SCROLL_BAR_LEFT_BORDER - HORIZONTAL_SCROLL_BAR_LEFT_BORDER)
949
950
951 /* Border widths for scroll bars.
952
953 Scroll bar windows don't have any X borders; their border width is
954 set to zero, and we redraw borders ourselves. This makes the code
955 a bit cleaner, since we don't have to convert between outside width
956 (used when relating to the rest of the screen) and inside width
957 (used when sizing and drawing the scroll bar window itself).
958
959 The handle moves up and down/back and forth in a rectangle inset
960 from the edges of the scroll bar. These are widths by which we
961 inset the handle boundaries from the scroll bar edges. */
962 #define VERTICAL_SCROLL_BAR_LEFT_BORDER (2)
963 #define VERTICAL_SCROLL_BAR_RIGHT_BORDER (2)
964 #define VERTICAL_SCROLL_BAR_TOP_BORDER (2)
965 #define VERTICAL_SCROLL_BAR_BOTTOM_BORDER (2)
966
967 #define HORIZONTAL_SCROLL_BAR_LEFT_BORDER (2)
968 #define HORIZONTAL_SCROLL_BAR_RIGHT_BORDER (2)
969 #define HORIZONTAL_SCROLL_BAR_TOP_BORDER (2)
970 #define HORIZONTAL_SCROLL_BAR_BOTTOM_BORDER (2)
971
972 /* Minimum lengths for scroll bar handles, in pixels. */
973 #define VERTICAL_SCROLL_BAR_MIN_HANDLE (5)
974 #define HORIZONTAL_SCROLL_BAR_MIN_HANDLE (5)
975
976 /* If a struct input_event has a kind which is SELECTION_REQUEST_EVENT
977 or SELECTION_CLEAR_EVENT, then its contents are really described
978 by this structure. */
979
980 /* For an event of kind SELECTION_REQUEST_EVENT,
981 this structure really describes the contents. */
982
983 struct selection_input_event
984 {
985 ENUM_BF (event_kind) kind : EVENT_KIND_WIDTH;
986 struct x_display_info *dpyinfo;
987 /* We spell it with an "o" here because X does. */
988 Window requestor;
989 Atom selection, target, property;
990 Time time;
991 };
992
993 /* Unlike macros below, this can't be used as an lvalue. */
994 INLINE Display *
995 SELECTION_EVENT_DISPLAY (struct selection_input_event *ev)
996 {
997 return ev->dpyinfo->display;
998 }
999 #define SELECTION_EVENT_DPYINFO(eventp) \
1000 ((eventp)->dpyinfo)
1001 /* We spell it with an "o" here because X does. */
1002 #define SELECTION_EVENT_REQUESTOR(eventp) \
1003 ((eventp)->requestor)
1004 #define SELECTION_EVENT_SELECTION(eventp) \
1005 ((eventp)->selection)
1006 #define SELECTION_EVENT_TARGET(eventp) \
1007 ((eventp)->target)
1008 #define SELECTION_EVENT_PROPERTY(eventp) \
1009 ((eventp)->property)
1010 #define SELECTION_EVENT_TIME(eventp) \
1011 ((eventp)->time)
1012
1013 /* From xfns.c. */
1014
1015 extern void x_free_gcs (struct frame *);
1016 extern void x_relative_mouse_position (struct frame *, int *, int *);
1017 extern void x_real_pos_and_offsets (struct frame *f,
1018 int *left_offset_x,
1019 int *right_offset_x,
1020 int *top_offset_y,
1021 int *bottom_offset_y,
1022 int *x_pixels_diff,
1023 int *y_pixels_diff,
1024 int *xptr,
1025 int *yptr,
1026 int *outer_border);
1027
1028 /* From xrdb.c. */
1029
1030 XrmDatabase x_load_resources (Display *, const char *, const char *,
1031 const char *);
1032
1033 /* Defined in xterm.c */
1034
1035 typedef void (*x_special_error_handler)(Display *, XErrorEvent *, char *,
1036 void *);
1037
1038 extern bool x_text_icon (struct frame *, const char *);
1039 extern void x_catch_errors (Display *);
1040 extern void x_catch_errors_with_handler (Display *, x_special_error_handler,
1041 void *);
1042 extern void x_check_errors (Display *, const char *)
1043 ATTRIBUTE_FORMAT_PRINTF (2, 0);
1044 extern bool x_had_errors_p (Display *);
1045 extern void x_uncatch_errors (void);
1046 extern void x_uncatch_errors_after_check (void);
1047 extern void x_clear_errors (Display *);
1048 extern void xembed_request_focus (struct frame *);
1049 extern void x_ewmh_activate_frame (struct frame *);
1050 extern void x_delete_terminal (struct terminal *terminal);
1051 extern unsigned long x_copy_color (struct frame *, unsigned long);
1052 #ifdef USE_X_TOOLKIT
1053 extern XtAppContext Xt_app_con;
1054 extern void x_activate_timeout_atimer (void);
1055 #endif
1056 #ifdef USE_LUCID
1057 extern bool x_alloc_lighter_color_for_widget (Widget, Display *, Colormap,
1058 unsigned long *,
1059 double, int);
1060 #endif
1061 extern bool x_alloc_nearest_color (struct frame *, Colormap, XColor *);
1062 extern void x_query_color (struct frame *f, XColor *);
1063 extern void x_clear_area (struct frame *f, int, int, int, int);
1064 #if !defined USE_X_TOOLKIT && !defined USE_GTK
1065 extern void x_mouse_leave (struct x_display_info *);
1066 #endif
1067
1068 #if defined USE_X_TOOLKIT || defined USE_MOTIF
1069 extern int x_dispatch_event (XEvent *, Display *);
1070 #endif
1071 extern int x_x_to_emacs_modifiers (struct x_display_info *, int);
1072 #ifdef USE_CAIRO
1073 extern cairo_t *x_begin_cr_clip (struct frame *, GC);
1074 extern void x_end_cr_clip (struct frame *);
1075 extern void x_set_cr_source_with_gc_foreground (struct frame *, GC);
1076 extern void x_set_cr_source_with_gc_background (struct frame *, GC);
1077 extern void x_cr_draw_frame (cairo_t *, struct frame *);
1078 extern Lisp_Object x_cr_export_frames (Lisp_Object, cairo_surface_type_t);
1079 #endif
1080
1081 INLINE int
1082 x_display_pixel_height (struct x_display_info *dpyinfo)
1083 {
1084 return HeightOfScreen (dpyinfo->screen);
1085 }
1086
1087 INLINE int
1088 x_display_pixel_width (struct x_display_info *dpyinfo)
1089 {
1090 return WidthOfScreen (dpyinfo->screen);
1091 }
1092
1093 INLINE void
1094 x_display_set_last_user_time (struct x_display_info *dpyinfo, Time t)
1095 {
1096 #ifdef ENABLE_CHECKING
1097 eassert (t <= X_ULONG_MAX);
1098 #endif
1099 dpyinfo->last_user_time = t;
1100 }
1101
1102 INLINE unsigned long
1103 x_make_truecolor_pixel (struct x_display_info *dpyinfo, int r, int g, int b)
1104 {
1105 unsigned long pr, pg, pb;
1106
1107 /* Scale down RGB values to the visual's bits per RGB, and shift
1108 them to the right position in the pixel color. Note that the
1109 original RGB values are 16-bit values, as usual in X. */
1110 pr = (r >> (16 - dpyinfo->red_bits)) << dpyinfo->red_offset;
1111 pg = (g >> (16 - dpyinfo->green_bits)) << dpyinfo->green_offset;
1112 pb = (b >> (16 - dpyinfo->blue_bits)) << dpyinfo->blue_offset;
1113
1114 /* Assemble the pixel color. */
1115 return pr | pg | pb;
1116 }
1117
1118 /* If display has an immutable color map, freeing colors is not
1119 necessary and some servers don't allow it, so we won't do it. That
1120 also allows us to make other optimizations relating to server-side
1121 reference counts. */
1122 INLINE bool
1123 x_mutable_colormap (Visual *visual)
1124 {
1125 int class = visual->class;
1126 return (class != StaticColor && class != StaticGray && class != TrueColor);
1127 }
1128
1129 extern void x_set_sticky (struct frame *, Lisp_Object, Lisp_Object);
1130 extern bool x_wm_supports (struct frame *, Atom);
1131 extern void x_wait_for_event (struct frame *, int);
1132 extern void x_clear_under_internal_border (struct frame *f);
1133
1134 /* Defined in xselect.c. */
1135
1136 extern void x_handle_property_notify (const XPropertyEvent *);
1137 extern void x_handle_selection_notify (const XSelectionEvent *);
1138 extern void x_handle_selection_event (struct selection_input_event *);
1139 extern void x_clear_frame_selections (struct frame *);
1140
1141 extern void x_send_client_event (Lisp_Object display,
1142 Lisp_Object dest,
1143 Lisp_Object from,
1144 Atom message_type,
1145 Lisp_Object format,
1146 Lisp_Object values);
1147
1148 extern bool x_handle_dnd_message (struct frame *,
1149 const XClientMessageEvent *,
1150 struct x_display_info *,
1151 struct input_event *);
1152 extern int x_check_property_data (Lisp_Object);
1153 extern void x_fill_property_data (Display *,
1154 Lisp_Object,
1155 void *,
1156 int);
1157 extern Lisp_Object x_property_data_to_lisp (struct frame *,
1158 const unsigned char *,
1159 Atom,
1160 int,
1161 unsigned long);
1162 extern void x_clipboard_manager_save_frame (Lisp_Object);
1163 extern void x_clipboard_manager_save_all (void);
1164
1165 #ifdef USE_GTK
1166 extern bool xg_set_icon (struct frame *, Lisp_Object);
1167 extern bool xg_set_icon_from_xpm_data (struct frame *, const char **);
1168 #endif /* USE_GTK */
1169
1170 extern void xic_free_xfontset (struct frame *);
1171 extern void create_frame_xic (struct frame *);
1172 extern void destroy_frame_xic (struct frame *);
1173 extern void xic_set_preeditarea (struct window *, int, int);
1174 extern void xic_set_statusarea (struct frame *);
1175 extern void xic_set_xfontset (struct frame *, const char *);
1176 extern bool x_defined_color (struct frame *, const char *, XColor *, bool);
1177 #ifdef HAVE_X_I18N
1178 extern void free_frame_xic (struct frame *);
1179 # if defined HAVE_X_WINDOWS && defined USE_X_TOOLKIT
1180 extern char *xic_create_fontsetname (const char *, bool);
1181 # endif
1182 #endif
1183
1184 /* Defined in xfaces.c */
1185
1186 #ifdef USE_X_TOOLKIT
1187 extern void x_free_dpy_colors (Display *, Screen *, Colormap,
1188 unsigned long *, int);
1189 #endif /* USE_X_TOOLKIT */
1190
1191 /* Defined in xmenu.c */
1192
1193 #if defined USE_X_TOOLKIT || defined USE_GTK
1194 extern Lisp_Object xw_popup_dialog (struct frame *, Lisp_Object, Lisp_Object);
1195 #endif
1196
1197 #if defined USE_GTK || defined USE_MOTIF
1198 extern void x_menu_set_in_use (bool);
1199 #endif
1200 extern void x_menu_wait_for_event (void *data);
1201 extern void initialize_frame_menubar (struct frame *);
1202
1203 /* Defined in xsmfns.c */
1204 #ifdef HAVE_X_SM
1205 extern void x_session_initialize (struct x_display_info *dpyinfo);
1206 extern bool x_session_have_connection (void);
1207 extern void x_session_close (void);
1208 #endif
1209
1210
1211 /* Is the frame embedded into another application? */
1212
1213 #define FRAME_X_EMBEDDED_P(f) (FRAME_X_OUTPUT(f)->explicit_parent != 0)
1214
1215 #define STORE_XCHAR2B(chp, b1, b2) \
1216 ((chp)->byte1 = (b1), (chp)->byte2 = (b2))
1217
1218 #define XCHAR2B_BYTE1(chp) \
1219 ((chp)->byte1)
1220
1221 #define XCHAR2B_BYTE2(chp) \
1222 ((chp)->byte2)
1223
1224 #define STORE_NATIVE_RECT(nr,rx,ry,rwidth,rheight) \
1225 ((nr).x = (rx), \
1226 (nr).y = (ry), \
1227 (nr).width = (rwidth), \
1228 (nr).height = (rheight))
1229
1230 INLINE_HEADER_END
1231
1232 #endif /* XTERM_H */