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